← 返回 Skills 市场
1inch
作者
eric1099281
· GitHub ↗
· v1.0.0
· MIT-0
118
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install 1inch
功能描述
Provides 1inch API v5.2 client to get optimal DEX trade quotes and execute token swaps across multiple chains with gas and slippage control.
使用说明 (SKILL.md)
1inch DEX 聚合器技能
描述
1inch 是一个去中心化交易所 (DEX) 聚合器,通过智能路由算法在多个 DEX 之间寻找最优交易路径。本技能提供 1inch API v5.2 的客户端实现,支持获取报价和执行代币交换。
功能
- 获取最优交易报价
- 执行 DEX 代币交换
- 支持多链和多 DEX 聚合
- Gas 估算和优化
- 限价单支持
API 端点
- 基础 URL:
https://api.1inch.dev/swap/v5.2 - 获取报价:
GET /quote- 获取交易报价 - 执行交换:
GET /swap- 获取交换交易数据
使用方法
Python 客户端
from oneinch_client import OneInchClient
client = OneInchClient(api_key="your_api_key")
# 获取交易报价
quote = client.get_quote(
chain_id=1, # Ethereum
from_token_address="0x...",
to_token_address="0x...",
amount="1000000000000000000" # 1 ETH in wei
)
# 获取支持的代币
tokens = client.get_tokens(chain_id=1)
DEX 交易
from oneinch_swap import OneInchSwap
swap = OneInchSwap(api_key="your_api_key")
# 执行代币交换
tx_data = swap.swap(
chain_id=1,
from_token_address="0x...",
to_token_address="0x...",
amount="1000000000000000000",
from_address="0x...",
slippage=1 # 1%
)
API 参考
get_quote 参数
chain_id: 链 ID (1=Ethereum, 56=BSC, 137=Polygon, etc.)from_token_address: 输入代币地址to_token_address: 输出代币地址amount: 输入数量 (最小单位)protocols: (可选) 指定使用的协议gas_price: (可选) Gas 价格complexity_level: (可选) 路由复杂度级别
swap 参数
chain_id: 链 IDfrom_token_address: 输入代币地址to_token_address: 输出代币地址amount: 输入数量from_address: 发送方地址slippage: 滑点容忍度 (百分比,1=1%)disable_estimate: (可选) 禁用 Gas 估算allow_partial_fill: (可选) 允许部分成交
响应格式
Quote 响应
{
"fromToken": {
"symbol": "ETH",
"name": "Ethereum",
"decimals": 18,
"address": "0x...",
"logoURI": "..."
},
"toToken": {
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"address": "0x...",
"logoURI": "..."
},
"fromTokenAmount": "1000000000000000000",
"toTokenAmount": "1850000000",
"protocols": [...],
"estimatedGas": 150000
}
Swap 响应
{
"tx": {
"from": "0x...",
"to": "0x...",
"data": "0x...",
"value": "1000000000000000000",
"gasPrice": "20000000000",
"gas": 150000
},
"toTokenAmount": "1850000000",
"fromTokenAmount": "1000000000000000000"
}
支持的链
- Ethereum (1)
- BSC (56)
- Polygon (137)
- Optimism (10)
- Arbitrum (42161)
- Avalanche (43114)
- Fantom (250)
- Gnosis (100)
- 更多...
错误处理
- 400: 请求参数错误
- 401: API 密钥无效
- 404: 代币或路由未找到
- 429: 请求速率限制
- 500: 服务器错误
速率限制
- 免费计划:100 请求/秒
- 需要 API 密钥:https://portal.1inch.dev/
依赖
requests: HTTP 客户端库- Python 3.8+
安全使用建议
This skill appears to be a straightforward 1inch API client. Before installing: 1) Verify the API base URL (the SKILL.md uses 'api.1inch.dev' — confirm that's the official endpoint you want to use). 2) Do not pass private keys into the skill or agent unless you understand where they will be logged or stored; the execute_swap method accepts a private_key parameter and prints transaction data, which could leak secrets in logs. 3) Provide an API key only when needed and prefer scoped/limited keys. 4) Review and test the code in a sandboxed environment (no special install required beyond 'requests') to confirm behavior and to ensure you are comfortable with network calls to the 1inch API.
功能分析
Type: OpenClaw Skill
Name: 1inch
Version: 1.0.0
The skill bundle provides a legitimate Python client and wrapper for the 1inch DEX aggregator API (v5.2). The code in `oneinch_client.py` and `oneinch_swap.py` correctly implements API interactions for quoting and building swap transactions using the official 1inch developer portal endpoints (api.1inch.dev). There is no evidence of data exfiltration, malicious execution, or prompt injection; sensitive operations like transaction signing are explicitly left as placeholders with warnings, requiring external libraries and user-provided keys.
能力评估
Purpose & Capability
Name/description match the included Python client and swap helper code. The two modules implement quote, swap, token, spender and approval endpoints consistent with a 1inch DEX aggregator client. No unrelated binaries, services, or credentials are requested.
Instruction Scope
SKILL.md and the example code stay within the stated purpose (calling 1inch endpoints to get quotes and build swap/approval txs). The code includes an execute_swap(private_key=...) parameter that prints transaction data when a private key is provided; the SKILL.md examples do not advise about private-key handling or logging, so users could accidentally expose secrets in logs if they supply keys. Also the SKILL.md uses the base URL 'https://api.1inch.dev/swap/v5.2' — verify this is the intended official endpoint for your environment.
Install Mechanism
Instruction-only skill with included source files; no install spec or external downloads. The only dependency is the common 'requests' Python package as declared. Nothing is being fetched from arbitrary URLs or extracted to disk.
Credentials
The skill metadata declares no required environment variables, and the code requires an API key parameter passed to the client (not implicitly via environment). This is proportionate for an API client, but there's a minor metadata mismatch: the skill effectively requires a 1inch API key at runtime even though no env vars are declared. No other credentials or unrelated secrets are requested.
Persistence & Privilege
always: false and normal invocation settings. The skill does not request persistent system privileges, modify other skills, or store/enable itself autonomously.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install 1inch - 安装完成后,直接呼叫该 Skill 的名称或使用
/1inch触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
1inch DEX 聚合器技能 v1.0.0 首次发布。
- 提供 1inch API v5.2 Python 客户端,支持多链与多 DEX 聚合。
- 支持获取最优交易报价、执行代币交换、限价单、Gas 估算与优化。
- 包含详细 API 端点、参数说明及使用示例。
- 列出支持链及常见错误处理方式。
- 需 API 密钥,支持免费额度。
元数据
常见问题
1inch 是什么?
Provides 1inch API v5.2 client to get optimal DEX trade quotes and execute token swaps across multiple chains with gas and slippage control. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 118 次。
如何安装 1inch?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install 1inch」即可一键安装,无需额外配置。
1inch 是免费的吗?
是的,1inch 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
1inch 支持哪些平台?
1inch 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 1inch?
由 eric1099281(@eric1099281)开发并维护,当前版本 v1.0.0。
推荐 Skills