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.

RelayBridge

Solidity API

IRelayBridge

Interface for the RelayBridge contract

*Defines the bridge function for cross-chain asset transfers*

bridge

function bridge(uint256 amount, address recipient, address poolAsset, uint256 poolGas, bytes extraData) external payable returns (uint256 nonce)

Bridges an asset (ERC20 token or native currency) from the origin chain to a pool chain

Parameters

NameTypeDescription
amountuint256Amount of asset units to bridge (ERC20 tokens or native currency)
recipientaddressAddress on the pool chain to receive the bridged asset
poolAssetaddressAddress of the asset on the pool chain to bridge to
poolGasuint256Gas limit for the pool chain transaction
extraDatabytesExtra data passed to the bridge proxy

Return Values

NameTypeDescription
nonceuint256Unique identifier for this bridge transaction

RelayBridge

RelayBridge contract enabling cross-chain bridging via Hyperlane

*Bridges assets from an origin chain to a configured pool chain*

BridgeTransaction

*Internal struct capturing parameters for a bridge transaction*

struct BridgeTransaction {
  uint256 amount;
  address recipient;
  address poolAsset;
  uint256 poolGas;
  bytes extraData;
  uint256 nonce;
  bytes txParams;
  uint32 poolChainId;
  bytes32 poolId;
}

BridgingFailed

error BridgingFailed(uint256 nonce)

Error for failed bridging operations

Parameters

NameTypeDescription
nonceuint256The nonce of the failed transaction

InsufficientValue

error InsufficientValue(uint256 received, uint256 expected)

Error for insufficient native value sent to cover fees or asset

Parameters

NameTypeDescription
receiveduint256The amount of native currency received
expecteduint256The amount of native currency expected

FailedFeeRefund

error FailedFeeRefund(uint256 value)

Error when refunding leftover native value fails

Parameters

NameTypeDescription
valueuint256The amount of native currency that failed to refund

transferNonce

uint256 transferNonce

Counter for assigning unique nonces to bridge transactions

*Incremented with each bridge transaction to ensure uniqueness*

ASSET

address ASSET

Asset address on the origin chain being bridged (address(0) for native currency)

*Immutable to ensure the bridge always handles the same asset*

BRIDGE\_PROXY

contract BridgeProxy BRIDGE_PROXY

BridgeProxy contract handling origin-chain transfer logic

*Uses delegatecall to execute custom bridge logic*

HYPERLANE\_MAILBOX

address HYPERLANE_MAILBOX

Hyperlane Mailbox contract for cross-chain messaging

*Used to dispatch messages to the pool chain*

BridgeInitiated

event BridgeInitiated(uint256 nonce, address sender, address recipient, address ASSET, address poolAsset, uint256 amount, contract BridgeProxy BRIDGE_PROXY)

Emitted when a bridge transaction is initiated on the origin chain

Parameters

NameTypeDescription
nonceuint256Nonce of the transaction
senderaddressAddress on the origin chain that initiated the bridge
recipientaddressAddress on the pool chain to receive assets
ASSETaddressAsset address on the origin chain (address(0) for native currency)
poolAssetaddressAsset address on the pool chain (address(0) for native currency)
amountuint256Amount of asset units bridged
BRIDGE\_PROXYcontract BridgeProxyBridgeProxy used

BridgeExecuted

event BridgeExecuted(uint256 nonce)

Emitted after a bridge transaction is executed on the pool chain

*This event would be emitted by the pool chain contract*

Parameters

NameTypeDescription
nonceuint256Nonce of the executed transaction

BridgeCancelled

event BridgeCancelled(uint256 nonce)

Emitted if a bridge transaction is cancelled prior to execution

*This event would be emitted if a bridge is cancelled*

Parameters

NameTypeDescription
nonceuint256Nonce of the cancelled transaction

constructor

constructor(address asset, contract BridgeProxy bridgeProxy, address hyperlaneMailbox) public

Initializes the RelayBridge with asset and infrastructure contracts

*All parameters are immutable after deployment*

Parameters

NameTypeDescription
assetaddressAsset address on the origin chain to bridge (0 for native currency)
bridgeProxycontract BridgeProxyBridgeProxy contract for origin-chain transfers
hyperlaneMailboxaddressHyperlane Mailbox address for messaging

getFee

function getFee(uint256 amount, address recipient, uint256 poolGas) external view returns (uint256 fee)

Calculates the fee required in native currency to dispatch a cross-chain message

*Uses Hyperlane's quoteDispatch to estimate the cross-chain messaging fee*

Parameters

NameTypeDescription
amountuint256Amount of asset units to bridge
recipientaddressAddress on the pool chain that will receive the bridged asset
poolGasuint256Gas limit for the pool chain transaction

Return Values

NameTypeDescription
feeuint256Required fee in native currency for dispatch

bridge

function bridge(uint256 amount, address recipient, address poolAsset, uint256 poolGas, bytes extraData) external payable returns (uint256 nonce)

Bridges an asset (ERC20 token or native currency) from the origin chain to a pool chain

\_Executes a cross-chain bridge transaction with the following steps:

  1. Validates sufficient payment for fees (and asset amount if native)
  2. Transfers the asset from sender to this contract (if ERC20)
  3. Executes bridge logic via delegatecall to BRIDGE\_PROXY
  4. Dispatches cross-chain message via Hyperlane
  5. Refunds any excess native currency to sender\_

Parameters

NameTypeDescription
amountuint256Amount of asset units to bridge (ERC20 tokens or native currency)
recipientaddressAddress on the pool chain to receive the bridged asset
poolAssetaddressAddress of the asset on the pool chain to bridge to
poolGasuint256Gas limit for the pool chain transaction
extraDatabytesExtra data passed to the bridge proxy

Return Values

NameTypeDescription
nonceuint256Unique identifier for this bridge transaction

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

PreviousRelayBridgeFactoryNextChangelog
Relay© 2026 Uneven Labs, Inc. All rights reserved.XGitHubSupport