使用 Tokenview API 查询区块链地址余额,默认 BTC,需 TOKENVIEW_API_KEY 环境变量。
A skill for querying the balance of a specified blockchain address using the Tokenview API.
The default supported coin is BTC, and the API Key must be provided through the environment variable TOKENVIEW_API_KEY.
<address>?" or "How much BTC does <address> have?"https://services.tokenview.io/vipapi/addr/b/{lowercase-coin-abbr}/{address}?apikey={apikey}TOKENVIEW_API_KEY to config API Key。lowercase-coin-abbr is coin abbreviation in lowercase (default: btc), address blockchain address extracted from the conversationSuccess:The script returns JSON , and the user sees:"Balance is {balance} {COIN}"
Failure:Example raw Tokenview API JSON: json
{
"code": 1,
"msg": "404",
"data": "NONE"
}
will be like: "Balance query failed:Code=1, Msg=404, Data=NONE"
Example command (BTC): bash
python $OPENCLAW_STATE_DIR/workspace/skills/tokenview_balance_checker/tokenview_api.py <address> --coin btc
$OPENCLAW_STATE_DIR/workspace/skills/tokenview_balance_checker/tokenview_api.py{"code":1,"msg":"success","data":"0.123 BTC"}