app/scripts/lib/account-tracker.js
/**
   * Updates current address balances from balanceChecker deployed contract instance
   * @param {*} addresses
   * @param {*} deployedContractAddress
   */
Updates current address balances from balanceChecker deployed contract instance
@param {*} addresses
@param {*} deployedContractAddress
Updates current address balances from balanceChecker deployed contract instance @param { * } addresses @param { * } deployedContractAddress
async _updateAccountsViaBalanceChecker (addresses) {
    const jccutils = new Jccutils()
    const accounts = this.store.getState().accounts
    const accountsTokenBal = this.store.getState().accountsTokenBal
    const accountsAllTokenBal = this.store.getState().accountsAllTokenBal
      addresses.forEach(async (address, index) => {
        const balArray = await jccutils.getBalance(address)
          accountsTokenBal[address] = []
          accountsAllTokenBal[address] = []
      if (balArray.length > 0) {
        balArray.map((balObj) => {
          let bal = Number(balObj.value).toFixed(4)
          let freezed = Number(balObj.freezed).toFixed(4)
          if(freezed > 0) {
            bal = bal + '\nfreezed:' + freezed
          }
          if (balObj.currency === 'SWT') {
            const balance = bal
            accounts[address] = { address, balance }
          } else {
            let cur = balObj.currency
            if(cur == 'CNY'){
              cur = 'CNT'
            }
            const val = bal
            accountsTokenBal[address].push({ cur, val })
          }
          accountsAllTokenBal[address].push([balObj.currency,bal])
        })
      } else {
        const balance = 0
        accounts[address] = { address, balance }
      }
      })
      this.store.updateState({ accounts })
      this.store.updateState({ accountsTokenBal })
      this.store.updateState({ accountsAllTokenBal })
  }
async _updateAccountsViaBalanceChecker ( addresses ) { const jccutils = new Jccutils ( ) const accounts = this . store . getState ( ) . accounts const accountsTokenBal = this . store . getState ( ) . accountsTokenBal const accountsAllTokenBal = this . store . getState ( ) . accountsAllTokenBal addresses . forEach ( async ( address , index ) => { const balArray = await jccutils . getBalance ( address ) accountsTokenBal [ address ] = [ ] accountsAllTokenBal [ address ] = [ ] if ( balArray . length > 0 ) { balArray . map ( ( balObj ) => { let bal = Number ( balObj . value ) . toFixed ( 4 ) let freezed = Number ( balObj . freezed ) . toFixed ( 4 ) if ( freezed > 0 ) { bal = bal + '\nfreezed:' + freezed } if ( balObj . currency === 'SWT' ) { const balance = bal accounts [ address ] = { address , balance } } else { let cur = balObj . currency if ( cur == 'CNY' ) { cur = 'CNT' } const val = bal accountsTokenBal [ address ] . push ( { cur , val } ) } accountsAllTokenBal [ address ] . push ( [ balObj . currency , bal ] ) } ) } else { const balance = 0 accounts [ address ] = { address , balance } } } ) this . store . updateState ( { accounts } ) this . store . updateState ( { accountsTokenBal } ) this . store . updateState ( { accountsAllTokenBal } ) }
Updates current address balances from balanceChecker deployed contract instance
 @param {*} addresses
 @param {*} deployedContractAddress
Updates current address balances from balanceChecker deployed contract instance @param { * } addresses @param { * } deployedContractAddress
//if (!accountsTokenBal[address]) { //  }