Skip to main content
Composable Actions are a small, typed DSL for describing what should happen on the destination chain of a Trails intent. Instead of hand-encoding calldata, you build a list of high-level steps — 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:
  1. Quote-first flow — use useQuote with actions when you want to build your own UI and preview a quote before sending it.
  2. Send-transaction flow — use useTrailsSendTransaction with actions when you want to trigger the Trails Widget.

What Composable Actions are

A Trails intent is a two-phase transaction:
  1. The user signs once on the origin chain. Their funds are bridged and/or swapped to an intent wallet on the destination chain.
  2. Trails then runs the destination calls from that intent wallet.
Composable Actions are a typed builder for those destination calls. Each builder returns a plain action descriptor, an array of them is what you hand to useQuote or useTrailsSendTransaction.

Available action builders

Import the builders you need directly from 0xtrails:
import { swap, lend, deposit, assertCondition, custom } from '0xtrails'
BuilderWhat 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)
See Building Actions for the full API of each builder.

Demo

Try composable actions in the SDK sandbox.

Where to go next

  • Quickstart — a multi-step example combining deposit, swap, assertCondition, and lend in a single intent.
  • Building Actions — the full builder API, one section per builder.
  • Dynamic Valuesdynamic() and self() 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.