Loading...
Loading...
Stacks network and blockchain query operations — get STX fees, account info, transaction history, block info, mempool transactions, contract info and events, network status, and call read-only contract functions. All queries use the Hiro API.
npx skill4agent add aibtcdev/skills queryget-account-infoget-account-transactionsbun run query/query.ts <subcommand> [options]bun run query/query.ts get-stx-fees{
"network": "mainnet",
"fees": {
"low": { "microStx": 1000, "stx": "0.001 STX", "description": "Lower fee, may take longer to confirm" },
"medium": { "microStx": 2500, "stx": "0.0025 STX", "description": "Standard fee, typical confirmation time" },
"high": { "microStx": 5000, "stx": "0.005 STX", "description": "Higher fee, faster confirmation" }
},
"byTransactionType": {
"tokenTransfer": { "low": 1000, "medium": 2500, "high": 5000 },
"contractCall": { "low": 1500, "medium": 3000, "high": 6000 },
"smartContract": { "low": 2000, "medium": 4000, "high": 8000 }
},
"unit": "micro-STX",
"note": "1 STX = 1,000,000 micro-STX. Fees are estimates based on current mempool conditions."
}bun run query/query.ts get-account-info [--address <stxAddress>]--address{
"address": "SP...",
"network": "mainnet",
"nonce": 42,
"balance": { "microStx": "1000000000", "stx": "1000 STX" },
"explorerUrl": "https://explorer.hiro.so/address/SP...?chain=mainnet"
}bun run query/query.ts get-account-transactions [--address <stxAddress>] [--limit 20] [--offset 0]--address--limit--offset{
"address": "SP...",
"network": "mainnet",
"total": 150,
"limit": 20,
"offset": 0,
"transactions": [
{
"txId": "0x...",
"type": "token_transfer",
"status": "success",
"sender": "SP...",
"blockHeight": 145000,
"fee": "1000",
"explorerUrl": "https://explorer.hiro.so/txid/0x...?chain=mainnet"
}
],
"explorerUrl": "https://explorer.hiro.so/address/SP...?chain=mainnet"
}bun run query/query.ts get-block-info --height-or-hash <value>--height-or-hash{
"network": "mainnet",
"hash": "0x...",
"height": 145000,
"canonical": true,
"burnBlockHeight": 840000,
"burnBlockTime": 1700000000,
"burnBlockTimeIso": "2024-01-01T00:00:00.000Z",
"txCount": 12,
"txIds": ["0x..."]
}bun run query/query.ts get-mempool-info [--sender-address <addr>] [--limit 20] [--offset 0]--sender-address--limit--offset{
"network": "mainnet",
"total": 5,
"limit": 20,
"offset": 0,
"transactions": [
{
"txId": "0x...",
"type": "contract_call",
"sender": "SP...",
"fee": "2500",
"nonce": 43,
"receiptTime": "2024-01-01T00:00:00.000Z",
"explorerUrl": "https://explorer.hiro.so/txid/0x...?chain=mainnet"
}
]
}bun run query/query.ts get-contract-info --contract-id <address.contract-name>--contract-idaddress.contract-name{
"contractId": "SP...contract-name",
"network": "mainnet",
"txId": "0x...",
"blockHeight": 140000,
"functions": [
{ "name": "transfer", "access": "public", "args": [...], "outputs": {...} }
],
"variables": [...],
"maps": [...],
"fungibleTokens": [...],
"nonFungibleTokens": [...],
"explorerUrl": "https://explorer.hiro.so/txid/SP...contract-name?chain=mainnet"
}bun run query/query.ts get-contract-events --contract-id <address.contract-name> [--limit 20] [--offset 0]--contract-idaddress.contract-name--limit--offset{
"contractId": "SP...contract-name",
"network": "mainnet",
"limit": 20,
"offset": 0,
"events": [...],
"explorerUrl": "https://explorer.hiro.so/txid/SP...contract-name?chain=mainnet"
}bun run query/query.ts get-network-status{
"network": "mainnet",
"serverVersion": "stacks-node 2.4.0.0.0",
"status": "ready",
"chainTip": { "block_height": 145000, "block_hash": "0x..." },
"coreInfo": {
"peerVersion": 4026533888,
"stacksTipHeight": 145000,
"burnBlockHeight": 840000,
"networkId": 1
}
}bun run query/query.ts call-read-only --contract-id <id> --function-name <name> [--args <json>] [--sender <address>]--contract-idaddress.contract-name--function-name--args[]--sender--args@stacks/transactionsuintCV(1)"0100000000000000000000000000000001"{
"contractId": "SP...contract-name",
"functionName": "get-balance",
"network": "mainnet",
"okay": true,
"result": "0x0100000000000000000000000000000064",
"cause": null
}api.mainnet.hiro.soapi.testnet.hiro.soNETWORKget-account-infoget-account-transactionscall-read-only