liberfi-swap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LiberFi Swap & Transaction

LiberFi 兑换与交易

Execute token swaps and broadcast transactions using the LiberFi CLI.
使用LiberFi CLI执行代币兑换并广播交易。

Pre-flight Checks

前置检查

See bootstrap.md for CLI installation and connectivity verification.
This skill's auth requirements:
CommandRequires Auth
lfi swap chains
No
lfi swap tokens
No
lfi swap quote
No
lfi tx estimate
No
lfi swap execute
Yes (JWT, uses TEE wallet)
lfi tx send
Yes (JWT, uses TEE wallet)
Authentication pre-flight for swap execute / tx send:
  1. Run
    lfi status --json
  2. If not authenticated:
    • Agent:
      lfi login key --role AGENT --json
    • Human:
      lfi login <email> --json
      lfi verify <otpId> <code> --json
  3. Run
    lfi whoami --json
    to confirm wallet addresses
Additional pre-flight for swap operations:
  • Confirm the user knows the input/output token addresses (or help look them up via
    lfi swap tokens
    or
    lfi token search
    )
  • Note:
    --account
    is now optional for
    swap execute
    . If omitted, the server uses the authenticated user's TEE wallet address automatically.
查看bootstrap.md了解CLI安装和连接验证方法。
该技能的鉴权要求:
命令需要鉴权
lfi swap chains
lfi swap tokens
lfi swap quote
lfi tx estimate
lfi swap execute
(JWT,使用TEE钱包)
lfi tx send
(JWT,使用TEE钱包)
兑换执行/交易发送的鉴权前置检查:
  1. 运行
    lfi status --json
  2. 如果未完成鉴权:
    • Agent:运行
      lfi login key --role AGENT --json
    • 个人用户:运行
      lfi login <email> --json
      → 运行
      lfi verify <otpId> <code> --json
  3. 运行
    lfi whoami --json
    确认钱包地址
兑换操作的额外前置检查:
  • 确认用户已知输入/输出代币地址(或通过
    lfi swap tokens
    lfi token search
    协助查询)
  • 注意:
    swap execute
    命令的
    --account
    参数现在是可选的。如果省略,服务端将自动使用已鉴权用户的TEE钱包地址。

Skill Routing

技能路由

If user asks about...Route to
Token search, price, details, securityliberfi-token
Token K-line, candlestick chartliberfi-token
Token holders, smart money tradersliberfi-token
Trending tokens, market rankingsliberfi-market
Newly listed tokensliberfi-market
Wallet holdings, balance, PnLliberfi-portfolio
Wallet activity, transaction historyliberfi-portfolio
如果用户询问...路由到
代币搜索、价格、详情、安全信息liberfi-token
代币K线、蜡烛图liberfi-token
代币持有者、聪明钱交易者liberfi-token
热门代币、市场排名liberfi-market
新上线代币liberfi-market
钱包持仓、余额、盈亏liberfi-portfolio
钱包活动、交易历史liberfi-portfolio

CLI Command Index

CLI命令索引

Query Commands (read-only)

查询命令(只读)

CommandDescriptionAuth
lfi swap chains
List all supported swap chainsNo
lfi swap tokens [--chain-id <id>]
List available swap tokensNo
命令描述鉴权
lfi swap chains
列出所有支持兑换的公链
lfi swap tokens [--chain-id <id>]
列出可用的兑换代币

Mutating Commands (generate transactions)

变更命令(生成交易)

