简体   繁体   中英

Display balance from an Aion Account

I'm trying to get the balance of an account in Aion using the Java API. No matter what I do I can't get a value from the account variable.

account = "a06f02e986965ddd3398c4de87e3708072ad58d96e9c53e87c31c8c970b211e5";
BigInteger account_balance = api.getChain().getBalance(account).getObject();

System.out.format("%n%s balance is = %d nAmp (over %d AION)%n", 
    account, 
    account_balance, 
    account_balance.divide(BigInteger.TEN.pow(18)));

Has anyone any ideas?

您需要在Address.wrap包装您的帐户地址。

account = Address.wrap("a06f02e9...");

您还可以尝试使用JSON请求进行RPC API调用: {"jsonrpc":"2.0","method":"eth_getBalance","params":["0x0","latest"],"id":32}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM