aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/scripts/keyring-controller.js9
-rw-r--r--app/scripts/metamask-controller.js6
2 files changed, 8 insertions, 7 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index 95f0a1d63..7a46c7737 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -171,11 +171,8 @@ module.exports = class KeyringController extends EventEmitter {
//
// Used when creating a first vault, to allow confirmation.
// Also used when revealing the seed words in the confirmation view.
- placeSeedWords () {
- const hdKeyrings = this.keyrings.filter((keyring) => keyring.type === 'HD Key Tree')
- const firstKeyring = hdKeyrings[0]
- if (!firstKeyring) throw new Error('KeyringController - No HD Key Tree found')
- return firstKeyring.serialize()
+ placeSeedWords (selectedKeyring) {
+ return selectedKeyring.serialize()
.then((serialized) => {
const seedWords = serialized.mnemonic
this.configManager.setSeedWords(seedWords)
@@ -436,7 +433,7 @@ module.exports = class KeyringController extends EventEmitter {
this.emit('newAccount', hexAccount)
return this.setupAccounts(accounts)
}).then(() => {
- return this.placeSeedWords()
+ return this.placeSeedWords(this.getKeyringsByType('HD Key Tree')[0])
})
.then(this.persistAllKeyrings.bind(this))
}
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 6b6424f2a..a235be75b 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -107,7 +107,11 @@ module.exports = class MetamaskController extends EventEmitter {
// forward directly to keyringController
createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain).bind(keyringController),
createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
- placeSeedWords: nodeify(keyringController.placeSeedWords).bind(keyringController),
+ placeSeedWords: (cb) => {
+ const primaryKeyring = keyringController.getKeyringsByType('HD Key Tree')[0]
+ if (!primaryKeyring) return cb(new Error('MetamaskController - No HD Key Tree found'))
+ promiseToCallback(keyringController.placeSeedWords(primaryKeyring))(cb)
+ },
clearSeedWordCache: nodeify(keyringController.clearSeedWordCache).bind(keyringController),
setLocked: nodeify(keyringController.setLocked).bind(keyringController),
submitPassword: (password, cb) => {