This guide covers the breaking changes in SDK 0.15.0 and intent protocol v1.5, and how to update your integration.Documentation Index
Fetch the complete documentation index at: https://docs.trails.build/llms.txt
Use this file to discover all available pages before exploring further.
Breaking changes
paymasterUrls removed from TrailsWidget
The paymasterUrls prop has been removed from TrailsWidget. Remove it from your configuration — it has no replacement.
Widget lifecycle callback renames
AllTrailsWidget checkout lifecycle callbacks were renamed. The onCheckout prefix is gone.
| Before (0.13.x) | After (0.15.0) |
|---|---|
onCheckoutStart | onStart |
onCheckoutQuote | onQuote |
onCheckoutSignatureRequest | onSignRequest |
onCheckoutSignatureConfirmed | onSign |
onCheckoutSignatureRejected | onSignReject |
onCheckoutComplete | onSuccess |
onCheckoutError | onError |
onCheckoutStatusUpdate | onStatus |
onCheckoutApprovalRequest | onApproveRequest |
onCheckoutApprovalConfirmed | onApprove |
onCheckoutApprovalRejected | onApproveReject |
Deep imports from src removed
The package now only publishes dist. Any import paths going into src (e.g. 0xtrails/src/...) will break. Use root or subpath imports only.
Removed exports from the 0xtrails root
TrailsContracts— removed from0xtrails. Still available from@0xtrails/apiif needed.determineRefundCall— deleted entirely, no replacement.
useQuote restructured inputs
useQuote now takes structured from and to objects instead of flat props. The flat fields — fromTokenAddress, fromChainId, toTokenAddress, toChainId, toAddress, toApprove, toCalldata, swapAmount, tradeType — are all gone.
Trade type is now inferred: set from.amount for exact-input, to.amount for exact-output.
useQuote amount units changed
from.amount and to.amount are now human-readable decimal strings (e.g. "1.5"), not raw smallest-unit integers. They are scaled internally using parseUnits with the token’s decimals.
useTrailsSendTransaction: tokenAmount and fromAmount are now human-readable decimal strings. Native value remains raw wei bigint (wagmi-compatible).
useQuote to.calldata deprecated
Passing to.calldata on useQuote now logs a runtime deprecation warning and is mutually exclusive with actions and to.calls. Migrate to one of:
actions— composable DeFi primitives (lend,deposit,swap, etc.)to.calls— raw ABI-encodedCall[]for custom contracts
New features
Composable actions
useQuote gains an actions array for composing destination-side DeFi flows:
swap, lend, deposit, custom, assertCondition
- Use
lendfor lending markets (Aave),depositfor ERC-4626 vaults (Morpho, Yearn). - Discover
marketIdvalues withuseEarnMarketsfiltered bytype: "lending"ortype: "vault".
dynamic()— resolves to the intent wallet’s ERC-20 balance at execution timeself()— resolves toaddress(this)(the intent wallet underDELEGATECALL)
useQuote({ to: { calls } }) accepts raw Call[] (or Call[][]) for hand-rolled ABI-encoded transactions. Calls support dynamicAmountToken, hydrateEntries, and sweepTokens for runtime hydration and dust recovery.
New hooks
| Hook | Purpose |
|---|---|
useEarnMarkets | Discover lending and vault markets usable with lend / deposit |
useEarnBalances | Read a user’s balances across earn markets |
useEarnProviders | List supported earn protocols |
useResolveActions | Resolve ActionItem[] into encoded destination Call[] |
Mode-specific widget components
New typed wrappers exported from0xtrails/widget, each with a tighter prop shape than the generic TrailsWidget:
| Component | Use case |
|---|---|
Pay | Payments to a recipient — structured to/from, paymentMethod discriminator |
Fund | Fund a wallet from any source |
Swap | Swap-only flows |
Earn | Deposit and withdraw from earn markets |
Withdraw | Withdrawal flows |
TrailsWidget with mode="pay" | "fund" | "swap" | "earn" | "withdraw" continues to work. These wrappers are additive.
Other additions
intentProtocolVersionprop onTrailsWidget— pin the intent protocol version per-instance.fromAmountprop onTrailsWidget— pre-populate source amount in human-readable units (e.g."1.5").- Wallet-less quote preview — pass
walletAddresstouseQuotebefore a wallet is connected. - Auto-refresh expired quotes —
useQuotenow refetches automatically whenexpiresAtpasses, so the “Intent quote has expired” pre-signing error no longer appears. - New utilities:
erc20Utils,buildCall,buildApproveAndCall,buildErc20Approve,getAmountWithSlippage,resolveChainId,resolveChainName. - API helpers:
getEarnMarkets,getEarnBalances,getEarnProviders. - New error codes:
CHAIN_MISMATCH,CALL_RESOLUTION_FAILED. quoteKeysfactory exported for targeted React Query cache invalidation.0xtrails/hydratesubpath — Hydrate builders, selectors, and calldata helpers for v1.5 execution flows.
Summary checklist
Remove deleted exports
Remove
TrailsContracts from 0xtrails imports (use @0xtrails/api if still needed). Remove determineRefundCall usage entirely.Migrate useQuote to structured inputs
Replace flat props (
fromTokenAddress, fromChainId, etc.) with from: { token, chain, amount } and to: { token, chain, recipient, ... }.Update amount units
Change
from.amount / to.amount in useQuote and tokenAmount / fromAmount in useTrailsSendTransaction from raw wei to human-readable decimal strings.