lifi brings LI.FI Earn + Composer into the terminal. It lets builders
discover yield opportunities, inspect vaults, generate Composer routes,
simulate and execute deposits, and verify positions without wiring a frontend
first.
This project wraps LI.FI's official APIs and product surfaces:
- LI.FI Earn overview
- LI.FI Earn discover + deposit recipe
- LI.FI Composer overview
- LI.FI quote API reference
Hosted docs are also available at:
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/lificp .env.example .envOpen .env and fill in what you need:
# required for deposit, withdraw, and approve
LIFI_WALLET_PRIVATE_KEY=0xabc...
# required for on-chain calls
LIFI_RPC_BASE=https://mainnet.base.org
LIFI_RPC_OPT=https://mainnet.optimism.io
# optional defaults
LIFI_DEFAULT_FROM_CHAIN=opt
LIFI_DEFAULT_SLIPPAGE_BPS=50Verify everything is wired up:
lifi doctor --write-checks --chain optlifi vaults --chain opt --asset USDC --transactional-only --sort apy --limit 5
lifi inspect 0x48921e52f70cec7d3425cf5103caace27fc0b2fe
lifi quote --vault 0x48921e52f70cec7d3425cf5103caace27fc0b2fe --from-chain opt --from-token USDC --amount 0.05
lifi deposit --vault 0x48921e52f70cec7d3425cf5103caace27fc0b2fe --from-chain opt --from-token USDC --amount 0.05 --dry-runThe Earn side of lifi is about discovery, inspection, recommendations,
portfolio reads, and full deposit execution.
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…4657
Key flags:
| Flag | Default | Description |
|---|---|---|
--chain |
$LIFI_DEFAULT_FROM_CHAIN |
Chain name, key, or numeric ID |
--asset |
Token symbol or address | |
--protocol |
Protocol name such as morpho-v1 |
|
--sort |
apy |
apy, apy30d, tvl, or name |
--order |
desc |
asc or desc |
--min-apy |
Minimum APY filter | |
--min-tvl-usd |
Minimum TVL filter | |
--transactional-only |
false |
Only show depositable vaults |
--limit |
25 |
Maximum results |
lifi inspect 0x1d3b1cd0a0f242d598834b3f2d126dc6bd774657This prints APY breakdown, TVL, protocol metadata, chain details, and deposit capability for a single vault.
lifi recommend --asset USDC --from-chain base --strategy balanced
lifi recommend --asset USDC --from-chain base --strategy safest --min-tvl-usd 5000000
lifi recommend --asset USDC --strategy highest-apy --limit 3 --jsonStrategies:
highest-apysafestbalanced
lifi portfolio 0xYourWallet
lifi portfolio 0xYourWallet --chain base --protocol morpho-v1No wallet key is required for portfolio reads. Pass any wallet address.
# preflight only, safe to run any time
lifi deposit \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100 \
--dry-run
# broadcast, wait for confirmation, and verify the position
lifi deposit \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100 \
--yes \
--wait \
--verify-positionRequired:
LIFI_WALLET_PRIVATE_KEYLIFI_RPC_<CHAIN>
Key flags:
| Flag | Default | Description |
|---|---|---|
--vault |
required | Target vault address |
--from-chain |
$LIFI_DEFAULT_FROM_CHAIN |
Source chain |
--from-token |
required | Token to deposit |
--amount |
required | Human-readable amount |
--to-chain |
vault's chain | Override destination chain |
--dry-run |
false |
Preflight only, never broadcasts |
--wait |
false |
Wait for confirmation |
--verify-position |
false |
Poll portfolio after confirmation |
--approve |
auto |
auto, always, or never |
--approval-amount |
exact |
exact or infinite |
--gas-policy |
auto |
auto, quote, or rpc |
--skip-simulate |
false |
Bypass RPC simulation |
--yes |
false |
Skip confirmation prompt |
# preview only
lifi withdraw \
--vault 0xVaultAddress \
--chain opt \
--amount 0.049 \
--dry-run
# broadcast
lifi withdraw \
--vault 0xVaultAddress \
--chain opt \
--amount 0.049 \
--yes--amount is specified in vault shares. Use lifi portfolio <address> to see
the share balance first.
The Composer side of lifi handles quote generation, approvals, allowance
checks, status tracking, and the transaction payloads used by deposit flows.
lifi quote \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100Export an unsigned transaction for downstream signing:
lifi quote \
--vault 0xVaultAddress \
--from-chain base \
--from-token USDC \
--amount 100 \
--unsigned \
--json > quote.jsonKey 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 in bps |
--unsigned |
false |
Print the unsigned tx payload |
--allow-bridges |
Restrict bridge choices | |
--deny-bridges |
Exclude bridge choices | |
--allow-exchanges |
Restrict exchange choices | |
--deny-exchanges |
Exclude exchange choices |
lifi allowance \
--chain base \
--token USDC \
--owner 0xYourWallet \
--spender 0xSpenderAddress \
--amount 100Or drive it from a saved quote:
lifi allowance --quote-file quote.json --owner 0xYourWalletlifi approve \
--chain base \
--token USDC \
--spender 0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE \
--amount 100Use --amount max for an unlimited approval. In most cases,
lifi deposit --approve auto handles this for you.
lifi status --tx-hash 0xabc... --from-chain opt
lifi status --tx-hash 0xabc... --from-chain opt --watchlifi doctor
lifi doctor --write-checks
lifi doctor --write-checks --chain baselifi chains
lifi chains --search optimism
lifi chains --evm-onlylifi protocols
lifi protocols --search morpho
lifi protocols --supports depositlifi tokens --chain base --token USDC
lifi tokens --chain eth --token ETHlifi config init
lifi config show
lifi --profile prod config showConfiguration is resolved in this order:
- command-line flags
- environment variables
~/.config/lifi/config.yaml- built-in defaults
| Variable | Description |
|---|---|
LIFI_WALLET_PRIVATE_KEY |
Required for write commands |
LIFI_WALLET_ADDRESS |
Optional explicit wallet address |
LIFI_API_KEY |
Optional LI.FI API key |
LIFI_DEFAULT_FROM_CHAIN |
Default chain |
LIFI_DEFAULT_SLIPPAGE_BPS |
Default slippage |
RPCs are chain-scoped:
LIFI_RPC_BASE=https://mainnet.base.org
LIFI_RPC_OPT=https://mainnet.optimism.io
LIFI_RPC_8453=https://my-private-base-rpc.example.comGenerate a starter config:
lifi config initExample:
profile: default
profiles:
default:
defaults:
from_chain: opt
slippage_bps: "50"
wallet:
private_key_env: LIFI_WALLET_PRIVATE_KEY
rpcs:
opt: https://mainnet.optimism.io
base: https://mainnet.base.orglifi is designed to be scriptable through --json.
Common automation-friendly commands:
lifi vaults --chain base --asset USDC --transactional-only --json
lifi quote --vault 0xVaultAddress --from-chain base --from-token USDC --amount 50 --unsigned --json
lifi deposit --vault 0xVaultAddress --from-chain base --from-token USDC --amount 50 --dry-run --json
lifi deposit --vault 0xVaultAddress --from-chain base --from-token USDC --amount 50 --wait --verify-position --jsonOutput conventions:
- read commands such as
vaults,inspect,recommend, andportfolioreturn the underlying API objects directly quote --jsonreturns the raw LI.FI quote object directlyquote --unsigned --jsonwraps the quote in an automation-friendly payloaddeposit --dry-run --jsonanddeposit --jsonreturn staged execution payloads withstage,status,message,quote, andpreflight- failures return normalized error payloads with
stage,status,message, andcode
Example dry-run shape:
{
"stage": "dry-run",
"status": "ok",
"message": "deposit preflight completed",
"quote": {
"type": "lifi",
"id": "quote-id"
},
"preflight": {
"wallet_address": "0xYourWallet",
"source_chain": "Optimism (10)",
"source_token": "USDC",
"source_amount": "50",
"destination_vault": "0xVaultAddress",
"approval_needed": true,
"gas_policy": "auto",
"simulation_status": "skipped"
}
}lifi --json <command>
lifi --verbose <command>
lifi --quiet <command>
lifi --no-color <command>
lifi --profile <name> <command>
lifi --config <path> <command>Practical expectations:
- EVM chains only
- best-tested paths today are Base and Optimism
- write commands require a working RPC URL for the source chain
- portfolio verification depends on LI.FI Earn portfolio indexing
Before using a chain with real funds:
lifi doctor --write-checks --chain baselifi can broadcast real transactions. Recommended operating model:
- use a dedicated low-balance wallet for testing
- keep
.envonly on trusted local machines - never commit
.env - prefer
deposit --dry-runbefore broadcasting - keep
--approval-amount exactunless you explicitly want an infinite approval - run
lifi doctor --write-checksbefore first use on a chain
Release checklist:
- run
make vetandmake test - run
lifi doctor --write-checks --chain base - run at least one dry-run deposit against a real vault
- tag the release with
git tag -a vX.Y.Z -m "vX.Y.Z" - push the tag
- wait for the GitHub Release workflow to publish artifacts and checksums
- update the Homebrew formula with
./scripts/update_formula.sh vX.Y.Z - verify
brew install lifi
Expected release artifacts:
- darwin amd64 tarball
- darwin arm64 tarball
- linux amd64 tarball
- linux arm64 tarball
checksums.txt
The deployable docs app lives in /frontend, and the authored markdown source
lives in /frontend/content.
Useful local docs entry points:
go test ./...
cd frontend
bun install
bun run build