Relay
SupportGet in TouchTry Relay
Relay PlatformAPI ReferenceRelayKitRelay ProtocolChangelog

Getting Started

What is Relay?How Relay Works

Solutions

Payment Service ProvidersWallets & Wallet ProvidersMultichain AppsChainsCommerce & Payments

Use Cases

Bridging & OnboardingSwapsCall Execution

Features

App FeesFee SponsorshipDeposit AddressesGas Top-UpGasless ExecutionFast FillGasless SwapsPrice StabilizationRouting Integration Models

Security

Transaction ScreeningUnsupported ExchangesBug Bounty ProgramMEV protectionCommunity SupportContract Audits

Resources

Supported ChainsIntegrating using AISupportBrand Assets

API Reference

API OverviewQuickstartApps, API keys, and Rate LimitsAccess TokensUnderstanding Step ExecutionWallet DetectionCost & Fee StructureRefundsInput ValidationTrade TypesSurplus & ShortageHandling Quote ErrorsHandling Rate LimitsHandling Execution ErrorsContract CompatibilityBridging Integration GuideCall Execution Integration GuideTransaction IndexingBase Builder CodesSmart Accounts in RelayTestnet SupportSolana SupportBitcoin SupportHyperliquid SupportLighter SupportDeep LinkingWebsocketsWebhooksMigrating to Requests v3Migrating to Currencies v2Migrating to Token Price v2Supported ChainsContract AddressesSupported Tokens & RoutesTroubleshootingGet QuoteSubmit PermitGet StatusGet RequestsGet Published RequestsGet ChainsGet Chains LiquidityGet CurrenciesGet Currency ClassificationsGet Token PriceTransactions IndexTransactions SingleDeposit Address ReindexGet App Fee BalancesGet Balance EventsClaim App FeesGet UsageFast FillGet Swap SourcesCreate Access TokenExecute Gasless TxsAttest DepositGet Recovery BalancesRequest WithdrawalGet Withdrawal StatusGet Requests (v2)Get PriceGet ConfigGet Execution StatusGet Currencies (v1)Get Token Price (v1)Get Quote

RelayKit

OverviewInstallationcreateClientgetQuoteexecutegetAppFeesclaimAppFeesfastFillexecuteGaslessBatchAdaptersTypescript API TypingsChain UtilsInstallationuseQuoteuseRelayChainsuseRequestsuseTokenListuseTokenPriceuseExecutionStatusInstallationRelayKitProviderSwapWidgetThemingTroubleshooting

Protocol

Relay ProtocolHow It WorksThe Relay ChainDepositoryDeposit AddressesOracleHubAllocatorSecurity CouncilSecurity & AuditsFor AppsProgrammatic WithdrawalsWithdrawing with a SafeOperate a Third-Party Relay OracleAddressesEVM Depository ReferenceSVM Depository ReferenceOverviewArchitectureSecurityRelay Vaults BackendBridgingInteracting with Relay VaultsWithdrawing from Relay VaultsRelayPoolFactoryRelayPoolRelayPoolNativeGatewayRelayBridgeFactoryRelayBridge

Changelog

Changelog
## Documentation Index Fetch the complete documentation index at: https://docs.relay.link/llms.txt Use this file to discover all available pages before exploring further.
## Agent Instructions To quote bridges and swaps, look up chains and tokens, or track Relay transactions from an agent, use the Relay MCP server: npx -y @relayprotocol/relay-mcp. It is read-only and does not sign or broadcast transactions. Setup: https://docs.relay.link/resources/developing-with-ai.md For Relay Protocol's trust model, security architecture, and audits, see https://docs.relay.link/references/protocol/security.md. For address screening, see https://docs.relay.link/security/transaction-screening.md.

Gasless Swaps

Remove gas friction from swaps so users only pay with the input token

Gas fees add layers of complexity to swapping. Holding the native token, on the right network, at the right time to pay for gas adds friction for users. A gasless swap means that the user only pays with the input token, and this covers all fees. This means someone else is executing the transaction and paying the gas.

What solution is right for me?

There are many different solutions when it comes to implementing a gasless swap experience. We've put together a decision tree below to help you arrive at the solution that best fits your application.

