aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-10-18 04:25:27 +0800
committerDan Finlay <dan@danfinlay.com>2017-10-18 04:25:27 +0800
commit50e8599988c54bbf9ee0e9f324f79f5835fa6727 (patch)
treed3b00d1c399df9d9dce26bb1c50c9d5e938efaf2 /app/scripts/metamask-controller.js
parentd7f384485d2af15ec694208b9ef068c18c7dc91d (diff)
downloadtangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.tar
tangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.tar.gz
tangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.tar.bz2
tangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.tar.lz
tangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.tar.xz
tangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.tar.zst
tangerine-wallet-browser-50e8599988c54bbf9ee0e9f324f79f5835fa6727.zip
Promisify metamask-controller vault creating methods
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js27
1 files changed, 10 insertions, 17 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 8a51fdd8d..4b11f6024 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -336,8 +336,8 @@ module.exports = class MetamaskController extends EventEmitter {
// KeyringController
setLocked: nodeify(keyringController.setLocked, keyringController),
- createNewVaultAndKeychain: this.createNewVaultAndKeychain.bind(this),
- createNewVaultAndRestore: this.createNewVaultAndRestore.bind(this),
+ createNewVaultAndKeychain: nodeify(this.createNewVaultAndKeychain, this),
+ createNewVaultAndRestore: nodeify(this.createNewVaultAndRestore, this),
addNewKeyring: nodeify(keyringController.addNewKeyring, keyringController),
saveAccountLabel: nodeify(keyringController.saveAccountLabel, keyringController),
exportAccount: nodeify(keyringController.exportAccount, keyringController),
@@ -458,23 +458,16 @@ module.exports = class MetamaskController extends EventEmitter {
// Vault Management
//
- createNewVaultAndKeychain (password, cb) {
- this.keyringController.createNewVaultAndKeychain(password)
- .then((vault) => {
- this.selectFirstIdentity(vault)
- this.preferencesController.setSelectedAddress(address)
- cb(null, vault)
- })
- .catch(reason => cb(reason))
+ async createNewVaultAndKeychain (password, cb) {
+ const vault = await this.keyringController.createNewVaultAndKeychain(password)
+ this.selectFirstIdentity(vault)
+ return vault
}
- createNewVaultAndRestore (password, seed, cb) {
- this.keyringController.createNewVaultAndRestore(password, seed)
- .then((vault) => {
- this.selectFirstIdentity(vault)
- cb(null, vault)
- })
- .catch(reason => cb(reason))
+ async createNewVaultAndRestore (password, seed, cb) {
+ const vault = await this.keyringController.createNewVaultAndRestore(password, seed)
+ this.selectFirstIdentity(vault)
+ return vault
}
selectFirstIdentity (vault) {