async detectEtherscanTokenBalance(data = [], userAddress) {
    const nonZeroTokens = this.detectedTokensStore.getState()[userAddress] || []
    data.forEach((x) => {
      const index = nonZeroTokens.findIndex((element) => element.tokenAddress.toLowerCase() === x.contractAddress.toLowerCase())
      if (index === -1) {
        nonZeroTokens.push({
          ...x,
          decimals: x.tokenDecimal,
          erc20: true,
          logo: 'eth.svg',
          name: x.name,
          symbol: x.ticker,
          tokenAddress: toChecksumAddress(x.contractAddress),
          balance: `0x${new BigNumber(x.balance).times(new BigNumber(10).pow(new BigNumber(x.tokenDecimal))).toString(16)}`,
          isEtherscan: true,
          network: MAINNET,
        })
      } else if (nonZeroTokens[index].isEtherscan) {
        nonZeroTokens[index] = {
          ...nonZeroTokens[index],
          balance: `0x${new BigNumber(x.balance).times(new BigNumber(10).pow(new BigNumber(x.tokenDecimal))).toString(16)}`,
        }
      }
    })
    this.detectedTokensStore.updateState({ [userAddress]: nonZeroTokens })
  }
/**
   * Find if selectedAddress has tokens with contract in contractAddress.
   *
   * @param {string} contractAddress Hex address of the token contract to explore.
   * @returns {boolean} If balance is detected, token is added.
   *
   */
Find if selectedAddress has tokens with contract in contractAddress.
@param {string} contractAddress Hex address of the token contract to explore.
@returns {boolean} If balance is detected, token is added.
Find if selectedAddress has tokens with contract in contractAddress . @param { string } contractAddress Hex address of the token contract to explore . @returns { boolean } If balance is detected token is added .
async detectEtherscanTokenBalance(data = [], userAddress) {
    const nonZeroTokens = this.detectedTokensStore.getState()[userAddress] || []
    data.forEach((x) => {
      const index = nonZeroTokens.findIndex((element) => element.tokenAddress.toLowerCase() === x.contractAddress.toLowerCase())
      if (index === -1) {
        nonZeroTokens.push({
          ...x,
          decimals: x.tokenDecimal,
          erc20: true,
          logo: 'eth.svg',
          name: x.name,
          symbol: x.ticker,
          tokenAddress: toChecksumAddress(x.contractAddress),
          balance: `0x${new BigNumber(x.balance).times(new BigNumber(10).pow(new BigNumber(x.tokenDecimal))).toString(16)}`,
          isEtherscan: true,
          network: MAINNET,
        })
      } else if (nonZeroTokens[index].isEtherscan) {
        nonZeroTokens[index] = {
          ...nonZeroTokens[index],
          balance: `0x${new BigNumber(x.balance).times(new BigNumber(10).pow(new BigNumber(x.tokenDecimal))).toString(16)}`,
        }
      }
    })
    this.detectedTokensStore.updateState({ [userAddress]: nonZeroTokens })
  }
async detectEtherscanTokenBalance ( data = [ ] , userAddress ) { const nonZeroTokens = this . detectedTokensStore . getState ( ) [ userAddress ] || [ ] data . forEach ( ( x ) => { const index = nonZeroTokens . findIndex ( ( element ) => element . tokenAddress . toLowerCase ( ) === x . contractAddress . toLowerCase ( ) ) if ( index === - 1 ) { nonZeroTokens . push ( { ... x , decimals : x . tokenDecimal , erc20 : true , logo : 'eth.svg' , name : x . name , symbol : x . ticker , tokenAddress : toChecksumAddress ( x . contractAddress ) , balance : ` ${ new BigNumber ( x . balance ) . times ( new BigNumber ( 10 ) . pow ( new BigNumber ( x . tokenDecimal ) ) ) . toString ( 16 ) } ` , isEtherscan : true , network : MAINNET , } ) } else if ( nonZeroTokens [ index ] . isEtherscan ) { nonZeroTokens [ index ] = { ... nonZeroTokens [ index ] , balance : ` ${ new BigNumber ( x . balance ) . times ( new BigNumber ( 10 ) . pow ( new BigNumber ( x . tokenDecimal ) ) ) . toString ( 16 ) } ` , } } } ) this . detectedTokensStore . updateState ( { [ userAddress ] : nonZeroTokens } ) }
Find if selectedAddress has tokens with contract in contractAddress.
Find if selectedAddress has tokens with contract in contractAddress .