flowchart TD
    Start([Which gasless flow should I use?]) --> Origin
    Origin{Is the origin<br/>chain Solana?}
    Origin -->|Yes| FeePayer
    Origin -->|No — EVM| WalletControl
    WalletControl{Does your app control<br/>the user's wallet?}
    WalletControl -->|No — BYO wallet| Permit
    WalletControl -->|Yes — embedded or custodial| Has4337
    Has4337{Are you already<br/>using ERC-4337?}
    Has4337 -->|Yes| Smart4337
    Has4337 -->|No| BatchExecutor

    Permit[/"Permit-based Gasless<br/><br/>Limitation: not all ERC-20s support permit"/]
    Smart4337[/"ERC-4337 Gasless"/]
    BatchExecutor[/"7702 BatchExecutor"/]
    FeePayer[/"Sponsored Fee Payer<br/><br/>Your sponsor wallet pays fees and rent"/]

    click Permit "#permit-based-gasless" _blank
    click Smart4337 "#erc-4337-gasless" _blank
    click BatchExecutor "#7702-batchexecutor" _blank
    click FeePayer "#gasless-swaps-on-solana" _blank

    style Permit fill:#f9e3e3,stroke:#c44,color:#000
    style Smart4337 fill:#e3e9f9,stroke:#44c,color:#000
    style BatchExecutor fill:#e3f9e6,stroke:#4a4,color:#000
    style FeePayer fill:#f9f0e3,stroke:#c84,color:#000
[!WARNING] Same-chain gasless swaps are only supported if you sponsor the fees. Same-chain swaps route directly through DEXes, due to this the solver never has an opportunity to deduct the gas fees before the user gets the destination token.

Permit-based Gasless

Use this approach when your app does not control the user's wallet (e.g. MetaMask, Rainbow, or any external EOA). The user signs an offchain EIP-3009 or Permit2 message and submits it through the Relay platform. Solvers execute the authorized flow and pay transaction gas.

[!WARNING] USDC is fully gasless. Other ERC-20 tokens require a one-time approval transaction. Same-chain ERC-20 → ERC-20 swaps do not support the permit flow: passing `usePermit: true` is ignored and the quote returns approve and swap transaction steps instead of a permit signature step. Same-chain ERC-20 → native swaps do return the `authorize2` permit step.

How it works

1. Get a quote

Call /quote/v2 with usePermit: true

2. Sign the permit

Prompt the user to sign an EIP-712 typed-data permit message (off-chain, no gas)

3. Submit to Relay

Submit the signed permit to Relay

4. Fulfillment

The signed permit authorizes the token transfer. A solver completes the destination transaction using its own capital.

ERC-3009 permits with MulticallAuthorization

From October 26, 2026, Relay routes permits through the v3.2 ApprovalProxy (see Migrating to the new router). On that proxy, an ERC-3009 permit (the USDC style TransferWithAuthorization) needs a second signature: a MulticallAuthorization that ties the permit to the exact calls Relay runs with the user's tokens.

Opt in by passing `useMulticallAuthorization: true` in the quote request. The permit signature step (authorize1, or authorize2 for a same-chain swap) then holds two items. Sign and post them in this order:

  1. `MulticallAuthorization`: EIP-712 typed data with the domain name RelayApprovalProxy, version 3.1, the chain id, and the v3.2 ApprovalProxy as the verifying contract. Post it to /execute/permits with kind multicall-authorization. This item has no check, since nothing executes yet.
  2. ERC-3009 authorization: the usual TransferWithAuthorization, posted with kind eip3009. Once both signatures are posted, Relay submits the permit. For a same-chain swap (authorize2), the response returns the swap transaction for the user to send instead.

Posting the ERC-3009 signature first returns a 400. Sign both items as the quote returns them: the ERC-3009 nonce is derived from the MulticallAuthorization, so changing either one invalidates the pair.

{
  "status": "incomplete",
  "data": {
    "sign": {
      "signatureKind": "eip712",
      "domain": {
        "name": "RelayApprovalProxy",
        "version": "3.1",
        "chainId": 8453,
        "verifyingContract": "0x5567954cd026cebfe486062cb75848e0f1c12e58"
      },
      "types": {
        "MulticallAuthorization": [
          { "name": "from", "type": "address" },
          { "name": "relayer", "type": "address" },
          { "name": "msgValue", "type": "uint256" },
          { "name": "refundTo", "type": "address" },
          { "name": "nftRecipient", "type": "address" },
          { "name": "metadata", "type": "bytes" },
          { "name": "fundingIndex", "type": "uint256" },
          { "name": "calls", "type": "Call3Value[]" },
          { "name": "funding", "type": "FundingAuthorization[]" }
        ],
        "Call3Value": [
          { "name": "target", "type": "address" },
          { "name": "allowFailure", "type": "bool" },
          { "name": "value", "type": "uint256" },
          { "name": "callData", "type": "bytes" }
        ],
        "FundingAuthorization": [
          { "name": "token", "type": "address" },
          { "name": "from", "type": "address" },
          { "name": "value", "type": "uint256" },
          { "name": "validAfter", "type": "uint256" },
          { "name": "validBefore", "type": "uint256" }
        ]
      },
      "primaryType": "MulticallAuthorization",
      "value": {
        "from": "WALLET_ADDRESS",
        "relayer": "0x...",
        "msgValue": "0",
        "refundTo": "WALLET_ADDRESS",
        "nftRecipient": "WALLET_ADDRESS",
        "metadata": "0x...",
        "fundingIndex": 0,
        "calls": [
          { "target": "0x...", "allowFailure": false, "value": "0", "callData": "0x..." }
        ],
        "funding": [
          {
            "token": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
            "from": "WALLET_ADDRESS",
            "value": "1000000",
            "validAfter": 0,
            "validBefore": 1764948419
          }
        ]
      }
    },
    "post": {
      "endpoint": "/execute/permits",
      "method": "POST",
      "body": {
        "kind": "multicall-authorization",
        "requestId": "0x...",
        "api": "swap"
      }
    }
  }
}

Without the opt in, ERC-3009 permits keep using the v3 ApprovalProxy with a single signature during the transition. You can pass the flag before the switch: until then the step holds only the ERC-3009 item.

Permit2 permits need no change. On the v3.2 ApprovalProxy the RelayerWitness in the quote's typed data includes msgValue; if you build Permit2 messages yourself, take the witness from the quote.

Fees

You can choose to subsidize all destination fees by passing subsidizeFees: true to the quote api (this effectively subsidizes the first time approval). The user still needs to pay for the origin gas fee. For subsidizing fees you'll need to make sure you have fee sponsorship set up.

*See the full working example: byo-eoa-permit*

ERC-4337 Gasless

Use this approach if your app already uses ERC-4337 smart accounts. ERC-4337 UserOperations normally require gas fees, either paid by the sender or a paymaster. Set all gas fee fields to 0 and submit the handleOps call through the platform's /execute endpoint; a relayer broadcasts the transaction and pays gas.

originGasOverhead

Pass `originGasOverhead: 300000` in the /quote/v2 request. This tells Relay how much additional gas the UserOperation adds over a normal EOA transaction, used during simulation to accurately price the fee.

How it works

1. Get a quote

Call /quote/v2 with originGasOverhead: 300000 to get deposit transaction details

2. Build the UserOperation

Build a UserOperation that batches approve + deposit calls via executeBatch

3. Zero out gas fields

Set `maxFeePerGas` and `maxPriorityFeePerGas` to 0

4. Sign the UserOperation

Sign the UserOperation with the account owner key

5. Submit via Relay

Encode an EntryPoint.handleOps() call and submit it via POST /execute with subsidizeFees: true

6. Monitor

Poll /intents/status/v3 until the bridge completes

Fees

You can choose to subsidize origin fees: pass subsidizeFees: true to the execute api executionOptions.

You can choose to subsidize destination fees: pass subsidizeFees: true to the quote api.

You can choose to subsidize both or none of these. If not subsidized the user pays from the output token.

For subsidizing fees you'll need to make sure you have fee sponsorship set up.

*See the full working example: 4337-gasless*

7702 BatchExecutor

Use this approach when your app controls an embedded or custodial wallet and you want gasless execution with any ERC-20 token — not just permit-compatible ones. This leverages EIP-7702 to delegate the user's EOA to a BatchExecutor contract (Calibur or similar), enabling atomic approve + deposit in a single call.

originGasOverhead

Pass `originGasOverhead: 80000` in the /quote/v2 request. This tells Relay how much additional gas the Calibur execute() wrapper adds over the raw inner calls (EIP-712 signature verification, batch dispatch, nonce check). This is lower than ERC-4337's 300000 because there's no EntryPoint or UserOp validation overhead.

[!NOTE] The 80000 value is specific to Calibur. Different BatchExecutor contracts may have different gas overheads — adjust this value based on the implementation you use.

How it works

1. Check delegation

Check if the user's EOA is already delegated to the BatchExecutor via EIP-7702

2. Get a quote

Call /quote/v2 with originGasOverhead: 80000 to get deposit transaction details

3. Build the batch

Build a BatchedCall that atomically combines approve() and deposit()

4. Sign the authorization

Sign an EIP-7702 authorization (off-chain, no gas) delegating the EOA to the BatchExecutor

5. Submit via Relay

Submit via POST /execute targeting the user's EOA

Fees

You can choose to subsidize origin fees: pass subsidizeFees: true to the execute api executionOptions.

You can choose to subsidize destination fees: pass subsidizeFees: true to the quote api.

You can choose to subsidize both or none of these. If not subsidized the user pays from the output token.

For subsidizing fees you'll need to make sure you have fee sponsorship set up.

*See the full working example: 7702-batch-executor*

Gasless Swaps on Solana

Use this approach for Solana-origin trades, where permits do not exist. A sponsor wallet your app controls pays the transaction fees and rent, so your users need zero SOL: pass `depositFeePayer` in the quote, and your app co-signs each transaction as the fee payer.

You need a sponsor wallet funded with SOL (your backend holds its key; it never touches the client), a Relay API key, and @solana/web3.js on your backend.

Three restrictions from Solana Fee Sponsorship apply to every step below:

  1. `depositFeePayer` must be a different address from `user`. The quote API does not enforce this, so your app must.
  2. The sponsor signs the transaction before the user. Signing in the other order lets the user modify the transaction and drain the sponsor.
  3. Do not use `depositFeePayer` for same-chain Solana swaps with untrusted users. That combination is exploitable.

How it works

1. Get a quote with a sponsor

Call /quote/v2 with `depositFeePayer` set to your sponsor wallet.

curl -X POST "https://api.relay.link/quote/v2" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "user": "USER_SOLANA_ADDRESS",
    "recipient": "RECIPIENT_ADDRESS",
    "originChainId": 792703809,
    "originCurrency": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "destinationChainId": 8453,
    "destinationCurrency": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "tradeType": "EXACT_INPUT",
    "amount": "5000000",
    "depositFeePayer": "SPONSOR_SOLANA_ADDRESS"
  }'

