diff options
author | kumavis <aaron@kumavis.me> | 2017-01-25 07:33:33 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2017-01-25 07:33:33 +0800 |
commit | 463a56ff54b0d850c86348e260e5f7c17b138ccb (patch) | |
tree | 615d9f36de26cbeca6ca38e0f86c2037dea72e64 /app/scripts/keyring-controller.js | |
parent | bef4b78196d83fe7c1babad5c42a6c217d4acf0a (diff) | |
download | tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.gz tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.tar.zst tangerine-wallet-browser-463a56ff54b0d850c86348e260e5f7c17b138ccb.zip |
background controller - extract KeyringC.placeSeedWords to MetamaskC
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r-- | app/scripts/keyring-controller.js | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 5c75ca04a..741757c5a 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -150,12 +150,13 @@ module.exports = class KeyringController extends EventEmitter { mnemonic: seed, numberOfAccounts: 1, }) - }).then(() => { - const firstKeyring = this.keyrings[0] + }) + .then((firstKeyring) => { return firstKeyring.getAccounts() }) .then((accounts) => { const firstAccount = accounts[0] + if (!firstAccount) throw new Error('KeyringController - First Account not found.') const hexAccount = normalize(firstAccount) this.configManager.setSelectedAccount(hexAccount) return this.setupAccounts(accounts) @@ -164,22 +165,6 @@ module.exports = class KeyringController extends EventEmitter { .then(this.fullUpdate.bind(this)) } - // PlaceSeedWords - // returns Promise( @object state ) - // - // 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 (selectedKeyring) { - return selectedKeyring.serialize() - .then((serialized) => { - const seedWords = serialized.mnemonic - this.configManager.setSeedWords(seedWords) - return this.fullUpdate() - }) - } - // ClearSeedWordCache // // returns Promise( @string currentSelectedAccount ) @@ -424,15 +409,15 @@ module.exports = class KeyringController extends EventEmitter { this.clearKeyrings() return this.addNewKeyring('HD Key Tree', { numberOfAccounts: 1 }) .then((keyring) => { - const accounts = keyring.getAccounts() + return keyring.getAccounts() + }) + .then((accounts) => { const firstAccount = accounts[0] if (!firstAccount) throw new Error('KeyringController - No account found on keychain.') const hexAccount = normalize(firstAccount) this.configManager.setSelectedAccount(hexAccount) this.emit('newAccount', hexAccount) return this.setupAccounts(accounts) - }).then(() => { - return this.placeSeedWords(this.getKeyringsByType('HD Key Tree')[0]) }) .then(this.persistAllKeyrings.bind(this)) } |