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