Core Guides

Composer

Composer quote generation, approvals, allowance checks, and status tracking.

View source on GitHub

Composer

The Composer commands wrap the LI.FI Routing API. They let you build cross-chain routing quotes, inspect ERC-20 token allowances, submit approvals, and track transaction status.

For the full deposit flow (quote → approve → deposit), use lifi deposit which handles everything end-to-end.


lifi quote

Generate a Composer routing quote for depositing into a vault. Returns the route chosen by LI.FI, expected output amounts, gas estimates, and the raw unsigned transaction payload.

bash
lifi quote --vault <address> --from-chain <chain> --from-token <token> --amount <amount> [flags]

Flags

FlagDefaultDescription
--vault <address>requiredTarget vault address. Used as the to-token in the routing request.
--from-chain <name|id>requiredSource chain.
--from-token <symbol|address>requiredInput token (e.g. USDC, ETH).
--amount <human>requiredInput amount in human-readable units (e.g. 100). Mutually exclusive with --amount-wei.
--amount-wei <raw>Input amount in raw base units. Mutually exclusive with --amount.
--to-chain <name|id>vault's chainOverride destination chain. Defaults to the vault's chain.
--from-address <address>derived from keySource wallet address.
--to-address <address>same as fromDestination address (if different from source).
--slippage-bps <n>$LIFI_DEFAULT_SLIPPAGE_BPSSlippage tolerance in basis points. 50 = 0.5%.
--preset <name>LI.FI quote preset (if applicable).
--allow-bridges <csv>Comma-separated list of bridge keys to allow exclusively.
--deny-bridges <csv>Comma-separated list of bridge keys to exclude.
--allow-exchanges <csv>Comma-separated list of exchange keys to allow exclusively.
--deny-exchanges <csv>Comma-separated list of exchange keys to exclude.
--unsignedfalsePrint the unsigned transaction payload. Useful for external signers.
--rawfalsePrint the full raw transaction request object.
--jsonJSON output.

Required secrets

LIFI_WALLET_ADDRESS must be set (or derivable from LIFI_WALLET_PRIVATE_KEY) — the Composer API requires a fromAddress to build the transaction.

No RPC endpoint is needed for quote alone.

Output

The default table shows:

FieldDescription
toolBridge or exchange used for routing
from chainSource chain ID
to chainDestination chain ID
from tokenInput token symbol
to tokenOutput token symbol (the vault)
from amountInput amount
to amountExpected output amount
min receivedMinimum output after slippage
approval addressERC-20 spender address to approve
gas usdEstimated gas cost

Examples

bash
# Standard quote
lifi quote \
  --vault 0xVault \
  --from-chain base \
  --from-token USDC \
  --amount 100

# Cross-chain quote: USDC on Optimism → vault on Base
lifi quote \
  --vault 0xVault \
  --from-chain opt \
  --from-token USDC \
  --to-chain base \
  --amount 50

# Export an unsigned transaction for offline/hardware wallet signing
lifi quote \
  --vault 0xVault \
  --from-chain base \
  --from-token USDC \
  --amount 100 \
  --unsigned \
  --json > quote.json

# Restrict routing to specific bridges
lifi quote \
  --vault 0xVault \
  --from-chain opt \
  --from-token USDC \
  --amount 50 \
  --allow-bridges stargate

# The saved quote file can be used with lifi allowance
lifi allowance --quote-file quote.json --owner 0xYourWallet

lifi allowance

Check the current ERC-20 token allowance for a wallet/spender pair. Reports whether the existing approval covers a given amount.

bash
lifi allowance [--chain <chain>] [--token <token>] [--owner <address>] [--spender <address>] [--amount <human>] [--quote-file <path>] [--json]

Flags

FlagDescription
--chain <name|id>Chain to check on.
--token <symbol|address>Token to check.
--owner <address>Token owner wallet address.
--spender <address>Spender contract address.
--amount <human>Required amount (used to determine if allowance is sufficient).
--quote-file <path>Path to a JSON quote file from lifi quote --unsigned --json. Fills in chain, token, spender, and required amount automatically.
--jsonJSON output.

