1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge pull request #1051 from MetaMask/hotfix1048

hotfix - addNewAccount  - dont assume hd keyring position
This commit is contained in:
Frankie 2017-01-24 13:38:24 -08:00 committed by GitHub
commit 5811f2ab14
2 changed files with 7 additions and 5 deletions

View File

@ -259,9 +259,11 @@ module.exports = class KeyringController extends EventEmitter {
// Calls the `addAccounts` method on the Keyring
// in the kryings array at index `keyringNum`,
// and then saves those changes.
addNewAccount (keyRingNum = 0) {
const ring = this.keyrings[keyRingNum]
return ring.addAccounts(1)
addNewAccount () {
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.addAccounts(1)
.then(this.setupAccounts.bind(this))
.then(this.persistAllKeyrings.bind(this))
.then(this.fullUpdate.bind(this))

View File

@ -286,8 +286,8 @@ function navigateToNewAccountScreen() {
}
}
function addNewAccount (ringNumber = 0) {
return callBackgroundThenUpdate(background.addNewAccount, ringNumber)
function addNewAccount () {
return callBackgroundThenUpdate(background.addNewAccount)
}
function showInfoPage () {