solana-payments-wallets-trading

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Payments, 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
npx
— it always runs the latest version with no global install to manage:
bash
npx @solana-compass/cli config set rpc.url https://your-rpc-endpoint.com
npx @solana-compass/cli wallet create --name my-wallet
If the user has installed globally (
npm install -g @solana-compass/cli
), you can use the shorter
sol
command instead:
bash
sol config set rpc.url https://your-rpc-endpoint.com
sol wallet create --name my-wallet
The 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.
推荐使用
npx
——它始终运行最新版本,无需管理全局安装:
bash
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/cli
),则可使用更简短的
sol
命令:
bash
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 --yes
Use
--yes
to skip the confirmation prompt — useful for automated payments between agents or apps. Confirmations are also skipped automatically in
--json
mode.
See 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
使用
--yes
跳过确认提示——适用于Agent或应用之间的自动化转账。在
--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 tokens
Results populate the local token cache, so subsequent
token info
and
token price
calls resolve instantly.
See 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 info
token 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 executing
Every 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 once
bash
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 wallets
bash
sol wallet balance                      # 所有代币的美元价值
sol wallet balance trading              # 查看指定名称钱包的资产
sol token list                          # 仅查看代币余额
sol wallet list                         # 查看所有钱包

Create and Manage Wallets

创建与管理钱包

Wallets are local key files in
~/.sol/wallets/
— no seed phrases in environment variables.
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 wallet
Any 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            # unstake
See 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 open
See 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 time
See 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
--json
for structured output. In JSON mode, confirmations are skipped automatically.
json
{ "ok": true, "data": { ... }, "meta": { "elapsed_ms": 450 } }
Error codes are
UPPER_SNAKE_CASE
(e.g.
SWAP_FAILED
). Check the
ok
field before reading
data
.
See references/json-output-format.md for the full schema.
所有命令均支持
--json
参数以获取结构化输出。在JSON模式下会自动跳过确认。
json
{ "ok": true, "data": { ... }, "meta": { "elapsed_ms": 450 } }
错误代码采用大写下划线格式(如
SWAP_FAILED
)。读取
data
前请先检查
ok
字段。
完整的 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 endpoint
bash
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:
    1000000
    not
    1m
    ,
    50000
    not
    50k
    . Always expand shorthand before passing to a command.
  • 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
    sol token info <symbol>
    to verify what it resolves to, or pass a mint address to be explicit.
  • Use
    --quote-only
    on swaps to preview before committing
  • Use
    --wallet <name>
    to target a specific wallet
  • 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
~/.sol/config.toml
. When a permission is set to
false
, the gated commands are not registered — they won't appear in
--help
or
sol <group> --help
, and invoking them returns "unknown command".
All permissions default to
true
(omitted = permitted). Example read-only config:
toml
[permissions]
canTransfer = false
canSwap = false
canStake = false
canWithdrawStake = false
canLend = false
canWithdrawLend = false
canBurn = false
canCreateWallet = false
canRemoveWallet = false
canExportWallet = false
PermissionGated subcommands
canTransfer
token send
canSwap
token swap
,
token close --all
canStake
stake new
canWithdrawStake
stake withdraw
,
stake claim-mev
canLend
lend deposit
,
lend borrow
canWithdrawLend
lend withdraw
,
lend repay
canBurn
token burn
,
token close --burn
canCreateWallet
wallet create
,
wallet import
canRemoveWallet
wallet remove
canExportWallet
wallet export
Read-only commands (
token browse/price/info/list
,
wallet list/balance
,
stake list
,
lend rates/positions
,
portfolio
,
network
,
tx
) are always available regardless of permissions.
Permissions cannot be changed via
sol config set
— they must be edited in
config.toml
directly.
CLI支持通过
~/.sol/config.toml
进行细粒度权限控制。当某一权限设置为
false
时,对应的命令将不会注册——它们不会出现在
--help
sol <group> --help
中,调用时会返回“未知命令”。
所有权限默认值为
true
(未设置即表示允许)。以下是只读配置示例:
toml
[permissions]
canTransfer = false
canSwap = false
canStake = false
canWithdrawStake = false
canLend = false
canWithdrawLend = false
canBurn = false
canCreateWallet = false
canRemoveWallet = false
canExportWallet = false
权限受限制的子命令
canTransfer
token send
canSwap
token swap
,
token close --all
canStake
stake new
canWithdrawStake
stake withdraw
,
stake claim-mev
canLend
lend deposit
,
lend borrow
canWithdrawLend
lend withdraw
,
lend repay
canBurn
token burn
,
token close --burn
canCreateWallet
wallet create
,
wallet import
canRemoveWallet
wallet remove
canExportWallet
wallet export
只读命令(
token browse/price/info/list
wallet list/balance
stake list
lend rates/positions
portfolio
network
tx
)始终可用,不受权限限制。
无法通过
sol config set
修改权限——必须直接编辑
config.toml
文件。

Troubleshooting

故障排除

See references/troubleshooting.md for common issues (RPC rate limits, token resolution, transaction timeouts).
常见问题(如RPC速率限制、代币解析、交易超时等)的解决方法可参考references/troubleshooting.md。