안녕하세요.
클레이 전송 예상 가스비 estimateComputationCost 메서드를 사용하려고 로직을 짜고 있는데,
const { from, to, value } = req.body; // fromAddress, toAddress, 10
const test = await caver.klay.abi.encodeFunctionCall(
{
name: "VALUE_TRANSFER",
type: "function",
inputs: [
{ type: "string", name: "type" },
{ type: "string", name: "from" },
{ type: "string", name: "to" },
{ type: "uint256", name: "gas" },
{ type: "uint256", name: "value" },
],
},
["VALUE_TRANSFER", from, to, 300000, caver.utils.toPeb(value, "KLAY")]
);
const jest = await caver.klay.estimateComputationCost({
to: to,
data: test,
});
위와같이 인코딩된 함수호출을 만들고 메서드를 사용했는데,
"test": "0x75a6103500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000493e00000000000000000000000000000000000000000000000008ac7230489e80000000000000000000000000000000000000000000000000000000000000000000e56414c55455f5452414e53464552000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30786164633536354262383861413732616131346239384362363139366632313639303036313462336300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30783264656530303562393233653531306231323963303534346234643532623138326533373738613300000000000000000000000000000000000000000000",
"jest": "0x0"
결과가 이렇게 나옵니다.
클레이를 1클레이 이상 전송하는데 예상 가스비가 0x0이 나오는게 아닌거 같은데
혹시 제가 잘못 짰을까요? 갈피를 잘 못 잡겠습니다.