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:
parent
d7f384485d
commit
50e8599988
@ -336,8 +336,8 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
|
|
||||||
// KeyringController
|
// KeyringController
|
||||||
setLocked: nodeify(keyringController.setLocked, keyringController),
|
setLocked: nodeify(keyringController.setLocked, keyringController),
|
||||||
createNewVaultAndKeychain: this.createNewVaultAndKeychain.bind(this),
|
createNewVaultAndKeychain: nodeify(this.createNewVaultAndKeychain, this),
|
||||||
createNewVaultAndRestore: this.createNewVaultAndRestore.bind(this),
|
createNewVaultAndRestore: nodeify(this.createNewVaultAndRestore, this),
|
||||||
addNewKeyring: nodeify(keyringController.addNewKeyring, keyringController),
|
addNewKeyring: nodeify(keyringController.addNewKeyring, keyringController),
|
||||||
saveAccountLabel: nodeify(keyringController.saveAccountLabel, keyringController),
|
saveAccountLabel: nodeify(keyringController.saveAccountLabel, keyringController),
|
||||||
exportAccount: nodeify(keyringController.exportAccount, keyringController),
|
exportAccount: nodeify(keyringController.exportAccount, keyringController),
|
||||||
@ -458,23 +458,16 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
// Vault Management
|
// Vault Management
|
||||||
//
|
//
|
||||||
|
|
||||||
createNewVaultAndKeychain (password, cb) {
|
async createNewVaultAndKeychain (password, cb) {
|
||||||
this.keyringController.createNewVaultAndKeychain(password)
|
const vault = await this.keyringController.createNewVaultAndKeychain(password)
|
||||||
.then((vault) => {
|
|
||||||
this.selectFirstIdentity(vault)
|
this.selectFirstIdentity(vault)
|
||||||
this.preferencesController.setSelectedAddress(address)
|
return vault
|
||||||
cb(null, vault)
|
|
||||||
})
|
|
||||||
.catch(reason => cb(reason))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewVaultAndRestore (password, seed, cb) {
|
async createNewVaultAndRestore (password, seed, cb) {
|
||||||
this.keyringController.createNewVaultAndRestore(password, seed)
|
const vault = await this.keyringController.createNewVaultAndRestore(password, seed)
|
||||||
.then((vault) => {
|
|
||||||
this.selectFirstIdentity(vault)
|
this.selectFirstIdentity(vault)
|
||||||
cb(null, vault)
|
return vault
|
||||||
})
|
|
||||||
.catch(reason => cb(reason))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectFirstIdentity (vault) {
|
selectFirstIdentity (vault) {
|
||||||
|
Loading…
Reference in New Issue
Block a user