Skip to content

Commit 82bbdb8

Browse files
JamesLawtonclaude
andauthored
docs: update SDK provider setup for 0.16 wagmi-opt-in 2026-05-26 (#89)
* docs: update SDK provider setup for 0.16 wagmi-opt-in 2026-05-26 Reflect the `0xtrails@0.16.0` change that makes wagmi opt-in via `@0xtrails/adapter-wagmi`. The hooks reference still showed `WagmiProvider` as a required wrapper. - sdk/hooks.mdx: split the provider-setup section into "Apps without wagmi" (default in 0.16) and "Apps with wagmi" (use the adapter). Drop the stale "future SDK release" note since the bundled runtime now exists. - examples/wallet-compatibility.mdx: add a 0.16 note clarifying that wagmi is no longer required and that the existing patterns apply when sharing an existing wagmi session. Source: trails @ production, 0xtrails@0.16.0 release notes; see the published changelog at sdk/changelog/0xtrails-0.16.0.mdx. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: update resources for 0.16 chain support 2026-05-26 - Remove Xai (660279) and Blast (81457) from mainnet chain tables; both were dropped from `0xtrails@0.16.0` SDK chain support. - Add HyperEVM (999) to the chain tables; added to SDK `ALL_CHAINS` and resolver in 0.16. - Add missing Etherlink and Berachain entries to the fees snippet and the composable-actions chain identifier list so the docs match `SupportedChainName` in `widget/shared/resolution.ts`. Source: trails @ production, packages/0xtrails/src/chainRegistry.ts and packages/0xtrails/src/widget/shared/resolution.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: stop tracking package-lock.json Picked up accidentally during the docs automation run; the repo uses pnpm and node_modules is already gitignored. Add package-lock.json to .gitignore so future automation runs don't re-include it. * docs: update examples for 0xtrails@0.16.0 wagmi opt-in In 0.16, Trails no longer requires wagmi by default. Add adapter-wagmi callouts and update the x402 Providers example to wire wagmiAdapter through TrailsProvider so the existing wagmi-based snippets work in 0.16+. - examples/refunds.mdx, examples/tokens-chains-prices.mdx, examples/transaction-history.mdx, use-cases/swap.mdx, sdk/modes/swap.mdx: add adapter-wagmi callouts on the wagmi-using snippets - examples/x402.mdx: extend the Providers.tsx example to wrap in TrailsProvider with wagmiAdapter, and add the @0xtrails/adapter-wagmi install step - api-reference/introduction.mdx: clarify the wagmi hooks comment to reference the SDK's usePublicClient and the wagmi adapter * docs: align modes & widget typing with 0xtrails@0.16.0 In 0.16 the widget props were tightened: `from.currency` is reserved for ISO 4217 fiat codes on the fiat-onramp arm, `from.token` is ERC-20 only, and the destination prop name is `to.token` / `to.defaultToken` (not `currency` / `defaultCurrency`). - sdk/modes/swap.mdx, sdk/modes/earn.mdx, sdk/modes/withdraw.mdx: rewrite the Source prop tables to reflect the discriminated union on `paymentMethod` (crypto arms expose `from.token`, fiat arm exposes `from.currency`). Add new 0.16 destination-support props (`supportedChains`, `supportedTokensByChain`, `originSupportedChains`, `originSupportedTokensByChain`). - sdk/modes/fund.mdx, sdk/modes/pay.mdx: rename destination prop rows (`to.currency` -> `to.token`, `to.defaultCurrency` -> `to.defaultToken`) and add the new destination-support props on fund. - All widget code samples in sdk/modes/*, sdk/get-started.mdx, sdk/quote-providers.mdx, use-cases/swap.mdx: rename `currency: "<TOKEN>"` -> `token: "<TOKEN>"` and `defaultCurrency:` -> `defaultToken:` except for ISO 4217 fiat codes on the credit-card flow examples in fund.mdx, which stay as `currency`. - sdk/configuration.mdx: drop removed `wagmiConnectors` / `decoupleWagmi` props and document the new `adapters` prop for wallet runtime adapters. * docs: document new 0xtrails@0.16.0 SDK surface Adds reference docs for the public exports introduced in 0.16 that weren't covered by the wagmi-migration changelog page. - Adapters: document `evmAdapter` (built-in EIP-1193 helper) and link to `wagmiAdapter` from @0xtrails/adapter-wagmi. - Public clients: `usePublicClient` and `usePublicClientGetter` for getting viem PublicClients via the Sequence node gateway. - Composable actions: `useResolveActions` for resolving action arrays into the concrete Call[] used by useTrailsSendTransaction. - Fiat: `useFiatCurrencyList` and `useExchangeRate` for fiat-aware UI. - Onramp: `useMeldPaymentMethods` and `useMeldServiceProviders` for building custom on-ramp UI on top of Mesh. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bc6dfb1 commit 82bbdb8

20 files changed

Lines changed: 377 additions & 95 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
scripts/node_modules
22
node_modules
33
.env
4-
.DS_Store
4+
.DS_Storepackage-lock.json

api-reference/introduction.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ import { createWalletClient, createPublicClient, http, encodeFunctionData, erc20
152152
import { privateKeyToAccount } from 'viem/accounts';
153153
import { base, arbitrum, mainnet } from 'viem/chains';
154154

155-
// Create clients (or use wagmi hooks: useWalletClient, usePublicClient)
155+
// Create clients (in React, you can also use the SDK's usePublicClient hook, or
156+
// useWalletClient from wagmi when paired with @0xtrails/adapter-wagmi)
156157
const walletClient = createWalletClient({
157158
account: privateKeyToAccount('0x...'),
158159
chain: arbitrum, // Set to the origin chain
@@ -215,7 +216,8 @@ import { createWalletClient, createPublicClient, http, encodeFunctionData, erc20
215216
import { privateKeyToAccount } from 'viem/accounts';
216217
import { base, arbitrum, mainnet } from 'viem/chains';
217218

218-
// Create clients (or use wagmi hooks: useWalletClient, usePublicClient)
219+
// Create clients (in React, you can also use the SDK's usePublicClient hook, or
220+
// useWalletClient from wagmi when paired with @0xtrails/adapter-wagmi)
219221
const walletClient = createWalletClient({
220222
account: privateKeyToAccount('0x...'),
221223
chain: arbitrum, // Set to the origin chain

examples/refunds.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ While Trails automatically refunds upon transaction failures, there may be edge
4646

4747
### Basic Usage
4848

49+
<Note>
50+
This example uses wagmi hooks (`useWalletClient`, `useAccount`). Since [`0xtrails@0.16.0`](/sdk/changelog/0xtrails-0.16.0), wagmi is opt-in — install `@0xtrails/adapter-wagmi` and pass `wagmiAdapter({ wagmiConfig })` in `adapters` for these hooks to resolve. See [SDK Hooks](/sdk/hooks#apps-with-wagmi).
51+
</Note>
52+
4953
```tsx
5054
import { useIntentRecover } from '0xtrails'
5155
import { useWalletClient, useAccount } from 'wagmi'

examples/tokens-chains-prices.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ For fetching prices without balances, use the [GetTokenPrices API](/api-referenc
5959

6060
Build a chain/token selector with live prices:
6161

62+
<Note>
63+
The `useAccount` import below is from wagmi. Since [`0xtrails@0.16.0`](/sdk/changelog/0xtrails-0.16.0), wagmi is opt-in — install `@0xtrails/adapter-wagmi` and configure `wagmiAdapter` to use wagmi hooks alongside Trails. See [SDK Hooks](/sdk/hooks#apps-with-wagmi).
64+
</Note>
65+
6266
```tsx
6367
import { useState } from 'react'
6468
import { useSupportedChains, useSupportedTokens, useTokenBalances } from '0xtrails'

examples/transaction-history.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ icon: 'clock'
66

77
Trails comes with a built in high-performant indexer which you can leverage seamlessly to retrieve information about a user's transaction history.
88

9+
<Note>
10+
The examples below import `useAccount` from wagmi. Since [`0xtrails@0.16.0`](/sdk/changelog/0xtrails-0.16.0), wagmi is opt-in — install `@0xtrails/adapter-wagmi` and configure `wagmiAdapter` to use wagmi hooks alongside Trails. See [SDK Hooks](/sdk/hooks#apps-with-wagmi).
11+
</Note>
12+
913
## Wallet Transaction History
1014

1115
Query a user's transaction history for a specific chain using their connected wallet address:

examples/wallet-compatibility.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ description: 'Comprehensive wallet integration support and compatibility across
44
icon: 'wallet'
55
---
66

7-
Trails works with virtually all wallets through wagmi connectors, including embedded wallets like Privy, smart contract wallets like Sequence, or injected EOAs like MetaMask. This enables complex transaction orchestration cross-chain in 1-click without requiring wallets to natively support ERC-7702.
7+
Trails works with virtually all wallets, including embedded wallets like Privy, smart contract wallets like Sequence, or injected EOAs like MetaMask. This enables complex transaction orchestration cross-chain in 1-click without requiring wallets to natively support ERC-7702.
8+
9+
<Note>
10+
Since `0xtrails@0.16.0`, Trails uses its own built-in EVM runtime by default — wagmi is no longer required. The patterns below still work for apps that share an existing wagmi session, via the `@0xtrails/adapter-wagmi` package. See the [0.16 release notes](/sdk/changelog/0xtrails-0.16.0) for the migration.
11+
</Note>
812

913
## How It Works
1014

11-
Trails automatically detects and uses any wagmi connectors configured in your application. Simply wrap your app with a wagmi provider and include the desired wallet connectors in your config.
15+
Trails detects and uses connected wallets through its built-in runtime, or through wagmi connectors when you install the wagmi adapter. For apps that already use wagmi, wrap your app with a wagmi provider, include the desired wallet connectors in your config, and pass `wagmiAdapter({ wagmiConfig })` to `TrailsProvider`.
1216

1317
## Basic Wagmi Setup
1418

examples/x402.mdx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ Trails + x402 creates a powerful payment flow:
8787
pnpm add 0xtrails x402-axios axios
8888
```
8989

90+
This example pairs Trails with an existing wagmi + RainbowKit setup. Since [`0xtrails@0.16.0`](/sdk/changelog/0xtrails-0.16.0), wagmi is opt-in for Trails — also install `@0xtrails/adapter-wagmi` so Trails can share the wagmi session:
91+
92+
```bash
93+
pnpm add @0xtrails/adapter-wagmi
94+
```
95+
9096
#### 2. Configure Providers
9197

9298
<CodeGroup>
@@ -95,6 +101,8 @@ import { WagmiProvider, createConfig, http } from "wagmi"
95101
import { RainbowKitProvider } from "@rainbow-me/rainbowkit"
96102
import { QueryClientProvider, QueryClient } from "@tanstack/react-query"
97103
import { mainnet, base } from "wagmi/chains"
104+
import { TrailsProvider } from "0xtrails"
105+
import { wagmiAdapter } from "@0xtrails/adapter-wagmi"
98106

99107
const config = createConfig({
100108
chains: [mainnet, base],
@@ -107,13 +115,17 @@ const config = createConfig({
107115

108116
const queryClient = new QueryClient()
109117

118+
const adapters = [wagmiAdapter({ wagmiConfig: config })]
119+
110120
export function Providers({ children }: { children: React.ReactNode }) {
111121
return (
112122
<WagmiProvider config={config}>
113123
<QueryClientProvider client={queryClient}>
114-
<RainbowKitProvider>
115-
{children}
116-
</RainbowKitProvider>
124+
<TrailsProvider config={{ trailsApiKey: "YOUR_TRAILS_API_KEY", adapters }}>
125+
<RainbowKitProvider>
126+
{children}
127+
</RainbowKitProvider>
128+
</TrailsProvider>
117129
</QueryClientProvider>
118130
</WagmiProvider>
119131
)

resources/supported-chains.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ Trails supports the following mainnet chains with full cross-chain routing capab
1818
| Avalanche | 43114 | AVAX |
1919
| BNB Chain | 56 | BNB |
2020
| Gnosis | 100 | xDAI |
21-
| Blast | 81457 | ETH |
2221
| Arbitrum Nova | 42170 | ETH |
2322
| Ape Chain | 33139 | APE |
2423
| B3 | 8333 | ETH |
2524
| Soneium | 1868 | ETH |
26-
| Xai | 660279 | XAI |
2725
| Katana | 747474 | ETH |
2826
| Etherlink | 42793 | XTZ |
2927
| Berachain | 80094 | BERA |
3028
| Sonic | 146 | S |
3129
| Monad | 143 | MON |
3230
| Somnia | 5031 | SOMI |
31+
| HyperEVM | 999 | HYPE |
3332

3433
<Note>
3534
Berachain, Sonic, Monad, and Somnia are newly integrated chains shipping with v1.5. Route coverage and supported token pairs will expand over time.

sdk/composable-actions/supported-chains.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Chain identifiers are either **names** or **chain IDs**. The following names are
1010

1111
```
1212
apechain, arbitrum, arbitrum-nova, avalanche, avalanche-c, b3,
13-
base, binance, bsc, bnb, etherlink, gnosis, hyperevm, katana,
14-
mainnet, ethereum, monad, optimism, polygon, soneium, somnia,
15-
sonic, xai
13+
base, berachain, binance, bsc, bnb, etherlink, gnosis, hyperevm,
14+
katana, mainnet, ethereum, monad, optimism, polygon, soneium,
15+
somnia, sonic
1616
```
1717

1818
Chain IDs (e.g. `8453` for Base, `42161` for Arbitrum) work interchangeably.

sdk/configuration.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ appMetadata={{
3838
|------|------|-------------|
3939
| `walletConnectProjectId` | `string` | WalletConnect project ID |
4040
| `walletOptions` | `string[]` | Wallet connector IDs to show (e.g. `["metamask", "walletconnect"]`) |
41-
| `wagmiConnectors` | `Connector[]` | Custom wagmi connectors |
42-
| `decoupleWagmi` | `boolean` | Decouple from external wagmi provider |
43-
| `hideDisconnect` | `boolean` | Hide the disconnect button |
41+
| `adapters` | `TrailsAdapterEntry[]` | Explicit wallet runtime adapters. Use `wagmiAdapter` from [`@0xtrails/adapter-wagmi`](/sdk/hooks#apps-with-wagmi) to share an existing wagmi session, or build your own with `evmAdapter`. |
4442
| `hideAddWallet` | `boolean` | Hide "Add wallet" option |
4543
| `isSmartWallet` | `boolean` | Signal that the connected wallet is a smart wallet |
4644

45+
<Note>
46+
The `wagmiConnectors` and `decoupleWagmi` props were removed in [`0xtrails@0.16.0`](/sdk/changelog/0xtrails-0.16.0). Wagmi is no longer required by default — pass adapters via the `adapters` prop instead.
47+
</Note>
48+
4749
#### Route options
4850

4951
| Prop | Type | Description |

0 commit comments

Comments
 (0)