我正在尝试使用web3j从erc20令牌合同中读取地址的余额。我已经生成了java等价合同文件。在此文件中,A函数返回RemoteCall类型的对象。现在,如何解析这个输出,以便我可以简单地得到数字(大整数值)?
当我尝试使用android日志记录输出时,我得到某种加密输出 -
org.Web3就.protocol.core.remote call@48从4的84
现在我完全不知道接下来要做什么?
public RemoteCall<BigInteger> balanceOf(String param0) {
final Function function = new Function(FUNC_BALANCEOF, Arrays.<Type>asList(new Address(param0)),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
预期输出具有Big Integer类型编号(地址的标记余额)。
你需要在send()
返回的RemoteCall<BigInteger>
实例上调用balanceOf()
:
RemoteCall<BigInteger> remoteCall = someObject.balanceOf(someParameter);
BigInteger result = remoteCall.send();