diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-10-18 04:25:27 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-10-18 04:25:27 +0800 |
commit | 50e8599988c54bbf9ee0e9f324f79f5835fa6727 (patch) | |
tree | d3b00d1c399df9d9dce26bb1c50c9d5e938efaf2 /app | |
parent | d7f384485d2af15ec694208b9ef068c18c7dc91d (diff) | |
download | tangerine-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')
-rw-r--r-- | app/scripts/metamask-controller.js | 27 |
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) { |