From 695b157e7b511a94a18ada1578ece2e4e838f869 Mon Sep 17 00:00:00 2001 From: MikeCheng1208 Date: Fri, 4 May 2018 19:57:19 +0800 Subject: Intergrate ENS with IPFS --- app/404.html | 28 ++++++++++++ app/error.html | 79 +++++++++++++++++++++++++++++++++ app/images/404.png | Bin 0 -> 39401 bytes app/images/cancel.png | Bin 0 -> 10928 bytes app/images/deadface.png | Bin 0 -> 8333 bytes app/images/loginglogo.svg | 53 ++++++++++++++++++++++ app/images/logo.png | Bin 0 -> 6589 bytes app/images/pw-128x128.png | Bin 0 -> 94988 bytes app/images/pw-48x48.png | Bin 0 -> 3279 bytes app/images/pw128x128.png | Bin 0 -> 94988 bytes app/loading.html | 35 +++++++++++++++ app/manifest.json | 15 ++++--- app/no_mainnet.html | 59 ++++++++++++++++++++++++ app/scripts/background.js | 10 +++++ app/scripts/lib/contracts/registrar.js | 1 + app/scripts/lib/contracts/resolver.js | 2 + app/scripts/lib/portalnetwork.js | 33 ++++++++++++++ app/scripts/lib/resolver.js | 46 +++++++++++++++++++ 18 files changed, 356 insertions(+), 5 deletions(-) create mode 100644 app/404.html create mode 100644 app/error.html create mode 100644 app/images/404.png create mode 100644 app/images/cancel.png create mode 100644 app/images/deadface.png create mode 100644 app/images/loginglogo.svg create mode 100644 app/images/logo.png create mode 100644 app/images/pw-128x128.png create mode 100644 app/images/pw-48x48.png create mode 100644 app/images/pw128x128.png create mode 100644 app/loading.html create mode 100644 app/no_mainnet.html create mode 100644 app/scripts/lib/contracts/registrar.js create mode 100644 app/scripts/lib/contracts/resolver.js create mode 100644 app/scripts/lib/portalnetwork.js create mode 100644 app/scripts/lib/resolver.js (limited to 'app') diff --git a/app/404.html b/app/404.html new file mode 100644 index 000000000..2fbf1e311 --- /dev/null +++ b/app/404.html @@ -0,0 +1,28 @@ + + + 404 + + + + + + \ No newline at end of file diff --git a/app/error.html b/app/error.html new file mode 100644 index 000000000..d4484d8e3 --- /dev/null +++ b/app/error.html @@ -0,0 +1,79 @@ + + + Portal Network + + + + +
+ +

not found

+

Powered by Portal Network

+
+ + + diff --git a/app/images/404.png b/app/images/404.png new file mode 100644 index 000000000..b1a767dde Binary files /dev/null and b/app/images/404.png differ diff --git a/app/images/cancel.png b/app/images/cancel.png new file mode 100644 index 000000000..4e0eb1143 Binary files /dev/null and b/app/images/cancel.png differ diff --git a/app/images/deadface.png b/app/images/deadface.png new file mode 100644 index 000000000..e12476c03 Binary files /dev/null and b/app/images/deadface.png differ diff --git a/app/images/loginglogo.svg b/app/images/loginglogo.svg new file mode 100644 index 000000000..ca8b0a2ee --- /dev/null +++ b/app/images/loginglogo.svg @@ -0,0 +1,53 @@ + + + + logo2 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/images/logo.png b/app/images/logo.png new file mode 100644 index 000000000..db6ba7d6c Binary files /dev/null and b/app/images/logo.png differ diff --git a/app/images/pw-128x128.png b/app/images/pw-128x128.png new file mode 100644 index 000000000..a0eb1b730 Binary files /dev/null and b/app/images/pw-128x128.png differ diff --git a/app/images/pw-48x48.png b/app/images/pw-48x48.png new file mode 100644 index 000000000..a96c59e15 Binary files /dev/null and b/app/images/pw-48x48.png differ diff --git a/app/images/pw128x128.png b/app/images/pw128x128.png new file mode 100644 index 000000000..a0eb1b730 Binary files /dev/null and b/app/images/pw128x128.png differ diff --git a/app/loading.html b/app/loading.html new file mode 100644 index 000000000..bbf1c1b4e --- /dev/null +++ b/app/loading.html @@ -0,0 +1,35 @@ + + + Portal Network + + + + + + diff --git a/app/manifest.json b/app/manifest.json index 3e5eed205..0f5a2566f 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "4.6.0", + "version": "4.6.2", "manifest_version": 2, "author": "https://metamask.io", "description": "__MSG_appDescription__", @@ -59,14 +59,19 @@ "unlimitedStorage", "clipboardWrite", "http://localhost:8545/", - "https://*.infura.io/" + "https://*.infura.io/", + "activeTab", + "webRequest", + "*://*.eth/" ], "web_accessible_resources": [ - "inpage.js" + "inpage.js", + "*" ], "externally_connectable": { "matches": [ "https://metamask.io/*" ] - } -} \ No newline at end of file + }, + "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" +} diff --git a/app/no_mainnet.html b/app/no_mainnet.html new file mode 100644 index 000000000..f90e6d397 --- /dev/null +++ b/app/no_mainnet.html @@ -0,0 +1,59 @@ + + + + + no_mainnet + + + +
+ +

ENS resolver only support on Ethereum mainnet

