合约如下,已经部署在测试链中 地址是 0x33ffbee3c5e3408730f4a51cc5089c5f0a673326
pragma solidity >=0.4.22 <0.9.0;
contract HelloWorld{
string my_name = "xtm";
function show() public view returns (string memory)
{
return my_name;
}
function changeName(string memory new_name) public {
my_name = new_name;
}
function pureTest(string memory _newName) pure public returns(string memory){
return _newName;
}
}
java代码如下:
public static String callContractMethod(String privateKey,String contractAddr) throws IOException {
//sign and send the transaction
CITAj service = CITAj.build(new HttpService("https://testnet.citahub.com"));
// List<Type> inputParameters = Arrays.asList(new Uint(BigInteger.valueOf(4l)));
String funcData = CITASystemContract.encodeCall("show");
Transaction tx = CITAUtil.initTransaction(contractAddr,10000000L,"0",funcData);
String rawTx = tx.sign(privateKey);
AppSendTransaction result = service.appSendRawTransaction(rawTx).send();
String txHash = result.getSendTransactionResult().getHash();
return txHash;
}
请问该如何看到函数的调用结果,也就是合约中的my_name: “xtm”?