lifi-cli
lifi is a CLI wrapper around the LI.FI REST API — it turns vault discovery, cross-chain routing quotes, ERC-20 approvals, and on-chain deposits into single terminal commands with no custom SDK required.
lifi vaults --chain base --asset USDC --sort apy --limit 5
lifi deposit --vault 0xVault --from-chain base --from-token USDC --amount 100 --dry-runInstall
brew tap Kirillr-Sibirski/lifi-cli https://github.com/Kirillr-Sibirski/lifi-cli
brew install lifiOr build from source:
git clone https://github.com/Kirillr-Sibirski/lifi-cli.git
cd lifi-cli
go build -o bin/lifi ./cmd/lifiSetup
cp .env.example .envOpen .env and fill in what you need:
# Required for deposit and approve
LIFI_WALLET_PRIVATE_KEY=0xabc...
# Required for on-chain calls — add one per chain you use
# Key must match the chain's key from `lifi chains` (e.g. base, opt, arb, eth)
LIFI_RPC_BASE=https://mainnet.base.org
LIFI_RPC_OPT=https://mainnet.optimism.io
# Optional — defaults
LIFI_DEFAULT_FROM_CHAIN=base
LIFI_DEFAULT_SLIPPAGE_BPS=50Verify everything is wired up:
lifi doctor --write-checks --chain baseEarn
Find vaults
lifi vaults --chain base --asset USDC --transactional-only --sort apy --limit 5 # │ vault │ protocol │ chain │ asset │ apy │ apy30d │ tvl │ tx │ address
───┼──────────┼─────────────┼─────────────┼───────┼────────┼────────┼───────────┼─────┼─────────────────
1 │ USDC │ yo-protocol │ Base (8453) │ USDC │ 16.46% │ 14.13% │ $27699993 │ yes │ 0x000000…8a65
2 │ RE7USDC │ morpho-v1 │ Base (8453) │ USDC │ 5.46% │ 3.85% │ $2050694 │ yes │ 0x12afde…406e
3 │ CSUSDC │ morpho-v1 │ Base (8453) │ USDC │ 5.28% │ 7.57% │ $4460216 │ yes │ 0x1d3b1c…4657Flags:
| Flag | Default | Description |
|---|---|---|
--chain | $LIFI_DEFAULT_FROM_CHAIN | Chain name, key, or numeric ID |
--asset | Token symbol or address | |
--protocol | Protocol name (e.g. morpho-v1, yo-protocol) | |
--sort | apy | apy, apy30d, tvl, or name |
--order | desc | asc or desc |
--min-apy | Minimum APY% filter | |
--min-tvl-usd | Minimum TVL filter in USD | |
--transactional-only | Only show vaults you can deposit into | |
--limit | 25 | Max results |
Inspect a vault
lifi inspect 0x1d3b1cd0a0f242d598834b3f2d126dc6bd774657Prints full APY breakdown (base / reward / 30-day), TVL, protocol, and deposit capability.
Recommendations
lifi recommend --asset USDC --from-chain base --strategy highest-apy
lifi recommend --asset USDC --from-chain base --strategy safest --min-tvl-usd 5000000Strategies: highest-apy, safest (weighted by TVL), balanced (default).
Portfolio
lifi portfolio 0xYourWallet
lifi portfolio 0xYourWallet --chain base --protocol morpho-v1Shows current Earn positions. No wallet key required — pass any address.
Deposit
# 1. See the execution plan without broadcasting
lifi deposit \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100 \
--dry-run
# 2. Broadcast, wait for confirmation, verify position appeared
lifi deposit \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100 \
--wait \
--verify-positionRequired: LIFI_WALLET_PRIVATE_KEY and LIFI_RPC_<CHAIN>
Flags:
| Flag | Default | Description |
|---|---|---|
--vault | required | Target vault address |
--from-chain | $LIFI_DEFAULT_FROM_CHAIN | Source chain |
--from-token | required | Token to deposit (e.g. USDC, ETH) |
--amount | required | Human-readable amount (e.g. 100) |
--to-chain | vault's chain | For cross-chain deposits |
--dry-run | Preflight only — never broadcasts | |
--wait | Wait for confirmation | |
--verify-position | Check portfolio after confirmation | |
--approve | auto | auto, always, or never |
--approval-amount | exact | exact or infinite |
--gas-policy | auto | auto, quote, or rpc |
--yes | Skip confirmation prompt | |
--skip-simulate | Bypass RPC simulation |
Withdraw
Redeem vault shares back to the underlying token:
# Preview only
lifi withdraw \
--vault 0xVaultAddress \
--chain opt \
--amount 0.049 \
--dry-run
# Broadcast
lifi withdraw \
--vault 0xVaultAddress \
--chain opt \
--amount 0.049 \
--yesThe --amount is in vault shares (check your balance with lifi portfolio <address>). The command handles the ERC-20 approval of the share token automatically.
Required: LIFI_WALLET_PRIVATE_KEY and LIFI_RPC_<CHAIN>
Flags:
| Flag | Default | Description |
|---|---|---|
--vault | required | Vault address to redeem from |
--chain | vault's chain | Chain the vault lives on |
--amount | required | Shares to redeem (human-readable) |
--amount-wei | Shares in raw base units | |
--to-token | vault's underlying | Output token |
--slippage-bps | 50 | Slippage tolerance |
--gas-policy | auto | auto, quote, or rpc |
--dry-run | Simulate only, never broadcasts | |
--yes | Skip confirmation prompt |
Composer
Quote
Get a routing quote before any broadcast:
lifi quote \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100Export an unsigned transaction for external signing:
lifi quote \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100 \
--unsigned --json > quote.jsonRequired: LIFI_WALLET_ADDRESS or LIFI_WALLET_PRIVATE_KEY (address is derived from it).
Flags:
| Flag | Default | Description |
|---|---|---|
--vault | required | Target vault address |
--from-chain | required | Source chain |
--from-token | required | Input token |
--amount | required | Input amount |
--slippage-bps | 50 | Slippage tolerance in basis points |
--unsigned | Print the unsigned transaction payload | |
--allow-bridges | Comma-separated bridge allowlist | |
--deny-bridges | Comma-separated bridge denylist |
Check allowance
lifi allowance \
--chain base \
--token USDC \
--owner 0xYourWallet \
--spender 0xSpenderAddress \
--amount 100Or from a saved quote file:
lifi allowance --quote-file quote.json --owner 0xYourWalletRequired: LIFI_RPC_<CHAIN>
Approve
lifi approve \
--chain base \
--token USDC \
--spender 0xSpenderAddress \
--amount 100Use --amount max for an unlimited approval. lifi deposit --approve auto handles this automatically.
Required: LIFI_WALLET_PRIVATE_KEY and LIFI_RPC_<CHAIN>
Track a transaction
lifi status --tx-hash 0xabc... --from-chain base
lifi status --tx-hash 0xabc... --watch # polls until doneUtility commands
doctor
lifi doctor # check API connectivity and config
lifi doctor --write-checks # also check wallet and RPC readiness
lifi doctor --write-checks --chain basechains
lifi chains # list all supported chains
lifi chains --search optimism # filter by name
lifi chains --evm-only # only EVM chainsChain keys (the key column) are the canonical identifiers used in --chain flags and LIFI_RPC_* env vars. Common keys: eth, bas, opt, arb, bsc, pol. Full names (base, ethereum, optimism) also work via fuzzy matching.
protocols
lifi protocols # all Earn protocols and Composer bridges
lifi protocols --search morpho # filter by name
lifi protocols --supports deposit # only protocols with deposit supporttokens
lifi tokens --chain base --token USDC # find the canonical USDC on Base
lifi tokens --chain eth --token ETH # native token infoconfig
lifi config init # write a starter config file to ~/.config/lifi/config.yaml
lifi config show # show resolved config for the active profile
lifi --profile prod <cmd> # use a named profile for one commandConfig file (~/.config/lifi/config.yaml) supports named profiles for multiple wallets or environments:
profile: default
profiles:
default:
defaults:
from_chain: base
slippage_bps: "50"
wallet:
private_key_env: LIFI_WALLET_PRIVATE_KEY
rpcs:
base: https://mainnet.base.org
opt: https://mainnet.optimism.io
staging:
defaults:
from_chain: optimism
wallet:
private_key_env: STAGING_PRIVATE_KEY
rpcs:
opt: https://my-private-rpc.example.comGlobal flags
These work with every command:
lifi --json <command> # machine-readable JSON output
lifi --verbose <command> # extra detail
lifi --no-color <command> # disable colors (for pipes/CI)
lifi --profile <name> <cmd> # switch config profile
lifi --config <path> <cmd> # use a custom config file pathSafety
depositalways runs a preflight check before broadcastingdeposit --dry-runnever broadcasts — always safe to run- Simulation (
--simulate) is on by default and catches most bad transactions before they hit the chain - Approvals default to
exactamount — never approve more than needed - Write commands prompt for confirmation unless
--yesis set
Troubleshooting
wallet private key is required
Set LIFI_WALLET_PRIVATE_KEY in .env or export it in your shell.
unknown chain "xyz"
Run lifi chains --search xyz to find the right key. Also try the numeric chain ID (e.g. --chain 8453 for Base).
--token is required / --vault is required
All flags use double-dash: --token USDC, not -token USDC.
no RPC URL configured for Base
Add LIFI_RPC_BASE=https://mainnet.base.org to .env. The key after LIFI_RPC_ must match the chain name or key (run lifi chains to check).
simulation failed
Run lifi deposit ... --dry-run --json to see the full preflight. If approval_needed: true, the simulation is intentionally skipped — grant approval first.
position detected: no
The portfolio index may take a moment to update. Retry with lifi portfolio 0xYourWallet --chain base.
Roadmap
lifi-cli is at v0.1 — the core read, deposit, and withdraw flows are solid. Here's what comes next.
Near-term
lifi watch— live-polling mode forportfolioandstatus, streaming updates to the terminallifi sweep— consolidate multiple small positions into one vault in a single command- Ledger / hardware wallet support — sign transactions via USB without exposing a raw private key
Medium-term
- Recurring deposits — cron-style automation:
lifi schedule --vault 0x... --amount 50 --every 1w - Multi-hop strategies — chain together a swap + bridge + deposit in one command using the Composer API
- Position alerts — notify (webhook, email) when APY drops below a threshold or a position reaches a target value
--output csv|tsv— tabular export for spreadsheet workflows alongside existing--json
Longer-term
- Plugin / hook system — let third-party scripts tap into the preflight and post-execution lifecycle
- TUI dashboard — an interactive terminal UI (
lifi tui) with a vault browser, live APY feed, and portfolio overview - EigenLayer / restaking integrations — extend Earn commands to cover restaking protocols as LI.FI adds support
Development
go test ./...
LIFI_SMOKE=1 go test ./internal/cli -run TestLiveSmokeReadPath # live network tests