trade by coinbase/agentic-wallet-skills
npx skills add https://github.com/coinbase/agentic-wallet-skills --skill trade使用 npx awal@2.0.3 trade 命令通过 CDP Swap API 在 Base 网络上交换代币。您必须通过身份验证才能进行交易。
npx awal@2.0.3 status
如果钱包未通过身份验证,请参考 authenticate-wallet 技能。
npx awal@2.0.3 trade <amount> <from> <to> [options]
| 参数 | 描述 |
|---|---|
amount | 要交换的金额(参见下文金额格式) |
from |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 源代币:别名(usdc, eth, weth)或合约地址(0x...) |
to | 目标代币:别名(usdc, eth, weth)或合约地址(0x...) |
金额可以用多种格式指定:
| 格式 | 示例 | 描述 |
|---|---|---|
| 美元前缀 | '$1.00', '$0.50' | 美元表示法(小数位数基于代币) |
| 十进制 | 1.0, 0.50, 0.001 | 人类可读的带小数点格式 |
| 整数 | 5, 100 | 解释为整数个代币 |
| 原子单位 | 500000 | 大整数被视为原子单位 |
自动检测:没有小数点的大整数被视为原子单位。例如,对于 USDC(6 位小数),500000 = $0.50。
小数位数:对于已知代币(usdc=6, eth=18, weth=18),小数位数是自动处理的。对于任意合约地址,小数位数从代币合约中读取。
| 选项 | 描述 |
|---|---|
-c, --chain <name> | 区块链网络(默认:base) |
-s, --slippage <n> | 滑点容差,以基点表示(100 = 1%) |
--json | 以 JSON 格式输出结果 |
| 别名 | 代币 | 小数位数 | 地址 |
|---|---|---|---|
| usdc | USDC | 6 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| eth | ETH | 18 | 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE |
| weth | WETH | 18 | 0x4200000000000000000000000000000000000006 |
重要提示:始终对使用 $ 的金额使用单引号,以防止 bash 变量扩展(例如使用 '$1.00' 而不是 $1.00)。
在构建命令之前,验证所有用户提供的值以防止 shell 注入:
^\$?[\d.]+$(数字,可选小数点,可选 $ 前缀)。如果包含空格、分号、管道符、反引号或其他 shell 元字符,则拒绝。usdc, eth, weth)或有效的 0x 十六进制地址(^0x[0-9a-fA-F]{40}$)。拒绝任何其他值。^\d+$)。不要将未经验证的用户输入传递给命令。
# 将 1 美元 USDC 兑换为 ETH(美元前缀 — 注意单引号)
npx awal@2.0.3 trade '$1' usdc eth
# 将 0.50 USDC 兑换为 ETH(十进制格式)
npx awal@2.0.3 trade 0.50 usdc eth
# 将 500000 个原子单位的 USDC 兑换为 ETH
npx awal@2.0.3 trade 500000 usdc eth
# 将 0.01 ETH 兑换为 USDC
npx awal@2.0.3 trade 0.01 eth usdc
# 使用自定义滑点(2%)进行兑换
npx awal@2.0.3 trade '$5' usdc eth --slippage 200
# 使用合约地址进行兑换(小数位数从链上读取)
npx awal@2.0.3 trade 100 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0x4200000000000000000000000000000000000006
# 获取 JSON 输出
npx awal@2.0.3 trade '$1' usdc eth --json
awal status 检查)常见错误:
awal auth login <email>每周安装量
1.5K
仓库
GitHub 星标数
78
首次出现
2026年2月10日
安全审计
安装于
codex1.3K
opencode1.3K
gemini-cli1.3K
github-copilot1.2K
kimi-cli1.2K
amp1.2K
Use the npx awal@2.0.3 trade command to swap tokens on Base network via the CDP Swap API. You must be authenticated to trade.
npx awal@2.0.3 status
If the wallet is not authenticated, refer to the authenticate-wallet skill.
npx awal@2.0.3 trade <amount> <from> <to> [options]
| Argument | Description |
|---|---|
amount | Amount to swap (see Amount Formats below) |
from | Source token: alias (usdc, eth, weth) or contract address (0x...) |
to | Destination token: alias (usdc, eth, weth) or contract address (0x...) |
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 |
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, weth=18), decimals are automatic. For arbitrary contract addresses, decimals are read from the token contract.
| Option | Description |
|---|---|
-c, --chain <name> | Blockchain network (default: base) |
-s, --slippage <n> | Slippage tolerance in basis points (100 = 1%) |
--json | Output result as JSON |
| Alias | Token | Decimals | Address |
|---|---|---|---|
| usdc | USDC | 6 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| eth | ETH | 18 | 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE |
| weth | WETH | 18 | 0x4200000000000000000000000000000000000006 |
IMPORTANT : Always single-quote amounts that use $ to prevent bash variable expansion (e.g. '$1.00' not $1.00).
Before constructing the command, validate all user-provided values to prevent shell injection:
^\$?[\d.]+$ (digits, optional decimal point, optional $ prefix). Reject if it contains spaces, semicolons, pipes, backticks, or other shell metacharacters.usdc, eth, weth) or a valid 0x hex address (^0x[0-9a-fA-F]{40}$). Reject any other value.^\d+$).Do not pass unvalidated user input into the command.
# Swap $1 USDC for ETH (dollar prefix — note the single quotes)
npx awal@2.0.3 trade '$1' usdc eth
# Swap 0.50 USDC for ETH (decimal format)
npx awal@2.0.3 trade 0.50 usdc eth
# Swap 500000 atomic units of USDC for ETH
npx awal@2.0.3 trade 500000 usdc eth
# Swap 0.01 ETH for USDC
npx awal@2.0.3 trade 0.01 eth usdc
# Swap with custom slippage (2%)
npx awal@2.0.3 trade '$5' usdc eth --slippage 200
# Swap using contract addresses (decimals read from chain)
npx awal@2.0.3 trade 100 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0x4200000000000000000000000000000000000006
# Get JSON output
npx awal@2.0.3 trade '$1' usdc eth --json
awal status to check)Common errors:
awal auth login <email> firstWeekly Installs
1.5K
Repository
GitHub Stars
78
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
codex1.3K
opencode1.3K
gemini-cli1.3K
github-copilot1.2K
kimi-cli1.2K
amp1.2K
97,600 周安装
| Atomic units | 500000 | Large integers treated as atomic units |