aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-29 04:43:44 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-29 08:13:03 +0800
commit80e76b45ee67900b5a60da1ddcd8b310f1e92413 (patch)
tree4eff8a2a7718e25afe8958198e3880e22530fdbb /app/scripts/metamask-controller.js
parentb8991195829474691f17db3a7a6c9c081f9a95c9 (diff)
downloadtangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.tar
tangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.tar.gz
tangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.tar.bz2
tangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.tar.lz
tangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.tar.xz
tangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.tar.zst
tangerine-wallet-browser-80e76b45ee67900b5a60da1ddcd8b310f1e92413.zip
Denodeify most of KeyringController
Mostly Fixes #893 A couple methods cache callbacks, and will require a larger refactor to fully denodeify. Specifically, our methods involving web3 requests to sign a tx, sign a message, and approve or cancel either of those. I think we should postpone those until the TxManager refactor, since it will likely handle this response caching itself.
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 701046e76..5bcb5b477 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -8,6 +8,7 @@ const Web3 = require('web3')
const ConfigManager = require('./lib/config-manager')
const extension = require('./lib/extension')
const autoFaucet = require('./lib/auto-faucet')
+const nodeify = require('./lib/nodeify')
module.exports = class MetamaskController {
@@ -62,21 +63,24 @@ module.exports = class MetamaskController {
setGasMultiplier: this.setGasMultiplier.bind(this),
// forward directly to keyringController
- placeSeedWords: keyringController.placeSeedWords.bind(keyringController),
- createNewVaultAndKeychain: keyringController.createNewVaultAndKeychain.bind(keyringController),
- createNewVaultAndRestore: keyringController.createNewVaultAndRestore.bind(keyringController),
- clearSeedWordCache: keyringController.clearSeedWordCache.bind(keyringController),
- addNewKeyring: keyringController.addNewKeyring.bind(keyringController),
- addNewAccount: keyringController.addNewAccount.bind(keyringController),
- submitPassword: keyringController.submitPassword.bind(keyringController),
- setSelectedAccount: keyringController.setSelectedAccount.bind(keyringController),
+ placeSeedWords: nodeify(keyringController.placeSeedWords.bind(keyringController)),
+ createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain.bind(keyringController)),
+ createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore.bind(keyringController)),
+ clearSeedWordCache: nodeify(keyringController.clearSeedWordCache.bind(keyringController)),
+ addNewKeyring: nodeify(keyringController.addNewKeyring.bind(keyringController)),
+ addNewAccount: nodeify(keyringController.addNewAccount.bind(keyringController)),
+ submitPassword: nodeify(keyringController.submitPassword.bind(keyringController)),
+ setSelectedAccount: nodeify(keyringController.setSelectedAccount.bind(keyringController)),
+ exportAccount: nodeify(keyringController.exportAccount.bind(keyringController)),
+ saveAccountLabel: nodeify(keyringController.saveAccountLabel.bind(keyringController)),
+ setLocked: nodeify(keyringController.setLocked.bind(keyringController)),
+
+ // signing methods
approveTransaction: keyringController.approveTransaction.bind(keyringController),
cancelTransaction: keyringController.cancelTransaction.bind(keyringController),
signMessage: keyringController.signMessage.bind(keyringController),
cancelMessage: keyringController.cancelMessage.bind(keyringController),
- setLocked: keyringController.setLocked.bind(keyringController),
- exportAccount: keyringController.exportAccount.bind(keyringController),
- saveAccountLabel: keyringController.saveAccountLabel.bind(keyringController),
+
// coinbase
buyEth: this.buyEth.bind(this),
// shapeshift