Loading...
Loading...
Compare original and translation side by side
| Command | Requires Auth |
|---|---|
| No |
| No |
| No |
| No |
| Yes (JWT, uses TEE wallet) |
| Yes (JWT, uses TEE wallet) |
lfi status --jsonlfi login key --role AGENT --jsonlfi login <email> --jsonlfi verify <otpId> <code> --jsonlfi whoami --jsonlfi swap tokenslfi token search--accountswap execute| 命令 | 需要鉴权 |
|---|---|
| 否 |
| 否 |
| 否 |
| 否 |
| 是(JWT,使用TEE钱包) |
| 是(JWT,使用TEE钱包) |
lfi status --jsonlfi login key --role AGENT --jsonlfi login <email> --jsonlfi verify <otpId> <code> --jsonlfi whoami --jsonlfi swap tokenslfi token searchswap execute--account| If user asks about... | Route to |
|---|---|
| Token search, price, details, security | liberfi-token |
| Token K-line, candlestick chart | liberfi-token |
| Token holders, smart money traders | liberfi-token |
| Trending tokens, market rankings | liberfi-market |
| Newly listed tokens | liberfi-market |
| Wallet holdings, balance, PnL | liberfi-portfolio |
| Wallet activity, transaction history | liberfi-portfolio |
| 如果用户询问... | 路由到 |
|---|---|
| 代币搜索、价格、详情、安全信息 | liberfi-token |
| 代币K线、蜡烛图 | liberfi-token |
| 代币持有者、聪明钱交易者 | liberfi-token |
| 热门代币、市场排名 | liberfi-market |
| 新上线代币 | liberfi-market |
| 钱包持仓、余额、盈亏 | liberfi-portfolio |
| 钱包活动、交易历史 | liberfi-portfolio |
| Command | Description | Auth |
|---|---|---|
| List all supported swap chains | No |
| List available swap tokens | No |
| 命令 | 描述 | 鉴权 |
|---|---|---|
| 列出所有支持兑换的公链 | 否 |
| 列出可用的兑换代币 | 否 |
| Command | Description | Auth |
|---|---|---|
| Get a swap quote | No |
| Execute swap via TEE wallet | Yes |
| Build, sign, and broadcast swap in one step via TEE wallet | Yes |
| Estimate transaction fee / gas | No |
| Broadcast a signed transaction | Yes |
| 命令 | 描述 | 鉴权 |
|---|---|---|
| 获取兑换报价 | 否 |
| 通过TEE钱包执行兑换 | 是 |
| 通过TEE钱包一步完成兑换交易的构建、签名和广播 | 是 |
| 估算交易手续费/Gas | 否 |
| 广播已签名的交易 | 是 |
--in <address>--out <address>--amount <amount>--chain-family <family>evmsvm--chain-id <id>01--slippage-bps <bps>100--swap-mode <mode>ExactInExactOut--account <address>--quote-result <json>swap quote--chain-family <family>evmsvm--chain-id <id>--data <json>--chain-family <family>evmsvm--chain-id <id>--quote-result <json>lfi swap quote--slippage-bps <bps>--chain-family <family>evmsvm--chain-id <id>--signed-tx <data>--in <address>--out <address>--amount <amount>--chain-family <family>evmsvm--chain-id <id>01--slippage-bps <bps>100--swap-mode <mode>ExactInExactOut--account <address>--quote-result <json>swap quote--chain-family <family>evmsvm--chain-id <id>--data <json>--chain-family <family>evmsvm--chain-id <id>--quote-result <json>lfi swap quote--slippage-bps <bps>--chain-family <family>evmsvm--chain-id <id>--signed-tx <data>lfi swap chains --jsonlfi swap chains --jsonlfi swap tokens --chain-id <id> --jsonlfi swap tokens --chain-id <id> --jsonlfi token security <chain> <outputTokenAddress> --jsonlfi swap quote --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --jsonlfi token security <chain> <outputTokenAddress> --jsonlfi swap quote --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --jsonlfi status --json # check sessionlfi status --json # 检查会话状态
1. **Collect inputs**: Input/output tokens, amount, chain
2. **(mandatory)** Security check: `lfi token security <chain> <outputTokenAddress> --json`
3. If security flags found → warn user, recommend NOT proceeding
4. **Get quote first**: `lfi swap quote --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --json`
5. **Present swap summary to user**:
- Input: X amount of TokenA
- Output: ~Y amount of TokenB
- Slippage: Z%
- Estimated fees (if available)
6. **(mandatory)** Wait for explicit user confirmation
7. **Execute swap**: `lfi swap execute --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --quote-result '<quoteJson>' --json`
- The server signs the transaction using the authenticated user's TEE wallet.
- No manual signing step required — the response contains the result or signed tx hash.
8. **Suggest next step**: "Swap submitted! You can track it on the block explorer."
1. **收集输入信息**:输入/输出代币、金额、公链
2. **(强制要求)** 安全检查:`lfi token security <chain> <outputTokenAddress> --json`
3. 如果发现安全风险标记 → 警告用户,建议不要继续操作
4. **优先获取报价**:`lfi swap quote --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --json`
5. **向用户展示兑换摘要**:
- 输入:X数量的TokenA
- 输出:约Y数量的TokenB
- 滑点:Z%
- 预估手续费(如有)
6. **(强制要求)** 等待用户明确确认
7. **执行兑换**:`lfi swap execute --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --quote-result '<quoteJson>' --json`
- 服务端使用已鉴权用户的TEE钱包对交易签名
- 无需手动签名步骤 — 响应包含执行结果或已签名交易哈希
8. **建议下一步**:“兑换已提交!你可以在区块浏览器上追踪交易状态。”swap executelfi status --json # check sessionswap executelfi status --json # 检查会话状态
1. **Collect inputs**: Chain family, chain ID, and the quote result JSON from a prior `swap quote` call
2. **(mandatory)** Security check already performed during the quote step — do not skip
3. **Present swap summary** and wait for explicit user confirmation
4. **Execute**: `lfi swap sign-and-send --chain-family <fam> --chain-id <id> --quote-result '<quoteJson>' --json`
- The server builds the transaction, signs it via the authenticated user's TEE wallet, and broadcasts it in one step.
5. **Suggest next step**: "Swap submitted! You can track it on the block explorer."
**When to use `sign-and-send` vs `execute`**:
- Use `sign-and-send` when you already have a `quote_result` and want a single atomic call.
- Use `execute` when you want to specify input/output tokens and amount directly (it internally fetches a quote).
1. **收集输入信息**:链家族、链ID,以及之前调用`swap quote`返回的报价结果JSON
2. **(强制要求)** 报价阶段已经完成安全检查 — 不要跳过该步骤
3. **展示兑换摘要**并等待用户明确确认
4. **执行**:`lfi swap sign-and-send --chain-family <fam> --chain-id <id> --quote-result '<quoteJson>' --json`
- 服务端构建交易,通过已鉴权用户的TEE钱包签名,然后一步完成广播
5. **建议下一步**:“兑换已提交!你可以在区块浏览器上追踪交易状态。”
**`sign-and-send`与`execute`的适用场景**:
- 如果你已经获取了`quote_result`,想要单次原子调用完成操作,使用`sign-and-send`
- 如果你想要直接指定输入/输出代币和金额(内部会自动获取报价),使用`execute`lfi tx estimate --chain-family <fam> --chain-id <id> --data '<txJson>' --jsonlfi tx estimate --chain-family <fam> --chain-id <id> --data '<txJson>' --jsonlfi status --jsonlfi tx send --chain-family <fam> --chain-id <id> --signed-tx <signedData> --jsonlfi status --jsonlfi tx send --chain-family <fam> --chain-id <id> --signed-tx <signedData> --jsonFull flow: auth → token → swap
lfi status --jsonlfi login key --jsonlfi whoami --jsonlfi token search --q "USDC" --chains sol --jsonlfi token security sol <usdcAddress> --jsonlfi swap quote --in So11111111111111111111111111111111111111112 --out <usdcAddress> --amount <amt> --chain-family svm --chain-id 0 --jsonlfi swap execute --in ... --out ... --amount ... --chain-family svm --chain-id 0 --json完整流程:鉴权 → 代币查询 → 兑换
lfi status --jsonlfi login key --jsonlfi whoami --jsonlfi token search --q "USDC" --chains sol --jsonlfi token security sol <usdcAddress> --jsonlfi swap quote --in So11111111111111111111111111111111111111112 --out <usdcAddress> --amount <amt> --chain-family svm --chain-id 0 --jsonlfi swap execute --in ... --out ... --amount ... --chain-family svm --chain-id 0 --jsonFull flow: auth → market → token → swap
lfi status --jsonlfi login key --jsonlfi ranking trending sol 1h --limit 5 --jsonlfi token security sol <address> --jsonlfi swap quote --in <baseToken> --out <address> --amount <amt> --chain-family svm --chain-id 0 --jsonlfi swap execute --in ... --out ... --json完整流程:鉴权 → 市场查询 → 代币查询 → 兑换
lfi status --jsonlfi login key --jsonlfi ranking trending sol 1h --limit 5 --jsonlfi token security sol <address> --jsonlfi swap quote --in <baseToken> --out <address> --amount <amt> --chain-family svm --chain-id 0 --jsonlfi swap execute --in ... --out ... --jsonFull flow: auth → portfolio → token → swap
lfi status --jsonlfi login key --jsonlfi whoami --jsonlfi wallet holdings sol <solAddress> --jsonlfi token security sol <tokenAddress> --jsonlfi swap quote --in <tokenAddress> --out <baseToken> --amount <halfAmt> --chain-family svm --chain-id 0 --jsonlfi swap execute --in ... --out ... --json完整流程:鉴权 → 资产查询 → 代币查询 → 兑换
lfi status --jsonlfi login key --jsonlfi whoami --jsonlfi wallet holdings sol <solAddress> --jsonlfi token security sol <tokenAddress> --jsonlfi swap quote --in <tokenAddress> --out <baseToken> --amount <halfAmt> --chain-family svm --chain-id 0 --jsonlfi swap execute --in ... --out ... --json| Just completed | Suggest to user |
|---|---|
| Chain list | "Which chain do you want to trade on?" / "想在哪条链上交易?" |
| Token list | "Which tokens do you want to swap?" / "想兑换哪些代币?" |
| Swap quote | "Want to execute this swap?" / "要执行这笔兑换吗?" |
| Swap execute (TEE) | "Swap submitted via your LiberFi TEE wallet!" / "已通过LiberFi TEE钱包提交兑换!" |
| Swap sign-and-send | "Swap built, signed, and broadcast in one step!" / "兑换已一步完成构建、签名并广播!" |
| Fee estimate | "Ready to send?" / "准备好发送了吗?" |
| Tx send | "Transaction submitted! Track it on the block explorer." / "交易已提交!可在区块浏览器上查看。" |
| Not authenticated | "Please log in first: |
| 刚完成的操作 | 向用户建议 |
|---|---|
| 公链列表查询 | "Which chain do you want to trade on?" / "想在哪条链上交易?" |
| 代币列表查询 | "Which tokens do you want to swap?" / "想兑换哪些代币?" |
| 兑换报价查询 | "Want to execute this swap?" / "要执行这笔兑换吗?" |
| 兑换执行(TEE钱包) | "Swap submitted via your LiberFi TEE wallet!" / "已通过LiberFi TEE钱包提交兑换!" |
| 兑换签名并发送 | "Swap built, signed, and broadcast in one step!" / "兑换已一步完成构建、签名并广播!" |
| 手续费估算 | "Ready to send?" / "准备好发送了吗?" |
| 交易发送 | "Transaction submitted! Track it on the block explorer." / "交易已提交!可在区块浏览器上查看。" |
| 未鉴权 | "Please log in first: |
lfi wallet holdingsevmsvmsvmevmlfi wallet holdingsevmsvmsvmevm| Pitfall | Correct Approach |
|---|---|
| Using human-readable amounts (e.g. "1 SOL") | Convert to smallest unit first: 1 SOL = 1,000,000,000 lamports |
| Skipping security check before swap | ALWAYS run |
| Executing swap without user confirmation | ALWAYS show quote summary and wait for explicit "yes" |
| Passing modified quote_result to execute / sign-and-send | Pass the quote_result JSON through WITHOUT any modification |
Calling | Check |
| Assuming a wallet address without checking | Call |
| Retrying failed tx send without checking | The tx may have been submitted; check on-chain status first |
Using | Call |
| 误区 | 正确做法 |
|---|---|
| 使用可读金额(例如“1 SOL”) | 先转换为最小单位:1 SOL = 1,000,000,000 lamports |
| 兑换前跳过安全检查 | 始终先对输出代币运行 |
| 未获得用户确认就执行兑换 | 始终展示报价摘要并等待用户明确回复“是” |
| 向execute/sign-and-send传递修改后的quote_result | 直接透传quote_result JSON,不要做任何修改 |
未鉴权就调用 | 先调用 |
| 不检查就默认使用某个钱包地址 | 调用 |
| 发送失败不检查就重试 | 交易可能已经提交;先查询链上状态 |
没有报价就使用 | 先调用 |
swap executetx sendtoken securityquote_resultswap executetx sendtoken securityquote_result