1inch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

1inch DEX Aggregator

1inch DEX聚合器

Swap tokens on EVM networks using the 1inch DEX aggregator. 1inch finds the best swap route across DEXes (Uniswap, SushiSwap, Curve, Balancer, etc.) to get the best price. This is Classic Swap mode where the user pays gas directly.
Supported Networks: Ethereum, Arbitrum, Base, Optimism, Polygon, BSC, Avalanche, Gnosis.
IMPORTANT: All tools require a
chain
parameter. Always ask the user which network they want to use before proceeding. Do not assume a default chain.
Default for spot token swaps. Use 1inch for buying/selling/swapping tokens. 1inch aggregates liquidity across all major DEXes to get the best price. Hyperliquid spot is only for tokens listed on Hyperliquid's own orderbook — for general spot trading across chains.
在EVM网络上使用1inch DEX聚合器进行代币兑换。1inch会在各DEX(Uniswap、SushiSwap、Curve、Balancer等)中寻找最优兑换路径,以获取最优惠价格。这是经典兑换模式,用户需要直接支付gas费用。
**支持的网络:**Ethereum、Arbitrum、Base、Optimism、Polygon、BSC、Avalanche、Gnosis。
**重要提示:**所有工具都需要
chain
参数。在操作前务必询问用户要使用的网络,不要默认任何网络。
现货代币兑换的默认选择。使用1inch进行代币的买入/卖出/兑换。1inch聚合了所有主流DEX的流动性以获取最优价格。Hyperliquid现货仅适用于Hyperliquid自有订单簿上列出的代币——若要在多链间进行通用现货交易,请使用1inch。

Prerequisites — Wallet Policy

前置条件——钱包策略

Before executing any swap, the wallet policy must be active. Load the wallet-policy skill and propose the standard wildcard policy (deny key export + allow
*
). This covers all 1inch operations — swap transactions, token approvals, and signing — across all chains.
在执行任何兑换操作前,钱包策略必须处于激活状态。加载wallet-policy技能并提议标准通配符策略(禁止密钥导出 + 允许
*
)。该策略适用于所有1inch操作——跨所有网络的兑换交易、代币授权和签名。

Available Tools (8)

可用工具(8个)

Same-Chain Read-Only Tools

同链只读工具

ToolDescription
oneinch_quote
Get swap price quote (estimated output, gas, route). Requires
chain
.
oneinch_tokens
Search supported tokens on a network (address, symbol, decimals). Requires
chain
.
oneinch_check_allowance
Check if a token needs approval before swapping. Requires
chain
.
工具描述
oneinch_quote
获取兑换价格报价(预估输出金额、gas费用、路径)。需要
chain
参数。
oneinch_tokens
搜索某一网络上支持的代币(地址、符号、小数位数)。需要
chain
参数。
oneinch_check_allowance
检查代币在兑换前是否需要授权。需要
chain
参数。

Same-Chain Write Tools (require wallet)

同链写入工具(需要钱包)

ToolDescription
oneinch_approve
Approve ERC-20 token for 1inch router spending. Requires
chain
.
oneinch_swap
Execute a token swap via 1inch. Requires
chain
.
工具描述
oneinch_approve
授权ERC-20代币给1inch路由合约使用。需要
chain
参数。
oneinch_swap
通过1inch执行代币兑换。需要
chain
参数。

Cross-Chain Tools (Fusion+)

跨链工具(Fusion+)

Fusion+ enables gasless cross-chain swaps using intent-based atomic swaps. Resolvers handle gas on both chains.
ToolDescription
oneinch_cross_chain_quote
Get a cross-chain swap quote. Requires
src_chain
,
dst_chain
,
src_token
,
dst_token
,
amount
.
oneinch_cross_chain_swap
Execute a cross-chain swap (long-running). Requires
src_chain
,
dst_chain
,
src_token
,
dst_token
,
amount
. Optional
preset
(fast/medium/slow). Recommend running via
sessions_spawn
as it can take up to 10 minutes.
oneinch_cross_chain_status
Check status of a cross-chain swap order. Requires
order_hash
.
Fusion+通过基于意图的原子兑换实现无gas跨链兑换。Resolver会处理两条链上的gas费用。
工具描述
oneinch_cross_chain_quote
获取跨链兑换报价。需要
src_chain
dst_chain
src_token
dst_token
amount
参数。
oneinch_cross_chain_swap
执行跨链兑换(耗时较长)。需要
src_chain
dst_chain
src_token
dst_token
amount
参数。可选参数
preset
(fast/medium/slow)。建议通过
sessions_spawn
运行,因为该操作可能需要长达10分钟。
oneinch_cross_chain_status
检查跨链兑换订单的状态。需要
order_hash
参数。

