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.

Fast Fill

Accelerate the destination fill of a cross-chain request

Fast Fill is a feature that allows you to accelerate the destination fill of a cross-chain request. This is useful if you want to speed up the completion of a bridge or swap operation before it's landed onchain.

Requirements

Before you can start fast filling requests, you need:

  1. An API key — Required to authenticate your fast fill requests. Create one in the Relay Dashboard; see API keys and Rate Limits for details.
  2. A Fee Sponsorship Wallet — A wallet that funds your app balance. Link one from the App Balance page in the Relay Dashboard by signing a message to prove ownership — no gas required. All API keys belonging to the same app share one Fee Sponsorship Wallet.
  3. Sufficient App Balance — Your app balance must have enough funds to cover fast fills and fee sponsorship. When a fast fill is triggered, a hold is placed against your app balance for the fill amount. This hold is released once the user's deposit lands onchain. While holds are active, they reduce the balance available for new fast fills and claims, but do not block fee sponsorship deductions.

One app balance for every route

Fast Fill uses a single app balance, held in USDC on Base, as collateral for all supported routes. You don't need to fund a separate balance on each origin or destination chain: a solver fills the destination with its own capital, and each hold is the USD value of the request's origin input, placed against your one app balance regardless of the chains involved. The balance belongs to your Fee Sponsorship Wallet, and every API key under the same app shares that wallet and its balance. See Funding Your App Balance to top it up.

Once you're set up, you can begin fast filling requests.

How to use it?

To Fast Fill a request you simply need to call the Fast Fill API with the request ID of the request you want to fast fill after you've submitted it onchain but before it finalizes. When a fast fill is triggered, the transaction is instantly filled on the destination chain and a hold is placed against your app balance for the fill amount. Once the user's deposit lands onchain and Relay indexes it, the hold is released.

If the origin deposit never lands

Fast Fill advances the destination funds before Relay confirms the origin deposit. If the deposit never lands, Relay does not release the hold. The sponsoring app bears the loss, and the held amount becomes a permanent debit against its app balance.

Example

This example demonstrates the full fast fill flow: getting a quote, submitting the transaction onchain, calling the fast fill API, and monitoring the status.

import { getClient, createClient } from "@relayprotocol/relay-sdk";
import { createWalletClient, createPublicClient, http } from "viem";
import { base } from "viem/chains";

// 1. Setup Wallet - Initialize your wallet using your preferred method
const account = {}; // Your wallet account (e.g., privateKeyToAccount, or injected wallet)
const wallet = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const publicClient = createPublicClient({
  chain: base,
  transport: http(),
});

// 2. Initialize the Relay client
createClient({
  baseApiUrl: "https://api.relay.link",
  source: "YOUR_APP_NAME",
});

// 3. Get a quote using the SDK
const quote = await getClient().actions.getQuote({
  chainId: 8453, // Base
  toChainId: 42161, // Arbitrum
  currency: "0x0000000000000000000000000000000000000000", // ETH
  toCurrency: "0x0000000000000000000000000000000000000000", // ETH
  amount: "100000000000000", // 0.0001 ETH
  tradeType: "EXACT_INPUT",
  wallet,
});

const requestId = quote.steps[0].requestId;
console.log(`Request ID: ${requestId}`);

// 4. Execute the quote and fast fill once the transaction is submitted
let txHash: string;

await getClient().actions.execute({
  quote,
  wallet,
  onProgress: async ({ currentStep, currentStepItem, txHashes }) => {
    // Once transaction is submitted, trigger fast fill immediately
    if (txHashes && txHashes.length > 0 && !txHash) {
      txHash = txHashes[0];
      console.log(`Transaction submitted: ${txHash}`);

      // 5. Call Fast Fill immediately after submitting (before waiting for confirmation)
      const fastFillResult = await getClient().actions.fastFill({
        requestId,
      });
      console.log("Fast fill initiated:", fastFillResult);
    }

    // Monitor progress
    if (currentStep && currentStepItem) {
      console.log(`Step: ${currentStep.action}, Status: ${currentStepItem.status}`);
    }
  },
});

console.log("Bridge completed successfully!");
import { createWalletClient, createPublicClient, http, type Hex } from "viem";
import { base } from "viem/chains";

// 1. Setup Wallet - Initialize your wallet using your preferred method
const account = {}; // Your wallet account (e.g., privateKeyToAccount, or injected wallet)
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const publicClient = createPublicClient({
  chain: base,
  transport: http(),
});

const API_KEY = "YOUR_API_KEY"; // Required for fast fill

// 2. Get a quote from the Relay API
const quoteResponse = await fetch("https://api.relay.link/quote/v2", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${API_KEY}`,
  },
  body: JSON.stringify({
    user: account.address,
    originChainId: 8453, // Base
    destinationChainId: 42161, // Arbitrum
    originCurrency: "0x0000000000000000000000000000000000000000", // ETH
    destinationCurrency: "0x0000000000000000000000000000000000000000", // ETH
    amount: "100000000000000", // 0.0001 ETH
    tradeType: "EXACT_INPUT",
  }),
});

const quote = await quoteResponse.json();
const step = quote.steps[0];
const item = step.items[0];
const requestId = step.requestId;

console.log(`Request ID: ${requestId}`);

// 3. Submit the transaction on-chain
const txHash = await walletClient.sendTransaction({
  to: item.data.to as Hex,
  data: item.data.data as Hex,
  value: BigInt(item.data.value),
});

console.log(`Transaction submitted: ${txHash}`);

// 4. Call the Fast Fill API immediately after submitting (before waiting for receipt)
// This accelerates the fill on the destination chain
const fastFillResponse = await fetch("https://api.relay.link/fast-fill", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${API_KEY}`,
  },
  body: JSON.stringify({
    requestId,
  }),
});

