Sage Wallet Skill
RPC interface to Sage wallet for Chia blockchain operations.
Configuration
User settings stored in {workspace}/config/sage-wallet.json:
CODEBLOCK0
Platform Defaults
| Platform | Cert Path | Key Path |
|---|
| mac | INLINECODE1 | INLINECODE2 |
| linux |
~/.local/share/sage/ssl/wallet.crt |
...wallet.key |
| windows |
%APPDATA%\com.rigidnetwork.sage\ssl\wallet.crt |
...wallet.key |
When platform is "auto", detect via uname -s.
Slash Commands
Configuration
| Command | Action |
|---|
| INLINECODE10 | Show config and test connection |
| INLINECODE11 |
Display current settings |
|
/sage config platform <auto\|mac\|linux\|windows> | Set platform |
|
/sage config rpc <url> | Set RPC URL |
|
/sage config cert <path> | Set SSL cert path |
|
/sage config key <path> | Set SSL key path |
|
/sage config fingerprint <fp> | Set default wallet fingerprint |
|
/sage config autologin <on\|off> | Toggle auto-login |
|
/sage config reset | Reset to defaults |
Operations
Route to appropriate sub-skill based on domain:
| Domain | Sub-Skill | Example Commands |
|---|
| Auth & Keys | INLINECODE19 | INLINECODE20 , /sage logout, INLINECODE22 |
| XCH |
sage-xch |
/sage send xch,
/sage balance,
/sage combine |
| CAT Tokens |
sage-cat |
/sage cats,
/sage send cat,
/sage issue cat |
| NFTs |
sage-nft |
/sage nfts,
/sage mint nft,
/sage transfer nft |
| DIDs |
sage-did |
/sage dids,
/sage create did |
| Offers |
sage-offers |
/sage offers,
/sage make offer,
/sage take offer |
| Options |
sage-options |
/sage options,
/sage mint option |
| Coins |
sage-coins |
/sage coins,
/sage check address |
| Transactions |
sage-txn |
/sage pending,
/sage submit |
| Network |
sage-network |
/sage peers,
/sage network |
| System |
sage-system |
/sage sync,
/sage version |
| WalletConnect |
sage-walletconnect |
/sage wc sign |
Global Parameters
All commands accept optional overrides:
- -
--fingerprint <fp> — Use specific wallet - INLINECODE60 — Override RPC URL
- INLINECODE61 — Override cert path
- INLINECODE62 — Override key path
Scripts
- -
scripts/sage-config.sh — Config management - INLINECODE64 — RPC caller with mTLS
Making RPC Calls
CODEBLOCK1
Sub-Skills
Each sub-skill handles a specific domain. Load the appropriate one based on the operation:
Send/receive XCH, combine, split coins |
|
sage-cat | CAT token operations |
|
sage-nft | NFT minting, transfers, collections |
|
sage-did | DID creation and management |
|
sage-offers | Offer creation, acceptance, cancellation |
|
sage-options | Options protocol operations |
|
sage-coins | Coin queries, address validation |
|
sage-txn | Transaction signing, submission |
|
sage-network | Peer and network settings |
|
sage-system | Sync status, version, database |
|
sage-walletconnect | WalletConnect integration |
First Run
On first invocation:
- 1. Check for config file; create if missing
- Detect platform if set to INLINECODE65
- Verify cert/key files exist
- If missing, prompt user to configure paths
- Test connection with INLINECODE66
If certs not found, guide user:
CODEBLOCK2
Error Handling
RPC errors return HTTP status codes:
- -
400 — Bad request (invalid params) - INLINECODE68 — Unauthorized (cert mismatch)
- INLINECODE69 — Not found
- INLINECODE70 — Internal error
Always check response for error field before processing data.
Amount Formatting
Sage uses mojos (1 XCH = 1,000,000,000,000 mojos). The Amount type in requests/responses is a string representing mojos. Convert for display:
CODEBLOCK3
Sage 钱包技能
用于 Chia 区块链操作的 Sage 钱包 RPC 接口。
配置
用户设置存储在 {workspace}/config/sage-wallet.json:
json
{
platform: auto,
rpc_url: https://127.0.0.1:9257,
cert_path: null,
key_path: null,
fingerprint: null,
auto_login: false
}
平台默认值
| 平台 | 证书路径 | 密钥路径 |
|---|
| mac | ~/Library/Application Support/com.rigidnetwork.sage/ssl/wallet.crt | ...wallet.key |
| linux |
~/.local/share/sage/ssl/wallet.crt | ...wallet.key |
| windows | %APPDATA%\com.rigidnetwork.sage\ssl\wallet.crt | ...wallet.key |
当 platform 设置为 auto 时,通过 uname -s 自动检测。
斜杠命令
配置
| 命令 | 操作 |
|---|
| /sage status | 显示配置并测试连接 |
| /sage config |
显示当前设置 |
| /sage config platform
| 设置平台 |
| /sage config rpc | 设置 RPC URL |
| /sage config cert | 设置 SSL 证书路径 |
| /sage config key | 设置 SSL 密钥路径 |
| /sage config fingerprint | 设置默认钱包指纹 |
| /sage config autologin | 切换自动登录 |
| /sage config reset | 重置为默认值 |
操作
根据领域路由到相应的子技能:
| 领域 | 子技能 | 示例命令 |
|---|
| 认证与密钥 | sage-auth | /sage login, /sage logout, /sage keys |
| XCH |
sage-xch | /sage send xch, /sage balance, /sage combine |
| CAT 代币 | sage-cat | /sage cats, /sage send cat, /sage issue cat |
| NFT | sage-nft | /sage nfts, /sage mint nft, /sage transfer nft |
| DID | sage-did | /sage dids, /sage create did |
| 报价 | sage-offers | /sage offers, /sage make offer, /sage take offer |
| 期权 | sage-options | /sage options, /sage mint option |
| 币 | sage-coins | /sage coins, /sage check address |
| 交易 | sage-txn | /sage pending, /sage submit |
| 网络 | sage-network | /sage peers, /sage network |
| 系统 | sage-system | /sage sync, /sage version |
| WalletConnect | sage-walletconnect | /sage wc sign |
全局参数
所有命令都接受可选覆盖参数:
- - --fingerprint — 使用特定钱包
- --rpc — 覆盖 RPC URL
- --cert — 覆盖证书路径
- --key — 覆盖密钥路径
脚本
- - scripts/sage-config.sh — 配置管理
- scripts/sage-rpc.sh — 带 mTLS 的 RPC 调用器
发起 RPC 调用
bash
加载 RPC 辅助脚本
source scripts/sage-rpc.sh
调用端点
sagerpc getsync_status {}
sagerpc sendxch {address:xch1...,amount:1000000000000,fee:100000000}
子技能
每个子技能处理特定领域。根据操作加载相应的子技能:
发送/接收 XCH、合并、拆分币 |
| sage-cat | CAT 代币操作 |
| sage-nft | NFT 铸造、转账、收藏 |
| sage-did | DID 创建和管理 |
| sage-offers | 报价创建、接受、取消 |
| sage-options | 期权协议操作 |
| sage-coins | 币查询、地址验证 |
| sage-txn | 交易签名、提交 |
| sage-network | 节点和网络设置 |
| sage-system | 同步状态、版本、数据库 |
| sage-walletconnect | WalletConnect 集成 |
首次运行
首次调用时:
- 1. 检查配置文件;如果缺失则创建
- 如果设置为 auto,检测平台
- 验证证书/密钥文件是否存在
- 如果缺失,提示用户配置路径
- 使用 GetVersion 测试连接
如果未找到证书,引导用户:
未找到 Sage 证书。请使用以下命令配置:
/sage config cert /path/to/wallet.crt
/sage config key /path/to/wallet.key
错误处理
RPC 错误返回 HTTP 状态码:
- - 400 — 错误请求(无效参数)
- 401 — 未授权(证书不匹配)
- 404 — 未找到
- 500 — 内部错误
在处理数据前,始终检查响应中的错误字段。
金额格式化
Sage 使用 mojos(1 XCH = 1,000,000,000,000 mojos)。请求/响应中的 Amount 类型是表示 mojos 的字符串。转换为显示格式:
1 XCH = 1000000000000
0.001 XCH = 1000000000