如何从"RemoteCall<BigInteger>" return类型函数中提取数据java/kotlin?

How to extract data from "RemoteCall<BigInteger>" return type function in java/kotlin?

我正在尝试使用 web3j 从 erc20 令牌合约中读取地址余额。我已经生成了 java 个等效的合同文件。在这个文件中,一个函数返回 RemoteCall 类型的对象。现在,如何解析此输出以便我可以简单地获取数字(大整数值)?

当我尝试使用 android 日志记录输出时,我得到了某种加密输出 -

org.web3j.protocol.core.RemoteCall@48c4d84

现在我完全不知道下一步该做什么?

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);
}

预期输出是一个大整数类型的数字(地址的代币余额)。

您需要在从 balanceOf() 返回的 RemoteCall<BigInteger> 实例上调用 send():

RemoteCall<BigInteger> remoteCall = someObject.balanceOf(someParameter);
BigInteger result = remoteCall.send();