call_data is a JSON string containing a serialized script transaction and the coin quantities required to fund it:
Transaction construction
1
Parse call_data
Deserialize the JSON string and extract the
script and quantities fields.2
Reconstruct the ScriptTransactionRequest
Use
ScriptTransactionRequest.from() to create a proper transaction request object from the serialized data.3
Estimate and fund
Call
estimateAndFund() on the transaction with the wallet and required quantities. This estimates gas costs and adds the necessary coin inputs.4
Simulate (optional)
Simulate the transaction against the Fuel provider to verify it will succeed before sending.
5
Send the transaction
Submit the transaction through the Fuel wallet and get the transaction id.
Full example
The Server-side tab signs with a raw private key. The Browser tab uses the Fuel Wallet extension via the Fuel connector. The @fuels/react tab wraps it as a hook for React apps.action.network.node_url and hold the required assets and fee token. Do not edit the returned script, outputs, asset ids, or quantities before funding it.
Store the transaction id and track the swap.