Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Custom Script Call

Icon LinkPreparing a Script Transaction

Akin to Contracts, we can configure the call parameters and transaction parameters for Scripts, as well as retrieve the entire transaction request or transaction ID prior to submission.

const script = new Script(SumScript.bytecode, SumScript.abi, 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 { waitForResult } = await tx.call();
const { value, gasUsed } = await waitForResult();