Add accounts back to metamask state

This commit is contained in:
Dan Finlay 2016-09-12 14:22:06 -07:00
parent 6fcbb43c50
commit 0d11eab8cb
5 changed files with 19 additions and 15 deletions

View File

@ -148,6 +148,10 @@ IdentityStore.prototype.revealAccount = function (cb) {
keyStore.setDefaultHdDerivationPath(this.hdPathString)
keyStore.generateNewAddress(derivedKey, 1)
const addresses = ks.getAddresses();
const address = addresses[ addresses.length -1 ]
this._ethStore.addAccount(ethUtil.addHexPrefix(address))
configManager.setWallet(keyStore.serialize())
@ -496,7 +500,7 @@ IdentityStore.prototype._createIdMgmt = function (derivedKey) {
IdentityStore.prototype.purgeCache = function () {
this._getAddresses().forEach((address) => {
this._ethStore.del(address)
this._ethStore.del(ethUtil.addHexPrefix(address))
})
}

File diff suppressed because one or more lines are too long

View File

@ -33,20 +33,20 @@
"accounts": {
"0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc": {
"code": "0x",
"balance": "0x0",
"balance": "0x100000000000",
"nonce": "0x0",
"address": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b": {
"code": "0x",
"nonce": "0x0",
"balance": "0x0",
"balance": "0x100000000000",
"address": "0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b"
},
"0xeb9e64b93097bc15f01f13eae97015c57ab64823": {
"code": "0x",
"nonce": "0x0",
"balance": "0x0",
"balance": "0x100000000000",
"address": "0xeb9e64b93097bc15f01f13eae97015c57ab64823"
},
"0x704107d04affddd9b66ab9de3dd7b095852e9b69": {

View File

@ -29,25 +29,25 @@
"unconfTxs": {},
"accounts": {
"0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc": {
"balance": "0x0",
"balance": "0x100000000000000",
"nonce": "0x0",
"code": "0x",
"address": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b": {
"balance": "0x0",
"balance": "0x100000000000000",
"nonce": "0x0",
"code": "0x",
"address": "0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b"
},
"0xeb9e64b93097bc15f01f13eae97015c57ab64823": {
"balance": "0x0",
"balance": "0x100000000000",
"nonce": "0x0",
"code": "0x",
"address": "0xeb9e64b93097bc15f01f13eae97015c57ab64823"
},
"0x704107d04affddd9b66ab9de3dd7b095852e9b69": {
"balance": "0x0",
"balance": "0x100000000000",
"code": "0x",
"nonce": "0x0",
"address": "0x704107d04affddd9b66ab9de3dd7b095852e9b69"
@ -82,4 +82,4 @@
"scrollToBottom": true
},
"identities": {}
}
}

View File

@ -7,14 +7,14 @@ const EthBalance = require('../components/eth-balance')
const CopyButton = require('../components/copyButton')
const Identicon = require('../components/identicon')
module.exports = NewComponent
module.exports = AccountListItem
inherits(NewComponent, Component)
function NewComponent () {
inherits(AccountListItem, Component)
function AccountListItem () {
Component.call(this)
}
NewComponent.prototype.render = function () {
AccountListItem.prototype.render = function () {
const identity = this.props.identity
var isSelected = this.props.selectedAddress === identity.address
var account = this.props.accounts[identity.address]
@ -73,7 +73,7 @@ NewComponent.prototype.render = function () {
)
}
NewComponent.prototype.pendingOrNot = function () {
AccountListItem.prototype.pendingOrNot = function () {
const pending = this.props.pending
if (pending.length === 0) return null
return h('.pending-dot', pending.length)