
Trade
Let an authenticated agent swap tokens on Base or Polygon when you ask to buy, sell, or convert USDC, ETH, or POL via the awal CLI.
Overview
Trade is an agent skill for the Build phase that swaps tokens on Base or Polygon through the awal CLI when a solo builder wants to buy, sell, or convert assets like USDC, ETH, or POL.
Install
npx skills add https://github.com/coinbase/agentic-wallet-skills --skill tradeWhat is this skill?
- Swap on Base or Polygon via `npx awal@2.10.0 trade` (alias `swap`)
- Token aliases usdc, eth, pol or raw contract addresses for from/to pairs
- Multiple amount formats including human amounts and percentage-of-balance styles per SKILL.md tables
- Pre-flight `npx awal@2.10.0 status` and balance checks with scoped Bash allowlist
- User-invocable triggers for buy/sell/convert phrasing (e.g. buy ETH, sell ETH for USDC)
- Pinned CLI: npx awal@2.10.0
- Chains: Base and Polygon via CDP Swap API
Adoption & trust: 3.1k installs on skills.sh; 110 GitHub stars; 1/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want your agent to swap on-chain from chat but fear wrong amounts, wrong chains, or trading while the wallet is not authenticated.
Who is it for?
Solo builders using Coinbase Agentic Wallet (awal) who delegate testnet or small mainnet swaps from Claude Code or Cursor with allowlisted Bash.
Skip if: Manual DEX traders who will not use awal, or anyone who needs CEX order books or multi-chain coverage beyond Base and Polygon in this skill.
When should I use this skill?
User wants to trade, swap, exchange, buy, sell, or convert tokens (e.g. USDC, ETH, POL) on Base or Polygon.
What do I get? / Deliverables
After status and balance checks, the agent runs a documented `awal trade` command with correct tokens and amount format—or routes you to wallet authentication first.
- Executed swap or documented awal trade command with amount and token pair
- Pre-trade status and balance verification output
Recommended Skills
Journey fit
Wallet swap execution is wiring your agent to on-chain infrastructure—classic integrations work during product build, not launch SEO. CDP Swap API access through `npx awal@2.10.0 trade` is an external service integration with explicit CLI contracts.
How it compares
An awal CLI integration for swaps—not a portfolio analytics dashboard or generic shell scripting skill.
Common Questions / FAQ
Who is trade for?
Indie builders running Coinbase’s agentic wallet who want the agent to execute Base/Polygon swaps from conversational trade intent.
When should I use trade?
In Build integrations when the user says trade, swap, buy, sell, or convert between supported tokens and awal is already the wallet path.
Is trade safe to install?
Swaps move real funds—read the Security Audits panel on this page, verify awal@2.10.0 pinning, and never grant broader Bash than the skill’s allowlist.
SKILL.md
READMESKILL.md - Trade
# Trading Tokens Use the `npx awal@2.10.0 trade` command to swap tokens on Base or Polygon via the CDP Swap API. You must be authenticated to trade. ## Confirm wallet is initialized and authed ```bash npx awal@2.10.0 status ``` If the wallet is not authenticated, refer to the `authenticate-wallet` skill. ## Command Syntax ```bash npx awal@2.10.0 trade <amount> <from> <to> [options] ``` The command is also available as `npx awal@2.10.0 swap` (alias). ## Arguments | Argument | Description | | -------- | ----------------------------------------------------------------------- | | `amount` | Amount to swap (see Amount Formats below) | | `from` | Source token: alias (usdc, eth, pol) or contract address (0x...) | | `to` | Destination token: alias (usdc, eth, pol) or contract address (0x...) | ## Amount Formats The amount can be specified in multiple formats: | Format | Example | Description | | ------------- | ---------------------- | -------------------------------------- | | Dollar prefix | `'$1.00'`, `'$0.50'` | USD notation (decimals based on token) | | Decimal | `1.0`, `0.50`, `0.001` | Human-readable with decimal point | | Whole number | `5`, `100` | Interpreted as whole tokens | | Atomic units | `500000` | Large integers treated as atomic units | **Auto-detection**: Large integers without a decimal point are treated as atomic units. For example, `500000` for USDC (6 decimals) = $0.50. **Decimals**: For known tokens (usdc=6, eth=18, pol=18), decimals are automatic. For arbitrary contract addresses, decimals are read from the token contract. ## Options | Option | Description | | -------------------- | --------------------------------------------- | | `-c, --chain <name>` | Blockchain network: base, polygon (default: base) | | `-s, --slippage <n>` | Slippage tolerance in basis points (100 = 1%) | | `--json` | Output result as JSON | ## Token Aliases | Alias | Token | Decimals | Chain | | ----- | ----- | -------- | ------- | | usdc | USDC | 6 | base | | eth | ETH | 18 | base | | pol | POL | 18 | polygon | **IMPORTANT**: Always single-quote amounts that use `$` to prevent bash variable expansion (e.g. `'$1.00'` not `$1.00`). ## Input Validation Before constructing the command, validate all user-provided values to prevent shell injection: - **amount**: Must match `^\$?[\d.]+$` (digits, optional decimal point, optional `$` prefix). Reject if it contains spaces, semicolons, pipes, backticks, or other shell metacharacters. - **from / to**: Must be a known alias (`usdc`, `eth`, `pol`) or a valid `0x` hex address (`^0x[0-9a-fA-F]{40}$`). Reject any other value. - **slippage**: Must be a positive integer (`^\d+$`). Do not pass unvalidated user input into the command. ## Examples ```bash # Swap $1 USDC for ETH (dollar prefix — note the single quotes) npx awal@2.10.0 trade '$1' usdc eth # Swap 0.50 USDC for ETH (decimal format) npx awal@2.10.0 trade 0.50 usdc eth # Swap 500000 atomic units of USDC for ETH npx awal@2.10.0 trade 500000 usdc eth # Swap 0.01 ETH for USDC npx awal@2.10.0 trade 0.01 eth usdc # Swap with custom slippage (2%) npx awal@2.10.0 trade '$5' usdc eth --slippage 200 # Swap using contract addresses (decimals read from