swap, lend, deposit, assertCondition, custom — and pass them to useQuote or useTrailsSendTransaction. Trails takes care of quoting, bridging, and executing.
Two browser integration styles are supported:
- Quote-first flow — use
useQuotewithactionswhen you want to build your own UI and preview a quote before sending it. - Send-transaction flow — use
useTrailsSendTransactionwithactionswhen you want to trigger the Trails Widget.
What Composable Actions are
A Trails intent is a two-phase transaction:- The user signs once on the origin chain. Their funds are bridged and/or swapped to an intent wallet on the destination chain.
- Trails then runs the destination calls from that intent wallet.
useQuote or useTrailsSendTransaction.
Available action builders
Import the builders you need directly from0xtrails:
| Builder | What it does |
|---|---|
swap({...}) | On-chain swap via Uniswap V3 or SushiSwap V3 |
lend({...}) | Supply into a money-market (Aave, Compound, Fluid, …) |
deposit({...}) | Deposit into an ERC-4626 / vault-style market (Morpho, Yearn, SummerFi, Sky, …) |
assertCondition({...}) | On-chain guard (balance >= X, deadline > now, …) — whole batch reverts if false |
custom({...}) | Wrap an arbitrary contract call (escape hatch) |
Demo
Try composable actions in the SDK sandbox.Where to go next
- Quickstart — a multi-step example combining
deposit,swap,assertCondition, andlendin a single intent. - Building Actions — the full builder API, one section per builder.
- Dynamic Values —
dynamic()andself()for runtime amount / address resolution. - Markets & Providers — discover markets and providers.
- ERC-20 Helpers — token registry, calldata builders, slippage helper.
- Supported Chains — chain identifiers and swap provider coverage.