diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2016-11-16 03:07:15 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2016-11-16 05:31:22 +0800 |
commit | a4666de0ce9eaa99242609fdbf518b6a37650ff2 (patch) | |
tree | ecf5b6f0e53f7faf70f77f89858dbc5188aee232 /app/scripts | |
parent | 7de6b12aad4a674bdbb0749d2e61d9fd5f69c536 (diff) | |
download | tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.tar tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.tar.gz tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.tar.bz2 tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.tar.lz tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.tar.xz tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.tar.zst tangerine-wallet-browser-a4666de0ce9eaa99242609fdbf518b6a37650ff2.zip |
Minimize repeated code.
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/keyring-controller.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index c7e3c32a4..84327b15f 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -153,13 +153,12 @@ module.exports = class KeyringController extends EventEmitter { createFirstKeyTree (password, cb) { this.clearKeyrings() this.addNewKeyring('HD Key Tree', {numberOfAccounts: 1}, (err) => { - const firstKeyring = this.keyrings[0] - const accounts = firstKeyring.getAccounts() + const accounts = this.keyrings[0].getAccounts() const firstAccount = accounts[0] const hexAccount = normalize(firstAccount) - const seedWords = firstKeyring.serialize().mnemonic this.configManager.setSelectedAccount(firstAccount) - this.configManager.setSeedWords(seedWords) + + this.placeSeedWords() autoFaucet(hexAccount) this.setupAccounts(accounts) this.persistAllKeyrings() @@ -172,7 +171,7 @@ module.exports = class KeyringController extends EventEmitter { }) } - placeSeedWords (cb) { + placeSeedWords () { const firstKeyring = this.keyrings[0] const seedWords = firstKeyring.serialize().mnemonic this.configManager.setSeedWords(seedWords) @@ -237,13 +236,13 @@ module.exports = class KeyringController extends EventEmitter { setupAccounts (accounts) { var arr = accounts || this.getAccounts() arr.forEach((account) => { - this.loadBalanceAndNickname(account) + this.getBalanceAndNickname(account) }) } // Takes an account address and an iterator representing // the current number of named accounts. - loadBalanceAndNickname (account) { + getBalanceAndNickname (account) { const address = normalize(account) this.ethStore.addAccount(address) this.createNickname(address) |