Merge pull request #4 from brunobar79/portal-metamask-lint-fix
Lint fix for Integration ENS with IPFSfeature/default_network_editable
commit
f38dc03b27
@ -0,0 +1,6 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
echo "Downloading firefox..." |
||||
wget https://ftp.mozilla.org/pub/firefox/releases/58.0/linux-x86_64/en-US/firefox-58.0.tar.bz2 \ |
||||
&& tar xjf firefox-58.0.tar.bz2 |
||||
echo "firefox download complete" |
@ -0,0 +1,8 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
echo "Installing firefox..." |
||||
sudo rm -r /opt/firefox |
||||
sudo mv firefox /opt/firefox58 |
||||
sudo mv /usr/bin/firefox /usr/bin/firefox-old |
||||
sudo ln -s /opt/firefox58/firefox /usr/bin/firefox |
||||
echo "Firefox installed." |
@ -1,6 +1,20 @@ |
||||
node_modules/** |
||||
dist/** |
||||
builds/** |
||||
docs/** |
||||
|
||||
development/bundle.js |
||||
development/states.js |
||||
|
||||
app/scripts/lib/extension-instance.js |
||||
app/scripts/chromereload.js |
||||
|
||||
ui/lib/blockies.js |
||||
|
||||
mascara/src/app/first-time/spinner.js |
||||
mascara/test/jquery-3.1.0.min.js |
||||
|
||||
test/integration/bundle.js |
||||
test/integration/jquery-3.1.0.min.js |
||||
test/integration/helpers.js |
||||
test/integration/lib/first-time.js |
||||
ui/lib/blockies.js |
@ -0,0 +1,24 @@ |
||||
const Config = require('./recipient-blacklist.js') |
||||
|
||||
/** @module*/ |
||||
module.exports = { |
||||
checkAccount, |
||||
} |
||||
|
||||
/** |
||||
* Checks if a specified account on a specified network is blacklisted. |
||||
@param networkId {number} |
||||
@param account {string} |
||||
*/ |
||||
function checkAccount (networkId, account) { |
||||
|
||||
const mainnetId = 1 |
||||
if (networkId !== mainnetId) { |
||||
return |
||||
} |
||||
|
||||
const accountToCheck = account.toLowerCase() |
||||
if (Config.blacklist.includes(accountToCheck)) { |
||||
throw new Error('Recipient is a public account') |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
module.exports = { |
||||
'blacklist': [ |
||||
// IDEX phisher
|
||||
'0x9bcb0A9d99d815Bb87ee3191b1399b1Bcc46dc77', |
||||
// Ganache default seed phrases
|
||||
'0x627306090abab3a6e1400e9345bc60c78a8bef57', |
||||
'0xf17f52151ebef6c7334fad080c5704d77216b732', |
||||
'0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef', |
||||
'0x821aea9a577a9b44299b9c15c88cf3087f3b5544', |
||||
'0x0d1d4e623d10f9fba5db95830f7d3839406c6af2', |
||||
'0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e', |
||||
'0x2191ef87e392377ec08e7c08eb105ef5448eced5', |
||||
'0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5', |
||||
'0x6330a553fc93768f612722bb8c2ec78ac90b3bbc', |
||||
'0x5aeda56215b167893e80b4fe645ba6d5bab767de', |
||||
], |
||||
} |
@ -0,0 +1,17 @@ |
||||
const MessageManager = require('./lib/message-manager') |
||||
const PersonalMessageManager = require('./lib/personal-message-manager') |
||||
const TypedMessageManager = require('./lib/typed-message-manager') |
||||
|
||||
class UserActionController { |
||||
|
||||
constructor (opts = {}) { |
||||
|
||||
this.messageManager = new MessageManager() |
||||
this.personalMessageManager = new PersonalMessageManager() |
||||
this.typedMessageManager = new TypedMessageManager() |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
module.exports = UserActionController |
@ -1 +1 @@ |
||||
module.exports = [{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"resolver","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"label","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"ttl","outputs":[{"name":"","type":"uint64"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":true,"name":"label","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"resolver","type":"address"}],"name":"NewResolver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"ttl","type":"uint64"}],"name":"NewTTL","type":"event"}] |
||||
module.exports = [{'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'resolver', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'owner', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'label', 'type': 'bytes32'}, {'name': 'owner', 'type': 'address'}], 'name': 'setSubnodeOwner', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'ttl', 'type': 'uint64'}], 'name': 'setTTL', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'ttl', 'outputs': [{'name': '', 'type': 'uint64'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'resolver', 'type': 'address'}], 'name': 'setResolver', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'owner', 'type': 'address'}], 'name': 'setOwner', 'outputs': [], 'payable': false, 'type': 'function'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'owner', 'type': 'address'}], 'name': 'Transfer', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': true, 'name': 'label', 'type': 'bytes32'}, {'indexed': false, 'name': 'owner', 'type': 'address'}], 'name': 'NewOwner', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'resolver', 'type': 'address'}], 'name': 'NewResolver', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'ttl', 'type': 'uint64'}], 'name': 'NewTTL', 'type': 'event'}] |
||||
|
@ -1,2 +1,2 @@ |
||||
module.exports = |
||||
[{"constant":true,"inputs":[{"name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"},{"name":"contentTypes","type":"uint256"}],"name":"ABI","outputs":[{"name":"contentType","type":"uint256"},{"name":"data","type":"bytes"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"x","type":"bytes32"},{"name":"y","type":"bytes32"}],"name":"setPubkey","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"content","outputs":[{"name":"ret","type":"bytes32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"addr","outputs":[{"name":"ret","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"contentType","type":"uint256"},{"name":"data","type":"bytes"}],"name":"setABI","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"name","outputs":[{"name":"ret","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"name","type":"string"}],"name":"setName","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"hash","type":"bytes32"}],"name":"setContent","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"pubkey","outputs":[{"name":"x","type":"bytes32"},{"name":"y","type":"bytes32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"addr","type":"address"}],"name":"setAddr","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"ensAddr","type":"address"}],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"a","type":"address"}],"name":"AddrChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"hash","type":"bytes32"}],"name":"ContentChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"name","type":"string"}],"name":"NameChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":true,"name":"contentType","type":"uint256"}],"name":"ABIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"x","type":"bytes32"},{"indexed":false,"name":"y","type":"bytes32"}],"name":"PubkeyChanged","type":"event"}] |
||||
[{'constant': true, 'inputs': [{'name': 'interfaceID', 'type': 'bytes4'}], 'name': 'supportsInterface', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'contentTypes', 'type': 'uint256'}], 'name': 'ABI', 'outputs': [{'name': 'contentType', 'type': 'uint256'}, {'name': 'data', 'type': 'bytes'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'x', 'type': 'bytes32'}, {'name': 'y', 'type': 'bytes32'}], 'name': 'setPubkey', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'content', 'outputs': [{'name': 'ret', 'type': 'bytes32'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'addr', 'outputs': [{'name': 'ret', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'contentType', 'type': 'uint256'}, {'name': 'data', 'type': 'bytes'}], 'name': 'setABI', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'name', 'outputs': [{'name': 'ret', 'type': 'string'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'name', 'type': 'string'}], 'name': 'setName', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'hash', 'type': 'bytes32'}], 'name': 'setContent', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'pubkey', 'outputs': [{'name': 'x', 'type': 'bytes32'}, {'name': 'y', 'type': 'bytes32'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'addr', 'type': 'address'}], 'name': 'setAddr', 'outputs': [], 'payable': false, 'type': 'function'}, {'inputs': [{'name': 'ensAddr', 'type': 'address'}], 'payable': false, 'type': 'constructor'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'a', 'type': 'address'}], 'name': 'AddrChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'hash', 'type': 'bytes32'}], 'name': 'ContentChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'name', 'type': 'string'}], 'name': 'NameChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': true, 'name': 'contentType', 'type': 'uint256'}], 'name': 'ABIChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'x', 'type': 'bytes32'}, {'indexed': false, 'name': 'y', 'type': 'bytes32'}], 'name': 'PubkeyChanged', 'type': 'event'}] |
||||
|
@ -0,0 +1,24 @@ |
||||
const WritableStream = require('readable-stream').Writable |
||||
const promiseToCallback = require('promise-to-callback') |
||||
|
||||
module.exports = createStreamSink |
||||
|
||||
|
||||
function createStreamSink (asyncWriteFn, _opts) { |
||||
return new AsyncWritableStream(asyncWriteFn, _opts) |
||||
} |
||||
|
||||
class AsyncWritableStream extends WritableStream { |
||||
|
||||
constructor (asyncWriteFn, _opts) { |
||||
const opts = Object.assign({ objectMode: true }, _opts) |
||||
super(opts) |
||||
this._asyncWriteFn = asyncWriteFn |
||||
} |
||||
|
||||
// write from incomming stream to state
|
||||
_write (chunk, encoding, callback) { |
||||
promiseToCallback(this._asyncWriteFn(chunk, encoding))(callback) |
||||
} |
||||
|
||||
} |
@ -0,0 +1,71 @@ |
||||
class DiagnosticsReporter { |
||||
|
||||
constructor ({ firstTimeInfo, version }) { |
||||
this.firstTimeInfo = firstTimeInfo |
||||
this.version = version |
||||
} |
||||
|
||||
async reportOrphans (orphans) { |
||||
try { |
||||
return await this.submit({ |
||||
accounts: Object.keys(orphans), |
||||
metadata: { |
||||
type: 'orphans', |
||||
}, |
||||
}) |
||||
} catch (err) { |
||||
console.error('DiagnosticsReporter - "reportOrphans" encountered an error:') |
||||
console.error(err) |
||||
} |
||||
} |
||||
|
||||
async reportMultipleKeyrings (rawKeyrings) { |
||||
try { |
||||
const keyrings = await Promise.all(rawKeyrings.map(async (keyring, index) => { |
||||
return { |
||||
index, |
||||
type: keyring.type, |
||||
accounts: await keyring.getAccounts(), |
||||
} |
||||
})) |
||||
return await this.submit({ |
||||
accounts: [], |
||||
metadata: { |
||||
type: 'keyrings', |
||||
keyrings, |
||||
}, |
||||
}) |
||||
} catch (err) { |
||||
console.error('DiagnosticsReporter - "reportMultipleKeyrings" encountered an error:') |
||||
console.error(err) |
||||
} |
||||
} |
||||
|
||||
async submit (message) { |
||||
try { |
||||
// add metadata
|
||||
message.metadata.version = this.version |
||||
message.metadata.firstTimeInfo = this.firstTimeInfo |
||||
return await postData(message) |
||||
} catch (err) { |
||||
console.error('DiagnosticsReporter - "submit" encountered an error:') |
||||
throw err |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
function postData (data) { |
||||
const uri = 'https://diagnostics.metamask.io/v1/orphanedAccounts' |
||||
return fetch(uri, { |
||||
body: JSON.stringify(data), // must match 'Content-Type' header
|
||||
credentials: 'same-origin', // include, same-origin, *omit
|
||||
headers: { |
||||
'content-type': 'application/json', |
||||
}, |
||||
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
||||
mode: 'cors', // no-cors, cors, *same-origin
|
||||
}) |
||||
} |
||||
|
||||
module.exports = DiagnosticsReporter |
@ -0,0 +1,241 @@ |
||||
const fs = require('fs') |
||||
const path = require('path') |
||||
const async = require('async') |
||||
const promisify = require('pify') |
||||
|
||||
// start(/\.selectors.js/, generateSelectorTest).catch(console.error)
|
||||
// start(/\.utils.js/, generateUtilTest).catch(console.error)
|
||||
startContainer(/\.container.js/, generateContainerTest).catch(console.error) |
||||
|
||||
async function getAllFileNames (dirName) { |
||||
const allNames = (await promisify(fs.readdir)(dirName)) |
||||
const fileNames = allNames.filter(name => name.match(/^.+\./)) |
||||
const dirNames = allNames.filter(name => name.match(/^[^.]+$/)) |
||||
|
||||
const fullPathDirNames = dirNames.map(d => `${dirName}/${d}`) |
||||
const subNameArrays = await promisify(async.map)(fullPathDirNames, getAllFileNames) |
||||
let subNames = [] |
||||
subNameArrays.forEach(subNameArray => { subNames = [...subNames, ...subNameArray] }) |
||||
|
||||
return [ |
||||
...fileNames.map(name => dirName + '/' + name), |
||||
...subNames, |
||||
] |
||||
} |
||||
|
||||
/* |
||||
async function start (fileRegEx, testGenerator) { |
||||
const fileNames = await getAllFileNames('./ui/app') |
||||
const sFiles = fileNames.filter(name => name.match(fileRegEx)) |
||||
|
||||
let sFileMethodNames |
||||
let testFilePath |
||||
async.each(sFiles, async (sFile, cb) => { |
||||
const [, sRootPath, sPath] = sFile.match(/^(.+\/)([^/]+)$/) |
||||
sFileMethodNames = Object.keys(require(__dirname + '/' + sFile)) |
||||
|
||||
testFilePath = sPath.replace('.', '-').replace('.', '.test.') |
||||
|
||||
await promisify(fs.writeFile)( |
||||
`${__dirname}/${sRootPath}tests/${testFilePath}`, |
||||
testGenerator(sPath, sFileMethodNames), |
||||
'utf8' |
||||
) |
||||
}, (err) => { |
||||
console.log(err) |
||||
}) |
||||
|
||||
} |
||||
*/ |
||||
|
||||
async function startContainer (fileRegEx, testGenerator) { |
||||
const fileNames = await getAllFileNames('./ui/app') |
||||
const sFiles = fileNames.filter(name => name.match(fileRegEx)) |
||||
|
||||
async.each(sFiles, async (sFile, cb) => { |
||||
console.log(`sFile`, sFile) |
||||
const [, sRootPath, sPath] = sFile.match(/^(.+\/)([^/]+)$/) |
||||
|
||||
const testFilePath = sPath.replace('.', '-').replace('.', '.test.') |
||||
|
||||
await promisify(fs.readFile)( |
||||
path.join(__dirname, sFile), |
||||
'utf8', |
||||
async (err, result) => { |
||||
if (err) { |
||||
console.log('Error: ', err) |
||||
} else { |
||||
console.log(`result`, result.length) |
||||
const returnObjectStrings = result |
||||
.match(/return\s(\{[\s\S]+?})\n}/g) |
||||
.map(str => { |
||||
return str |
||||
.slice(0, str.length - 1) |
||||
.slice(7) |
||||
.replace(/\n/g, '') |
||||
.replace(/\s\s+/g, ' ') |
||||
|
||||
}) |
||||
const mapStateToPropsAssertionObject = returnObjectStrings[0] |
||||
.replace(/\w+:\s\w+\([\w,\s]+\),/g, str => { |
||||
const strKey = str.match(/^\w+/)[0] |
||||
return strKey + ': \'mock' + str.match(/^\w+/)[0].replace(/^./, c => c.toUpperCase()) + ':mockState\',\n' |
||||
}) |
||||
.replace(/{\s\w.+/, firstLinePair => `{\n ${firstLinePair.slice(2)}`) |
||||
.replace(/\w+:.+,/g, s => ` ${s}`) |
||||
.replace(/}/g, s => ` ${s}`) |
||||
let mapDispatchToPropsMethodNames |
||||
if (returnObjectStrings[1]) { |
||||
mapDispatchToPropsMethodNames = returnObjectStrings[1].match(/\s\w+:\s/g).map(str => str.match(/\w+/)[0]) |
||||
} |
||||
const proxyquireObject = ('{\n ' + result |
||||
.match(/import\s{[\s\S]+?}\sfrom\s.+/g) |
||||
.map(s => s.replace(/\n/g, '')) |
||||
.map((s, i) => { |
||||
const proxyKeys = s.match(/{.+}/)[0].match(/\w+/g) |
||||
return '\'' + s.match(/'(.+)'/)[1] + '\': { ' + (proxyKeys.length > 1 |
||||
? '\n ' + proxyKeys.join(': () => {},\n ') + ': () => {},\n ' |
||||
: proxyKeys[0] + ': () => {},') + ' }' |
||||
}) |
||||
.join(',\n ') + '\n}') |
||||
.replace('{ connect: () => {}, },', `{
|
||||
connect: (ms, md) => { |
||||
mapStateToProps = ms |
||||
mapDispatchToProps = md |
||||
return () => ({}) |
||||
}, |
||||
},`)
|
||||
// console.log(`proxyquireObject`, proxyquireObject);
|
||||
// console.log(`mapStateToPropsAssertionObject`, mapStateToPropsAssertionObject);
|
||||
// console.log(`mapDispatchToPropsMethodNames`, mapDispatchToPropsMethodNames);
|
||||
|
||||
const containerTest = generateContainerTest(sPath, { |
||||
mapStateToPropsAssertionObject, |
||||
mapDispatchToPropsMethodNames, |
||||
proxyquireObject, |
||||
}) |
||||
// console.log(`containerTest`, `${__dirname}/${sRootPath}tests/${testFilePath}`, containerTest);
|
||||
console.log('----') |
||||
console.log(`sRootPath`, sRootPath) |
||||
console.log(`testFilePath`, testFilePath) |
||||
await promisify(fs.writeFile)( |
||||
`${__dirname}/${sRootPath}tests/${testFilePath}`, |
||||
containerTest, |
||||
'utf8' |
||||
) |
||||
} |
||||
} |
||||
) |
||||
}, (err) => { |
||||
console.log('123', err) |
||||
}) |
||||
|
||||
} |
||||
/* |
||||
function generateMethodList (methodArray) { |
||||
return methodArray.map(n => ' ' + n).join(',\n') + ',' |
||||
} |
||||
|
||||
function generateMethodDescribeBlock (methodName, index) { |
||||
const describeBlock = |
||||
`${index ? ' ' : ''}describe('${methodName}()', () => {
|
||||
it('should', () => { |
||||
const state = {} |
||||
|
||||
assert.equal(${methodName}(state), ) |
||||
}) |
||||
})` |
||||
return describeBlock |
||||
} |
||||
*/ |
||||
function generateDispatchMethodDescribeBlock (methodName, index) { |
||||
const describeBlock = |
||||
`${index ? ' ' : ''}describe('${methodName}()', () => {
|
||||
it('should dispatch an action', () => { |
||||
mapDispatchToPropsObject.${methodName}() |
||||
assert(dispatchSpy.calledOnce) |
||||
}) |
||||
})` |
||||
return describeBlock |
||||
} |
||||
/* |
||||
function generateMethodDescribeBlocks (methodArray) { |
||||
return methodArray |
||||
.map((methodName, index) => generateMethodDescribeBlock(methodName, index)) |
||||
.join('\n\n') |
||||
} |
||||
*/ |
||||
|
||||
function generateDispatchMethodDescribeBlocks (methodArray) { |
||||
return methodArray |
||||
.map((methodName, index) => generateDispatchMethodDescribeBlock(methodName, index)) |
||||
.join('\n\n') |
||||
} |
||||
|
||||
/* |
||||
function generateSelectorTest (name, methodArray) { |
||||
return `import assert from 'assert'
|
||||
import { |
||||
${generateMethodList(methodArray)} |
||||
} from '../${name}' |
||||
|
||||
describe('${name.match(/^[^.]+/)} selectors', () => { |
||||
|
||||
${generateMethodDescribeBlocks(methodArray)} |
||||
|
||||
})` |
||||
} |
||||
|
||||
function generateUtilTest (name, methodArray) { |
||||
return `import assert from 'assert'
|
||||
import { |
||||
${generateMethodList(methodArray)} |
||||
} from '../${name}' |
||||
|
||||
describe('${name.match(/^[^.]+/)} utils', () => { |
||||
|
||||
${generateMethodDescribeBlocks(methodArray)} |
||||
|
||||
})` |
||||
} |
||||
*/ |
||||
|
||||
function generateContainerTest (sPath, { |
||||
mapStateToPropsAssertionObject, |
||||
mapDispatchToPropsMethodNames, |
||||
proxyquireObject, |
||||
}) { |
||||
return `import assert from 'assert'
|
||||
import proxyquire from 'proxyquire' |
||||
import sinon from 'sinon' |
||||
|
||||
let mapStateToProps |
||||
let mapDispatchToProps |
||||
|
||||
proxyquire('../${sPath}', ${proxyquireObject}) |
||||
|
||||
describe('${sPath.match(/^[^.]+/)} container', () => { |
||||
|
||||
describe('mapStateToProps()', () => { |
||||
|
||||
it('should map the correct properties to props', () => { |
||||
assert.deepEqual(mapStateToProps('mockState'), ${mapStateToPropsAssertionObject}) |
||||
}) |
||||
|
||||
}) |
||||
|
||||
describe('mapDispatchToProps()', () => { |
||||
let dispatchSpy |
||||
let mapDispatchToPropsObject |
||||
|
||||
beforeEach(() => { |
||||
dispatchSpy = sinon.spy() |
||||
mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy) |
||||
}) |
||||
|
||||
${mapDispatchToPropsMethodNames ? generateDispatchMethodDescribeBlocks(mapDispatchToPropsMethodNames) : 'delete'} |
||||
|
||||
}) |
||||
|
||||
})` |
||||
} |
@ -0,0 +1,6 @@ |
||||
Dear MetaMask Users, |
||||
|
||||
There have been several instances of high-profile legitimate websites such as BTC Manager and Games Workshop that have had their websites temporarily compromised. This involves showing a fake MetaMask window on the page asking for user's seed phrases. MetaMask will never open itself in this way and users are encouraged to report these instances immediately to either [our phishing blacklist](https://github.com/MetaMask/eth-phishing-detect/issues) or our support email at [support@metamask.io](mailto:support@metamask.io). |
||||
|
||||
Please read our full article on this ongoing issue at [https://medium.com/metamask/new-phishing-strategy-becoming-common-1b1123837168](https://medium.com/metamask/new-phishing-strategy-becoming-common-1b1123837168). |
||||
|
@ -1,27 +0,0 @@ |
||||
var fs = require('fs') |
||||
var path = require('path') |
||||
var prompt = require('prompt') |
||||
var open = require('open') |
||||
var extend = require('extend') |
||||
var notices = require('./notices.json') |
||||
|
||||
|
||||
console.log('List of Notices') |
||||
console.log(`ID \t DATE \t\t\t TITLE`) |
||||
notices.forEach((notice) => { |
||||
console.log(`${(' ' + notice.id).slice(-2)} \t ${notice.date} \t ${notice.title}`) |
||||
}) |
||||
prompt.get(['id'], (error, res) => { |
||||
prompt.start() |
||||
if (error) { |
||||
console.log("Exiting...") |
||||
process.exit() |
||||
} |
||||
var index = notices.findIndex((notice) => { return notice.id == res.id}) |
||||
if (index === -1) { |
||||
console.log('Notice not found. Exiting...') |
||||
} |
||||
notices.splice(index, 1) |
||||
fs.unlink(`notices/archive/notice_${res.id}.md`) |
||||
fs.writeFile(`notices/notices.json`, JSON.stringify(notices)) |
||||
}) |
@ -1,33 +0,0 @@ |
||||
var fsp = require('fs-promise') |
||||
var path = require('path') |
||||
var prompt = require('prompt') |
||||
var open = require('open') |
||||
var extend = require('extend') |
||||
var notices = require('./notices.json') |
||||
var id = Number(require('./notice-nonce.json')) |
||||
|
||||
var date = new Date().toDateString() |
||||
|
||||
var notice = { |
||||
read: false, |
||||
date: date, |
||||
} |
||||
|
||||
fsp.writeFile(`notices/archive/notice_${id}.md`,'Message goes here. Please write out your notice and save before proceeding at the command line.') |
||||
.then(() => { |
||||
open(`notices/archive/notice_${id}.md`) |
||||
prompt.start() |
||||
prompt.get(['title'], (err, result) => { |
||||
notice.title = result.title |
||||
fsp.readFile(`notices/archive/notice_${id}.md`) |
||||
.then((body) => { |
||||
notice.body = body.toString() |
||||
notice.id = id |
||||
notices.push(notice) |
||||
return fsp.writeFile(`notices/notices.json`, JSON.stringify(notices)) |
||||
}).then((completion) => { |
||||
id += 1 |
||||
return fsp.writeFile(`notices/notice-nonce.json`, id) |
||||
}) |
||||
}) |
||||
}) |
@ -1 +0,0 @@ |
||||
4 |
@ -0,0 +1,35 @@ |
||||
// fs.readFileSync is inlined by browserify transform "brfs"
|
||||
const fs = require('fs') |
||||
const path = require('path') |
||||
|
||||
module.exports = [ |
||||
{ |
||||
id: 0, |
||||
read: false, |
||||
date: 'Thu Feb 09 2017', |
||||
title: 'Terms of Use', |
||||
body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_0.md'), 'utf8'), |
||||
}, |
||||
{ |
||||
id: 2, |
||||
read: false, |
||||
date: 'Mon May 08 2017', |
||||
title: 'Privacy Notice', |
||||
body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_2.md'), 'utf8'), |
||||
}, |
||||
{ |
||||
id: 3, |
||||
read: false, |
||||
date: 'Tue Nov 28 2017', |
||||
title: 'Seed Phrase Alert', |
||||
firstVersion: '<=3.12.0', |
||||
body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_3.md'), 'utf8'), |
||||
}, |
||||
{ |
||||
id: 4, |
||||
read: false, |
||||
date: 'Wed Jun 13 2018', |
||||
title: 'Phishing Warning', |
||||
body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_4.md'), 'utf8'), |
||||
}, |
||||
] |
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue