settings について
settingsはaibtcの設定を管理するスキルで、Stacks APIやHiro APIの設定を調整するユーザー向けです。バージョン情報の確認やx402 sponsor relayのヘルスチェックも行えます。
主な機能
- 01Hiro APIキーの保存、確認、削除
- 02Stacks API URLの設定またはリセット
- 03使用中のAPI URLとネットワークの表示
- 04インストール済みと最新のバージョン比較
- 05relayとsponsorの状態確認
活用シーン
- 01Hiro APIリクエスト用キーの設定
- 02カスタムStacks APIノードへのリクエスト転送
- 03使用中のネットワークとAPI URLの確認
- 04sponsor relayの接続状況の調査
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ aibtcdev/ skills --skill settingsインストール後、Claude Code で/settingsを入力して読み込まれたか確認します。
同梱ファイルAGENT.mdsettings.ts
詳細
設定スキル
~/.aibtc/config.json に保存されている設定を管理します。認証済みの Stacks API リクエストで使用する Hiro API キー、カスタム Stacks API ノード URLを設定し、バージョン情報を表示します。
使用方法
bun run settings/settings.ts <subcommand> [options]
サブコマンド
set-hiro-api-key
Hiro API キーを ~/.aibtc/config.json に保存します。認証済みのリクエストでは、公開(未認証)リクエストより高いレート制限が適用されます。
無料の API キーは https://platform.hiro.so/ で取得できます。
bun run settings/settings.ts set-hiro-api-key --api-key <key>
オプション:
--api-key(必須)— Hiro API キー(機密情報)
出力:
{
"success": true,
"message": "Hiro API key saved. All subsequent Hiro API requests will use this key.",
"maskedKey": "abcd...wxyz",
"storedIn": "~/.aibtc/config.json"
}
get-hiro-api-key
Hiro API キーが設定されているか確認します。キーの取得元とマスクされたプレビューを表示します。
bun run settings/settings.ts get-hiro-api-key
出力(キーが設定されている場合):
{
"configured": true,
"source": "~/.aibtc/config.json",
"maskedKey": "abcd...wxyz",
"hint": "API key is active. Hiro API requests use authenticated rate limits."
}
出力(キーが設定されていない場合):
{
"configured": false,
"source": "none",
"maskedKey": "(not set)",
"hint": "No API key configured. Using public rate limits. Get a key at https://platform.hiro.so/"
}
delete-hiro-api-key
保存されている Hiro API キーを ~/.aibtc/config.json から削除します。環境変数に HIRO_API_KEY が設定されている場合は、引き続きフォールバックとして使用されます。
bun run settings/settings.ts delete-hiro-api-key
出力:
{
"success": true,
"message": "Hiro API key removed from ~/.aibtc/config.json.",
"envFallbackActive": false,
"hint": "No API key configured. Requests will use public rate limits."
}
set-stacks-api-url
デフォルトの Hiro API の代わりに、すべての Stacks API リクエストをカスタムノードに送信します。URL は api.hiro.so と同じ /v2/ および /extended/v1/ エンドポイントを提供する必要があります。
bun run settings/settings.ts set-stacks-api-url --url <url>
オプション:
--url(必須)— Stacks API ノードのベース URL(例:http://localhost:3999)
出力:
{
"success": true,
"message": "Custom Stacks API URL saved. All subsequent Stacks API requests will use this node.",
"url": "http://localhost:3999",
"storedIn": "~/.aibtc/config.json",
"tip": "Use get-stacks-api-url to verify, or delete-stacks-api-url to revert to the default."
}
get-stacks-api-url
現在使用中の Stacks API URL を表示します。カスタムノードかデフォルトの Hiro API かも示します。
bun run settings/settings.ts get-stacks-api-url
出力(カスタム URL):
{
"activeUrl": "http://localhost:3999",
"isCustom": true,
"source": "~/.aibtc/config.json",
"defaultUrl": "https://api.testnet.hiro.so",
"network": "testnet",
"hint": "Using custom Stacks API node."
}
出力(デフォルト):
{
"activeUrl": "https://api.testnet.hiro.so",
"isCustom": false,
"source": "default (Hiro API)",
"defaultUrl": "https://api.testnet.hiro.so",
"network": "testnet",
"hint": "Using default Hiro API. Use set-stacks-api-url to point to your own node."
}
delete-stacks-api-url
カスタム Stacks API URL を削除し、デフォルトの Hiro API(api.mainnet.hiro.so または api.testnet.hiro.so)に戻します。
bun run settings/settings.ts delete-stacks-api-url
出力:
{
"success": true,
"message": "Custom Stacks API URL removed. Reverted to default: https://api.testnet.hiro.so",
"activeUrl": "https://api.testnet.hiro.so",
"network": "testnet"
}
get-server-version
現在インストールされているパッケージのバージョンを確認し、npm で公開されている最新バージョンと比較します。
bun run settings/settings.ts get-server-version
出力:
{
"currentVersion": "0.1.0",
"latestVersion": "0.1.0",
"isLatest": true,
"updateAvailable": false,
"package": "@aibtc/skills"
}
check-relay-health
x402 スポンサーレイヤーの稼働状況と、オンチェーンのスポンサ―アドレスのノンス状態を確認します。レイヤーへの到達可能性、バージョン、スポンサーノンスの欠落、メンプールの混雑状況を報告します。
bun run settings/settings.ts check-relay-health [--relay-url <url>] [--sponsor-address <address>]
オプション:
--relay-url(任意)— スポンサーレイヤーのベース URL(デフォルト:https://sponsor.aibtc.dev)--sponsor-address(任意)— レイヤースポンサーの STX アドレス(デフォルト:SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7)
出力(正常な場合):
{
"healthy": true,
"relay": {
"url": "https://sponsor.aibtc.dev",
"reachable": true,
"status": "ok",
"version": "1.0.0"
},
"sponsor": {
"address": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
"lastExecutedNonce": 732,
"possibleNextNonce": 733,
"lastMempoolNonce": null,
"mempoolCount": 0,
"missingNonces": []
},
"issues": [],
"hint": "Relay and sponsor are operating normally."
}
出力(問題が検出された場合):
{
"healthy": false,
"relay": { "url": "https://sponsor.aibtc.dev", "reachable": false, "error": "fetch failed" },
"sponsor": {
"address": "SP1PMPPVCMVW96FSWFV30KJQ4MNBMZ8MRWR3JWQ7",
"lastExecutedNonce": 732,
"possibleNextNonce": 733,
"lastMempoolNonce": null,
"mempoolCount": 0,
"missingNonces": [730]
},
"issues": [
"Relay unreachable: fetch failed",
"Nonce gaps detected: [730]. Transactions may be stuck. The sponsor may need to fill missing nonces."
],
"hint": "Issues detected — see the issues array for details."
}
設定ファイル
すべての設定は ~/.aibtc/config.json に保存されます。このファイルは、ウォレットまたは設定のサブコマンドが初めて使用されたときに自動的に作成されます。
{
"version": 1,
"activeWalletId": null,
"autoLockTimeout": 15,
"hiroApiKey": "your-key-here",
"stacksApiUrl": "http://localhost:3999"
}
環境変数のフォールバック
HIRO_API_KEY— 設定に保存されたキーがない場合に使用されますNETWORK—mainnetまたはtestnetを設定します(デフォルト:testnet)API_URL— カスタム x402 レイヤー URL