+
+ + \ No newline at end of file diff --git a/app/scripts/background.js b/app/scripts/background.js index 686296329..fc2ad5773 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -25,6 +25,8 @@ const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics') const EdgeEncryptor = require('./edge-encryptor') const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code') const getObjStructure = require('./lib/getObjStructure') +const pw = require('./lib/portalnetwork.js') + const { ENVIRONMENT_TYPE_POPUP, ENVIRONMENT_TYPE_NOTIFICATION, @@ -59,12 +61,17 @@ const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY }) const localStore = new LocalStore() let versionedData +console.log('localStore', localStore); +console.log('diskStore', diskStore); + // initialization flow initialize().catch(log.error) // setup metamask mesh testing container setupMetamaskMeshMetrics() + + /** * An object representing a transaction, in whatever state it is in. * @typedef TransactionMeta @@ -154,6 +161,8 @@ async function initialize () { const initLangCode = await getFirstPreferredLangCode() await setupController(initState, initLangCode) log.debug('MetaMask initialization complete.') + // porto network init + pw(initState.NetworkController.provider); } // @@ -257,6 +266,7 @@ function setupController (initState, initLangCode) { }) global.metamaskController = controller + // report failed transactions to Sentry controller.txController.on(`tx:status-update`, (txId, status) => { if (status !== 'failed') return diff --git a/app/scripts/lib/contracts/registrar.js b/app/scripts/lib/contracts/registrar.js new file mode 100644 index 000000000..980a64d7f --- /dev/null +++ b/app/scripts/lib/contracts/registrar.js @@ -0,0 +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"}] \ No newline at end of file diff --git a/app/scripts/lib/contracts/resolver.js b/app/scripts/lib/contracts/resolver.js new file mode 100644 index 000000000..f42777cc7 --- /dev/null +++ b/app/scripts/lib/contracts/resolver.js @@ -0,0 +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"}] \ No newline at end of file diff --git a/app/scripts/lib/portalnetwork.js b/app/scripts/lib/portalnetwork.js new file mode 100644 index 000000000..5ff4f5ecf --- /dev/null +++ b/app/scripts/lib/portalnetwork.js @@ -0,0 +1,33 @@ +const extension = require('extensionizer') +const resolver = require('./resolver.js'); +module.exports = function (provider) { + extension.webRequest.onBeforeRequest.addListener(details => { + let name = details.url.substring(7, details.url.length - 1); + extension.tabs.getSelected(null, tab => { + extension.tabs.update(tab.id, { url: "loading.html" }); + + setTimeout(() => { + return extension.tabs.update(tab.id, { url: "404.html" }); + }, 60000); + + resolver.resolve(name, provider).then(ipfsHash => { + let url = "https://gateway.ipfs.io/ipfs/" + ipfsHash; + return fetch(url, {method: "HEAD"}).then(response => response.status).then(statusCode => { + if (statusCode !== 200) return "Local" + extension.tabs.update(tab.id, { url: url }) + }) + .catch(err => { + url = "https://gateway.ipfs.io/ipfs/" + ipfsHash + extension.tabs.update(tab.id, {url: url}) + return err + }) + }) + .catch(err => { + let nameWithoutTld = name.substring(0, name.lastIndexOf('.')) + let url = err === "no_mainnet" ? "no_mainnet" : "error" + extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`}) + }) + }) + return { cancel: true } + }, {urls: ["*://*.eth/"]}) +} \ No newline at end of file diff --git a/app/scripts/lib/resolver.js b/app/scripts/lib/resolver.js new file mode 100644 index 000000000..43ccec0cc --- /dev/null +++ b/app/scripts/lib/resolver.js @@ -0,0 +1,46 @@ +const namehash = require('eth-ens-namehash') +const multihash = require('multihashes') +const REGISTRAR_ENS_MAIN_NET = "0x314159265dd8dbb310642f98f50c066173c1259b" +const HttpProvider = require('ethjs-provider-http') +const Eth = require('ethjs-query') +const EthContract = require('ethjs-contract') +const registrarAbi = require('./contracts/registrar') +const resolverAbi = require('./contracts/resolver') +function ens(name, provider) { + // provider need mainnet + let eth = new Eth(new HttpProvider(provider.rpcTarget)) + let hash = namehash.hash(name) + let contract = new EthContract(eth) + let Registrar = contract(registrarAbi).at(REGISTRAR_ENS_MAIN_NET) + return new Promise((resolve, reject) => { + if (provider.type !== "mainnet") reject('no_mainnet') + Registrar.resolver(hash).then((address) => { + if (address === '0x0000000000000000000000000000000000000000') { + reject(null) + } else { + let Resolver = contract(resolverAbi).at(address["0"]) + return Resolver.content(hash) + } + }).then((contentHash) => { + if (contentHash["0"] === '0x0000000000000000000000000000000000000000000000000000000000000000') reject(null) + if (contentHash.ret !== "0x") { + let hex = contentHash["0"].substring(2) + let buf = multihash.fromHexString(hex) + resolve(multihash.toB58String(multihash.encode(buf, 'sha2-256'))) + } else { + reject('fisk') + } + }) + }) +} +module.exports.resolve = function (name, provider) { + let path = name.split("."); + let tld = path[path.length - 1]; + if (tld === 'eth') { + return ens(name, provider); + } else { + return new Promise((resolve, reject) => { + reject(null) + }) + } +} -- cgit v1.2.3 From 88a6b4edc79a27e9d94dc4ec25e9de02153abc5d Mon Sep 17 00:00:00 2001 From: MikeCheng1208 Date: Mon, 7 May 2018 18:19:17 +0800 Subject: setTimeout bug fix --- app/scripts/lib/portalnetwork.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/portalnetwork.js b/app/scripts/lib/portalnetwork.js index 5ff4f5ecf..960871ebc 100644 --- a/app/scripts/lib/portalnetwork.js +++ b/app/scripts/lib/portalnetwork.js @@ -3,16 +3,18 @@ const resolver = require('./resolver.js'); module.exports = function (provider) { extension.webRequest.onBeforeRequest.addListener(details => { let name = details.url.substring(7, details.url.length - 1); + let clearTime = null; extension.tabs.getSelected(null, tab => { extension.tabs.update(tab.id, { url: "loading.html" }); - setTimeout(() => { + clearTime = setTimeout(() => { return extension.tabs.update(tab.id, { url: "404.html" }); }, 60000); resolver.resolve(name, provider).then(ipfsHash => { + clearTimeout(clearTime); let url = "https://gateway.ipfs.io/ipfs/" + ipfsHash; - return fetch(url, {method: "HEAD"}).then(response => response.status).then(statusCode => { + return fetch(url, { method: "HEAD" }).then(response => response.status).then(statusCode => { if (statusCode !== 200) return "Local" extension.tabs.update(tab.id, { url: url }) }) @@ -23,6 +25,7 @@ module.exports = function (provider) { }) }) .catch(err => { + clearTimeout(clearTime); let nameWithoutTld = name.substring(0, name.lastIndexOf('.')) let url = err === "no_mainnet" ? "no_mainnet" : "error" extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`}) -- cgit v1.2.3 From 8b8cc94f6f8cb949ee214e814d9d8949d17ddd16 Mon Sep 17 00:00:00 2001 From: MikeCheng1208 Date: Fri, 4 May 2018 19:57:19 +0800 Subject: Intergrate ENS with IPFS --- app/manifest.json | 4 ++++ app/scripts/lib/portalnetwork.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/manifest.json b/app/manifest.json index 0f5a2566f..ad500e40a 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -74,4 +74,8 @@ ] }, "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" +<<<<<<< HEAD } +======= +} +>>>>>>> Intergrate ENS with IPFS diff --git a/app/scripts/lib/portalnetwork.js b/app/scripts/lib/portalnetwork.js index 960871ebc..977f17926 100644 --- a/app/scripts/lib/portalnetwork.js +++ b/app/scripts/lib/portalnetwork.js @@ -33,4 +33,4 @@ module.exports = function (provider) { }) return { cancel: true } }, {urls: ["*://*.eth/"]}) -} \ No newline at end of file +} -- cgit v1.2.3 From 86ead431c3e07eff3ff9deae42ab0994ca998229 Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Thu, 24 May 2018 22:37:41 +0700 Subject: Update manifest.json --- app/manifest.json | 4 ---- 1 file changed, 4 deletions(-) (limited to 'app') diff --git a/app/manifest.json b/app/manifest.json index ad500e40a..0f5a2566f 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -74,8 +74,4 @@ ] }, "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" -<<<<<<< HEAD } -======= -} ->>>>>>> Intergrate ENS with IPFS -- cgit v1.2.3 From 829deacb57a23ec8027269c93cdef3f3735d1710 Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Thu, 24 May 2018 23:08:02 +0700 Subject: Rename files --- app/404.html | 2 +- app/error.html | 2 +- app/loading.html | 2 +- app/no_mainnet.html | 59 ---------------------------------------- app/scripts/background.js | 8 ++---- app/scripts/lib/ipfsContent.js | 36 ++++++++++++++++++++++++ app/scripts/lib/portalnetwork.js | 36 ------------------------ app/scripts/lib/resolver.js | 37 +++++++++++++------------ app/unsupport.html | 59 ++++++++++++++++++++++++++++++++++++++++ 9 files changed, 119 insertions(+), 122 deletions(-) delete mode 100644 app/no_mainnet.html create mode 100644 app/scripts/lib/ipfsContent.js delete mode 100644 app/scripts/lib/portalnetwork.js create mode 100644 app/unsupport.html (limited to 'app') diff --git a/app/404.html b/app/404.html index 2fbf1e311..0dbab69a7 100644 --- a/app/404.html +++ b/app/404.html @@ -1,6 +1,6 @@ - 404 + MetaMask - -
- -

ENS resolver only support on Ethereum mainnet

