Skip to main content

Overview

Fuel deposits use a script-based transaction model. The Layerswap API returns a pre-built script transaction in call_data that you need to deserialize, fund with the required coin quantities, and submit. Prerequisites:
  • fuels (Fuel TypeScript SDK) for transaction construction and wallet interaction
Supported networks: Fuel Mainnet, Fuel Testnet

call_data Format

For Fuel, call_data is a JSON string containing two fields:
  • script — A serialized ScriptTransactionRequest object containing the transaction script, inputs, outputs, and other parameters.
  • quantities — An array of coin quantities required to fund the transaction (covers the transfer amount and fees).

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

Pick the flavor that matches your setup. 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.

Next Step

After the transaction is submitted, notify Layerswap so it can match your deposit faster:
See the full deposit flow for details.