Loading...
Loading...
Compare original and translation side by side
/swap-build/swap-build/swap-build/swap-execute/swap-build/swap-execute/swap-build/swap-execute/swap-build/swap-execute/swap-build/swap-execute/swap-build${CLAUDE_PLUGIN_ROOT}/skills/swap-execute-fast/scripts/execute-swap.shfast-swap.sh/swap-build/swap-execute/swap-build${CLAUDE_PLUGIN_ROOT}/skills/swap-execute-fast/scripts/execute-swap.shfast-swap.shcast${CLAUDE_PLUGIN_ROOT}/skills/swap-execute/references/wallet-setup.mdundefinedcast${CLAUDE_PLUGIN_ROOT}/skills/swap-execute/references/wallet-setup.mdundefinedundefinedundefined1 ETH to USDC on base from 0xAbc123...100 USDC to ETH on arbitrum from 0xAbc123... slippage 1000.5 WBTC to DAI on polygon from 0xAbc123... keystore mykeyethereumkeystoreenvledgertrezorkeystoremykey0x00000000000000000000000000000000000000000xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE1 ETH to USDC on base from 0xAbc123...100 USDC to ETH on arbitrum from 0xAbc123... slippage 1000.5 WBTC to DAI on polygon from 0xAbc123... keystore mykeyethereumkeystoreenvledgertrezorkeystoremykey0x00000000000000000000000000000000000000000xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE| Pair type | Default | Rationale |
|---|---|---|
| Stablecoin ↔ Stablecoin (e.g. USDC→USDT) | 5 bps (0.05%) | Minimal price deviation between pegged assets |
| Common tokens (e.g. ETH→USDC, WBTC→ETH) | 50 bps (0.50%) | Standard volatility buffer |
| All other / unknown pairs | 100 bps (1.00%) | Conservative default for long-tail or volatile tokens |
Note: The underlyingscript defaults to 50 bps if no slippage argument is passed. You must calculate and pass the correct slippage value from this table as argument 7 when calling the script.execute-swap.sh
| 代币对类型 | 默认值 | 逻辑说明 |
|---|---|---|
| 稳定币 ↔ 稳定币(例如USDC→USDT) | 5 bps(0.05%) | 挂钩资产之间的价格波动极小 |
| 主流代币(例如ETH→USDC、WBTC→ETH) | 50 bps(0.50%) | 标准波动缓冲 |
| 其他/未知代币对 | 100 bps(1.00%) | 长尾或波动代币的保守默认值 |
注意: 如果未传入滑点参数,底层脚本默认使用50 bps。你必须根据上表计算并传入正确的滑点值,作为调用脚本的第7个参数。execute-swap.sh
You are about to execute a swap IMMEDIATELY with no confirmation step. The transaction will be broadcast as soon as the route is found. Proceed? (yes/no)
/swap-build/swap-execute你即将立即执行兑换,无后续确认步骤。路由找到后交易就会立刻广播,是否继续?(是/否)
/swap-build/swap-execute0.0000000001 ETH"This swap amount is extremely small. Gas fees will far exceed the swap value. Use a larger amount."
0.0000000001 ETH「本次兑换金额极小,Gas费会远高于兑换价值,请使用更大的金额。」
${CLAUDE_PLUGIN_ROOT}/references/token-registry.mdETHUSDChttps://token-api.kyberswap.com/api/v1/public/tokens?chainIds={chainId}&symbol={symbol}&isWhitelisted=truesymbolmarketCapisWhitelisted?chainIds={chainId}&name={symbol}&isWhitelisted=trueaddress:decimals0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48:6GET https://token-api.kyberswap.com/api/v1/public/tokens/honeypot-fot-info?chainId={chainId}&address={tokenAddress}tokenIntokenOutisHoneypot: trueisFOT: true${CLAUDE_PLUGIN_ROOT}/references/token-registry.mdETHUSDChttps://token-api.kyberswap.com/api/v1/public/tokens?chainIds={chainId}&symbol={symbol}&isWhitelisted=truesymbolmarketCapisWhitelisted?chainIds={chainId}&name={symbol}&isWhitelisted=trueaddress:decimals0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48:6GET https://token-api.kyberswap.com/api/v1/public/tokens/honeypot-fot-info?chainId={chainId}&address={tokenAddress}tokenIntokenOutisHoneypot: trueisFOT: truebash ${CLAUDE_PLUGIN_ROOT}/skills/swap-execute-fast/scripts/execute-swap.sh <amount> <tokenIn> <tokenOut> <chain> <sender> [recipient] [slippage_bps] [wallet_method] [keystore_name]| # | Name | Required | Description |
|---|---|---|---|
| 1 | | Yes | Human-readable amount (e.g. |
| 2 | | Yes | Input token symbol (e.g. |
| 3 | | Yes | Output token symbol (e.g. |
| 4 | | Yes | Chain slug (e.g. |
| 5 | | Yes | Sender wallet address |
| 6 | | No | Recipient address (default: same as sender) |
| 7 | | No | Slippage in basis points (default: |
| 8 | | No | |
| 9 | | No | Keystore account name (default: |
Note: Arguments 7-9 use snake_case (shell convention) for the script's positional parameters. When parsing user input, map from the camelCase names above (slippageTolerance → slippage_bps, walletMethod → wallet_method, keystoreName → keystore_name).
undefinedbash ${CLAUDE_PLUGIN_ROOT}/skills/swap-execute-fast/scripts/execute-swap.sh <amount> <tokenIn> <tokenOut> <chain> <sender> [recipient] [slippage_bps] [wallet_method] [keystore_name]| 序号 | 名称 | 必填 | 说明 |
|---|---|---|---|
| 1 | | 是 | 人工可读的金额(例如 |
| 2 | | 是 | 输入代币符号(例如 |
| 3 | | 是 | 输出代币符号(例如 |
| 4 | | 是 | 链标识(例如 |
| 5 | | 是 | 发送方钱包地址 |
| 6 | | 否 | 接收方地址(默认:和sender一致) |
| 7 | | 否 | 滑点,单位为基点(默认: |
| 8 | | 否 | |
| 9 | | 否 | Keystore账户名称(默认: |
注意: 脚本的位置参数7-9遵循shell命名规范使用蛇形命名。解析用户输入时,需将上文的驼峰命名映射过来:slippageTolerance → slippage_bps、walletMethod → wallet_method、keystoreName → keystore_name。
undefinedundefinedundefinedok: true{
"ok": true,
"chain": "base",
"txHash": "0x1234567890abcdef...",
"blockNumber": "12345678",
"gasUsed": "285432",
"status": "1",
"explorerUrl": "https://basescan.org/tx/0x1234...",
"swap": {
"tokenIn": {"symbol": "ETH", "amount": "1"},
"tokenOut": {"symbol": "USDC", "amount": "2345.67"},
"slippageBps": "50"
},
"tx": {
"sender": "0xYourAddress",
"recipient": "0xYourAddress",
"router": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
"value": "1000000000000000000"
},
"walletMethod": "keystore"
}ok: false{
"ok": false,
"error": "Swap failed (pre-flight): Build failed — Route not found. No route available for this pair/amount. No transaction was submitted."
}ok: true{
"ok": true,
"chain": "base",
"txHash": "0x1234567890abcdef...",
"blockNumber": "12345678",
"gasUsed": "285432",
"status": "1",
"explorerUrl": "https://basescan.org/tx/0x1234...",
"swap": {
"tokenIn": {"symbol": "ETH", "amount": "1"},
"tokenOut": {"symbol": "USDC", "amount": "2345.67"},
"slippageBps": "50"
},
"tx": {
"sender": "0xYourAddress",
"recipient": "0xYourAddress",
"router": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
"value": "1000000000000000000"
},
"walletMethod": "keystore"
}ok: false{
"ok": false,
"error": "Swap failed (pre-flight): Build failed — Route not found. No route available for this pair/amount. No transaction was submitted."
}undefinedundefined| Field | Value |
|---|---|
| Transaction Hash | |
| Block Number | {blockNumber} |
| Gas Used | {gasUsed} |
| Status | {status == "1" ? "Success" : "Failed"} |
| Slippage | {swap.slippageBps/100}% |
⚠️ This transaction was executed immediately without confirmation. If this was a mistake, you cannot undo it.
**On error**, check the error prefix to determine what happened:
- **`"Swap failed (pre-flight): ..."`** — No transaction was submitted on-chain. No gas was spent. Fix the issue and retry.
- **`"Transaction was broadcast but ..."`** — A real transaction was sent. Gas fees were consumed. Check the block explorer for details.| 字段 | 值 |
|---|---|
| 交易哈希 | |
| 区块号 | {blockNumber} |
| Gas消耗 | {gasUsed} |
| 状态 | {status == "1" ? "成功" : "失败"} |
| 滑点 | {swap.slippageBps/100}% |
⚠️ 本次交易未经过确认直接执行,如果操作失误无法撤销。
**执行错误时,根据错误前缀判断问题类型:**
- **`"Swap failed (pre-flight): ..."`** —— 未上链提交交易,未消耗Gas费,修复问题后重试即可。
- **`"Transaction was broadcast but ..."`** —— 已发送真实交易,已消耗Gas费,请在区块浏览器查看详情。| Variable | Description |
|---|---|
| Private key (required if |
| Override default |
| Override chain RPC URL |
| 变量 | 说明 |
|---|---|
| 私钥(如果 |
| 覆盖默认的 |
| 覆盖链的RPC URL |
/swap-build/swap-execute/swap-build/swap-execute"Swap failed (pre-flight): ..."| Error | Cause | Quick Fix |
|---|---|---|
| Route not found (4008) | No liquidity for this pair/amount | Try a smaller amount, remove source filters, or try a different chain. |
| Token not found (4011) | Wrong token address or unsupported token | Verify the token symbol and chain are correct. |
| Gas estimation failed — return amount not enough (4227) | Price moved between route fetch and build | Retry — the script will fetch a fresh route. Increase slippage if it keeps failing. |
| Gas estimation failed — insufficient funds (4227) | Sender doesn't have enough native token for value + gas | Top up the wallet or reduce swap amount. |
| Gas estimation failed — TRANSFER_FROM_FAILED (4227) | Missing token approval or insufficient token balance | Approve the router to spend the input token first. Check balance. |
| Quoted amount smaller than estimated (4222) | RFQ quote came in lower than expected | Retry. The script will fetch a fresh route. |
| Insufficient allowance | ERC-20 approval too low | The script detects this and aborts. Approve the router address for at least |
| Insufficient token balance | Sender doesn't hold enough of the input token | The script detects this and aborts. Check balance. |
| Dust amount detected | Swap value < $0.10 USD | Use a larger amount. Gas fees dwarf the swap value. |
| Uneconomical swap | Gas cost > swap value | Use a larger amount to make the trade worthwhile. |
"Swap failed (pre-flight): ..."| 错误 | 原因 | 快速修复方案 |
|---|---|---|
| Route not found (4008) | 该代币对/金额没有流动性 | 尝试减少金额、移除来源过滤,或换其他链。 |
| Token not found (4011) | 代币地址错误或不支持该代币 | 核对代币符号和链是否正确。 |
| Gas estimation failed — return amount not enough (4227) | 获取路由和构建交易之间价格发生变动 | 重试即可,脚本会获取最新路由。如果持续失败请调高滑点。 |
| Gas estimation failed — insufficient funds (4227) | 发送方原生代币余额不足以支付交易金额+Gas费 | 给钱包充值或减少兑换金额。 |
| Gas estimation failed — TRANSFER_FROM_FAILED (4227) | 缺少代币授权或代币余额不足 | 先授权路由地址消耗输入代币,核对余额。 |
| Quoted amount smaller than estimated (4222) | RFQ报价低于预期 | 重试即可,脚本会获取最新路由。 |
| Insufficient allowance | ERC-20授权额度不足 | 脚本会检测到该问题并终止,请给路由地址授权至少等于兑换金额的额度。 |
| Insufficient token balance | 发送方持有的输入代币不足 | 脚本会检测到该问题并终止,核对余额。 |
| Dust amount detected | 兑换价值低于0.1美元 | 使用更大的金额,Gas费会远高于兑换价值。 |
| Uneconomical swap | Gas成本高于兑换价值 | 使用更大的金额让交易更划算。 |
"Transaction was broadcast but ..."| Error | Cause | Quick Fix |
|---|---|---|
| Approval revoked or race condition | Re-approve and retry. |
| Price slipped beyond tolerance during execution | Increase slippage or retry quickly. For MEV protection, use a private RPC. |
| Out of gas | Gas limit insufficient for the route | The script adds a 20% buffer, but complex routes may need more. Set |
"Transaction was broadcast but ..."| 错误 | 原因 | 快速修复方案 |
|---|---|---|
| 授权被撤销或出现竞态条件 | 重新授权后重试。 |
| 执行期间价格波动超出滑点容忍范围 | 调高滑点或快速重试。如需MEV保护请使用私有RPC。 |
| Out of gas | Gas限制不足以支撑该路由 | 脚本已添加20%缓冲,但复杂路由可能需要更高额度。设置 |
${CLAUDE_PLUGIN_ROOT}/skills/error-handling/SKILL.md| Error | Solution |
|---|---|
| Install Foundry: |
| Create |
| Export |
| Set |
${CLAUDE_PLUGIN_ROOT}/skills/error-handling/SKILL.md| 错误 | 解决方案 |
|---|---|
| 安装Foundry: |
| 创建 |
| 导出 |
| 设置 |