The response's deposit step carries raw instructions, addressLookupTableAddresses, and a check endpoint for tracking.

2. Assemble the transaction

On your backend, build a versioned transaction from the returned instructions with the sponsor as `payerKey` (instruction data is hex-encoded).

import {
  AddressLookupTableAccount,
  Connection,
  PublicKey,
  TransactionInstruction,
  TransactionMessage,
  VersionedTransaction,
} from "@solana/web3.js";

const connection = new Connection(SOLANA_RPC_URL);
const item = quote.steps[0].items[0];

// 1. Rebuild the instructions returned by the quote
const instructions = item.data.instructions.map(
  (i) =>
    new TransactionInstruction({
      programId: new PublicKey(i.programId),
      keys: i.keys.map((k) => ({
        pubkey: new PublicKey(k.pubkey),
        isSigner: k.isSigner,
        isWritable: k.isWritable,
      })),
      data: Buffer.from(i.data, "hex"),
    })
);

// 2. Resolve the address lookup tables
const lookupTables = (
  await Promise.all(
    (item.data.addressLookupTableAddresses ?? []).map((address: string) =>
      connection
        .getAddressLookupTable(new PublicKey(address))
        .then((res) => res.value)
    )
  )
).filter((t): t is AddressLookupTableAccount => t !== null);

