# Ave Trade Chain Wallet

> |

- **Type:** Skill
- **Install:** `agentstack add skill-avecloud-ave-cloud-skill-trade-chain-wallet`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [AveCloud](https://agentstack.voostack.com/s/avecloud)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [AveCloud](https://github.com/AveCloud)
- **Source:** https://github.com/AveCloud/ave-cloud-skill/tree/main/skills/trade-chain-wallet

## Install

```sh
agentstack add skill-avecloud-ave-cloud-skill-trade-chain-wallet
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# ave-trade-chain-wallet

Self-custody DEX trading via the AVE Cloud Chain Wallet API. Use this only when the user explicitly wants local signing, private-key or mnemonic control, or an external signer workflow. For shared trade-path rules and current PROD quirks, see [operator-playbook.md](../../references/operator-playbook.md).

**Trading fee:** 0.6% | **Rebate to `feeRecipient`:** 20%

## Route Cues

| EN | ZH |
|---|---|
| "use my private key", "sign with my key" | "用我的私钥", "用私钥签名" |
| "use my mnemonic", "use my seed phrase" | "用我的助记词", "用种子短语" |
| "sign locally", "self-custody" | "本地签名", "自托管" |
| "use my own wallet" | "用我自己的钱包" |
| "build an unsigned tx", "external signer" | "构建未签名交易", "外部签名" |

## Setup

```bash
export AVE_API_KEY="your_api_key_here"
export API_PLAN="free"   # free | normal | pro
export AVE_EVM_PRIVATE_KEY="0x..."         # optional for EVM signed send
export AVE_SOLANA_PRIVATE_KEY="base58..."  # optional for Solana signed send
export AVE_MNEMONIC="word1 word2 ... word12"  # optional fallback
```

Get a key at https://cloud.ave.ai/register. EVM signed sends also require `--rpc-url` or `AVE_BSC_RPC_URL` / `AVE_ETH_RPC_URL` / `AVE_BASE_RPC_URL`.

## Rate Limits

| `API_PLAN` | Write TPS |
|---|---|
| `free` | 1 |
| `normal` | 5 |
| `pro` | 20 |

## Supported Chains

`bsc`, `eth`, `base`, `solana`

Preview or create first, then submit only after the path is valid and the user has confirmed execution.

## Common Pitfalls

- **Solana native token**: Use `sol` (not `So11111111111111111111111111111111111111112`) for `--in-token` / `--out-token` in all trade commands. The full mint address is rejected by the API.
- **EVM sell requires approval first**: Before selling an ERC-20 token, run `approve-chain` to approve the swap router. Native coin buys do not need approval. Without approval, `swap-evm` sell will fail with `status 3025: failed to simulate send signed tx`.
- **Minimum swap value**: The API rejects swaps below ~$0.10 USD with `swap value too small`. Use at least 0.01 SOL / 0.001 BNB / 0.0001 ETH.
- **Solana fee required**: `swap-solana` and `create-solana-tx` require `--fee` (lamports). With `--use-mev`, minimum is 1000000 (0.001 SOL). Use `gas-tip` to query recommended values.
- **EVM RPC required**: `swap-evm` requires `--rpc-url` or the chain env var (`AVE_BSC_RPC_URL`, etc.) for local signing (nonce, gas price, estimate gas).
- **Query slippage first**: Use `auto-slippage` to get the recommended slippage for a token before trading. The API may override your slippage value.

## Operations

### Quote

Get estimated output before building or sending anything. Response includes `spender` field for approval.

```bash
python scripts/ave_trade_rest.py quote --chain  --in-amount  --in-token  --out-token  --swap-type buy|sell
```

### Auto Slippage

Query recommended slippage (bps) for a token before trading.

```bash
python scripts/ave_trade_rest.py auto-slippage --chain  --token  [--use-mev]
```

### Gas Tip

Query recommended gas prices per chain. Returns low/average/high tiers in lamports (Solana) or wei (EVM).

```bash
python scripts/ave_trade_rest.py gas-tip
```

### Approve Chain (EVM only)

Approve an ERC-20 token for the swap router before selling. Not needed for native coin buys. Gets spender from quote, builds and signs approve(MAX_UINT256) tx locally.

```bash
python scripts/ave_trade_rest.py approve-chain --chain bsc --token  [--rpc-url https://...]
```

### Swap EVM

Create, sign, and send an EVM swap locally with a key or mnemonic.

```bash
python scripts/ave_trade_rest.py swap-evm --chain bsc --rpc-url https://... --in-amount  --in-token 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee --out-token  --swap-type buy --slippage 500 [--auto-slippage] [--use-mev]
```

### Swap Solana

Create, sign, and send a Solana swap locally with a key or mnemonic.

```bash
python scripts/ave_trade_rest.py swap-solana --in-amount  --in-token sol --out-token  --swap-type buy --slippage 500 --fee 50000000 [--auto-slippage] [--use-mev]
```

### Create EVM tx

Build an unsigned EVM swap transaction for an external signer.

```bash
python scripts/ave_trade_rest.py create-evm-tx --chain bsc --creator-address 0x... --in-amount  --in-token 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee --out-token  --swap-type buy --slippage 500
```

### Send EVM tx

Submit a pre-signed EVM transaction returned from `create-evm-tx`.

```bash
python scripts/ave_trade_rest.py send-evm-tx --chain bsc --request-tx-id  --signed-tx 0x...
```

### Create Solana tx

Build an unsigned Solana swap transaction for an external signer.

```bash
python scripts/ave_trade_rest.py create-solana-tx --creator-address  --in-amount  --in-token sol --out-token  --swap-type buy --slippage 500 --fee 50000000
```

### Send Solana tx

Submit a pre-signed Solana transaction returned from `create-solana-tx`.

```bash
python scripts/ave_trade_rest.py send-solana-tx --request-tx-id  --signed-tx 
```

## Workflow Examples

### EVM buy + sell flow (self-custody)

Buy a token, then approve and sell it back. Approval is only needed once per token per spender.

```bash
# 1. Check gas and slippage
python scripts/ave_trade_rest.py gas-tip
python scripts/ave_trade_rest.py auto-slippage --chain bsc --token 

# 2. Buy (native coin -> token, no approval needed)
python scripts/ave_trade_rest.py swap-evm --chain bsc --in-amount 1000000000000000 --in-token 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee --out-token  --swap-type buy --slippage 1000

# 3. Approve token for selling (one-time per token)
python scripts/ave_trade_rest.py approve-chain --chain bsc --token 

# 4. Sell (token -> native coin)
python scripts/ave_trade_rest.py swap-evm --chain bsc --in-amount  --in-token  --out-token 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee --swap-type sell --slippage 1000
```

### Solana buy + sell flow (self-custody)

No approval needed on Solana. Use `sol` for native token.

```bash
# Buy
python scripts/ave_trade_rest.py swap-solana --in-amount 10000000 --in-token sol --out-token  --swap-type buy --slippage 1000 --fee 1000000 --use-mev

# Sell (use full token address for in-token, sol for out-token)
python scripts/ave_trade_rest.py swap-solana --in-amount  --in-token  --out-token sol --swap-type sell --slippage 1000 --fee 1000000 --use-mev
```

### External signer EVM flow

Preview first, then build the unsigned transaction, then submit the signed payload.

```bash
python scripts/ave_trade_rest.py quote --chain bsc --in-amount 500000000000000 --in-token 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee --out-token  --swap-type buy
python scripts/ave_trade_rest.py create-evm-tx --chain bsc --creator-address 0x... --in-amount 500000000000000 --in-token 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee --out-token  --swap-type buy --slippage 500
python scripts/ave_trade_rest.py send-evm-tx --chain bsc --request-tx-id  --signed-tx 0x...
```

## Reference

Use shared references for current PROD quirks, test caps, token conventions, error wording, response shape, and fuller trade API details.

- [operator-playbook.md](../../references/operator-playbook.md)
- [error-translation.md](../../references/error-translation.md)
- [safe-test-defaults.md](../../references/safe-test-defaults.md)
- [token-conventions.md](../../references/token-conventions.md)
- [response-contract.md](../../references/response-contract.md)
- [learn-more.md](../../references/learn-more.md)
- [trade-api-doc.md](../../references/trade-api-doc.md)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [AveCloud](https://github.com/AveCloud)
- **Source:** [AveCloud/ave-cloud-skill](https://github.com/AveCloud/ave-cloud-skill)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-avecloud-ave-cloud-skill-trade-chain-wallet
- Seller: https://agentstack.voostack.com/s/avecloud
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