CommandDescriptionAuth
lfi swap quote --in <addr> --out <addr> --amount <amt> --chain-family <fam> --chain-id <id>
Get a swap quoteNo
lfi swap execute --in <addr> --out <addr> --amount <amt> --chain-family <fam> --chain-id <id>
Execute swap via TEE walletYes
lfi swap sign-and-send --chain-family <fam> --chain-id <id> --quote-result '<json>'
Build, sign, and broadcast swap in one step via TEE walletYes
lfi tx estimate --chain-family <fam> --chain-id <id> --data '<json>'
Estimate transaction fee / gasNo
lfi tx send --chain-family <fam> --chain-id <id> --signed-tx <data>
Broadcast a signed transactionYes
命令描述鉴权
lfi swap quote --in <addr> --out <addr> --amount <amt> --chain-family <fam> --chain-id <id>
获取兑换报价
lfi swap execute --in <addr> --out <addr> --amount <amt> --chain-family <fam> --chain-id <id>
通过TEE钱包执行兑换
lfi swap sign-and-send --chain-family <fam> --chain-id <id> --quote-result '<json>'
通过TEE钱包一步完成兑换交易的构建、签名和广播
lfi tx estimate --chain-family <fam> --chain-id <id> --data '<json>'
估算交易手续费/Gas
lfi tx send --chain-family <fam> --chain-id <id> --signed-tx <data>
广播已签名的交易

Parameter Reference

参数参考

Swap quote & execute (shared parameters):
  • --in <address>
    Required. Input token address
  • --out <address>
    Required. Output token address
  • --amount <amount>
    Required. Input amount in smallest unit (lamports, wei, etc.)
  • --chain-family <family>
    Required.
    evm
    or
    svm
  • --chain-id <id>
    Required. Numeric chain ID (e.g.
    0
    for Solana mainnet,
    1
    for Ethereum)
  • --slippage-bps <bps>
    — Slippage tolerance in basis points (e.g.
    100
    = 1%)
  • --swap-mode <mode>
    ExactIn
    (default) or
    ExactOut
Execute-only additional parameter:
  • --account <address>
    Optional. Wallet address override. If omitted, the server uses the authenticated user's TEE wallet automatically. Requires authentication.
  • --quote-result <json>
    — Opaque quote result JSON from a prior
    swap quote
    call (pass through without modification)
Tx estimate parameters:
  • --chain-family <family>
    Required.
    evm
    or
    svm
  • --chain-id <id>
    Required. Numeric chain ID
  • --data <json>
    Required. Transaction data as JSON string (structure depends on chain family)
Sign-and-send parameters:
  • --chain-family <family>
    Required.
    evm
    or
    svm
  • --chain-id <id>
    Required. Numeric chain ID
  • --quote-result <json>
    Required. Full quote result JSON from a prior
    lfi swap quote
    call (pass through without modification)
  • --slippage-bps <bps>
    — Override slippage tolerance in basis points
Tx send parameters:
  • --chain-family <family>
    Required.
    evm
    or
    svm
  • --chain-id <id>
    Required. Numeric chain ID
  • --signed-tx <data>
    Required. Signed transaction in base64 or hex encoding
