mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #1244 from MetaMask/i1227-uidumpblockhash
Add current block number and hash to the state.
This commit is contained in:
commit
5b81f7120b
@ -19,6 +19,8 @@ class EthereumStore extends ObservableStore {
|
|||||||
super({
|
super({
|
||||||
accounts: {},
|
accounts: {},
|
||||||
transactions: {},
|
transactions: {},
|
||||||
|
currentBlockNumber: '0',
|
||||||
|
currentBlockHash: '',
|
||||||
})
|
})
|
||||||
this._provider = opts.provider
|
this._provider = opts.provider
|
||||||
this._query = new EthQuery(this._provider)
|
this._query = new EthQuery(this._provider)
|
||||||
@ -69,6 +71,8 @@ class EthereumStore extends ObservableStore {
|
|||||||
_updateForBlock (block) {
|
_updateForBlock (block) {
|
||||||
const blockNumber = '0x' + block.number.toString('hex')
|
const blockNumber = '0x' + block.number.toString('hex')
|
||||||
this._currentBlockNumber = blockNumber
|
this._currentBlockNumber = blockNumber
|
||||||
|
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
|
||||||
|
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
|
||||||
async.parallel([
|
async.parallel([
|
||||||
this._updateAccounts.bind(this),
|
this._updateAccounts.bind(this),
|
||||||
this._updateTransactions.bind(this, blockNumber),
|
this._updateTransactions.bind(this, blockNumber),
|
||||||
@ -129,4 +133,4 @@ class EthereumStore extends ObservableStore {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = EthereumStore
|
module.exports = EthereumStore
|
||||||
|
Loading…
Reference in New Issue
Block a user