tokens
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTokens Skill
Tokens 技能
Provides SIP-010 fungible token operations on Stacks L2. Transfer operations require an unlocked wallet (use first). Balance and info queries work without a wallet.
bun run wallet/wallet.ts unlockSupports well-known tokens by symbol: , , ,
Or use the full contract ID:
sBTCUSDCxALEXDIKOSP2...address.contract-name提供Stacks L2上的SIP-010可替代代币操作。转账操作需要解锁钱包(请先执行)。余额和信息查询无需钱包即可使用。
bun run wallet/wallet.ts unlock支持通过以下知名代币符号进行操作:、、、
也可使用完整合约ID:
sBTCUSDCxALEXDIKOSP2...address.contract-nameUsage
使用方法
bun run tokens/tokens.ts <subcommand> [options]bun run tokens/tokens.ts <subcommand> [options]Subcommands
子命令
get-balance
get-balance
Get the balance of any SIP-010 token for a wallet address.
bun run tokens/tokens.ts get-balance --token <symbol-or-id> [--address <addr>]Options:
- (required) — Token symbol (e.g.,
--token,USDCx) or contract IDsBTC - (optional) — Stacks address to check (uses active wallet if omitted)
--address
Output:
json
{
"address": "SP2...",
"network": "mainnet",
"token": {
"contractId": "SP2...address.usdc-token",
"symbol": "USDCx",
"name": "USD Coin",
"decimals": 6
},
"balance": {
"raw": "1000000",
"formatted": "1 USDCx"
}
}查询指定钱包地址的任意SIP-010代币余额。
bun run tokens/tokens.ts get-balance --token <symbol-or-id> [--address <addr>]选项:
- (必填)——代币符号(例如
--token、USDCx)或合约IDsBTC - (可选)——要查询的Stacks地址(若省略则使用当前活跃钱包)
--address
输出:
json
{
"address": "SP2...",
"network": "mainnet",
"token": {
"contractId": "SP2...address.usdc-token",
"symbol": "USDCx",
"name": "USD Coin",
"decimals": 6
},
"balance": {
"raw": "1000000",
"formatted": "1 USDCx"
}
}transfer
transfer
Transfer any SIP-010 token to a recipient address. Requires an unlocked wallet.
bun run tokens/tokens.ts transfer --token <symbol-or-id> --recipient <addr> --amount <amount> [--memo <text>] [--fee low|medium|high|<microStx>]Options:
- (required) — Token symbol or contract ID
--token - (required) — Stacks address to send to
--recipient - (required) — Amount in smallest unit (depends on token decimals)
--amount - (optional) — Memo message (max 34 bytes)
--memo - (optional) — Fee preset (low|medium|high) or micro-STX amount; auto-estimated if omitted
--fee
Output:
json
{
"success": true,
"txid": "abc123...",
"from": "SP2...",
"recipient": "SP3...",
"token": "USDCx",
"amount": "1000000",
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/abc123...?chain=mainnet"
}将任意SIP-010代币转账至接收地址。需要解锁钱包。
bun run tokens/tokens.ts transfer --token <symbol-or-id> --recipient <addr> --amount <amount> [--memo <text>] [--fee low|medium|high|<microStx>]选项:
- (必填)——代币符号或合约ID
--token - (必填)——接收代币的Stacks地址
--recipient - (必填)——转账金额(使用代币最小单位,取决于代币的小数位数)
--amount - (可选)——备注信息(最大34字节)
--memo - (可选)——手续费预设(low|medium|high)或具体microStx数值;若省略则自动估算
--fee
输出:
json
{
"success": true,
"txid": "abc123...",
"from": "SP2...",
"recipient": "SP3...",
"token": "USDCx",
"amount": "1000000",
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/abc123...?chain=mainnet"
}get-info
get-info
Get metadata for a SIP-010 token (name, symbol, decimals, total supply).
bun run tokens/tokens.ts get-info --token <symbol-or-id>Options:
- (required) — Token symbol or contract ID
--token
Output:
json
{
"network": "mainnet",
"contractId": "SP2...address.usdc-token",
"name": "USD Coin",
"symbol": "USDCx",
"decimals": 6,
"totalSupply": "1000000000000",
"tokenUri": "https://..."
}获取SIP-010代币的元数据(名称、符号、小数位数、总供应量)。
bun run tokens/tokens.ts get-info --token <symbol-or-id>选项:
- (必填)——代币符号或合约ID
--token
输出:
json
{
"network": "mainnet",
"contractId": "SP2...address.usdc-token",
"name": "USD Coin",
"symbol": "USDCx",
"decimals": 6,
"totalSupply": "1000000000000",
"tokenUri": "https://..."
}list-user-tokens
list-user-tokens
List all fungible tokens owned by an address.
bun run tokens/tokens.ts list-user-tokens [--address <addr>]Options:
- (optional) — Stacks address to check (uses active wallet if omitted)
--address
Output:
json
{
"address": "SP2...",
"network": "mainnet",
"tokenCount": 2,
"tokens": [
{ "contractId": "SP2....usdc-token::usdcx", "balance": "1000000" },
{ "contractId": "SP3....alex-token::alex", "balance": "500000000" }
]
}列出指定地址持有的所有可替代代币。
bun run tokens/tokens.ts list-user-tokens [--address <addr>]选项:
- (可选)——要查询的Stacks地址(若省略则使用当前活跃钱包)
--address
输出:
json
{
"address": "SP2...",
"network": "mainnet",
"tokenCount": 2,
"tokens": [
{ "contractId": "SP2....usdc-token::usdcx", "balance": "1000000" },
{ "contractId": "SP3....alex-token::alex", "balance": "500000000" }
]
}get-holders
get-holders
Get the top holders of a SIP-010 token.
bun run tokens/tokens.ts get-holders --token <symbol-or-id> [--limit <n>] [--offset <n>]Options:
- (required) — Token symbol or contract ID
--token - (optional) — Maximum number of holders to return (default: 20)
--limit - (optional) — Offset for pagination (default: 0)
--offset
Output:
json
{
"token": "USDCx",
"network": "mainnet",
"total": 1234,
"holders": [
{ "address": "SP2...", "balance": "50000000000" },
{ "address": "SP3...", "balance": "25000000000" }
]
}获取SIP-010代币的顶级持有者。
bun run tokens/tokens.ts get-holders --token <symbol-or-id> [--limit <n>] [--offset <n>]选项:
- (必填)——代币符号或合约ID
--token - (可选)——返回的最大持有者数量(默认:20)
--limit - (可选)——分页偏移量(默认:0)
--offset
输出:
json
{
"token": "USDCx",
"network": "mainnet",
"total": 1234,
"holders": [
{ "address": "SP2...", "balance": "50000000000" },
{ "address": "SP3...", "balance": "25000000000" }
]
}Notes
注意事项
- Token balance and info queries use the public Hiro API (no authentication required)
- Transfer operations require an unlocked wallet
- Well-known token symbols: ,
sBTC,USDCx,ALEX— or use the full contract IDDIKO - Token amounts are in the smallest unit — check field to convert to human-readable values
decimals
- 代币余额和信息查询使用公开的Hiro API(无需身份验证)
- 转账操作需要解锁钱包
- 支持的知名代币符号:、
sBTC、USDCx、ALEX——也可使用完整合约IDDIKO - 代币金额以最小单位表示——请查看字段转换为人类可读数值
decimals