solana-payments-wallets-trading
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePayments, Wallets and Trading on Solana
Solana 上的支付、钱包与交易
Sol is a command-line tool that lets you work with Solana the way you'd
describe it out loud. Instead of constructing transactions and managing
program instructions, you say what you want: pay someone, buy a token,
stake your SOL.
Keys live locally on disk — no private keys in environment variables,
no API keys to configure.
Sol 是一款命令行工具,让你能用直白的方式操作Solana。无需构建交易和管理程序指令,只需说出你的需求:给他人转账、购买代币、质押你的SOL即可。
密钥存储在本地磁盘中——无需在环境变量中设置私钥,也无需配置API密钥。
Get Set Up
安装配置
Prefer — it always runs the latest version with no global
install to manage:
npxbash
npx @solana-compass/cli config set rpc.url https://your-rpc-endpoint.com
npx @solana-compass/cli wallet create --name my-walletIf the user has installed globally (),
you can use the shorter command instead:
npm install -g @solana-compass/clisolbash
sol config set rpc.url https://your-rpc-endpoint.com
sol wallet create --name my-walletThe public RPC endpoint rate-limits aggressively. Use a dedicated RPC
for anything beyond testing — Helius, Triton, and QuickNode all offer
free tiers.
Requires Node.js >= 20.
推荐使用——它始终运行最新版本,无需管理全局安装:
npxbash
npx @solana-compass/cli config set rpc.url https://your-rpc-endpoint.com
npx @solana-compass/cli wallet create --name my-wallet如果用户已全局安装(),则可使用更简短的命令:
npm install -g @solana-compass/clisolbash
sol config set rpc.url https://your-rpc-endpoint.com
sol wallet create --name my-wallet公共RPC端点的速率限制严格。除测试外,建议使用专用RPC——Helius、Triton和QuickNode均提供免费层级。
要求Node.js版本 >= 20。
Pay Someone
转账给他人
Send SOL, USDC, or any Solana token to a wallet address.
bash
sol token send 50 usdc GkX...abc
sol token send 2 sol 7nY...xyz
sol token send 1000 bonk AgE...def --yesUse to skip the confirmation prompt — useful for automated
payments between agents or apps. Confirmations are also skipped
automatically in mode.
--yes--jsonSee references/trading-commands.md for the full send reference.
向钱包地址发送SOL、USDC或任何Solana代币。
bash
sol token send 50 usdc GkX...abc
sol token send 2 sol 7nY...xyz
sol token send 1000 bonk AgE...def --yes使用跳过确认提示——适用于Agent或应用之间的自动化转账。在模式下也会自动跳过确认。
--yes--json完整的转账说明可参考references/trading-commands.md。
Discover Tokens
发现代币
Browse the Solana token ecosystem — trending, most traded, recently
launched, and more.
bash
sol token browse trending # what's hot right now
sol token browse top-traded --interval 24h # highest volume over 24h
sol token browse recent --limit 10 # just launched
sol token browse lst # liquid staking tokensResults populate the local token cache, so subsequent and
calls resolve instantly.
token infotoken priceSee references/trading-commands.md for all categories and flags.
浏览Solana代币生态——热门代币、交易量最高代币、近期上线代币等。
bash
sol token browse trending # 当前热门代币
sol token browse top-traded --interval 24h # 24小时内交易量最高代币
sol token browse recent --limit 10 # 近期上线代币
sol token browse lst # 流动性质押代币搜索结果会存入本地代币缓存,因此后续的和调用可立即返回结果。
token infotoken price所有分类和参数说明可参考references/trading-commands.md。
Buy and Sell Tokens
代币买卖
Swap any token for any other token. Prices come from Jupiter — best
rate across every Solana DEX, no API key needed.
bash
sol token swap 50 usdc bonk # buy BONK with USDC
sol token swap 1.5 sol usdc # sell SOL for USDC
sol token swap 50 usdc bonk --quote-only # preview without executingEvery swap records the price at execution time, so you can track
cost basis and P&L later.
See references/trading-commands.md for slippage, wallet selection, etc.
将任意代币兑换为其他代币。价格来自Jupiter——聚合Solana所有DEX的最优汇率,无需API密钥。
bash
sol token swap 50 usdc bonk # 用USDC购买BONK
sol token swap 1.5 sol usdc # 卖出SOL兑换USDC
sol token swap 50 usdc bonk --quote-only # 仅预览交易,不执行每笔兑换都会记录执行时的价格,方便后续追踪成本基准和盈亏。
滑点设置、钱包选择等说明可参考references/trading-commands.md。
Check Prices
查询价格
bash
sol token price sol
sol token price sol usdc bonk eth # multiple at oncebash
sol token price sol
sol token price sol usdc bonk eth # 同时查询多个代币价格See What You Have
查看资产
bash
sol wallet balance # all tokens with USD values
sol wallet balance trading # specific wallet by name
sol token list # just token balances
sol wallet list # all your walletsbash
sol wallet balance # 所有代币的美元价值
sol wallet balance trading # 查看指定名称钱包的资产
sol token list # 仅查看代币余额
sol wallet list # 查看所有钱包Create and Manage Wallets
创建与管理钱包
Wallets are local key files in — no seed phrases
in environment variables.
~/.sol/wallets/bash
sol wallet create # new wallet, auto-named
sol wallet create --name trading # pick a name
sol wallet import --solana-cli # import from Solana CLI
sol wallet set-default trading # switch active walletAny command can target a specific wallet with .
--wallet <name>See references/wallet-commands.md for import, export, labels, history.
钱包是存储在中的本地密钥文件——无需在环境变量中存储助记词。
~/.sol/wallets/bash
sol wallet create # 创建新钱包,自动命名
sol wallet create --name trading # 自定义钱包名称
sol wallet import --solana-cli # 从Solana CLI导入钱包
sol wallet set-default trading # 切换默认钱包任何命令都可通过指定目标钱包。
--wallet <name>导入、导出、标签、历史记录等说明可参考references/wallet-commands.md。
Stake SOL
SOL质押
Delegate SOL to a validator and earn staking rewards. One command
handles the entire process — creating the stake account, funding it,
and delegating.
bash
sol stake new 10 # stake 10 SOL
sol stake list # your stake accounts + claimable tips
sol stake claim-mev # compound MEV rewards
sol stake withdraw 7gK...abc # unstakeSee references/staking-commands.md for validator selection, partial
withdrawals, and force unstake.
将SOL委托给验证节点以赚取质押奖励。只需一条命令即可完成整个流程——创建质押账户、充值并委托。
bash
sol stake new 10 # 质押10 SOL
sol stake list # 查看你的质押账户及可领取的奖励
sol stake claim-mev # 复利MEV奖励
sol stake withdraw 7gK...abc # 解除质押验证节点选择、部分提取、强制解除质押等说明可参考references/staking-commands.md。
Earn Yield by Lending
借贷赚息
Deposit tokens into Kamino Finance to earn interest, or borrow
against your deposits.
bash
sol lend rates usdc # current APY
sol lend deposit 100 usdc # start earning
sol lend borrow 500 usdc --collateral sol
sol lend positions # everything you've got openSee references/lending-commands.md for full details.
将代币存入Kamino Finance赚取利息,或用存款作为抵押进行借贷。
bash
sol lend rates usdc # 查询当前APY
sol lend deposit 100 usdc # 存入开始赚息
sol lend borrow 500 usdc --collateral sol
sol lend positions # 查看所有未结清仓位详细说明可参考references/lending-commands.md。
Track How Your Portfolio Is Doing
追踪投资组合表现
See everything in one place — tokens, staked SOL, lending positions.
bash
sol portfolio # the full picture
sol portfolio snapshot --label "monday"
sol portfolio compare # what changed since last snapshot
sol portfolio pnl # profit and loss over timeSee references/portfolio-commands.md for snapshot management.
一站式查看所有资产——代币、质押的SOL、借贷仓位。
bash
sol portfolio # 查看完整资产状况
sol portfolio snapshot --label "monday"
sol portfolio compare # 对比与上次快照的变化
sol portfolio pnl # 查看历史盈亏快照管理说明可参考references/portfolio-commands.md。
Structured Output
结构化输出
Every command supports for structured output. In JSON mode,
confirmations are skipped automatically.
--jsonjson
{ "ok": true, "data": { ... }, "meta": { "elapsed_ms": 450 } }Error codes are (e.g. ). Check the
field before reading .
UPPER_SNAKE_CASESWAP_FAILEDokdataSee references/json-output-format.md for the full schema.
所有命令均支持参数以获取结构化输出。在JSON模式下会自动跳过确认。
--jsonjson
{ "ok": true, "data": { ... }, "meta": { "elapsed_ms": 450 } }错误代码采用大写下划线格式(如)。读取前请先检查字段。
SWAP_FAILEDdataok完整的 schema 可参考references/json-output-format.md。
Other Useful Commands
其他实用命令
bash
sol network # epoch, TPS, staking APY
sol tx 4xK9...abc # look up any transaction
sol config set rpc.url <url> # change RPC endpointbash
sol network # 查询纪元、TPS、质押APY
sol tx 4xK9...abc # 查询任意交易详情
sol config set rpc.url <url> # 更换RPC端点Tips
注意事项
- Keep SOL for gas. Every Solana transaction costs ~0.000005 SOL, but token account creation costs ~0.002 SOL. Unless the user specifically asks to drain or close a wallet, keep at least 0.05 SOL as a reserve so future transactions don't fail.
- Use full numbers, not shorthand. The CLI expects literal
amounts: not
1000000,1mnot50000. Always expand shorthand before passing to a command.50k - Addresses are raw public keys only. The CLI does not resolve .sol domains, SNS names, or contact labels — pass the full base58 public key for recipients.
- Ambiguous symbols pick the highest-liquidity match. If a symbol
maps to multiple tokens, the CLI picks the one with the most
trading volume on Jupiter. It does not prompt. Use to verify what it resolves to, or pass a mint address to be explicit.
sol token info <symbol> - Use on swaps to preview before committing
--quote-only - Use to target a specific wallet
--wallet <name> - The transaction log tracks all operations with USD prices at execution time — useful for cost basis and P&L
- 保留SOL作为手续费。每笔Solana交易的手续费约为0.000005 SOL,但创建代币账户的手续费约为0.002 SOL。除非用户明确要求清空或关闭钱包,否则请保留至少0.05 SOL作为储备金,避免后续交易失败。
- 使用完整数字,而非简写。CLI要求输入字面金额:请用而非
1000000,用1m而非50000。在传入命令前请务必展开简写形式。50k - 地址仅支持原始公钥。CLI不解析.sol域名、SNS名称或联系人标签——请传入完整的base58公钥作为收款地址。
- 符号模糊时选择流动性最高的匹配项。若某一符号对应多个代币,CLI会选择Jupiter上交易量最高的代币,且不会提示。可使用验证解析结果,或传入铸币地址以明确指定。
sol token info <symbol> - 兑换时使用参数预览交易后再执行
--quote-only - 使用指定目标钱包
--wallet <name> - 交易日志会记录所有操作及执行时的美元价格——有助于追踪成本基准和盈亏
Permissions
权限设置
The CLI supports fine-grained permissions via . When a permission is set to , the gated commands are not registered — they won't appear in or , and invoking them returns "unknown command".
~/.sol/config.tomlfalse--helpsol <group> --helpAll permissions default to (omitted = permitted). Example read-only config:
truetoml
[permissions]
canTransfer = false
canSwap = false
canStake = false
canWithdrawStake = false
canLend = false
canWithdrawLend = false
canBurn = false
canCreateWallet = false
canRemoveWallet = false
canExportWallet = false| Permission | Gated subcommands |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Read-only commands (, , , , , , ) are always available regardless of permissions.
token browse/price/info/listwallet list/balancestake listlend rates/positionsportfolionetworktxPermissions cannot be changed via — they must be edited in directly.
sol config setconfig.tomlCLI支持通过进行细粒度权限控制。当某一权限设置为时,对应的命令将不会注册——它们不会出现在或中,调用时会返回“未知命令”。
~/.sol/config.tomlfalse--helpsol <group> --help所有权限默认值为(未设置即表示允许)。以下是只读配置示例:
truetoml
[permissions]
canTransfer = false
canSwap = false
canStake = false
canWithdrawStake = false
canLend = false
canWithdrawLend = false
canBurn = false
canCreateWallet = false
canRemoveWallet = false
canExportWallet = false| 权限 | 受限制的子命令 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
只读命令(、、、、、、)始终可用,不受权限限制。
token browse/price/info/listwallet list/balancestake listlend rates/positionsportfolionetworktx无法通过修改权限——必须直接编辑文件。
sol config setconfig.tomlTroubleshooting
故障排除
See references/troubleshooting.md for common issues (RPC rate limits,
token resolution, transaction timeouts).
常见问题(如RPC速率限制、代币解析、交易超时等)的解决方法可参考references/troubleshooting.md。