diff options
author | Kevin Serrano <kevin.serrano@consensys.net> | 2017-09-14 23:35:48 +0800 |
---|---|---|
committer | Kevin Serrano <kevin.serrano@consensys.net> | 2017-09-14 23:35:48 +0800 |
commit | cb8856597cb650e282e7209f43547a5f9328de28 (patch) | |
tree | 842b64aea519c7041bc4fbf2a6f31f5d17f57cb8 /app | |
parent | 162aedb30b94890935658921b0dd399f43d6cd65 (diff) | |
parent | 1d3cd9768cdd372d02e7e34674dde9d86af536f5 (diff) | |
download | tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.tar tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.tar.gz tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.tar.bz2 tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.tar.lz tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.tar.xz tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.tar.zst tangerine-wallet-browser-cb8856597cb650e282e7209f43547a5f9328de28.zip |
Merge branch 'master' into new-currency-test
Diffstat (limited to 'app')
-rw-r--r-- | app/manifest.json | 7 | ||||
-rw-r--r-- | app/scripts/keyring-controller.js | 3 | ||||
-rw-r--r-- | app/scripts/lib/auto-reload.js | 2 | ||||
-rw-r--r-- | app/scripts/lib/inpage-provider.js | 51 |
4 files changed, 33 insertions, 30 deletions
diff --git a/app/manifest.json b/app/manifest.json index 7ec32ea78..bd25c1f6f 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "3.9.11", + "version": "3.10.0", "manifest_version": 2, "author": "https://metamask.io", "description": "Ethereum Browser Extension", @@ -57,9 +57,8 @@ "permissions": [ "storage", "clipboardWrite", - "http://localhost:8545/", - "https://api.cryptonator.com/" - ], + "http://localhost:8545/" + ], "web_accessible_resources": [ "scripts/inpage.js" ], diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 2edc8060e..fd57fac70 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -171,9 +171,9 @@ class KeyringController extends EventEmitter { return this.setupAccounts(checkedAccounts) }) .then(() => this.persistAllKeyrings()) + .then(() => this._updateMemStoreKeyrings()) .then(() => this.fullUpdate()) .then(() => { - this._updateMemStoreKeyrings() return keyring }) } @@ -208,6 +208,7 @@ class KeyringController extends EventEmitter { return selectedKeyring.addAccounts(1) .then(this.setupAccounts.bind(this)) .then(this.persistAllKeyrings.bind(this)) + .then(this._updateMemStoreKeyrings.bind(this)) .then(this.fullUpdate.bind(this)) } diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js index 62aaf405c..cce31c3d2 100644 --- a/app/scripts/lib/auto-reload.js +++ b/app/scripts/lib/auto-reload.js @@ -11,7 +11,7 @@ function setupDappAutoReload (web3, observable) { get: (_web3, key) => { // show warning once on web3 access if (!hasBeenWarned && key !== 'currentProvider') { - console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider \nhttps://github.com/ethereum/mist/releases/tag/v0.9.0') + console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider \nhttps://github.com/MetaMask/faq/blob/master/detecting_metamask.md#web3-deprecation') hasBeenWarned = true } // get the time of use diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index 7c74a62d3..13888dc67 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -40,30 +40,37 @@ function MetamaskInpageProvider (connectionStream) { // start and stop polling to unblock first block lock self.idMap = {} - // handle sendAsync requests via asyncProvider - self.sendAsync = function (payload, cb) { - // rewrite request ids - var request = eachJsonMessage(payload, (message) => { - var newId = createRandomId() - self.idMap[newId] = message.id - message.id = newId +} + +// handle sendAsync requests via asyncProvider +// also remap ids inbound and outbound +MetamaskInpageProvider.prototype.sendAsync = function (payload, cb) { + const self = this + + // rewrite request ids + const request = eachJsonMessage(payload, (_message) => { + const message = Object.assign({}, _message) + const newId = createRandomId() + self.idMap[newId] = message.id + message.id = newId + return message + }) + + // forward to asyncProvider + self.asyncProvider.sendAsync(request, (err, _res) => { + if (err) return cb(err) + // transform messages to original ids + const res = eachJsonMessage(_res, (message) => { + const oldId = self.idMap[message.id] + delete self.idMap[message.id] + message.id = oldId return message }) - // forward to asyncProvider - asyncProvider.sendAsync(request, function (err, res) { - if (err) return cb(err) - // transform messages to original ids - eachJsonMessage(res, (message) => { - var oldId = self.idMap[message.id] - delete self.idMap[message.id] - message.id = oldId - return message - }) - cb(null, res) - }) - } + cb(null, res) + }) } + MetamaskInpageProvider.prototype.send = function (payload) { const self = this @@ -109,10 +116,6 @@ MetamaskInpageProvider.prototype.send = function (payload) { } } -MetamaskInpageProvider.prototype.sendAsync = function () { - throw new Error('MetamaskInpageProvider - sendAsync not overwritten') -} - MetamaskInpageProvider.prototype.isConnected = function () { return true } |