aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-03-23 04:41:19 +0800
committerKevin Serrano <kevgagser@gmail.com>2017-03-23 04:41:19 +0800
commit1b7326048db25afc36baea84ebcf9ece0847f3c3 (patch)
tree6506a5c15decbc5a0900a5971f12ebf4ba7b4a04
parent864f8b06f9f2ec56b7ffce0afe83a1d70c3c7843 (diff)
downloadtangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.tar
tangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.tar.gz
tangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.tar.bz2
tangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.tar.lz
tangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.tar.xz
tangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.tar.zst
tangerine-wallet-browser-1b7326048db25afc36baea84ebcf9ece0847f3c3.zip
Add current block number and hash to the state.
-rw-r--r--app/scripts/lib/eth-store.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/scripts/lib/eth-store.js b/app/scripts/lib/eth-store.js
index 8812a507b..243253df2 100644
--- a/app/scripts/lib/eth-store.js
+++ b/app/scripts/lib/eth-store.js
@@ -19,6 +19,8 @@ class EthereumStore extends ObservableStore {
super({
accounts: {},
transactions: {},
+ currentBlockNumber: '0',
+ currentBlockHash: '',
})
this._provider = opts.provider
this._query = new EthQuery(this._provider)
@@ -69,6 +71,8 @@ class EthereumStore extends ObservableStore {
_updateForBlock (block) {
const blockNumber = '0x' + block.number.toString('hex')
this._currentBlockNumber = blockNumber
+ this.updateState({ currentBlockNumber: parseInt(blockNumber) })
+ this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
async.parallel([
this._updateAccounts.bind(this),
this._updateTransactions.bind(this, blockNumber),
@@ -129,4 +133,4 @@ class EthereumStore extends ObservableStore {
}
-module.exports = EthereumStore \ No newline at end of file
+module.exports = EthereumStore