Configuration Options
Trails is easy to get started, however we have deep configuration options to address most use cases.Core Props
| Prop | Type | Required | Description |
|---|---|---|---|
apiKey | string | No | Your project access key provided by Trails |
mode | "pay" | "fund" | "earn" | "swap" | "receive" | Yes | Widget operation mode |
toAddress | string | No | Destination address for payments |
toAmount | string | No | Exact amount for payments (used in pay mode) |
toChainId | number | string | No | Destination chain ID |
toToken | string | No | Destination token symbol or contract address |
toCalldata | string | No | Custom calldata for contract interactions |
UI & Rendering Options
| Prop | Type | Required | Description |
|---|---|---|---|
renderInline | boolean | No | Render widget inline instead of as a modal (default: false) |
children | React.ReactNode | No | Custom button content (when not renderInline) |
buttonText | string | No | Custom text for the trigger button (auto-generated if not provided) |
theme | "light" | "dark" | "auto" | No | Color theme; auto follows system preference (default: "auto") |
customCss | string | Record<string, string> | No | Custom CSS styles to apply to the component |
Wallet & Connection Options
| Prop | Type | Required | Description |
|---|---|---|---|
walletConnectProjectId | string | No | WalletConnect project ID for WalletConnect integration |
Transaction Options
| Prop | Type | Required | Description |
|---|---|---|---|
paymasterUrls | Array<{ chainId: number; url: string }> | No | Configure per-chain paymaster endpoints for gasless transactions |
quoteProvider | "auto" | "lifi" | "relay" | "cctp" | No | Preferred quote provider (default: "auto"). "auto" automatically selects best provider, "lifi" uses LiFi aggregator for multi-source routing, "relay" uses Relay for fast direct transfers, "cctp" uses Circle’s CCTP for native USDC transfers |
slippageTolerance | number | string | No | Slippage tolerance for swaps (e.g., 0.005 for 0.5%) |
Event Handlers
| Prop | Type | Required | Description |
|---|---|---|---|
onOriginConfirmation | (data: { txHash: string; chainId: number; sessionId: string }) => void | No | Called when origin transaction is confirmed |
onDestinationConfirmation | (data: { txHash: string; chainId: number; sessionId: string }) => void | No | Called when destination transaction is confirmed |
onCheckoutStart | (data: { sessionId: string }) => void | No | Called when checkout process starts |
onCheckoutQuote | (data: { sessionId: string; quote: any }) => void | No | Called when quote is received |
onCheckoutComplete | (data: { sessionId: string }) => void | No | Called when checkout completes successfully |
onCheckoutError | (data: { sessionId: string; error: string }) => void | No | Called when checkout encounters an error (including user rejection) |
onCheckoutStatusUpdate | (data: { sessionId: string; transactionStates: TransactionState[] }) => void | No | Called when transaction status updates |
Smart Contract Interactions
Execute custom contract calls with payments:Event Handling Examples
Complete Event Handling
Handling User Rejection
User rejection occurs when a user declines to sign a transaction in their wallet. This is handled through theonCheckoutError callback: