生成Java文件的代码
public RemoteFunctionCall<TransactionReceipt> averagePrice() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_AVERAGEPRICE,
Arrays.<Type>asList(),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
调用返回数据:
RemoteFunctionCall<TransactionReceipt> transactionReceiptRemoteFunctionCall = token.averagePrice();
String s = transactionReceiptRemoteFunctionCall.encodeFunctionCall();
System.out.println(s);//返回结果 0xa0352ea3
请问下这个返回要怎么编码转换。
public RemoteFunctionCall<Uint256> getAveragePrice() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_AVERAGEPRICE,
Arrays.<Type>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
}));
return executeRemoteCallSingleValueReturn(function);
}
CompletableFuture<Uint256> value = gsToken.getAveragePrice().sendAsync();
System.out.println(value.get().getValue());