@ -14,7 +14,7 @@ import log from 'loglevel'
import pify from 'pify'
import Web3 from 'web3'
import SINGLE _CALL _BALANCES _ABI from 'single-call-balance-checker-abi'
import { MAINNET _NETWORK _ID , RINKEBY _NETWORK _ID , ROPSTEN _NETWORK _ID , KOVAN _NETWORK _ID } from '../controllers/network/enums'
import { MAINNET _CHAI N _ID , RINKEBY _CHAI N _ID , ROPSTEN _CHAI N _ID , KOVAN _CHAI N _ID } from '../controllers/network/enums'
import {
SINGLE _CALL _BALANCES _ADDRESS ,
@ -61,7 +61,7 @@ export default class AccountTracker {
} )
// bind function for easier listener syntax
this . _updateForBlock = this . _updateForBlock . bind ( this )
this . network = opts . network
this . getCurrentChainId = opts . getCurrentChainId
this . web3 = new Web3 ( this . _provider )
}
@ -196,22 +196,22 @@ export default class AccountTracker {
async _updateAccounts ( ) {
const { accounts } = this . store . getState ( )
const addresses = Object . keys ( accounts )
const currentNetwork = this . network . getNetworkState ( )
const chainId = this . getCurrentChainId ( )
switch ( currentNetwork ) {
case MAINNET _NETWORK _ID . toString ( ) :
switch ( chainId ) {
case MAINNET _CHAI N _ID :
await this . _updateAccountsViaBalanceChecker ( addresses , SINGLE _CALL _BALANCES _ADDRESS )
break
case RINKEBY _NETWORK _ID . toString ( ) :
case RINKEBY _CHAI N _ID :
await this . _updateAccountsViaBalanceChecker ( addresses , SINGLE _CALL _BALANCES _ADDRESS _RINKEBY )
break
case ROPSTEN _NETWORK _ID . toString ( ) :
case ROPSTEN _CHAI N _ID :
await this . _updateAccountsViaBalanceChecker ( addresses , SINGLE _CALL _BALANCES _ADDRESS _ROPSTEN )
break
case KOVAN _NETWORK _ID . toString ( ) :
case KOVAN _CHAI N _ID :
await this . _updateAccountsViaBalanceChecker ( addresses , SINGLE _CALL _BALANCES _ADDRESS _KOVAN )
break