Technical & DevelopmentIntermediate
trade
Swap onchain assets on Base or Polygon via CDP Swap.
Developer Setup
Setup & Installation
bash
npx skills add https://github.com/coinbase/agentic-wallet-skills/blob/main/skills/agentic-wallet/references/trade.md --skill tradenpx skills add https://github.com/coinbase/agentic-wallet-skills/blob/main/skills/agentic-wallet/references/trade.md --skill tradeOr paste this URL into your assistant to install:
Overview
What This Skill Does
Swaps assets using the CDP Swap CLI commands on Base or Polygon, including slippage and gas configurations.
Application
When to use this Skill
- Swapping tokens on Base or Polygon networks using the CDP Swap API.
- Executing trade swaps via CLI commands or alias shortcuts.
- Checking price slips and gas fee projections before swapping.
- Exchanging USDC for other supported onchain assets.
- Automating asset rebalancing strategies inside agent wallets.
Documentation
Show Skills.md file
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.
If the wallet is not authenticated, see references/auth.md.
Command Syntax
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:
Lines 1 - 25 of 109
Recommendations