- Tools
- Chainhooks
- Fetch
Fetch chainhooks
Retrieve chainhook information using the SDK
getChainhook
Retrieve a paginated list of all your chainhooks.
Example
1import { ChainhooksClient, CHAINHOOKS_BASE_URL } from '@hirosystems/chainhooks-client';23const client = new ChainhooksClient({4baseUrl: CHAINHOOKS_BASE_URL.testnet,5apiKey: process.env.HIRO_API_KEY!,6});78// Get first page (default: 20 results)9const chainhooks = await client.getChainhooks();1011console.log('Total chainhooks:', chainhooks.total);12console.log('Results:', chainhooks.results.length);13console.log('Limit:', chainhooks.limit);14console.log('Offset:', chainhooks.offset);
With options
1// Get specific page with 50 chainhooks starting from position 1002const chainhooks = await client.getChainhooks({3limit: 50,4offset: 100,5});
getChainhooks
Retrieve a specific chainhook by UUID.
Example
1const chainhook = await client.getChainhook('be4ab3ed-b606-4fe0-97c4-6c0b1ac9b185');