-
- - \ No newline at end of file diff --git a/app/scripts/background.js b/app/scripts/background.js index fc2ad5773..672a2dcac 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -25,7 +25,7 @@ const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics') const EdgeEncryptor = require('./edge-encryptor') const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code') const getObjStructure = require('./lib/getObjStructure') -const pw = require('./lib/portalnetwork.js') +const ipfsContent = require('./lib/ipfsContent.js') const { ENVIRONMENT_TYPE_POPUP, @@ -61,9 +61,6 @@ const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY }) const localStore = new LocalStore() let versionedData -console.log('localStore', localStore); -console.log('diskStore', diskStore); - // initialization flow initialize().catch(log.error) @@ -161,8 +158,7 @@ async function initialize () { const initLangCode = await getFirstPreferredLangCode() await setupController(initState, initLangCode) log.debug('MetaMask initialization complete.') - // porto network init - pw(initState.NetworkController.provider); + ipfsContent(initState.NetworkController.provider) } // diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js new file mode 100644 index 000000000..4d66745e9 --- /dev/null +++ b/app/scripts/lib/ipfsContent.js @@ -0,0 +1,36 @@ +const extension = require('extensionizer') +const resolver = require('./resolver.js') + +module.exports = function (provider) { + extension.webRequest.onBeforeRequest.addListener(details => { + const name = details.url.substring(7, details.url.length - 1) + let clearTime = null + extension.tabs.getSelected(null, tab => { + extension.tabs.update(tab.id, { url: 'loading.html' }) + + clearTime = setTimeout(() => { + return extension.tabs.update(tab.id, { url: '404.html' }) + }, 60000) + + resolver.resolve(name, provider).then(ipfsHash => { + clearTimeout(clearTime) + let url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash + return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => { + if (statusCode !== 200) return 'Local' + extension.tabs.update(tab.id, { url: url }) + }) + .catch(err => { + url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash + extension.tabs.update(tab.id, {url: url}) + return err + }) + }) + .catch(err => { + clearTimeout(clearTime) + const url = err === 'unsupport' ? 'unsupport' : 'error' + extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`}) + }) + }) + return { cancel: true } + }, {urls: ['*://*.eth/']}) +} diff --git a/app/scripts/lib/portalnetwork.js b/app/scripts/lib/portalnetwork.js deleted file mode 100644 index 977f17926..000000000 --- a/app/scripts/lib/portalnetwork.js +++ /dev/null @@ -1,36 +0,0 @@ -const extension = require('extensionizer') -const resolver = require('./resolver.js'); -module.exports = function (provider) { - extension.webRequest.onBeforeRequest.addListener(details => { - let name = details.url.substring(7, details.url.length - 1); - let clearTime = null; - extension.tabs.getSelected(null, tab => { - extension.tabs.update(tab.id, { url: "loading.html" }); - - clearTime = setTimeout(() => { - return extension.tabs.update(tab.id, { url: "404.html" }); - }, 60000); - - resolver.resolve(name, provider).then(ipfsHash => { - clearTimeout(clearTime); - let url = "https://gateway.ipfs.io/ipfs/" + ipfsHash; - return fetch(url, { method: "HEAD" }).then(response => response.status).then(statusCode => { - if (statusCode !== 200) return "Local" - extension.tabs.update(tab.id, { url: url }) - }) - .catch(err => { - url = "https://gateway.ipfs.io/ipfs/" + ipfsHash - extension.tabs.update(tab.id, {url: url}) - return err - }) - }) - .catch(err => { - clearTimeout(clearTime); - let nameWithoutTld = name.substring(0, name.lastIndexOf('.')) - let url = err === "no_mainnet" ? "no_mainnet" : "error" - extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`}) - }) - }) - return { cancel: true } - }, {urls: ["*://*.eth/"]}) -} diff --git a/app/scripts/lib/resolver.js b/app/scripts/lib/resolver.js index 43ccec0cc..dec43c481 100644 --- a/app/scripts/lib/resolver.js +++ b/app/scripts/lib/resolver.js @@ -1,43 +1,44 @@ const namehash = require('eth-ens-namehash') const multihash = require('multihashes') -const REGISTRAR_ENS_MAIN_NET = "0x314159265dd8dbb310642f98f50c066173c1259b" +const REGISTRAR_ENS_MAIN_NET = '0x314159265dd8dbb310642f98f50c066173c1259b' const HttpProvider = require('ethjs-provider-http') const Eth = require('ethjs-query') const EthContract = require('ethjs-contract') const registrarAbi = require('./contracts/registrar') const resolverAbi = require('./contracts/resolver') -function ens(name, provider) { - // provider need mainnet - let eth = new Eth(new HttpProvider(provider.rpcTarget)) - let hash = namehash.hash(name) - let contract = new EthContract(eth) - let Registrar = contract(registrarAbi).at(REGISTRAR_ENS_MAIN_NET) + +function ens (name, provider) { + const eth = new Eth(new HttpProvider(provider.rpcTarget)) + const hash = namehash.hash(name) + const contract = new EthContract(eth) + const Registrar = contract(registrarAbi).at(REGISTRAR_ENS_MAIN_NET) return new Promise((resolve, reject) => { - if (provider.type !== "mainnet") reject('no_mainnet') + if (provider.type !== 'mainnet') reject('unsupport') Registrar.resolver(hash).then((address) => { if (address === '0x0000000000000000000000000000000000000000') { reject(null) } else { - let Resolver = contract(resolverAbi).at(address["0"]) + const Resolver = contract(resolverAbi).at(address['0']) return Resolver.content(hash) } }).then((contentHash) => { - if (contentHash["0"] === '0x0000000000000000000000000000000000000000000000000000000000000000') reject(null) - if (contentHash.ret !== "0x") { - let hex = contentHash["0"].substring(2) - let buf = multihash.fromHexString(hex) - resolve(multihash.toB58String(multihash.encode(buf, 'sha2-256'))) + if (contentHash['0'] === '0x0000000000000000000000000000000000000000000000000000000000000000') reject(null) + if (contentHash.ret !== '0x') { + const hex = contentHash['0'].substring(2) + const buf = multihash.fromHexString(hex) + resolve(multihash.toB58String(buf)) } else { - reject('fisk') + reject(null) } }) }) } + module.exports.resolve = function (name, provider) { - let path = name.split("."); - let tld = path[path.length - 1]; + const path = name.split('.') + const tld = path[path.length - 1] if (tld === 'eth') { - return ens(name, provider); + return ens(name, provider) } else { return new Promise((resolve, reject) => { reject(null) diff --git a/app/unsupport.html b/app/unsupport.html new file mode 100644 index 000000000..6f514eb17 --- /dev/null +++ b/app/unsupport.html @@ -0,0 +1,59 @@ + + + + + MetaMask + + + +
+ +

ENS resolver only support on Ethereum mainnet

