tokens

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tokens Skill

Tokens 技能

Provides SIP-010 fungible token operations on Stacks L2. Transfer operations require an unlocked wallet (use
bun run wallet/wallet.ts unlock
first). Balance and info queries work without a wallet.
Supports well-known tokens by symbol:
sBTC
,
USDCx
,
ALEX
,
DIKO
Or use the full contract ID:
SP2...address.contract-name
提供Stacks L2上的SIP-010可替代代币操作。转账操作需要解锁钱包(请先执行
bun run wallet/wallet.ts unlock
)。余额和信息查询无需钱包即可使用。
支持通过以下知名代币符号进行操作:
sBTC
USDCx
ALEX
DIKO
也可使用完整合约ID:
SP2...address.contract-name

Usage

使用方法

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:
  • --token
    (required) — Token symbol (e.g.,
    USDCx
    ,
    sBTC
    ) or contract ID
  • --address
    (optional) — Stacks address to check (uses active wallet if omitted)
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
    sBTC
    )或合约ID
  • --address
    (可选)——要查询的Stacks地址(若省略则使用当前活跃钱包)
输出:
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:
  • --token
    (required) — Token symbol or contract ID
  • --recipient
    (required) — Stacks address to send to
  • --amount
    (required) — Amount in smallest unit (depends on token decimals)
  • --memo
    (optional) — Memo message (max 34 bytes)
  • --fee
    (optional) — Fee preset (low|medium|high) or micro-STX amount; auto-estimated if omitted
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>]
选项:
  • --token
    (必填)——代币符号或合约ID
  • --recipient
    (必填)——接收代币的Stacks地址
  • --amount
    (必填)——转账金额(使用代币最小单位,取决于代币的小数位数)
  • --memo
    (可选)——备注信息(最大34字节)
  • --fee
    (可选)——手续费预设(low|medium|high)或具体microStx数值;若省略则自动估算
输出:
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:
  • --token
    (required) — Token symbol or contract ID
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>
选项:
  • --token
    (必填)——代币符号或合约ID
输出:
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:
  • --address
    (optional) — Stacks address to check (uses active wallet if omitted)
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>]
选项:
  • --address
    (可选)——要查询的Stacks地址(若省略则使用当前活跃钱包)
输出:
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:
  • --token
    (required) — Token symbol or contract ID
  • --limit
    (optional) — Maximum number of holders to return (default: 20)
  • --offset
    (optional) — Offset for pagination (default: 0)
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>]
选项:
  • --token
    (必填)——代币符号或合约ID
  • --limit
    (可选)——返回的最大持有者数量(默认:20)
  • --offset
    (可选)——分页偏移量(默认:0)
输出:
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
    ,
    DIKO
    — or use the full contract ID
  • Token amounts are in the smallest unit — check
    decimals
    field to convert to human-readable values
  • 代币余额和信息查询使用公开的Hiro API(无需身份验证)
  • 转账操作需要解锁钱包
  • 支持的知名代币符号:
    sBTC
    USDCx
    ALEX
    DIKO
    ——也可使用完整合约ID
  • 代币金额以最小单位表示——请查看
    decimals
    字段转换为人类可读数值