1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Promisify metamask-controller vault creating methods

This commit is contained in:
Dan Finlay 2017-10-17 13:25:27 -07:00
parent d7f384485d
commit 50e8599988

View File

@ -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) => {
async createNewVaultAndKeychain (password, cb) {
const vault = await this.keyringController.createNewVaultAndKeychain(password)
this.selectFirstIdentity(vault)
this.preferencesController.setSelectedAddress(address)
cb(null, vault)
})
.catch(reason => cb(reason))
return vault
}
createNewVaultAndRestore (password, seed, cb) {
this.keyringController.createNewVaultAndRestore(password, seed)
.then((vault) => {
async createNewVaultAndRestore (password, seed, cb) {
const vault = await this.keyringController.createNewVaultAndRestore(password, seed)
this.selectFirstIdentity(vault)
cb(null, vault)
})
.catch(reason => cb(reason))
return vault
}
selectFirstIdentity (vault) {