Tool Usage Examples

工具使用示例

Get a quote (price check only)

获取报价(仅价格查询)

oneinch_quote(
  chain="arbitrum",
  src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",  # ETH
  dst="<USDC_ADDRESS>",                                  # use oneinch_tokens to find
  amount="1000000000000000000"                            # 1 ETH in wei
)
oneinch_quote(
  chain="arbitrum",
  src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",  # ETH
  dst="<USDC_ADDRESS>",                                  # 使用oneinch_tokens查找
  amount="1000000000000000000"                            # 1 ETH(以wei为单位)
)

Search for a token

搜索代币

oneinch_tokens(chain="ethereum", search="USDC")
oneinch_tokens(chain="ethereum", search="USDC")

Check if approval is needed

检查是否需要授权

oneinch_check_allowance(chain="arbitrum", token_address="<TOKEN_ADDRESS>")
oneinch_check_allowance(chain="arbitrum", token_address="<TOKEN_ADDRESS>")

Approve a token

授权代币

oneinch_approve(chain="arbitrum", token_address="<TOKEN_ADDRESS>")
oneinch_approve(chain="arbitrum", token_address="<TOKEN_ADDRESS>")

Execute a swap

执行兑换

oneinch_swap(
  chain="arbitrum",
  src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",  # ETH
  dst="<USDC_ADDRESS>",                                  # use oneinch_tokens to find
  amount="1000000000000000000",                           # 1 ETH
  slippage=1.0                                            # 1% slippage
)
oneinch_swap(
  chain="arbitrum",
  src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",  # ETH
  dst="<USDC_ADDRESS>",                                  # 使用oneinch_tokens查找
  amount="1000000000000000000",                           # 1 ETH
  slippage=1.0                                            # 1%滑点
)

Cross-Chain: Get a quote

跨链操作:获取报价

oneinch_cross_chain_quote(
  src_chain="ethereum",
  dst_chain="arbitrum",
  src_token="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",  # ETH on Ethereum
  dst_token="<USDC_ADDRESS>",                                  # USDC on Arbitrum
  amount="1000000000000000000"                                  # 1 ETH in wei
)
oneinch_cross_chain_quote(
  src_chain="ethereum",
  dst_chain="arbitrum",
  src_token="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",  # Ethereum上的ETH
  dst_token="<USDC_ADDRESS>",                                  # Arbitrum上的USDC
  amount="1000000000000000000"                                  # 1 ETH(以wei为单位)
)

Cross-Chain: Execute a swap (recommend background task)

跨链操作:执行兑换(建议后台任务运行)

sessions_spawn(
  message="Execute cross-chain swap: oneinch_cross_chain_swap(src_chain='ethereum', dst_chain='arbitrum', src_token='0xEeee...EEeE', dst_token='<USDC_ADDR>', amount='1000000000000000000', preset='medium')"
)
sessions_spawn(
  message="Execute cross-chain swap: oneinch_cross_chain_swap(src_chain='ethereum', dst_chain='arbitrum', src_token='0xEeee...EEeE', dst_token='<USDC_ADDR>', amount='1000000000000000000', preset='medium')"
)

Cross-Chain: Check order status

跨链操作:检查订单状态

oneinch_cross_chain_status(order_hash="<ORDER_HASH>")
oneinch_cross_chain_status(order_hash="<ORDER_HASH>")

Common Workflows

常见工作流

Step 0 for all workflows: If the wallet policy is not yet active, load the wallet-policy skill and propose the standard wildcard policy before proceeding.
**所有工作流的第0步:**如果钱包策略尚未激活,请先加载wallet-policy技能并提议标准通配符策略,然后再进行后续操作。

Swap native ETH for USDC (no approval needed)