Required secrets

LIFI_RPC_<CHAIN> — an on-chain RPC call is needed to read the allowance.

Examples

bash
# Manual check
lifi allowance \
  --chain base \
  --token USDC \
  --owner 0xYourWallet \
  --spender 0xSpenderAddress \
  --amount 100

# Driven from a saved quote file
lifi allowance \
  --quote-file quote.json \
  --owner 0xYourWallet

# JSON output
lifi allowance --quote-file quote.json --owner 0xYourWallet --json

Output

bash
 field       │ value
─────────────┼──────────────────────────────────────
 chain       │ Base (8453)
 token       │ 0xUSDCAddress
 owner       │ 0xYourWallet
 spender     │ 0xSpenderAddress
 allowance   │ 0
 required    │ 100
 sufficient  │ no

lifi approve

Send an ERC-20 approval transaction. This is rarely needed manually — lifi deposit --approve auto handles approvals automatically. Use lifi approve when you want fine-grained control over the approval step.

bash
lifi approve --chain <chain> --token <token> --spender <address> --amount <human|max> [flags]

Flags

FlagDefaultDescription
--chain <name|id>requiredChain to approve on.
--token <symbol|address>requiredToken to approve.
--spender <address>requiredSpender contract address (from the quote's approval_address field).
--amount <human|max>requiredAmount to approve. Pass max for an unlimited (type(uint256).max) approval.
--gas-policy auto|rpcautoGas pricing strategy.
--yesfalseSkip the confirmation prompt.
--jsonJSON output.

Required secrets

SecretPurpose
LIFI_WALLET_PRIVATE_KEYSigns the approval transaction
LIFI_RPC_<CHAIN>On-chain RPC for the chain

Examples

bash
# Approve exact amount
lifi approve \
  --chain base \
  --token USDC \
  --spender 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE \
  --amount 100

# Approve unlimited (use with caution)
lifi approve \
  --chain base \
  --token USDC \
  --spender 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE \
  --amount max \
  --yes

# Get the spender address from a quote first
SPENDER=$(lifi quote --vault 0xVault --from-chain base --from-token USDC --amount 100 --json | jq -r '.estimate.approvalAddress')
lifi approve --chain base --token USDC --spender "$SPENDER" --amount 100

Find the correct chain key

Run lifi chains to see all supported chains and their keys. The chain key is what you pass to --chain:

bash
lifi chains --search optimism
bash
 id      │ name      │ key  │ type │ native │ relayer
─────────┼───────────┼──────┼──────┼────────┼────────
 10      │ Optimism  │ opt  │ EVM  │ ETH    │ yes

So --chain opt is correct for Optimism.


lifi status

Track the execution status of a LI.FI cross-chain transaction by its source transaction hash.

bash
lifi status --tx-hash <hash> [flags]

Flags

FlagDefaultDescription
--tx-hash <hash>requiredSource transaction hash.
--from-chain <name|id>Source chain (improves lookup accuracy).
--to-chain <name|id>Destination chain.
--bridge <key>Bridge or tool key used for the route.
--watchfalsePoll continuously until the transaction reaches a terminal status.
--interval <duration>5sPolling interval when --watch is enabled.
--jsonJSON output (streams one object per poll when --watch is set).

Required secrets

None.

Terminal statuses

StatusMeaning
DONETransaction completed successfully on both source and destination.
FAILEDTransaction failed.
NOT_FOUNDHash not recognized by LI.FI.
INVALIDHash is malformed or on the wrong chain.

Examples

bash
# One-shot status check
lifi status --tx-hash 0xabc... --from-chain base

# Watch until done
lifi status --tx-hash 0xabc... --from-chain base --to-chain opt --watch

# Stream JSON for automation
lifi status --tx-hash 0xabc... --watch --json | jq '.status'