调用 Evm 合约 返回值带一堆 0,如何处理
方法代码
public ResultOuterClass.TxResponse queryContract(String contractName) {
ResultOuterClass.TxResponse responseInfo = null;
try {
String calcContractName = Utils.calcContractName(contractName);
Map<String, byte[]> params = new HashMap<>();
Function function = new Function("name", Arrays.asList(),
Collections.emptyList());
String methodDataStr = FunctionEncoder.encode(function);
String method = methodDataStr.substring(0, 10);
params.put("data", methodDataStr.getBytes());
responseInfo = chainClient.queryContract(calcContractName, method,
null, params, 10000);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(responseInfo);
return responseInfo;
}
返回值
message: "SUCCESS"
contract_result {
result: "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\aMyToken\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
gas_used: 4034
}
tx_id: "39d148e8b2414a006887cd725beed94fad6c9731d3d10e16cea87ec895d92467"
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information