Skip to main content
API Reference: GET /getAction · POST /submitTx This guide extends the standard Swaps.xyz swap flow with optional gasless execution.

Overview

Gasless transactions allow users to execute swaps without paying gas fees directly. When gasless=true is passed to getAction, the API returns a set of signing steps (executions) instead of a raw transaction. The user signs each step and submits them to POST /submitTx, which handles relay and broadcast. Supported Chains: Tron same-chain swaps only (cross-chain and EVM chains coming soon)

Requesting Gasless Execution

Add the optional gasless query parameter to your getAction request:
Note: Omit gasless or set it to false for standard transactions.

Understanding the Response

When gasless=true is requested and a relay provider is available for the source chain, the response includes:
If executionsType is "DEFAULT" (relay unavailable or gasless not set), broadcast tx directly as a standard transaction — see the swap guide.

Executing Gasless Transactions

1

Check executionsType

Always check the response before proceeding:
2

Sign each execution in order

Iterate executions and sign each step with the appropriate wallet method:
Order matters. Fee approval steps (if present) must be signed and submitted before the swap step. The array is already in the correct order.
3

Submit to POST /submitTx

Send the signed executions along with the txId from the getAction response:

Complete Example


Notes

  • Standard fallback: Always check executionsType — if "DEFAULT", broadcast tx directly (see swap guide).
  • Error handling: POST /submitTx validates signatures and simulates transactions before broadcasting. A 400 response indicates a bad signature or expired txId.
  • Relayer fee: The relayerFee field shows the fee deducted from amountIn to pay the relay. Display it to users alongside the swap quote.

Type Definitions