aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-25 07:33:33 +0800
committerkumavis <aaron@kumavis.me>2017-01-25 07:33:33 +0800
commit463a56ff54b0d850c86348e260e5f7c17b138ccb (patch)
tree615d9f36de26cbeca6ca38e0f86c2037dea72e64 /app/scripts/metamask-controller.js
parentbef4b78196d83fe7c1babad5c42a6c217d4acf0a (diff)
downloadtangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar
tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.gz
tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.bz2
tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.lz
tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.xz
tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.zst
tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.zip
background controller - extract KeyringC.placeSeedWords to MetamaskC
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index a235be75b..a1bb9a923 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -107,10 +107,19 @@ module.exports = class MetamaskController extends EventEmitter {
// forward directly to keyringController
createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain).bind(keyringController),
createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
+ // Adds the current vault's seed words to the UI's state tree.
+ //
+ // Used when creating a first vault, to allow confirmation.
+ // Also used when revealing the seed words in the confirmation view.
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)
+ primaryKeyring.serialize()
+ .then((serialized) => {
+ const seedWords = serialized.mnemonic
+ this.configManager.setSeedWords(seedWords)
+ promiseToCallback(this.keyringController.fullUpdate())(cb)
+ })
},
clearSeedWordCache: nodeify(keyringController.clearSeedWordCache).bind(keyringController),
setLocked: nodeify(keyringController.setLocked).bind(keyringController),