+
+ + \ No newline at end of file -- cgit v1.2.3 From 384cb126dd3cdf0d1dcf67525d7a390436ec6ea2 Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Tue, 29 May 2018 19:29:12 +0800 Subject: Update lib --- app/404.html | 26 ++++++++++++++++- app/scripts/lib/ipfsContent.js | 2 +- app/scripts/lib/resolver.js | 66 ++++++++++++++++++++++++++++-------------- 3 files changed, 71 insertions(+), 23 deletions(-) (limited to 'app') diff --git a/app/404.html b/app/404.html index 0dbab69a7..f66723ad6 100644 --- a/app/404.html +++ b/app/404.html @@ -17,12 +17,36 @@ width: 100%; height: 100%; } + .app{ + position: relative; + width: 100%; + height: auto; + overflow: hidden; + } img{ display: block; + width: 100%; + height: auto; + } + h2{ + display: block; + width: 100%; + overflow: hidden; + position: absolute; + bottom: 20%; + left: 0; + color: #1b243d; + text-align: center; + } + h2 > a{ + color: #1b243d; } - +
+ +

Powered by Portal Network

+
\ No newline at end of file diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js index 4d66745e9..bf04c854b 100644 --- a/app/scripts/lib/ipfsContent.js +++ b/app/scripts/lib/ipfsContent.js @@ -16,7 +16,7 @@ module.exports = function (provider) { clearTimeout(clearTime) let url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => { - if (statusCode !== 200) return 'Local' + if (statusCode !== 200) return extension.tabs.update(tab.id, { url: '404.html' }) extension.tabs.update(tab.id, { url: url }) }) .catch(err => { diff --git a/app/scripts/lib/resolver.js b/app/scripts/lib/resolver.js index dec43c481..2bf9dac50 100644 --- a/app/scripts/lib/resolver.js +++ b/app/scripts/lib/resolver.js @@ -1,6 +1,5 @@ const namehash = require('eth-ens-namehash') const multihash = require('multihashes') -const REGISTRAR_ENS_MAIN_NET = '0x314159265dd8dbb310642f98f50c066173c1259b' const HttpProvider = require('ethjs-provider-http') const Eth = require('ethjs-query') const EthContract = require('ethjs-contract') @@ -8,32 +7,57 @@ const registrarAbi = require('./contracts/registrar') const resolverAbi = require('./contracts/resolver') function ens (name, provider) { - const eth = new Eth(new HttpProvider(provider.rpcTarget)) + const eth = new Eth(new HttpProvider(getProvider(provider.type))) const hash = namehash.hash(name) const contract = new EthContract(eth) - const Registrar = contract(registrarAbi).at(REGISTRAR_ENS_MAIN_NET) + const Registrar = contract(registrarAbi).at(getRegistrar(provider.type)) return new Promise((resolve, reject) => { - if (provider.type !== 'mainnet') reject('unsupport') - Registrar.resolver(hash).then((address) => { - if (address === '0x0000000000000000000000000000000000000000') { - reject(null) - } else { - const Resolver = contract(resolverAbi).at(address['0']) - return Resolver.content(hash) - } - }).then((contentHash) => { - if (contentHash['0'] === '0x0000000000000000000000000000000000000000000000000000000000000000') reject(null) - if (contentHash.ret !== '0x') { - const hex = contentHash['0'].substring(2) - const buf = multihash.fromHexString(hex) - resolve(multihash.toB58String(buf)) - } else { - reject(null) - } - }) + if (provider.type === 'mainnet' || provider.type === 'ropsten') { + Registrar.resolver(hash).then((address) => { + if (address === '0x0000000000000000000000000000000000000000') { + reject(null) + } else { + const Resolver = contract(resolverAbi).at(address['0']) + return Resolver.content(hash) + } + }).then((contentHash) => { + if (contentHash['0'] === '0x0000000000000000000000000000000000000000000000000000000000000000') reject(null) + if (contentHash.ret !== '0x') { + const hex = contentHash['0'].substring(2) + const buf = multihash.fromHexString(hex) + resolve(multihash.toB58String(multihash.encode(buf, 'sha2-256'))) + } else { + reject(null) + } + }) + } else { + return reject('unsupport') + } }) } +function getProvider (type) { + switch (type) { + case 'mainnet': + return 'https://mainnet.infura.io/' + case 'ropsten': + return 'https://ropsten.infura.io/' + default: + return 'http://localhost:3000/' + } +} + +function getRegistrar (type) { + switch (type) { + case 'mainnet': + return '0x314159265dd8dbb310642f98f50c066173c1259b' + case 'ropsten': + return '0x112234455c3a32fd11230c42e7bccd4a84e02010' + default: + return '0x0000000000000000000000000000000000000000' + } +} + module.exports.resolve = function (name, provider) { const path = name.split('.') const tld = path[path.length - 1] -- cgit v1.2.3 From 181a11eae2c4059a7c3f0f15bb96630c0761ae7b Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Wed, 30 May 2018 09:57:31 +0800 Subject: Update default provider --- app/scripts/lib/resolver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/scripts/lib/resolver.js b/app/scripts/lib/resolver.js index 2bf9dac50..6786929d8 100644 --- a/app/scripts/lib/resolver.js +++ b/app/scripts/lib/resolver.js @@ -43,7 +43,7 @@ function getProvider (type) { case 'ropsten': return 'https://ropsten.infura.io/' default: - return 'http://localhost:3000/' + return 'http://localhost:8545/' } } -- cgit v1.2.3 From 4e14313ba8a72648be810f3e78d6e5849b363d11 Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Fri, 1 Jun 2018 11:26:44 +0800 Subject: Update manifest.json --- app/manifest.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/manifest.json b/app/manifest.json index 0f5a2566f..1a4114a1b 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "4.6.2", + "version": "4.6.0", "manifest_version": 2, "author": "https://metamask.io", "description": "__MSG_appDescription__", @@ -65,13 +65,12 @@ "*://*.eth/" ], "web_accessible_resources": [ - "inpage.js", - "*" + "inpage.js" ], "externally_connectable": { "matches": [ "https://metamask.io/*" ] }, - "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" + "content_security_policy": "script-src 'self'; object-src 'self'" } -- cgit v1.2.3 From 77d17f2d55a3e3ed704324020f6ec4b42cc4dde2 Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Fri, 1 Jun 2018 11:27:05 +0800 Subject: Update ipfs to infura --- app/scripts/lib/ipfsContent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js index bf04c854b..46131b266 100644 --- a/app/scripts/lib/ipfsContent.js +++ b/app/scripts/lib/ipfsContent.js @@ -14,13 +14,13 @@ module.exports = function (provider) { resolver.resolve(name, provider).then(ipfsHash => { clearTimeout(clearTime) - let url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash + let url = 'https://ipfs.infura.io/ipfs/' + ipfsHash return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => { if (statusCode !== 200) return extension.tabs.update(tab.id, { url: '404.html' }) extension.tabs.update(tab.id, { url: url }) }) .catch(err => { - url = 'https://gateway.ipfs.io/ipfs/' + ipfsHash + url = 'https://ipfs.infura.io/ipfs/' + ipfsHash extension.tabs.update(tab.id, {url: url}) return err }) -- cgit v1.2.3 From cc5bdadbf1f12f3f8d7f24f9bcf7ea81fe93f012 Mon Sep 17 00:00:00 2001 From: Yung chieh Tsai Date: Fri, 1 Jun 2018 15:30:57 +0800 Subject: Update 404 --- app/404.html | 1 - 1 file changed, 1 deletion(-) (limited to 'app') diff --git a/app/404.html b/app/404.html index f66723ad6..5a1585318 100644 --- a/app/404.html +++ b/app/404.html @@ -46,7 +46,6 @@
-

Powered by Portal Network

\ No newline at end of file -- cgit v1.2.3 From 8a571ece367f089e9cfef45fed925736c5858e82 Mon Sep 17 00:00:00 2001 From: PhyrexTsai Date: Sat, 2 Jun 2018 00:00:11 +0800 Subject: Update 404.html --- app/404.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/404.html b/app/404.html index 5a1585318..8a6df9d7a 100644 --- a/app/404.html +++ b/app/404.html @@ -46,6 +46,7 @@
+

Powered by Portal Network

- \ No newline at end of file + -- cgit v1.2.3 From bb855707efbcb754f5e4ee4e124f69308bca037d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 14 Jun 2018 11:25:55 -0230 Subject: ENS input in send form shows distinct errors for invalid addresses and non-existent addresses. --- app/_locales/en/messages.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 457c3c3b1..b65d8ac87 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -262,6 +262,9 @@ "encryptNewDen": { "message": "Encrypt your new DEN" }, + "ensNameNotFound": { + "message": "ENS name not found" + }, "enterPassword": { "message": "Enter password" }, -- cgit v1.2.3 From de01a6f112716cad8ebc1fd56dd304f1818704f4 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 28 Jun 2018 13:17:44 -0230 Subject: Use background gas price estimation method in new ui. --- app/scripts/metamask-controller.js | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index d40a351a5..2055a2dc2 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -338,6 +338,7 @@ module.exports = class MetamaskController extends EventEmitter { markAccountsFound: this.markAccountsFound.bind(this), markPasswordForgotten: this.markPasswordForgotten.bind(this), unMarkPasswordForgotten: this.unMarkPasswordForgotten.bind(this), + getGasPrice: (cb) => cb(null, this.getGasPrice()), // coinbase buyEth: this.buyEth.bind(this), -- cgit v1.2.3 From 11736e6318182ab5b43430410a46059e5f46ad52 Mon Sep 17 00:00:00 2001 From: PhyrexTsai Date: Fri, 29 Jun 2018 13:57:41 +0800 Subject: Update to support pathnames on IPFS hash As @Georgi87 mentioned about pathnames on the domain like `http://phyrextsai.eth/home` will pass to IPFS hash and append `/home` on redirection url. You can try the example below: http://phyrextsai.eth/index.html http://phyrextsai.eth/images/phyrex.jpg --- app/scripts/lib/ipfsContent.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js index 46131b266..2ddbe5558 100644 --- a/app/scripts/lib/ipfsContent.js +++ b/app/scripts/lib/ipfsContent.js @@ -3,8 +3,12 @@ const resolver = require('./resolver.js') module.exports = function (provider) { extension.webRequest.onBeforeRequest.addListener(details => { - const name = details.url.substring(7, details.url.length - 1) + const urlhttpreplace = details.url.replace(/\w+?:\/\//, "") + const url = urlhttpreplace.replace(/[\\\/].*/g, "") + let domainhtml = urlhttpreplace.match(/[\\\/].*/g) let clearTime = null + let name = url.replace(/\/$/g, "") + if (domainhtml === null) domainhtml = [""] extension.tabs.getSelected(null, tab => { extension.tabs.update(tab.id, { url: 'loading.html' }) @@ -14,13 +18,13 @@ module.exports = function (provider) { resolver.resolve(name, provider).then(ipfsHash => { clearTimeout(clearTime) - let url = 'https://ipfs.infura.io/ipfs/' + ipfsHash + let url = 'https://ipfs.infura.io/ipfs/' + ipfsHash + domainhtml[0] return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => { if (statusCode !== 200) return extension.tabs.update(tab.id, { url: '404.html' }) extension.tabs.update(tab.id, { url: url }) }) .catch(err => { - url = 'https://ipfs.infura.io/ipfs/' + ipfsHash + url = 'https://ipfs.infura.io/ipfs/' + ipfsHash + domainhtml[0] extension.tabs.update(tab.id, {url: url}) return err }) @@ -32,5 +36,5 @@ module.exports = function (provider) { }) }) return { cancel: true } - }, {urls: ['*://*.eth/']}) + }, {urls: ['*://*.eth/', '*://*.eth/*']}) } -- cgit v1.2.3 From a8f745f9fe74751b87f500af3857b66d4c80f45e Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 2 Jul 2018 18:49:33 -0400 Subject: eslint --fix . --- app/scripts/background.js | 2 +- app/scripts/contentscript.js | 4 ++-- app/scripts/controllers/balance.js | 4 ++-- app/scripts/controllers/blacklist.js | 2 +- app/scripts/controllers/computed-balances.js | 2 +- app/scripts/controllers/currency.js | 8 ++++---- app/scripts/controllers/network/network.js | 2 +- app/scripts/controllers/preferences.js | 6 +++--- app/scripts/controllers/recent-blocks.js | 2 +- app/scripts/controllers/transactions/tx-gas-utils.js | 2 +- app/scripts/lib/cleanErrorStack.js | 2 +- app/scripts/lib/createErrorMiddleware.js | 2 +- app/scripts/lib/createStreamSink.js | 2 +- app/scripts/lib/diagnostics-reporter.js | 6 +++--- app/scripts/lib/extractEthjsErrorMessage.js | 4 ++-- app/scripts/lib/get-first-preferred-lang-code.js | 2 +- app/scripts/lib/getObjStructure.js | 6 +++--- app/scripts/lib/local-store.js | 12 ++++++------ app/scripts/lib/port-stream.js | 2 +- app/scripts/lib/reportFailedTxToSentry.js | 2 +- app/scripts/lib/setupMetamaskMeshMetrics.js | 2 +- app/scripts/lib/setupRaven.js | 14 +++++++------- app/scripts/metamask-controller.js | 5 ++--- app/scripts/migrations/013.js | 2 +- app/scripts/migrations/023.js | 4 ++-- app/scripts/popup-core.js | 2 +- app/scripts/ui.js | 2 +- 27 files changed, 52 insertions(+), 53 deletions(-) (limited to 'app') diff --git a/app/scripts/background.js b/app/scripts/background.js index 2451cddb6..54511631f 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -378,7 +378,7 @@ function setupController (initState, initLangCode) { } // communication with page or other extension - function connectExternal(remotePort) { + function connectExternal (remotePort) { const originDomain = urlUtil.parse(remotePort.sender.url).hostname const portStream = new PortStream(remotePort) controller.setupUntrustedCommunication(portStream, originDomain) diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 75e0a95b3..b35a70dd2 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -115,8 +115,8 @@ function logStreamDisconnectWarning (remoteLabel, err) { * @returns {boolean} {@code true} if Web3 should be injected */ function shouldInjectWeb3 () { - return doctypeCheck() && suffixCheck() - && documentElementCheck() && !blacklistedDomainCheck() + return doctypeCheck() && suffixCheck() && + documentElementCheck() && !blacklistedDomainCheck() } /** diff --git a/app/scripts/controllers/balance.js b/app/scripts/controllers/balance.js index 86619fce1..4c97810a3 100644 --- a/app/scripts/controllers/balance.js +++ b/app/scripts/controllers/balance.js @@ -60,7 +60,7 @@ class BalanceController { * Sets up listeners and subscriptions which should trigger an update of ethBalance. These updates include: * - when a transaction changes state to 'submitted', 'confirmed' or 'failed' * - when the current account changes (i.e. a new account is selected) - * - when there is a block update + * - when there is a block update * * @private * @@ -100,7 +100,7 @@ class BalanceController { /** * Gets the pending transactions (i.e. those with a 'submitted' status). These are accessed from the - * TransactionController passed to this BalanceController during construction. + * TransactionController passed to this BalanceController during construction. * * @private * @returns {Promise} Promises an array of transaction objects. diff --git a/app/scripts/controllers/blacklist.js b/app/scripts/controllers/blacklist.js index f100c4525..1d2191433 100644 --- a/app/scripts/controllers/blacklist.js +++ b/app/scripts/controllers/blacklist.js @@ -87,7 +87,7 @@ class BlacklistController { * * @private * @param {object} config A config object like that found at {@link https://github.com/MetaMask/eth-phishing-detect/blob/master/src/config.json} - * + * */ _setupPhishingDetector (config) { this._phishingDetector = new PhishingDetector(config) diff --git a/app/scripts/controllers/computed-balances.js b/app/scripts/controllers/computed-balances.js index 1a6802f9a..e04ce2ef7 100644 --- a/app/scripts/controllers/computed-balances.js +++ b/app/scripts/controllers/computed-balances.js @@ -18,7 +18,7 @@ class ComputedbalancesController { /** * Creates a new controller instance * - * @param {ComputedBalancesOptions} [opts] Controller configuration parameters + * @param {ComputedBalancesOptions} [opts] Controller configuration parameters */ constructor (opts = {}) { const { accountTracker, txController, blockTracker } = opts diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js index 480c08b1c..a93aff49b 100644 --- a/app/scripts/controllers/currency.js +++ b/app/scripts/controllers/currency.js @@ -16,9 +16,9 @@ class CurrencyController { * currentCurrency, conversionRate and conversionDate properties * @property {string} currentCurrency A 2-4 character shorthand that describes a specific currency, currently * selected by the user - * @property {number} conversionRate The conversion rate from ETH to the selected currency. + * @property {number} conversionRate The conversion rate from ETH to the selected currency. * @property {string} conversionDate The date at which the conversion rate was set. Expressed in in milliseconds - * since midnight of January 1, 1970 + * since midnight of January 1, 1970 * @property {number} conversionInterval The id of the interval created by the scheduleConversionInterval method. * Used to clear an existing interval on subsequent calls of that method. * @@ -59,7 +59,7 @@ class CurrencyController { /** * A getter for the conversionRate property * - * @returns {string} The conversion rate from ETH to the selected currency. + * @returns {string} The conversion rate from ETH to the selected currency. * */ getConversionRate () { @@ -80,7 +80,7 @@ class CurrencyController { * A getter for the conversionDate property * * @returns {string} The date at which the conversion rate was set. Expressed in milliseconds since midnight of - * January 1, 1970 + * January 1, 1970 * */ getConversionDate () { diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js index 5e0c63e7d..a50f6dc45 100644 --- a/app/scripts/controllers/network/network.js +++ b/app/scripts/controllers/network/network.js @@ -132,7 +132,7 @@ module.exports = class NetworkController extends EventEmitter { } else if (type === LOCALHOST) { this._configureStandardProvider({ rpcUrl: LOCALHOST_RPC_URL }) // url-based rpc endpoints - } else if (type === 'rpc'){ + } else if (type === 'rpc') { this._configureStandardProvider({ rpcUrl: rpcTarget }) } else { throw new Error(`NetworkController - _configureProvider - unknown type "${type}"`) diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 8411e3a28..b314745f5 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -111,9 +111,9 @@ class PreferencesController { * @returns {Promise} selectedAddress the selected address. */ syncAddresses (addresses) { - let { identities, lostIdentities } = this.store.getState() + const { identities, lostIdentities } = this.store.getState() - let newlyLost = {} + const newlyLost = {} Object.keys(identities).forEach((identity) => { if (!addresses.includes(identity)) { newlyLost[identity] = identities[identity] @@ -128,7 +128,7 @@ class PreferencesController { if (this.diagnostics) this.diagnostics.reportOrphans(newlyLost) // store lost accounts - for (let key in newlyLost) { + for (const key in newlyLost) { lostIdentities[key] = newlyLost[key] } } diff --git a/app/scripts/controllers/recent-blocks.js b/app/scripts/controllers/recent-blocks.js index 033ef1d7e..926268691 100644 --- a/app/scripts/controllers/recent-blocks.js +++ b/app/scripts/controllers/recent-blocks.js @@ -117,7 +117,7 @@ class RecentBlocksController { * * @returns {Promise} Promises undefined */ - async backfill() { + async backfill () { this.blockTracker.once('block', async (block) => { const currentBlockNumber = Number.parseInt(block.number, 16) const blocksToFetch = Math.min(currentBlockNumber, this.historyLength) diff --git a/app/scripts/controllers/transactions/tx-gas-utils.js b/app/scripts/controllers/transactions/tx-gas-utils.js index 36b5cdbc9..ab4031faa 100644 --- a/app/scripts/controllers/transactions/tx-gas-utils.js +++ b/app/scripts/controllers/transactions/tx-gas-utils.js @@ -126,4 +126,4 @@ class TxGasUtil { } } -module.exports = TxGasUtil \ No newline at end of file +module.exports = TxGasUtil diff --git a/app/scripts/lib/cleanErrorStack.js b/app/scripts/lib/cleanErrorStack.js index fe1bfb0ce..8adf55db7 100644 --- a/app/scripts/lib/cleanErrorStack.js +++ b/app/scripts/lib/cleanErrorStack.js @@ -3,7 +3,7 @@ * @param {Error} err - error * @returns {Error} Error with clean stack trace. */ -function cleanErrorStack(err){ +function cleanErrorStack (err) { var name = err.name name = (name === undefined) ? 'Error' : String(name) diff --git a/app/scripts/lib/createErrorMiddleware.js b/app/scripts/lib/createErrorMiddleware.js index c70beddfd..7f6a4bd73 100644 --- a/app/scripts/lib/createErrorMiddleware.js +++ b/app/scripts/lib/createErrorMiddleware.js @@ -64,4 +64,4 @@ function createErrorMiddleware ({ override = true } = {}) { } } -module.exports = createErrorMiddleware \ No newline at end of file +module.exports = createErrorMiddleware diff --git a/app/scripts/lib/createStreamSink.js b/app/scripts/lib/createStreamSink.js index cf9416fea..b93dbc089 100644 --- a/app/scripts/lib/createStreamSink.js +++ b/app/scripts/lib/createStreamSink.js @@ -4,7 +4,7 @@ const promiseToCallback = require('promise-to-callback') module.exports = createStreamSink -function createStreamSink(asyncWriteFn, _opts) { +function createStreamSink (asyncWriteFn, _opts) { return new AsyncWritableStream(asyncWriteFn, _opts) } diff --git a/app/scripts/lib/diagnostics-reporter.js b/app/scripts/lib/diagnostics-reporter.js index aa4ca6e26..569eb3268 100644 --- a/app/scripts/lib/diagnostics-reporter.js +++ b/app/scripts/lib/diagnostics-reporter.js @@ -5,7 +5,7 @@ class DiagnosticsReporter { this.version = version } - async reportOrphans(orphans) { + async reportOrphans (orphans) { try { return await this.submit({ accounts: Object.keys(orphans), @@ -19,7 +19,7 @@ class DiagnosticsReporter { } } - async reportMultipleKeyrings(rawKeyrings) { + async reportMultipleKeyrings (rawKeyrings) { try { const keyrings = await Promise.all(rawKeyrings.map(async (keyring, index) => { return { @@ -55,7 +55,7 @@ class DiagnosticsReporter { } -function postData(data) { +function postData (data) { const uri = 'https://diagnostics.metamask.io/v1/orphanedAccounts' return fetch(uri, { body: JSON.stringify(data), // must match 'Content-Type' header diff --git a/app/scripts/lib/extractEthjsErrorMessage.js b/app/scripts/lib/extractEthjsErrorMessage.js index 0f100756f..4891075c3 100644 --- a/app/scripts/lib/extractEthjsErrorMessage.js +++ b/app/scripts/lib/extractEthjsErrorMessage.js @@ -10,13 +10,13 @@ module.exports = extractEthjsErrorMessage * * @param {string} errorMessage The error message to parse * @returns {string} Returns an error message, either the same as was passed, or the ending message portion of an isEthjsRpcError - * + * * @example * // returns 'Transaction Failed: replacement transaction underpriced' * extractEthjsErrorMessage(`Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced`) * */ -function extractEthjsErrorMessage(errorMessage) { +function extractEthjsErrorMessage (errorMessage) { const isEthjsRpcError = errorMessage.includes(ethJsRpcSlug) if (isEthjsRpcError) { const payloadAndError = errorMessage.slice(ethJsRpcSlug.length) diff --git a/app/scripts/lib/get-first-preferred-lang-code.js b/app/scripts/lib/get-first-preferred-lang-code.js index 41a886d74..170d508c1 100644 --- a/app/scripts/lib/get-first-preferred-lang-code.js +++ b/app/scripts/lib/get-first-preferred-lang-code.js @@ -28,7 +28,7 @@ async function getFirstPreferredLangCode () { // safeguard for Brave Browser until they implement chrome.i18n.getAcceptLanguages // https://github.com/MetaMask/metamask-extension/issues/4270 - if (!userPreferredLocaleCodes){ + if (!userPreferredLocaleCodes) { userPreferredLocaleCodes = [] } diff --git a/app/scripts/lib/getObjStructure.js b/app/scripts/lib/getObjStructure.js index 52250d3fb..9c92879fb 100644 --- a/app/scripts/lib/getObjStructure.js +++ b/app/scripts/lib/getObjStructure.js @@ -18,12 +18,12 @@ module.exports = getObjStructure * Creates an object that represents the structure of the given object. It replaces all values with the result of their * type. * - * @param {object} obj The object for which a 'structure' will be returned. Usually a plain object and not a class. + * @param {object} obj The object for which a 'structure' will be returned. Usually a plain object and not a class. * @returns {object} The "mapped" version of a deep clone of the passed object, with each non-object property value * replaced with the javascript type of that value. * */ -function getObjStructure(obj) { +function getObjStructure (obj) { const structure = clone(obj) return deepMap(structure, (value) => { return value === null ? 'null' : typeof value @@ -38,7 +38,7 @@ function getObjStructure(obj) { * @param {Function} visit The modifier to apply to each non-object property value * @returns {object} The modified object */ -function deepMap(target = {}, visit) { +function deepMap (target = {}, visit) { Object.entries(target).forEach(([key, value]) => { if (typeof value === 'object' && value !== null) { target[key] = deepMap(value, visit) diff --git a/app/scripts/lib/local-store.js b/app/scripts/lib/local-store.js index 139ff86bd..fbcba09cd 100644 --- a/app/scripts/lib/local-store.js +++ b/app/scripts/lib/local-store.js @@ -8,7 +8,7 @@ module.exports = class ExtensionStore { /** * @constructor */ - constructor() { + constructor () { this.isSupported = !!(extension.storage.local) if (!this.isSupported) { log.error('Storage local API not available.') @@ -19,7 +19,7 @@ module.exports = class ExtensionStore { * Returns all of the keys currently saved * @return {Promise<*>} */ - async get() { + async get () { if (!this.isSupported) return undefined const result = await this._get() // extension.storage.local always returns an obj @@ -36,7 +36,7 @@ module.exports = class ExtensionStore { * @param {object} state - The state to set * @return {Promise} */ - async set(state) { + async set (state) { return this._set(state) } @@ -45,7 +45,7 @@ module.exports = class ExtensionStore { * @private * @return {object} the key-value map from local storage */ - _get() { + _get () { const local = extension.storage.local return new Promise((resolve, reject) => { local.get(null, (/** @type {any} */ result) => { @@ -65,7 +65,7 @@ module.exports = class ExtensionStore { * @return {Promise} * @private */ - _set(obj) { + _set (obj) { const local = extension.storage.local return new Promise((resolve, reject) => { local.set(obj, () => { @@ -85,6 +85,6 @@ module.exports = class ExtensionStore { * @param {object} obj - The object to check * @returns {boolean} */ -function isEmpty(obj) { +function isEmpty (obj) { return Object.keys(obj).length === 0 } diff --git a/app/scripts/lib/port-stream.js b/app/scripts/lib/port-stream.js index 5c4224fd9..fd65d94f3 100644 --- a/app/scripts/lib/port-stream.js +++ b/app/scripts/lib/port-stream.js @@ -58,7 +58,7 @@ PortDuplexStream.prototype._read = noop /** * Called internally when data should be written to * this writable stream. - * + * * @private * @param {*} msg Arbitrary object to write * @param {string} encoding Encoding to use when writing payload diff --git a/app/scripts/lib/reportFailedTxToSentry.js b/app/scripts/lib/reportFailedTxToSentry.js index e09f4f1f8..df5661e59 100644 --- a/app/scripts/lib/reportFailedTxToSentry.js +++ b/app/scripts/lib/reportFailedTxToSentry.js @@ -7,7 +7,7 @@ module.exports = reportFailedTxToSentry // for sending to sentry // -function reportFailedTxToSentry({ raven, txMeta }) { +function reportFailedTxToSentry ({ raven, txMeta }) { const errorMessage = 'Transaction Failed: ' + extractEthjsErrorMessage(txMeta.err.message) raven.captureMessage(errorMessage, { // "extra" key is required by Sentry diff --git a/app/scripts/lib/setupMetamaskMeshMetrics.js b/app/scripts/lib/setupMetamaskMeshMetrics.js index 02690a948..fd3b93fc4 100644 --- a/app/scripts/lib/setupMetamaskMeshMetrics.js +++ b/app/scripts/lib/setupMetamaskMeshMetrics.js @@ -4,7 +4,7 @@ module.exports = setupMetamaskMeshMetrics /** * Injects an iframe into the current document for testing */ -function setupMetamaskMeshMetrics() { +function setupMetamaskMeshMetrics () { const testingContainer = document.createElement('iframe') testingContainer.src = 'https://metamask.github.io/mesh-testing/' console.log('Injecting MetaMask Mesh testing client') diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js index 77aefb00a..3f69fb3bb 100644 --- a/app/scripts/lib/setupRaven.js +++ b/app/scripts/lib/setupRaven.js @@ -7,7 +7,7 @@ const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496' module.exports = setupRaven // Setup raven / sentry remote error reporting -function setupRaven(opts) { +function setupRaven (opts) { const { release } = opts let ravenTarget @@ -21,7 +21,7 @@ function setupRaven(opts) { const client = Raven.config(ravenTarget, { release, - transport: function(opts) { + transport: function (opts) { const report = opts.data try { // handle error-like non-error exceptions @@ -42,7 +42,7 @@ function setupRaven(opts) { return Raven } -function rewriteErrorLikeExceptions(report) { +function rewriteErrorLikeExceptions (report) { // handle errors that lost their error-ness in serialization (e.g. dnode) rewriteErrorMessages(report, (errorMessage) => { if (!errorMessage.includes('Non-Error exception captured with keys:')) return errorMessage @@ -51,7 +51,7 @@ function rewriteErrorLikeExceptions(report) { }) } -function simplifyErrorMessages(report) { +function simplifyErrorMessages (report) { rewriteErrorMessages(report, (errorMessage) => { // simplify ethjs error messages errorMessage = extractEthjsErrorMessage(errorMessage) @@ -64,7 +64,7 @@ function simplifyErrorMessages(report) { }) } -function rewriteErrorMessages(report, rewriteFn) { +function rewriteErrorMessages (report, rewriteFn) { // rewrite top level message if (report.message) report.message = rewriteFn(report.message) // rewrite each exception message @@ -75,7 +75,7 @@ function rewriteErrorMessages(report, rewriteFn) { } } -function rewriteReportUrls(report) { +function rewriteReportUrls (report) { // update request url report.request.url = toMetamaskUrl(report.request.url) // update exception stack trace @@ -88,7 +88,7 @@ function rewriteReportUrls(report) { } } -function toMetamaskUrl(origUrl) { +function toMetamaskUrl (origUrl) { const filePath = origUrl.split(location.origin)[1] if (!filePath) return origUrl const metamaskUrl = `metamask${filePath}` diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index d40a351a5..b4d39031a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -405,7 +405,6 @@ module.exports = class MetamaskController extends EventEmitter { } - //============================================================================= // VAULT / KEYRING RELATED METHODS //============================================================================= @@ -962,7 +961,7 @@ module.exports = class MetamaskController extends EventEmitter { * Allows a user to begin the seed phrase recovery process. * @param {Function} cb - A callback function called when complete. */ - markPasswordForgotten(cb) { + markPasswordForgotten (cb) { this.configManager.setPasswordForgotten(true) this.sendUpdate() cb() @@ -972,7 +971,7 @@ module.exports = class MetamaskController extends EventEmitter { * Allows a user to end the seed phrase recovery process. * @param {Function} cb - A callback function called when complete. */ - unMarkPasswordForgotten(cb) { + unMarkPasswordForgotten (cb) { this.configManager.setPasswordForgotten(false) this.sendUpdate() cb() diff --git a/app/scripts/migrations/013.js b/app/scripts/migrations/013.js index 15a9b28d4..fb7131f8e 100644 --- a/app/scripts/migrations/013.js +++ b/app/scripts/migrations/013.js @@ -28,7 +28,7 @@ module.exports = { function transformState (state) { const newState = state const { config } = newState - if ( config && config.provider ) { + if (config && config.provider) { if (config.provider.type === 'testnet') { newState.config.provider.type = 'ropsten' } diff --git a/app/scripts/migrations/023.js b/app/scripts/migrations/023.js index 151496b06..18493a789 100644 --- a/app/scripts/migrations/023.js +++ b/app/scripts/migrations/023.js @@ -35,10 +35,10 @@ function transformState (state) { if (transactions.length <= 40) return newState - let reverseTxList = transactions.reverse() + const reverseTxList = transactions.reverse() let stripping = true while (reverseTxList.length > 40 && stripping) { - let txIndex = reverseTxList.findIndex((txMeta) => { + const txIndex = reverseTxList.findIndex((txMeta) => { return (txMeta.status === 'failed' || txMeta.status === 'rejected' || txMeta.status === 'confirmed' || diff --git a/app/scripts/popup-core.js b/app/scripts/popup-core.js index 6325b8a8d..db885ec93 100644 --- a/app/scripts/popup-core.js +++ b/app/scripts/popup-core.js @@ -12,7 +12,7 @@ module.exports = initializePopup /** * Asynchronously initializes the MetaMask popup UI * - * @param {{ container: Element, connectionStream: * }} config Popup configuration object + * @param {{ container: Element, connectionStream: * }} config Popup configuration object * @param {Function} cb Called when initialization is complete */ function initializePopup ({ container, connectionStream }, cb) { diff --git a/app/scripts/ui.js b/app/scripts/ui.js index bdab29c1e..9bf97be87 100644 --- a/app/scripts/ui.js +++ b/app/scripts/ui.js @@ -14,7 +14,7 @@ const log = require('loglevel') start().catch(log.error) -async function start() { +async function start () { // create platform global global.platform = new ExtensionPlatform() -- cgit v1.2.3 From badf0ce3142b97631dc2ba559a68005258625026 Mon Sep 17 00:00:00 2001 From: bitpshr Date: Tue, 3 Jul 2018 13:20:05 -0400 Subject: Conditionally use Promise-based extension API when creating windows --- app/scripts/lib/notification-manager.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js index 6b88a7a99..969a9459a 100644 --- a/app/scripts/lib/notification-manager.js +++ b/app/scripts/lib/notification-manager.js @@ -26,15 +26,15 @@ class NotificationManager { // bring focus to existing chrome popup extension.windows.update(popup.id, { focused: true }) } else { + const cb = (currentPopup) => { this._popupId = currentPopup.id } // create new notification popup - extension.windows.create({ + const creation = extension.windows.create({ url: 'notification.html', type: 'popup', width, height, - }).then((currentPopup) => { - this._popupId = currentPopup.id - }) + }, cb) + creation && creation.then && creation.then(cb) } }) } -- cgit v1.2.3 From 13b03ec090df70512d43e0d6acbe6bf60040a892 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 3 Jul 2018 14:29:36 -0400 Subject: fix lint errors --- app/scripts/background.js | 1 - app/scripts/lib/contracts/registrar.js | 2 +- app/scripts/lib/contracts/resolver.js | 2 +- app/scripts/lib/ipfsContent.js | 10 +++++----- 4 files changed, 7 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/scripts/background.js b/app/scripts/background.js index f751867cc..1479d9f72 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -69,7 +69,6 @@ initialize().catch(log.error) setupMetamaskMeshMetrics() - /** * An object representing a transaction, in whatever state it is in. * @typedef TransactionMeta diff --git a/app/scripts/lib/contracts/registrar.js b/app/scripts/lib/contracts/registrar.js index 980a64d7f..99ca24458 100644 --- a/app/scripts/lib/contracts/registrar.js +++ b/app/scripts/lib/contracts/registrar.js @@ -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"}] \ No newline at end of file +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'}] diff --git a/app/scripts/lib/contracts/resolver.js b/app/scripts/lib/contracts/resolver.js index f42777cc7..1bf3f90ce 100644 --- a/app/scripts/lib/contracts/resolver.js +++ b/app/scripts/lib/contracts/resolver.js @@ -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"}] \ No newline at end of file +[{'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'}] diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js index 2ddbe5558..a6b99b2f9 100644 --- a/app/scripts/lib/ipfsContent.js +++ b/app/scripts/lib/ipfsContent.js @@ -3,12 +3,12 @@ const resolver = require('./resolver.js') module.exports = function (provider) { extension.webRequest.onBeforeRequest.addListener(details => { - const urlhttpreplace = details.url.replace(/\w+?:\/\//, "") - const url = urlhttpreplace.replace(/[\\\/].*/g, "") - let domainhtml = urlhttpreplace.match(/[\\\/].*/g) + const urlhttpreplace = details.url.replace(/\w+?:\/\//, '') + const url = urlhttpreplace.replace(/[\\/].*/g, '') // eslint-disable-line no-useless-escape + let domainhtml = urlhttpreplace.match(/[\\/].*/g) // eslint-disable-line no-useless-escape let clearTime = null - let name = url.replace(/\/$/g, "") - if (domainhtml === null) domainhtml = [""] + const name = url.replace(/\/$/g, '') + if (domainhtml === null) domainhtml = [''] extension.tabs.getSelected(null, tab => { extension.tabs.update(tab.id, { url: 'loading.html' }) -- cgit v1.2.3 From f262f0ea64e1e803d8dcd9a31f92cffe81d27b3d Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 22 Jun 2018 14:41:18 -0230 Subject: Update import from seed screen on new ui. --- app/_locales/en/messages.json | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app') diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 46fbdc1a7..621775592 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -664,6 +664,9 @@ "restoreVault": { "message": "Restore Vault" }, + "restoreAccountWithSeed": { + "message": "Restore your Account with Seed Phrase" + }, "required": { "message": "Required" }, @@ -673,6 +676,9 @@ "walletSeed": { "message": "Wallet Seed" }, + "restore": { + "message": "Restore" + }, "revealSeedWords": { "message": "Reveal Seed Words" }, @@ -777,6 +783,9 @@ "sendTokens": { "message": "Send Tokens" }, + "separateEachWord": { + "message": "Separate each word with a single space" + }, "onlySendToEtherAddress": { "message": "Only send ETH to an Ethereum address." }, -- cgit v1.2.3