Hello, I want to generate ScriptSum to perform similar transaction as this. I have checked all your documention but couldn’t find a command on how to do this
import { ScriptTransactionRequest, Provider, Wallet } from 'fuels';
import { ScriptSum } from '../../../../typegend'; // Replace with your contract/script
const provider = new Provider(LOCAL_NETWORK_URL);
const wallet = Wallet.fromPrivateKey(WALLET_PVT_KEY, provider);
// Instantiate the transaction request using a ScriptTransactionRequest
const scriptTransactionRequest = new ScriptTransactionRequest({
script: ScriptSum.bytecode, // Use your contract's bytecode
});
// Set the script main function arguments (e.g., incrementing the counter)
const incrementAmount = 1; // Amount to increment
scriptTransactionRequest.setData(ScriptSum.abi, [incrementAmount]);
// Optionally, add any coin outputs if needed
const baseAssetId = await provider.getBaseAssetId();
scriptTransactionRequest.addCoinOutput(wallet.address, 1000, baseAssetId);
// Estimate and fund the transaction
await scriptTransactionRequest.estimateAndFund(wallet);
// Send the transaction
await wallet.sendTransaction(scriptTransactionRequest);