用原生ETH兑换USDC(无需授权)

  1. Find token address:
    oneinch_tokens(chain="arbitrum", search="USDC")
    — get the USDC address on Arbitrum
  2. Quote:
    oneinch_quote(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000")
  3. Swap:
    oneinch_swap(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000")
Native ETH does not require token approval.
  1. 查找代币地址:
    oneinch_tokens(chain="arbitrum", search="USDC")
    ——获取Arbitrum上的USDC地址
  2. 获取报价:
    oneinch_quote(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000")
  3. 执行兑换:
    oneinch_swap(chain="arbitrum", src="0xEeee...EEeE", dst="<USDC_ADDR>", amount="1000000000000000000")
原生ETH无需代币授权。

Swap USDC for WETH (approval required)

用USDC兑换WETH(需要授权)

  1. Find token addresses:
    oneinch_tokens(chain="arbitrum", search="USDC")
    and
    oneinch_tokens(chain="arbitrum", search="WETH")
  2. Check allowance:
    oneinch_check_allowance(chain="arbitrum", token_address="<USDC_ADDR>")
  3. If needs_approval:
    oneinch_approve(chain="arbitrum", token_address="<USDC_ADDR>")
  4. Swap:
    oneinch_swap(chain="arbitrum", src="<USDC_ADDR>", dst="<WETH_ADDR>", amount="1000000", slippage=1.0)
  1. 查找代币地址:
    oneinch_tokens(chain="arbitrum", search="USDC")
    oneinch_tokens(chain="arbitrum", search="WETH")
  2. 检查授权额度:
    oneinch_check_allowance(chain="arbitrum", token_address="<USDC_ADDR>")
  3. 若需要授权:
    oneinch_approve(chain="arbitrum", token_address="<USDC_ADDR>")
  4. 执行兑换:
    oneinch_swap(chain="arbitrum", src="<USDC_ADDR>", dst="<WETH_ADDR>", amount="1000000", slippage=1.0)

Price check only (no execution)

仅价格查询(不执行兑换)

Use
oneinch_quote
to compare prices without executing. This does not require a wallet.
使用
oneinch_quote
比较价格,无需执行兑换操作,此操作不需要钱包。

Token Addresses

代币地址

Token addresses differ between networks. Always use
oneinch_tokens(chain="<network>", search="<symbol>")
to discover the correct address for a token on a specific chain.
The native gas token address is the same on all EVM chains:
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
不同网络上的代币地址不同。请始终使用
oneinch_tokens(chain="<network>", search="<symbol>")
来查找特定链上代币的正确地址。
原生gas代币的地址在所有EVM链上都是相同的:
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

Amount Formatting (Wei Conversion)

金额格式(Wei转换)

All amounts must be in wei (the smallest unit of the token):
Token1 Token in WeiFormula
ETH (18 decimals)
1000000000000000000
amount × 10^18
USDC (6 decimals)
1000000
amount × 10^6
USDT (6 decimals)
1000000
amount × 10^6
Always check token decimals with
oneinch_tokens
before calculating amounts.
所有金额必须以wei为单位(代币的最小单位):
代币1个代币对应的Wei值计算公式
ETH(18位小数)
1000000000000000000
金额 × 10^18
USDC(6位小数)
1000000
金额 × 10^6
USDT(6位小数)
1000000
金额 × 10^6
在计算金额前,请务必使用
oneinch_tokens
检查代币的小数位数。

Error Handling

错误处理

ErrorCauseSolution
Unknown chain
Invalid chain nameUse one of: ethereum, arbitrum, base, optimism, polygon, bsc, avalanche, gnosis
insufficient allowance
Token not approved for 1inch routerUse
oneinch_approve
first
insufficient balance
Not enough tokens in walletCheck balance with
wallet_balance
cannot estimate
Route not found or amount too smallTry a different amount or token pair
Policy violation
Wallet policy blocks the transactionLoad the wallet-policy skill and propose the standard wildcard policy (deny key export + allow
*
).
rate limit
Too many API calls (1 RPS free tier)Wait a moment and retry
错误原因解决方案
Unknown chain
无效的网络名称使用以下网络之一:ethereum、arbitrum、base、optimism、polygon、bsc、avalanche、gnosis
insufficient allowance
代币未授权给1inch路由合约先使用
oneinch_approve
进行授权
insufficient balance
钱包中的代币余额不足使用
wallet_balance
检查余额
cannot estimate
未找到兑换路径或金额过小尝试更换金额或代币对
Policy violation
钱包策略阻止了交易加载wallet-policy技能并提议标准通配符策略(禁止密钥导出 + 允许
*
)。
rate limit
API调用过于频繁(免费 tier 限制为1次/秒)稍等片刻后重试

Wallet Policy

钱包策略

For 1inch swaps to work, the wallet policy must be active. Use the standard wildcard policy (deny key export + allow
*
) — see Prerequisites section above.
要使1inch兑换正常工作,钱包策略必须处于激活状态。请使用标准通配符策略(禁止密钥导出 + 允许
*
)——详见上方的前置条件部分。