Skip to main content
The LI.FI SDK runs the Composer lifecycle for you: allowance checks and approvals, transaction submission, status tracking and, for two-transaction routes, chain switching. Install and configure it as described in Installing the SDK and Configure SDK, and register an EVM provider for the chains you use.

Deposit with getQuote

Deposit 1 USDC into a Morpho vault on Base:
toToken is the position token address of the target protocol, such as a vault share token; take it from Supported Protocols & Chains. The routing engine compares the Composer route with DEX routes into the same token, so check includedSteps for tool: "composer" to see which one you got. executeRoute throws when execution fails. Keep the latest route from updateRouteHook and read action.error on its FAILED actions for details. For every execution option, see Execute Routes/Quotes.

Compare routes with getRoutes

getRoutes returns several options and uses different parameter names:
Pass the selected route to executeRoute as above.

Cross-chain deposits

Use different fromChain and toChain values. A cross-chain route has one of two shapes:
  • One transaction: the bridge runs the Composer deposit as a destination call. getQuote always returns this shape.
  • Two transactions: a bridge step, then a separate Composer step on the destination chain. getRoutes can return this shape; the SDK switches the wallet to the destination chain and asks the user to sign the second transaction. Pass options: { allowSwitchChain: false } to getRoutes to exclude it.
If the bridge delivers but the destination deposit does not run, the receiving action ends with status DONE and substatus PARTIAL, and the user holds the bridged token on the destination chain. See Cross-chain deposits for how to handle it.

Next steps

Vault Deposit Recipes

Quote parameters for each supported protocol

Widget Integration

Composer through the drop-in Widget