// 3. Compile with the sponsor as the fee payer
const message = new TransactionMessage({
  payerKey: new PublicKey(SPONSOR_SOLANA_ADDRESS),
  instructions,
  recentBlockhash: (await connection.getLatestBlockhash()).blockhash,
}).compileToV0Message(lookupTables);

const transaction = new VersionedTransaction(message);

3. Sign: sponsor first, then user

Sign with the sponsor key on your backend, then hand the partially signed transaction to the client for the user's signature.

// Backend: the sponsor signs first
transaction.sign([sponsorKeypair]);

// Client: the user signs the partially signed transaction
const signed = await userWallet.signTransaction(transaction);

4. Submit and track

Broadcast the signed transaction, then poll the quote's check endpoint until the request reaches a terminal status.

const signature = await connection.sendRawTransaction(signed.serialize());

// Poll until "success" or "failure"
const status = await fetch(
  `https://api.relay.link${item.check.endpoint}`
).then((r) => r.json());

A failed fill refunds automatically on the origin chain in the origin currency; see Refunds for the conditions.

Fees

`depositFeePayer` covers the origin transaction only: Solana transaction fees and rent for accounts the deposit creates. It is independent from the destination side and from your App Balance. To also sponsor destination gas or rent, use `subsidizeFees` and `subsidizeRent`, which draw from your App Balance instead of the sponsor wallet.

Each trade is one Solana deposit transaction, so the sponsor pays one fee per trade. If you also want fills to start before the deposit confirms, see Fast Fill.

See Solana Support for chain-specific parameters and transaction-size guidance.

This documentation is built and hosted on Mintlify, a developer documentation platform.

PreviousFast FillNextPrice Stabilization
Relay© 2026 Uneven Labs, Inc. All rights reserved.XGitHubSupport