Skip to main content
The Cross-chain SDK is a React library with ready-made widgets for payments, funding, earn, and swaps, plus hooks for building your own UI. It runs in the browser and authenticates with your OMS publishable key (pk_...) from the OMS Dashboard.

Install

The SDK requires React 18 or later, viem 2, and @tanstack/react-query 5.

Add a widget

Widgets need no provider. Import one from 0xtrails/widget, pass your key, and set the destination.
Widgets open as a modal by default. Set renderInline to embed one in the page. For appearance and callbacks, see configuration.

Set up the provider for hooks

Hooks such as useQuote and useEarnMarkets need TrailsProvider above them, inside a QueryClientProvider.
See React hooks.

Connect your users’ wallets

Widgets include their own wallet connection. If your app already manages wallets, pass them in with the adapters prop so the widget uses the same session. For apps using wagmi, install @0xtrails/adapter-wagmi and pass wagmiAdapter. For any other EIP-1193 provider, use evmAdapter from 0xtrails/widget.

Without React

For sites without React, see the CDN example.