← Back to Skills Marketplace
eric1099281

1inch

by eric1099281 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
118
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install 1inch
Description
Provides 1inch API v5.2 client to get optimal DEX trade quotes and execute token swaps across multiple chains with gas and slippage control.
README (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: 链 ID
  • from_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+
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install 1inch
  3. After installation, invoke the skill by name or use /1inch
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
1inch DEX 聚合器技能 v1.0.0 首次发布。 - 提供 1inch API v5.2 Python 客户端,支持多链与多 DEX 聚合。 - 支持获取最优交易报价、执行代币交换、限价单、Gas 估算与优化。 - 包含详细 API 端点、参数说明及使用示例。 - 列出支持链及常见错误处理方式。 - 需 API 密钥,支持免费额度。
Metadata
Slug 1inch
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is 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. It is an AI Agent Skill for Claude Code / OpenClaw, with 118 downloads so far.

How do I install 1inch?

Run "/install 1inch" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 1inch free?

Yes, 1inch is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 1inch support?

1inch is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 1inch?

It is built and maintained by eric1099281 (@eric1099281); the current version is v1.0.0.

💬 Comments