@ -91,26 +91,32 @@ module.exports = class KeyringController extends EventEmitter {
const address = configManager . getSelectedAccount ( )
const address = configManager . getSelectedAccount ( )
const wallet = configManager . getWallet ( ) // old style vault
const wallet = configManager . getWallet ( ) // old style vault
const vault = configManager . getVault ( ) // new style vault
const vault = configManager . getVault ( ) // new style vault
const keyrings = this . keyrings
return {
seedWords : this . configManager . getSeedWords ( ) ,
return Promise . all ( keyrings . map ( this . displayForKeyring ) )
isInitialized : ( ! ! wallet || ! ! vault ) ,
. then ( ( displayKeyrings ) => {
isUnlocked : Boolean ( this . password ) ,
return {
isDisclaimerConfirmed : this . configManager . getConfirmedDisclaimer ( ) , // AUDIT this.configManager.getConfirmedDisclaimer(),
seedWords : this . configManager . getSeedWords ( ) ,
unconfTxs : this . configManager . unconfirmedTxs ( ) ,
isInitialized : ( ! ! wallet || ! ! vault ) ,
transactions : this . configManager . getTxList ( ) ,
isUnlocked : Boolean ( this . password ) ,
unconfMsgs : messageManager . unconfirmedMsgs ( ) ,
isDisclaimerConfirmed : this . configManager . getConfirmedDisclaimer ( ) ,
messages : messageManager . getMsgList ( ) ,
unconfTxs : this . configManager . unconfirmedTxs ( ) ,
selectedAccount : address ,
transactions : this . configManager . getTxList ( ) ,
shapeShiftTxList : this . configManager . getShapeShiftTxList ( ) ,
unconfMsgs : messageManager . unconfirmedMsgs ( ) ,
currentFiat : this . configManager . getCurrentFiat ( ) ,
messages : messageManager . getMsgList ( ) ,
conversionRate : this . configManager . getConversionRate ( ) ,
selectedAccount : address ,
conversionDate : this . configManager . getConversionDate ( ) ,
shapeShiftTxList : this . configManager . getShapeShiftTxList ( ) ,
keyringTypes : this . keyringTypes . map ( krt => krt . type ) ,
currentFiat : this . configManager . getCurrentFiat ( ) ,
identities : this . identities ,
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
// Create New Vault And Keychain
// @string password - The password to encrypt the vault with
// @string password - The password to encrypt the vault with
//
//
@ -693,7 +699,7 @@ module.exports = class KeyringController extends EventEmitter {
if ( typeof password === 'string' ) {
if ( typeof password === 'string' ) {
this . password = password
this . password = password
}
}
return Promise . all ( this . keyrings . map ( ( keyring ) => {
return Promise . all ( this . keyrings . map ( ( keyring , i ) => {
return Promise . all ( [ keyring . type , keyring . serialize ( ) ] )
return Promise . all ( [ keyring . type , keyring . serialize ( ) ] )
. then ( ( serializedKeyringArray ) => {
. then ( ( serializedKeyringArray ) => {
// Label the output values on each serialized Keyring:
// Label the output values on each serialized Keyring:
@ -744,6 +750,7 @@ module.exports = class KeyringController extends EventEmitter {
// On success, returns the resulting @Keyring instance.
// On success, returns the resulting @Keyring instance.
restoreKeyring ( serialized ) {
restoreKeyring ( serialized ) {
const { type , data } = serialized
const { type , data } = serialized
const Keyring = this . getKeyringClassForType ( type )
const Keyring = this . getKeyringClassForType ( type )
const keyring = new Keyring ( )
const keyring = new Keyring ( )
return keyring . deserialize ( data )
return keyring . deserialize ( data )
@ -816,6 +823,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
// Add Gas Buffer
// @string gas (as hexadecimal value)
// @string gas (as hexadecimal value)
//
//