3 import com.google.gson.annotations.SerializedName;
4 import io.bytom.common.Utils;
5 import io.bytom.exception.BytomException;
6 import io.bytom.http.Client;
7 import org.apache.log4j.Logger;
9 import java.lang.reflect.Type;
10 import java.util.List;
13 public class Balance {
18 @SerializedName("account_id")
19 public String accountId;
24 @SerializedName("account_alias")
25 public String accountAlias;
28 * sum of the unspent outputs.
29 * specified asset balance of account.
36 @SerializedName("asset_id")
37 public String assetId;
42 @SerializedName("asset_alias")
43 public String assetAlias;
45 @SerializedName("asset_definition")
46 public Map<String, Object> definition;
48 private static Logger logger = Logger.getLogger(Balance.class);
51 * Serializes the Balance into a form that is safe to transfer over the wire.
53 * @return the JSON-serialized representation of the Receiver object
55 public String toJson() {
56 return Utils.serializer.toJson(this);
60 public static class QueryBuilder {
63 * Call list-Balances api
67 * @throws BytomException
69 public List<Balance> list(Client client) throws BytomException {
71 // TODO: 2018/5/23 need tx and test
72 Type listType = new ParameterizedTypeImpl(List.class, new Class[]{Balance.class});
73 List<Balance> balanceList = client.request("list-balances", null, listType);
74 logger.info("list-balances:");
75 logger.info("size of :" + balanceList.size());
76 logger.info(balanceList.get(0).toJson());