Search in sources :

Example 1 with ResOkAccountToken

use of wannabit.io.cosmostaion.network.res.ResOkAccountToken in project cosmostation-android by cosmostation.

the class WUtil method getBalancesFromOkLcd.

public static ArrayList<Balance> getBalancesFromOkLcd(long accountId, ResOkAccountToken lcd) {
    long time = System.currentTimeMillis();
    ArrayList<Balance> result = new ArrayList<>();
    if (lcd.data != null && lcd.data.currencies != null && lcd.data.currencies.size() > 0) {
        for (ResOkAccountToken.OkCurrency currency : lcd.data.currencies) {
            Balance temp = new Balance();
            temp.accountId = accountId;
            temp.symbol = currency.symbol;
            temp.balance = new BigDecimal(currency.available);
            temp.locked = new BigDecimal(currency.locked);
            temp.fetchTime = time;
            result.add(temp);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Balance(wannabit.io.cosmostaion.dao.Balance) BigDecimal(java.math.BigDecimal) ResOkAccountToken(wannabit.io.cosmostaion.network.res.ResOkAccountToken)

Aggregations

BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 Balance (wannabit.io.cosmostaion.dao.Balance)1 ResOkAccountToken (wannabit.io.cosmostaion.network.res.ResOkAccountToken)1