兑换报价与执行(共用参数):
  • --in <address>
    必填。输入代币地址
  • --out <address>
    必填。输出代币地址
  • --amount <amount>
    必填。输入金额,以最小单位计算(lamports、wei等)
  • --chain-family <family>
    必填
    evm
    svm
  • --chain-id <id>
    必填。数字链ID(例如Solana主网为
    0
    ,以太坊主网为
    1
  • --slippage-bps <bps>
    — 滑点容忍度,单位为基点(例如
    100
    = 1%)
  • --swap-mode <mode>
    ExactIn
    (默认)或
    ExactOut
仅执行命令的额外参数
  • --account <address>
    可选。覆盖钱包地址。如果省略,服务端将自动使用已鉴权用户的TEE钱包。需要提前鉴权。
  • --quote-result <json>
    — 之前调用
    swap quote
    返回的不透明报价结果JSON(直接透传即可,无需修改)
交易估算参数
  • --chain-family <family>
    必填
    evm
    svm
  • --chain-id <id>
    必填。数字链ID
  • --data <json>
    必填。JSON格式的交易数据(结构取决于链家族)
签名并发送参数
  • --chain-family <family>
    必填
    evm
    svm
  • --chain-id <id>
    必填。数字链ID
  • --quote-result <json>
    必填。之前调用
    lfi swap quote
    返回的完整报价结果JSON(直接透传即可,无需修改)
  • --slippage-bps <bps>
    — 覆盖滑点容忍度,单位为基点
交易发送参数
  • --chain-family <family>
    必填
    evm
    svm
  • --chain-id <id>
    必填。数字链ID
  • --signed-tx <data>
    必填。base64或十六进制编码的已签名交易

Operation Flow

操作流程

List Supported Chains

列出支持的公链

  1. Fetch chains:
    lfi swap chains --json
  2. Present: Show chain name, chain ID, chain family (evm/svm)
  3. Suggest next step: "Which chain do you want to trade on?"
  1. 获取公链列表
    lfi swap chains --json
  2. 展示:显示公链名称、链ID、链家族(evm/svm)
  3. 建议下一步:“你想在哪条链上交易?”

Find Available Tokens

查询可用代币

  1. Fetch tokens:
    lfi swap tokens --chain-id <id> --json
  2. Present: Show token name, symbol, address
  3. Suggest next step: "Which tokens do you want to swap?"
  1. 获取代币列表
    lfi swap tokens --chain-id <id> --json
  2. 展示:显示代币名称、符号、地址
  3. 建议下一步:“你想兑换哪些代币?”

Get a Swap Quote

获取兑换报价

  1. Collect inputs: Input token, output token, amount, chain family, chain ID
  2. (mandatory) Run security check:
    lfi token security <chain> <outputTokenAddress> --json
  3. Review security result — warn user if any risk flags
  4. Get quote:
    lfi swap quote --in <in> --out <out> --amount <amt> --chain-family <fam> --chain-id <id> --json
  5. Present: Show input amount, expected output amount, price impact, slippage, route
  6. Suggest next step: "Want to execute this swap?"
  1. 收集输入信息:输入代币、输出代币、金额、链家族、链ID
  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. 展示:显示输入金额、预期输出金额、价格影响、滑点、路由
  6. 建议下一步:“要执行这笔兑换吗?”

Execute a Swap (Full Flow)

执行兑换(完整流程)

Authentication pre-flight (do this first):
bash
lfi status --json   # check session
鉴权前置检查(优先执行):
bash
lfi status --json   # 检查会话状态

If not authenticated:

如果未鉴权:

lfi login key --role AGENT --json # agent
lfi login key --role AGENT --json # Agent用户

or: lfi login <email> --json → lfi verify <otpId> <code> --json

或: lfi login <email> --json → lfi verify <otpId> <code> --json

lfi whoami --json # confirm evmAddress / solAddress

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."
lfi whoami --json # 确认evmAddress / solAddress

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. **建议下一步**:“兑换已提交!你可以在区块浏览器上追踪交易状态。”

Execute Swap in One Step (sign-and-send)

一步执行兑换(签名并发送)

Use this when you already have a quote result and want to build, sign, and broadcast in a single call — no separate
swap execute
needed.
Authentication pre-flight (do this first):
bash
lfi status --json   # check session
如果你已经获取了报价结果,想要在单次调用中完成构建、签名和广播操作,可使用该方法 — 无需单独调用
swap execute
鉴权前置检查(优先执行):
bash
lfi status --json   # 检查会话状态

If not authenticated:

如果未鉴权:

lfi login key --role AGENT --json # agent
lfi login key --role AGENT --json # Agent用户

or: lfi login <email> --json → lfi verify <otpId> <code> --json

或: lfi login <email> --json → lfi verify <otpId> <code> --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`

Estimate Transaction Fee

估算交易手续费

  1. Estimate:
    lfi tx estimate --chain-family <fam> --chain-id <id> --data '<txJson>' --json
  2. Present: Show estimated gas/fee in native token and USD equivalent
  3. Suggest next step: "Ready to send?"
  1. 估算
    lfi tx estimate --chain-family <fam> --chain-id <id> --data '<txJson>' --json
  2. 展示:显示预估的Gas/手续费(原生代币计价和等价美元金额)
  3. 建议下一步:“准备好发送交易了吗?”

Broadcast Signed Transaction (when using external wallet)

广播已签名交易(使用外部钱包时)

When the user has signed the transaction externally (not using TEE wallet):
  1. (mandatory) Ensure authenticated:
    lfi status --json
  2. (mandatory) Final confirmation: "Are you sure you want to broadcast this transaction? This is irreversible."
  3. Send:
    lfi tx send --chain-family <fam> --chain-id <id> --signed-tx <signedData> --json
  4. Present: Show transaction hash
  5. Suggest next step: "Transaction submitted! You can track it on the block explorer."
当用户使用外部钱包完成了交易签名(不使用TEE钱包)时:
  1. (强制要求) 确认已完成鉴权:
    lfi status --json
  2. (强制要求) 最终确认:“你确定要广播这笔交易吗?该操作不可撤销。”
  3. 发送
    lfi tx send --chain-family <fam> --chain-id <id> --signed-tx <signedData> --json
  4. 展示:显示交易哈希
  5. 建议下一步:“交易已提交!你可以在区块浏览器上追踪交易状态。”

Cross-Skill Workflows

跨技能工作流

"I want to swap SOL for USDC"

“我想把SOL换成USDC”

Full flow: auth → token → swap
  1. auth
    lfi status --json
    — Check session; if not authed →
    lfi login key --json
  2. auth
    lfi whoami --json
    — Confirm solAddress
  3. token
    lfi token search --q "USDC" --chains sol --json
    — Find USDC address on Solana
  4. token
    lfi token security sol <usdcAddress> --json
    — Security check (mandatory)
  5. swap
    lfi swap quote --in So11111111111111111111111111111111111111112 --out <usdcAddress> --amount <amt> --chain-family svm --chain-id 0 --json
    — Get quote
  6. Present quote summary, wait for user confirmation
  7. swap
    lfi swap execute --in ... --out ... --amount ... --chain-family svm --chain-id 0 --json
    — Server signs via TEE wallet
完整流程:鉴权 → 代币查询 → 兑换
  1. 鉴权 → 运行
    lfi status --json
    — 检查会话;如果未鉴权 → 运行
    lfi login key --json
  2. 鉴权 → 运行
    lfi whoami --json
    — 确认solAddress
  3. 代币查询 → 运行
    lfi token search --q "USDC" --chains sol --json
    — 查询Solana上的USDC地址
  4. 代币查询 → 运行
    lfi token security sol <usdcAddress> --json
    — 安全检查(强制要求)
  5. 兑换 → 运行
    lfi swap quote --in So11111111111111111111111111111111111111112 --out <usdcAddress> --amount <amt> --chain-family svm --chain-id 0 --json
    — 获取报价
  6. 展示报价摘要,等待用户确认
  7. 兑换 → 运行
    lfi swap execute --in ... --out ... --amount ... --chain-family svm --chain-id 0 --json
    — 服务端通过TEE钱包签名

"What's the best price to buy this trending token?"

“买这个热门代币的最优价格是多少?”

Full flow: auth → market → token → swap
  1. auth
    lfi status --json
    — Check session; if not authed →
    lfi login key --json
  2. market
    lfi ranking trending sol 1h --limit 5 --json
    — Get trending tokens
  3. User picks a token
  4. token
    lfi token security sol <address> --json
    — Mandatory security check
  5. swap
    lfi swap quote --in <baseToken> --out <address> --amount <amt> --chain-family svm --chain-id 0 --json
  6. Present quote with price impact analysis, wait for confirmation
  7. swap
    lfi swap execute --in ... --out ... --json
    — Server signs via TEE wallet
完整流程:鉴权 → 市场查询 → 代币查询 → 兑换
  1. 鉴权 → 运行
    lfi status --json
    — 检查会话;如果未鉴权 → 运行
    lfi login key --json
  2. 市场查询 → 运行
    lfi ranking trending sol 1h --limit 5 --json
    — 获取热门代币列表
  3. 用户选择一个代币
  4. 代币查询 → 运行
    lfi token security sol <address> --json
    — 强制安全检查
  5. 兑换 → 运行
    lfi swap quote --in <baseToken> --out <address> --amount <amt> --chain-family svm --chain-id 0 --json
  6. 展示报价和价格影响分析,等待用户确认
  7. 兑换 → 运行
    lfi swap execute --in ... --out ... --json
    — 服务端通过TEE钱包签名

"Check my wallet, then sell half of my biggest holding"

“查看我的钱包,然后把我持仓最多的代币卖出一半”

Full flow: auth → portfolio → token → swap
  1. auth
    lfi status --json
    — Check session; if not authed →
    lfi login key --json
  2. auth
    lfi whoami --json
    — Get solAddress / evmAddress
  3. portfolio
    lfi wallet holdings sol <solAddress> --json
    — Get holdings
  4. Identify largest holding, calculate half amount in smallest unit
  5. token
    lfi token security sol <tokenAddress> --json
    — Security check
  6. swap
    lfi swap quote --in <tokenAddress> --out <baseToken> --amount <halfAmt> --chain-family svm --chain-id 0 --json
  7. Present quote, wait for confirmation
  8. swap
    lfi swap execute --in ... --out ... --json
    — Server signs via TEE wallet
完整流程:鉴权 → 资产查询 → 代币查询 → 兑换
  1. 鉴权 → 运行
    lfi status --json
    — 检查会话;如果未鉴权 → 运行
    lfi login key --json
  2. 鉴权 → 运行
    lfi whoami --json
    — 获取solAddress / evmAddress
  3. 资产查询 → 运行
    lfi wallet holdings sol <solAddress> --json
    — 获取持仓列表
  4. 识别最大持仓,计算一半金额的最小单位数值
  5. 代币查询 → 运行
    lfi token security sol <tokenAddress> --json
    — 安全检查
  6. 兑换 → 运行
    lfi swap quote --in <tokenAddress> --out <baseToken> --amount <halfAmt> --chain-family svm --chain-id 0 --json
  7. 展示报价,等待用户确认
  8. 兑换 → 运行
    lfi swap execute --in ... --out ... --json
    — 服务端通过TEE钱包签名

Suggest Next Steps

建议下一步操作

Just completedSuggest 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:
lfi login key --json
" / "请先登录:
lfi login key --json
"
刚完成的操作向用户建议
公链列表查询"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 login key --json
" / "请先登录:
lfi login key --json
"

Edge Cases

边缘场景

  • Insufficient balance: If the swap execute fails with an insufficient balance error, inform the user and suggest checking their holdings via
    lfi wallet holdings
  • Slippage exceeded: If the quote shows high price impact (>5%), warn the user and suggest reducing the amount or increasing slippage tolerance
  • Invalid token address: Validate format before calling the API; ask user to verify the address
  • Unknown chain family: Only
    evm
    and
    svm
    are supported; if user mentions a chain, map it to the correct family (e.g. Solana →
    svm
    , Ethereum/BSC/Base →
    evm
    )
  • Amount format error: Remind user that amounts must be in smallest unit (lamports for SOL = amount * 10^9, wei for ETH = amount * 10^18)
  • Transaction already submitted: If tx send fails, warn that the transaction may have already been broadcast; check status before retrying
  • Quote expired: Quotes have a limited validity window; if too much time passes, get a new quote before executing
  • Network timeout: Retry once after 3 seconds; if still fails, suggest checking connectivity
  • 余额不足:如果兑换执行因余额不足失败,告知用户并建议通过
    lfi wallet holdings
    查询持仓
  • 滑点超出:如果报价显示价格影响过高(>5%),警告用户并建议减少兑换金额或提高滑点容忍度
  • 无效代币地址:调用API前验证地址格式;要求用户确认地址是否正确
  • 未知链家族:仅支持
    evm
    svm
    ;如果用户提到某条公链,映射到正确的家族(例如Solana →
    svm
    ,以太坊/BSC/Base →
    evm
  • 金额格式错误:提醒用户金额必须以最小单位计算(SOL的lamports = 金额 * 10^9,ETH的wei = 金额 * 10^18)
  • 交易已提交:如果交易发送失败,警告用户该交易可能已经广播;重试前先查询状态
  • 报价过期:报价有效期有限;如果间隔时间过长,执行前先获取新的报价
  • 网络超时:3秒后重试一次;如果仍然失败,建议检查网络连接

Common Pitfalls

常见误区

PitfallCorrect 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 swapALWAYS run
lfi token security
on the output token first
Executing swap without user confirmationALWAYS show quote summary and wait for explicit "yes"
Passing modified quote_result to execute / sign-and-sendPass the quote_result JSON through WITHOUT any modification
Calling
swap execute
or
swap sign-and-send
without authentication
Check
lfi status --json
first; re-authenticate if needed
Assuming a wallet address without checkingCall
lfi whoami --json
to get the confirmed evmAddress / solAddress
Retrying failed tx send without checkingThe tx may have been submitted; check on-chain status first
Using
sign-and-send
when you don't yet have a quote
Call
swap quote
first to get the quote result, then pass it to
sign-and-send
误区正确做法
使用可读金额(例如“1 SOL”)先转换为最小单位:1 SOL = 1,000,000,000 lamports
兑换前跳过安全检查始终先对输出代币运行
lfi token security
未获得用户确认就执行兑换始终展示报价摘要并等待用户明确回复“是”
向execute/sign-and-send传递修改后的quote_result直接透传quote_result JSON,不要做任何修改
未鉴权就调用
swap execute
swap sign-and-send
先调用
lfi status --json
检查;如有需要重新鉴权
不检查就默认使用某个钱包地址调用
lfi whoami --json
获取确认的evmAddress / solAddress
发送失败不检查就重试交易可能已经提交;先查询链上状态
没有报价就使用
sign-and-send
先调用
swap quote
获取报价结果,再传递给
sign-and-send

Security Notes

安全说明

See security-policy.md for global security rules.
Skill-specific rules:
  • Swap and transaction operations are HIGH RISK — they can move funds irreversibly
  • NEVER execute
    swap execute
    or
    tx send
    without explicit user confirmation
  • ALWAYS run
    token security
    on the output token before presenting a swap quote
  • If the security audit reveals honeypot or high tax flags, strongly recommend the user NOT proceed
  • The
    quote_result
    field is opaque — pass it through as-is; do not interpret, modify, or display its raw content
  • Transaction amounts in smallest unit are easy to get wrong — always double-check with the user: "You want to swap X SOL (= Y lamports), correct?"
  • After broadcasting, provide the transaction hash so the user can independently verify on a block explorer
查看security-policy.md了解全局安全规则。
技能专属规则:
  • 兑换和交易操作属于高风险操作 — 资金转移后不可撤销
  • 没有用户明确确认的情况下,绝对不要执行
    swap execute
    tx send
  • 展示兑换报价前,始终对输出代币运行
    token security
    检查
  • 如果安全审计发现蜜罐或高税率标记,强烈建议用户不要继续操作
  • quote_result
    字段是不透明的 — 直接透传即可;不要解析、修改或展示其原始内容
  • 最小单位的交易金额很容易出错 — 始终和用户二次确认:“你要兑换X SOL (= Y lamports),对吗?”
  • 广播交易后提供交易哈希,方便用户在区块浏览器上独立验证