nansen-trade
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTrade
交易
Two-step flow: quote then execute. Trades are irreversible once on-chain.
Prerequisite: You need a wallet first. Run before trading.
nansen wallet create两步流程:先获取报价再执行。交易一旦上链就不可撤销。
前置要求: 你需要先拥有一个钱包。交易前请运行命令。
nansen wallet createQuote
获取报价
bash
nansen trade quote \
--chain solana \
--from SOL \
--to USDC \
--amount 1000000000Symbols resolve automatically: , , , , , , . Raw addresses also work.
SOLETHBNBUSDCUSDTWETHWBNBbash
nansen trade quote \
--chain solana \
--from SOL \
--to USDC \
--amount 1000000000代币符号会自动识别:、、、、、、。也支持直接使用原生地址。
SOLETHBNBUSDCUSDTWETHWBNBExecute
执行交易
bash
nansen trade execute --quote <quote-id>bash
nansen trade execute --quote <quote-id>Agent pattern
Agent使用模式
bash
undefinedbash
undefinedPipe quote ID directly into execute
将报价ID直接传入执行命令
QUOTE_ID=$(nansen trade quote --chain solana --from SOL --to USDC --amount 1000000000 2>&1 | grep "Quote ID:" | awk '{print $NF}')
nansen trade execute --quote "$QUOTE_ID"
undefinedQUOTE_ID=$(nansen trade quote --chain solana --from SOL --to USDC --amount 1000000000 2>&1 | grep "Quote ID:" | awk '{print $NF}')
nansen trade execute --quote "$QUOTE_ID"
undefinedCommon Token Addresses
常用代币地址
| Token | Chain | Address |
|---|---|---|
| SOL | Solana | |
| USDC | Solana | |
| ETH | Base | |
| USDC | Base | |
| 代币 | 链 | 地址 |
|---|---|---|
| SOL | Solana | |
| USDC | Solana | |
| ETH | Base | |
| USDC | Base | |
Amounts are in base units
金额以基础单位计价
| Token | Decimals | 1 token = |
|---|---|---|
| SOL | 9 | |
| ETH | 18 | |
| USDC | 6 | |
| 代币 | 小数位数 | 1枚代币等于 |
|---|---|---|
| SOL | 9 | |
| ETH | 18 | |
| USDC | 6 | |
Flags
参数说明
| Flag | Purpose |
|---|---|
| |
| Source token (symbol or address) |
| Destination token (symbol or address) |
| Amount in base units (integer) |
| Wallet name (default: default wallet) |
| Slippage tolerance as decimal (e.g. 0.03) |
| Quote ID for execute |
| Skip pre-broadcast simulation |
| 参数 | 用途 |
|---|---|
| |
| 源代币(符号或地址) |
| 目标代币(符号或地址) |
| 基础单位计价的金额(整数) |
| 钱包名称(默认:默认钱包) |
| 滑点容忍度,用小数表示(例如0.03) |
| 执行交易所需的报价ID |
| 跳过广播前的模拟验证 |
Notes
注意事项
- Quotes expire after ~1 hour. If execute fails, get a fresh quote.
- A wallet is required even for quotes (the API builds sender-specific transactions).
- ERC-20 swaps may require an approval step — execute handles this automatically.
- 报价约1小时后过期。如果执行失败,请重新获取最新报价。
- 即使是获取报价也需要钱包(API会构建针对发送方的专属交易)。
- ERC-20兑换可能需要授权步骤——执行命令会自动处理该步骤。