Search

PythonReactSEOPDF
OpenClaw

Zeroex Swap

ZeroEx Swap Skill

aviclaw0 source installs☆ 0 Repository stars

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

SkillHub CLI

skillhub install aviclaw/zeroex-swap

Inspect the source and compatibility requirements, then follow its installation steps.

Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.

View source ↗Guides

Skill instructions

ZeroEx Swap Skill

⚠️ SECURITY WARNING: This skill involves real funds. Review all parameters before executing swaps.

Install

cd skills/zeroex-swap
npm install

Required Environment Variables

Variable Description Required
ZEROEX_API_KEY Get from https://dashboard.0x.org/ Yes
PRIVATE_KEY Wallet private key (hex, without 0x prefix) Yes
RPC_URL RPC endpoint for chain (optional, defaults provided) No

Declared required env vars: ZEROEX_API_KEY, PRIVATE_KEY

export ZEROEX_API_KEY="your-0x-api-key"
export PRIVATE_KEY="your-private-key-hex"
export RPC_URL="https://mainnet.base.org"  # optional

Usage

Get Price Quote
node quote.js --sell USDC --buy WETH --amount 1 --chain base
Execute Swap (sell → buy)
node swap.js --sell USDC --buy WETH --amount 1 --chain base
Execute Swap (buy example)
node swap.js --sell WETH --buy USDC --amount 0.01 --chain base

Trade History

getSwapTrades
curl -s "https://api.0x.org/trade-analytics/swap?chainId=8453&taker=0xYOUR_WALLET" \
  -H "0x-api-key: $ZEROEX_API_KEY" \
  -H "0x-version: v2"
getGaslessTrades
curl -s "https://api.0x.org/trade-analytics/gasless?chainId=8453&taker=0xYOUR_WALLET" \
  -H "0x-api-key: $ZEROEX_API_KEY" \
  -H "0x-version: v2"

Gasless Swap (Meta-transaction)

Flow:

  1. Get gasless quote
  2. Sign EIP-712 payload
  3. Submit meta-tx
1) Get gasless quote
curl -s "https://api.0x.org/gasless/quote?sellToken=USDC&buyToken=WETH&sellAmount=1000000&chainId=8453&taker=0xYOUR_WALLET" \
  -H "0x-api-key: $ZEROEX_API_KEY" \
  -H "0x-version: v2"
2) Sign EIP-712 (use viem)
// use viem to sign quote.trade.eip712
await client.signTypedData({
  domain: quote.trade.eip712.domain,
  types: quote.trade.eip712.types,
  message: quote.trade.eip712.message,
  primaryType: quote.trade.eip712.primaryType...

Source information

Source
github
Repository
openclaw/skills
Path
skills/aviclaw/zeroex-swap
Version
—
Commit
ecf4ee0c0a05bbdbc083a62bf9398554dc6301fd
Classification source
rules
Status
active
Visibility
public

These signals come from indexed source analysis and may lag behind changes. Check the current source files.

README

0x Swap Skill

Secure ERC‑20 swaps via 0x Swap API.

Files

  • SKILL.md — agent skill instructions
  • quote.js — fetch quotes
  • swap.js — execute swaps
  • package.json — dependencies

Setup

npm install
export ZEROEX_API_KEY="your-0x-api-key"
export PRIVATE_KEY="your-private-key-hex"
export RPC_URL="https://mainnet.base.org"  # optional

Usage

node quote.js --sell USDC --buy WETH --amount 1 --chain base
node swap.js  --sell USDC --buy WETH --amount 1 --chain base

Security

  • Use a dedicated hot wallet
  • Set slippage protection
  • Approve exact amounts only

Extracted content

SKILL.md
# ZeroEx Swap Skill

⚠️ **SECURITY WARNING:** This skill involves real funds. Review all parameters before executing swaps.

## Install
```bash
cd skills/zeroex-swap
npm install
```

## Required Environment Variables

| Variable | Description | Required |
|----------|-------------|----------|
| `ZEROEX_API_KEY` | Get from https://dashboard.0x.org/ | Yes |
| `PRIVATE_KEY` | Wallet private key (hex, without 0x prefix) | Yes |
| `RPC_URL` | RPC endpoint for chain (optional, defaults provided) | No |

**Declared required env vars:** `ZEROEX_API_KEY`, `PRIVATE_KEY`

```bash
export ZEROEX_API_KEY="your-0x-api-key"
export PRIVATE_KEY="your-private-key-hex"
export RPC_URL="https://mainnet.base.org"  # optional
```

## Usage

### Get Price Quote
```bash
node quote.js --sell USDC --buy WETH --amount 1 --chain base
```

### Execute Swap (sell → buy)
```bash
node swap.js --sell USDC --buy WETH --amount 1 --chain base
```

### Execute Swap (buy example)
```bash
node swap.js --sell WETH --buy USDC --amount 0.01 --chain base
```

## Trade History

### getSwapTrades
```bash
curl -s "https://api.0x.org/trade-analytics/swap?chainId=8453&taker=0xYOUR_WALLET" \
  -H "0x-api-key: $ZEROEX_API_KEY" \
  -H "0x-version: v2"
```

### getGaslessTrades
```bash
curl -s "https://api.0x.org/trade-analytics/gasless?chainId=8453&taker=0xYOUR_WALLET" \
  -H "0x-api-key: $ZEROEX_API_KEY" \
  -H "0x-version: v2"
```

## Gasless Swap (Meta-transaction)

**Flow:**
1. Get gasless quote
2. Sign EIP-712 payload
3. Submit meta-tx

### 1) Get gasless quote
```bash
curl -s "https://api.0x.org/gasless/quote?sellToken=USDC&buyToken=WETH&sellAmount=1000000&chainId=8453&taker=0xYOUR_WALLET" \
  -H "0x-api-key: $ZEROEX_API_KEY" \
  -H "0x-version: v2"
```

### 2) Sign EIP-712 (use viem)
```js
// use viem to sign quote.trade.eip712
await client.signTypedData({
  domain: quote.trade.eip712.domain,
  types: quote.trade.eip712.types,
  message: quote.trade.eip712.message,
  primaryType: quote.trade.eip712.primaryType...
README
# 0x Swap Skill

Secure ERC‑20 swaps via 0x Swap API.

## Files
- `SKILL.md` — agent skill instructions
- `quote.js` — fetch quotes
- `swap.js` — execute swaps
- `package.json` — dependencies

## Setup
```bash
npm install
export ZEROEX_API_KEY="your-0x-api-key"
export PRIVATE_KEY="your-private-key-hex"
export RPC_URL="https://mainnet.base.org"  # optional
```

## Usage
```bash
node quote.js --sell USDC --buy WETH --amount 1 --chain base
node swap.js  --sell USDC --buy WETH --amount 1 --chain base
```

## Security
- Use a dedicated hot wallet
- Set slippage protection
- Approve exact amounts only

Related skills

OpenClaw

x402hub

capncoconut

Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay,...

OpenClaw

claw

capevace

Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.

OpenClaw

captchas-openclaw

captchasco

OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.