This guide covers two integration paths: Passkey Signing where the widget handles passkey-based signing for you, and Metadata Mode where you receive transaction metadata to sign with your own stack. Both modes use the same Widget component.Documentation Index
Fetch the complete documentation index at: https://docs.relayer.fi/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites: wagmi providers configured per Installation. An understanding of your integration mode — see the Overview for architecture details.
Passkey Signing Integration
In Passkey Signing, the widget manages the full transaction lifecycle: prepare, sign via passkey, and confirm. You provide a wallet adapter and an action URL or widget ID.Create the adapter
Use the The Widget component handles the entire signing flow automatically. When a user initiates an action, the widget calls
useWagmiAdapter hook and render a Widget with your action URL:src/components/SwapWidget.tsx
POST /v1/transactions/prepare to get an unsigned transaction, prompts the user with a passkey biometric challenge, and then calls POST /v1/transactions/confirm with the signed result.User signs with passkey
The widget renders a biometric prompt (Face ID, fingerprint, or security key). Signing happens inside a secure enclave — the private key never leaves the hardware-protected environment. No additional code is needed on your side.
Metadata Mode Integration
In Metadata Mode, the widget handles UI and user input, but signing is delegated to your stack. You receive transaction metadata (routing, calldata, gas estimates) and handle signing and broadcast yourself.Render the Widget
The Widget renders the same UI as Passkey Signing. Provide a wallet adapter and action URL:The Widget renders the same UI, but in Metadata Mode the signing step is delegated to your infrastructure.
src/components/SwapWidget.tsx
Handle transaction metadata
When your integrator is configured for Metadata Mode, the Relayer API returns routing and calldata for your application to sign:
In Metadata Mode, the widget UI still renders action cards and handles user input. The difference is in how signing is handled — your backend receives the transaction parameters instead of completing the flow inside the widget.
Widget Examples
Widget Kit ships first-party widgets for the canonical protocols Relayer supports. All examples use the same Widget component pattern — only the action URL differs.- Swap
- Transfer
- Crosschain Transfer
- Crosschain Bridge
POST /v1/action/builders/swap and executed via /v1/action/execute/swap/*.Embedder: End-User Onboarding
For Embedder integrators using Passkey Signing, each end user gets their own wallet and passkey. The onboarding flow:User registers passkey
When a new end user first interacts with a widget, they are prompted to create a passkey (biometric or security key). This registers a WebAuthn credential tied to your application’s wallet workspace.
Wallet creation
A wallet is automatically created in the user’s workspace. The private key is generated and stored inside a hardware-secured enclave — neither you nor Relayer can access it.
WidgetProps Reference
| Prop | Type | Required | Description |
|---|---|---|---|
adapter | WidgetAdapter | Yes | Wallet adapter — use useWagmiAdapter() or createWagmiAdapter(config) |
url | string | Yes* | URL to fetch widget metadata from |
metadata | ValidatedMetadata | Yes* | Pass pre-validated metadata instead of url |
securityState | WidgetSecurityState | Yes (with metadata) | Security context for pre-validated flow |
stylePreset | 'x' | undefined | No | Apply Twitter/X visual preset |
enableAnalytics | boolean | No | Track interaction events (default: true) |
player | boolean | No | Enable player mode for embedded contexts |
className | string | No | Additional CSS class on the root element |
startDisabled | boolean | No | Render widget in disabled state |
Either
url or metadata + securityState must be provided, not both.Theming
Widgets readdata-x-theme="dark|light" from the document root to determine the active theme.
Automatic Theme Detection (Twitter/X)
CallapplyXTheme() once on mount to read the Twitter/X night mode cookie and set the theme attribute automatically:
React Hook
Use theuseTheme hook to read the current theme in your components:
Manual Override
Set the attribute directly ondocument.documentElement for custom toggle UIs:
Twitter/X stylePreset
PassstylePreset="x" to apply the Twitter/X visual preset — rounded card, correct font sizing, consistent with the embedded appearance on social platforms:
Platform Observers
The library ships observers for automatic widget detection on Twitter/X, YouTube, and Twitch. These observers scan the DOM for canonical action URLs and render Widget components inline. For custom embedding in your own app, use theWidget component directly as shown above. See the Widget Kit Overview for architecture details.
Next Steps
SDK Reference
The metadata schema for canonical protocols.
Widget Kit Overview
Package ecosystem and architecture.