Custom Script Call

Icon Link准备脚本交易

与合约类似,我们可以为脚本配置调用参数 交易参数 ,以及在提交之前检索整个交易请求或交易ID。

const script = new Script(binHexlified, abiContents, wallet);
 
const tx = script.functions.main(argument);
 
// Set the call parameters
tx.callParams({ gasLimit: 1500 });
 
// Get the entire transaction request prior to
const txRequest = await tx.getTransactionRequest();
 
// Get the transaction ID
const txId = await tx.getTransactionId();
 
// Retrieve the value of the call and the actual gas used
const { value, gasUsed } = await tx.call();