diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-01-05 05:05:29 +0800 |
---|---|---|
committer | Frankie <frankie.diamond@gmail.com> | 2017-01-05 05:05:29 +0800 |
commit | 354fa763d4962deeeb4584c5d5bd5f6d007e211a (patch) | |
tree | 0b3996c83748803caa47268d90cd1c7fdaf462d6 /app/scripts/keyring-controller.js | |
parent | e6da8e2762cd54975c334314357f1cd27cc980c8 (diff) | |
parent | c22da8450cf5014fb2bf3c96e0df88c70aa39465 (diff) | |
download | tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.tar tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.tar.gz tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.tar.bz2 tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.tar.lz tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.tar.xz tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.tar.zst tangerine-wallet-browser-354fa763d4962deeeb4584c5d5bd5f6d007e211a.zip |
Merge branch 'dev' into fixtTxManager
Diffstat (limited to 'app/scripts/keyring-controller.js')
-rw-r--r-- | app/scripts/keyring-controller.js | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index acec8feb1..1a26a887f 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -86,22 +86,28 @@ module.exports = class KeyringController extends EventEmitter { const address = configManager.getSelectedAccount() const wallet = configManager.getWallet() // old style vault const vault = configManager.getVault() // new style vault - - return { - seedWords: this.configManager.getSeedWords(), - isInitialized: (!!wallet || !!vault), - isUnlocked: Boolean(this.password), - isDisclaimerConfirmed: this.configManager.getConfirmedDisclaimer(), // AUDIT this.configManager.getConfirmedDisclaimer(), - unconfMsgs: messageManager.unconfirmedMsgs(), - messages: messageManager.getMsgList(), - selectedAccount: address, - shapeShiftTxList: this.configManager.getShapeShiftTxList(), - currentFiat: this.configManager.getCurrentFiat(), - conversionRate: this.configManager.getConversionRate(), - conversionDate: this.configManager.getConversionDate(), - keyringTypes: this.keyringTypes.map(krt => krt.type), - identities: this.identities, - } + const keyrings = this.keyrings + + return Promise.all(keyrings.map(this.displayForKeyring)) + .then((displayKeyrings) => { + return { + seedWords: this.configManager.getSeedWords(), + isInitialized: (!!wallet || !!vault), + isUnlocked: Boolean(this.password), + isDisclaimerConfirmed: this.configManager.getConfirmedDisclaimer(), + transactions: this.configManager.getTxList(), + unconfMsgs: messageManager.unconfirmedMsgs(), + messages: messageManager.getMsgList(), + selectedAccount: address, + shapeShiftTxList: this.configManager.getShapeShiftTxList(), + currentFiat: this.configManager.getCurrentFiat(), + conversionRate: this.configManager.getConversionRate(), + conversionDate: this.configManager.getConversionDate(), + keyringTypes: this.keyringTypes.map(krt => krt.type), + identities: this.identities, + keyrings: displayKeyrings, + } + }) } // Create New Vault And Keychain @@ -555,6 +561,7 @@ module.exports = class KeyringController extends EventEmitter { // On success, returns the resulting @Keyring instance. restoreKeyring (serialized) { const { type, data } = serialized + const Keyring = this.getKeyringClassForType(type) const keyring = new Keyring() return keyring.deserialize(data) @@ -627,6 +634,22 @@ module.exports = class KeyringController extends EventEmitter { }) } + // Display For Keyring + // @Keyring keyring + // + // returns Promise( @Object { type:String, accounts:Array } ) + // + // Is used for adding the current keyrings to the state object. + displayForKeyring (keyring) { + return keyring.getAccounts() + .then((accounts) => { + return { + type: keyring.type, + accounts: accounts, + } + }) + } + // Add Gas Buffer // @string gas (as hexadecimal value) // |