|
|
|
@ -77,9 +77,11 @@ export function reducer (state = initialState, action) { |
|
|
|
|
|
|
|
|
|
let fetchedTokenBalanceBlockNumber = 0 |
|
|
|
|
function loadTokenBalance (blockNumber) { |
|
|
|
|
if (blockNumber >= fetchedTokenBalanceBlockNumber) { |
|
|
|
|
if (blockNumber > fetchedTokenBalanceBlockNumber) { |
|
|
|
|
fetchedTokenBalanceBlockNumber = blockNumber |
|
|
|
|
setTimeout(loadTokenBalanceDropdown, 1000) |
|
|
|
|
} else if (fetchedTokenBalanceBlockNumber === 0 && blockNumber === null) { |
|
|
|
|
setTimeout(loadTokenBalanceDropdown, 1000) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -94,7 +96,7 @@ const elements = { |
|
|
|
|
return { balanceCard: $el.html(), balance: parseFloat($el.find('.current-balance-in-wei').attr('data-wei-value')) } |
|
|
|
|
}, |
|
|
|
|
render ($el, state, oldState) { |
|
|
|
|
if (oldState.balance === state.balance || isNaN(state.balance)) return |
|
|
|
|
if (oldState.balance === state.balance || (isNaN(oldState.balance) && isNaN(state.balance))) return |
|
|
|
|
$el.empty().append(state.balanceCard) |
|
|
|
|
loadTokenBalance(state.fetchedCoinBalanceBlockNumber) |
|
|
|
|
updateAllCalculatedUsdValues() |
|
|
|
|