Skip to main content
Each recipe is one runnable task: the SDK code, how to run it, and what to check in the compile result.

Same-chain

Swap and deposit

Swap WETH to USDC, then deposit the USDC into Aave. You pick each step.

Split a deposit across vaults

Divide USDC between an Aave and a Morpho vault.

Deposit with a server-planned route

Composer plans up to two hops (swap included) from USDT into an Aave position, with sdk.route.

Add liquidity on Uniswap

Add to a V2 pair from one token, or mint a V3 position.

Consolidate tokens into USDC

Swap several stablecoins into USDC in one transaction.

Cross-chain flows

Bridge and deposit

Bridge USDC to Base and deposit it into Aave, with one signature.

Pay cross-chain

Pay exact amounts to a payee and a fee recipient on Base, from ETH on Arbitrum. One signature: both get paid or neither does.
To only send tokens to an address on another chain, use lifi.bridge with a destination; see Which cross-chain path?.

More examples

The composer-sdk-examples repo has about 40 runnable examples. A few cover tasks these recipes do not:
The examples repo may pin an older SDK version. These recipes target @lifi/composer-sdk and @lifi/compose-spec 0.14.0.