const fastFillResult = await fastFillResponse.json();
console.log("Fast fill initiated:", fastFillResult);

// 5. Now wait for the transaction receipt (origin chain confirmation)
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
console.log(`Origin transaction confirmed in block ${receipt.blockNumber}`);

// 6. Poll the status API to confirm the fill completed
const checkStatus = async (): Promise<any> => {
  const statusResponse = await fetch(
    `https://api.relay.link/intents/status/v3?requestId=${requestId}`,
    {
      headers: { "Authorization": `Bearer ${API_KEY}` },
    }
  );
  return statusResponse.json();
};

// Poll until success
let status = await checkStatus();
while (status.status !== "success" && status.status !== "failure") {
  console.log(`Status: ${status.status}`);
  await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait 1 second
  status = await checkStatus();
}

if (status.status === "success") {
  console.log("Bridge completed successfully!");
  console.log(`Destination tx: ${status.txHashes?.[0]}`);
} else {
  console.error("Bridge failed:", status);
}
[!NOTE] You can use the `maxFillAmountUsd` parameter to set a maximum USD value for a fast fill request. If the request's value exceeds this limit, the fast fill will not be executed. This is useful for managing risk and controlling exposure, especially when dealing with volatile assets or large transaction volumes.

Funding Your App Balance

There are two ways to deposit funds to your app balance:

Option 1: Use the Relay App UI

The simplest way to deposit funds is through the Relay App Balance UI. This provides a user-friendly interface for managing your balance.

Option 2: Direct On-Chain Deposit

You can programmatically fund your app balance through the Base address below. This app-balance flow uses a direct transfer to a solver address, not a Relay Protocol Depository deposit. Appending specific calldata identifies the account to credit.

How It Works

The platform indexes the transfer and credits your app balance using the appended calldata. This method uses a fixed 12-character prefix and suffix (012345abcdef) with the middle portion specifying which address to credit:

Calldata Format:

0x[prefix][address-to-credit][suffix]
  • Prefix: 012345abcdef
  • Address to Credit: The wallet address to deposit funds for (use 0000000000000000000000000000000000000000 for msg.sender)
  • Suffix: 012345abcdef

Examples

CalldataBehavior
0x012345abcdef0000000000000000000000000000000000000000012345abcdefCredits msg.sender
0x012345abcdefd5c0d17ccb9071d27a4f7ed8255f59989b9aee0d012345abcdefCredits 0xd5c0d17ccb9071d27a4f7ed8255f59989b9aee0d
[!TIP] The ability to specify a different address is useful for building auto-topup systems or having more granular control over which accounts receive deposits.

App Balance Funding Address

Use this address only for the app-balance funding flow described here. For transaction deposits, use the steps returned by the quote API instead.

NetworkAddress
Base0xf70da97812cb96acdf810712aa562db8dfa3dbef

TypeScript Example

import { erc20Abi, encodeFunctionData, createWalletClient } from 'viem'
import { base } from 'viem/chains'

const BASE_USDC_ADDRESS = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913' as const
const APP_BALANCE_FUNDING_ADDRESS = '0xf70da97812cb96acdf810712aa562db8dfa3dbef' as const
const REQUEST_ID_PREFIX = '012345abcdef'

const walletClient = createWalletClient({
  chain: base,
  transport: custom(window.ethereum!),
})

const [userAddress] = await walletClient.getAddresses()

const amountInWei = '100000000' // 100 USDC

// Encode the transfer function call
const transferData = encodeFunctionData({
  abi: erc20Abi,
  functionName: 'transfer',
  args: [APP_BALANCE_FUNDING_ADDRESS, amountInWei]
})

// Add custom calldata to credit the wallet address
const customCalldata =
  `${REQUEST_ID_PREFIX}${userAddress.slice(2)}${REQUEST_ID_PREFIX}` as `0x${string}`

const hash = await walletClient.sendTransaction({
  to: BASE_USDC_ADDRESS,
  data: `${transferData}${customCalldata}`,
  account: userAddress,
  chain: base
})

Checking Your App Balance

Verify your available balance using the Get App Fee Balances API:

curl --location 'https://api.relay.link/app-fees/{your-wallet-address}/balances'
{
  "currency": {
    "chainId": 8453,
    "address": "0x0000000000000000000000000000000000000000",
    "symbol": "USDC",
    "name": "USDC",
    "decimals": 6
  },
  "amount": "75021651210714015",
  "amountFormatted": "0.075021651210714015",
  "amountUsd": "116.235557",
  "minimumAmount": "75021651210714015"
}

Caveats

  • Slippage may lead to a surplus or shortage in your app balance. If you have a good estimate of the final amount you can use the `solverInputCurrencyAmount` parameter to specify the exact amount of input currency you want to use for the fill, thus minimizing slippage.
  • We recommend protecting your API key on the backend by not exposing it to the client.
  • Fast Fill holds, outstanding fast fills that are waiting to be indexed on the destination chain, reduce the balance available for new fast fills and claims, but do not block fee sponsorship.

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

PreviousGasless ExecutionNextGasless Swaps
Relay© 2026 Uneven Labs, Inc. All rights reserved.XGitHubSupport