How it works
Every composable action flow is two phases:- The user signs a single transaction on their origin chain. Funds bridge and swap to an intent wallet on the destination.
- The SDK executes the action sequence from that wallet. All actions run top-down in a single atomic batch, if any step fails, the entire batch reverts.
Quickstart: multi-step DeFi in one intent
This example deposits USDT into Morpho, swaps the remainder to USDC, and lends it into Aave, all in one intent.dynamic() means “use whatever balance the intent wallet holds at execution time.” You don’t need to predict exact amounts after bridging or swapping. See Dynamic values for details.
Track status across hops
TheonStatusUpdate callback fires at each step, bridge confirmation, destination execution, and completion. Use it to drive progress UI:
Quote-first pattern
UseuseQuote if you want to show the user a preview before sending, or if you want to avoid the SDK modal entirely:
Discovering markets
The quickstart example above hard-codes market IDs for clarity. In production, useuseEarnMarkets to discover available markets for a given chain, token, and provider at runtime:
useEarnMarkets reference.
Available action builders
| Builder | What it does |
|---|---|
swap() | Token exchange via Uniswap V3 or SushiSwap V3 |
lend() | Supply to a lending market (Aave and others) |
deposit() | Deposit into a vault (ERC-4626, Morpho, Yearn) |
assertCondition() | Onchain guard, reverts the batch if the condition fails |
custom() | Arbitrary contract call via ABI encoding |