diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-02-24 05:56:58 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-02-24 05:56:58 +0800 |
commit | 62854398f1d3c72a82ae9d4feb03d9a1a947534e (patch) | |
tree | 879c6ded10ca1f11bdb7057282ffbc61c01b36e4 /app/scripts | |
parent | 3be6ee5f6cc5e7b79a8eeea182f91a15eb9ed989 (diff) | |
download | tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.gz tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.bz2 tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.lz tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.xz tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.tar.zst tangerine-wallet-browser-62854398f1d3c72a82ae9d4feb03d9a1a947534e.zip |
Tested against code to play nice with unit tests.
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/lib/controllers/preferences.js | 13 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/app/scripts/lib/controllers/preferences.js b/app/scripts/lib/controllers/preferences.js index 8cc320179..7bd2e5631 100644 --- a/app/scripts/lib/controllers/preferences.js +++ b/app/scripts/lib/controllers/preferences.js @@ -25,6 +25,14 @@ class PreferencesController { return this.store.getState().selectedAddress } + updateFrequentRpcList (_url) { + return this.addToFrequentRpcList(_url) + .then((rpcList) => { + this.store.updateState({ frequentRpcList: rpcList }) + return rpcList + }) + } + addToFrequentRpcList (_url) { let rpcList = this.getFrequentRpcList() let index = rpcList.findIndex((element) => { return element === _url }) @@ -37,8 +45,7 @@ class PreferencesController { if (rpcList.length > 2) { rpcList.shift() } - this.store.updateState({ frequentRpcList: rpcList }) - return Promise.resolve() + return Promise.resolve(rpcList) } getFrequentRpcList () { @@ -49,6 +56,8 @@ class PreferencesController { // PRIVATE METHODS // + + } module.exports = PreferencesController diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index da186d958..ad67a5875 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -259,7 +259,7 @@ module.exports = class MetamaskController extends EventEmitter { // PreferencesController setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController), - addToFrequentRpcList: nodeify(preferencesController.addToFrequentRpcList).bind(preferencesController), + updateFrequentRpcList: nodeify(preferencesController.updateFrequentRpcList).bind(preferencesController), // KeyringController setLocked: nodeify(keyringController.setLocked).bind(keyringController), |