I have a call of script that creates order
Link to script is here
When I provide required object as argument it fails with “NotEnoughBalance” error, I assume it can be fixed by providing UTXO, but I couldn’t find any example how to attach it to script call function.
When executing a Script that requires funds, you have some options;
Create a Script Instance with a Account Instance, this account instance can be of types Predicate or WalletUnlocked/Locked. Calling a script | Fuels-ts
Create a Script Instance, and add specifics Inputs and Outputs by changing the transactionRequest. script.
const wallet = new WalletUnlocked();
const script = new Script('<hex>', {...}, account);
const call = script.functions.main();
call.transactionRequest.addCoinOutput({...});
call.transactionRequest.inputs.push({...});
call.transactionRequest.outputs.push({...});
Create a Transaction Request instance directly and update the data on it;
const wallet = Wallet.generate();
const tx = new TransactionRequest({
script: '<hex>',
scriptData: '<hex of data>'
});
tx.addCoinOutput({...});
tx.inputs.push({...});
tx.outputs.push({...});
wallet.sendTransaction(tx);