Skip to main content

Overview

The gasless flow lets the taker sign Permit2 while Rialto submits the onchain swap transaction. The taker still authorizes the exact swap with a Permit2 witness signature, but the relayer wallet pays the network gas.

Constraints

ConstraintBehavior
SettlementRequires settlement: permit2 and a returned permit2 payload.
Token typeERC20 sells only. Native ETH sells require the taker-submitted flow.
Permit ownerPass permit2_owner=taker on the quote. For gasless, permit2_owner must equal taker.
RecipientThe quote controls the recipient through the Permit2 witness. Do not edit it.
AllowanceThe taker must still approve Permit2 if issues.allowance is non-null.
BalanceDo not submit if issues.balance is non-null.

Step 1: request a gasless quote

Add permit2_owner to the standard quote request:
API_KEY='rialto_live_example.redacted_secret'
TAKER='0x1111111111111111111111111111111111111111'

curl -sS "https://rialto-trade-api.rialto.xyz/quote?sell_token=USDC&buy_token=ARB&sell_amount=1&taker=$TAKER&permit2_owner=$TAKER&slippage_bps=50&chain_id=42161" \
  -H "Authorization: Bearer $API_KEY"
The response includes quote_id, the permit2 typed data, issues, and the tx Rialto will submit after receiving the signature.

Step 2: approval and signature

If issues.allowance is non-null, the taker approves issues.allowance.spender for at least the raw sell_amount. For gasless Permit2 quotes the spender is the Permit2 contract. Then have the taker sign the permit2 typed data exactly as returned.

Step 3: submit to the relayer

POST /gasless/submit
Auth: requires an API key with swap access.
FieldDescription
quote_idUUID returned by the quote. The quote must have been requested with permit2_owner.
signature0x-prefixed 65-byte Permit2 signature over the typed data returned by the quote.
idempotency_keyOptional client-generated unique string for one relay attempt, such as your internal order id or a UUID. Reuse the same value only when retrying the same quote submission; do not reuse it across different quotes or users.
curl -sS 'https://rialto-trade-api.rialto.xyz/gasless/submit' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "quote_id": "b7b0a3d8-9f6a-4f4a-92d2-1b0e4b5d0c6a",
    "signature": "0xabc123...",
    "idempotency_key": "partner-order-123"
  }'
Example response:
{
  "relay_id": "f3f6a35f-93b9-4629-9a2e-02d2b80648ef",
  "quote_id": "b7b0a3d8-9f6a-4f4a-92d2-1b0e4b5d0c6a",
  "status": "submitted",
  "chain_id": 42161,
  "tx_hash": "0x6b8f...",
  "error": null
}

Step 4: poll relay status

GET /gasless/status/{relay_id}
Auth: requires an API key with swap access.
StatusMeaning
acceptedRequest accepted and queued.
submittedRelayer broadcasted the transaction.
confirmedTransaction mined successfully.
failedTransaction was submitted but failed or could not be confirmed.
expiredRequest expired before successful relay.
rejectedRequest failed validation before relay.
curl -sS 'https://rialto-trade-api.rialto.xyz/gasless/status/f3f6a35f-93b9-4629-9a2e-02d2b80648ef' \
  -H "Authorization: Bearer $API_KEY"
A full runnable Python example for the gasless flow is in the API repo: https://github.com/rialto-plds/rialto-api-docs/blob/main/RIALTO_SWAP_API.md