Fetch chainhooks

Retrieve chainhook information using the SDK

getChainhook

Retrieve a paginated list of all your chainhooks.

Example

1
import { ChainhooksClient, CHAINHOOKS_BASE_URL } from '@hirosystems/chainhooks-client';
2
3
const client = new ChainhooksClient({
4
baseUrl: CHAINHOOKS_BASE_URL.testnet,
5
apiKey: process.env.HIRO_API_KEY!,
6
});
7
8
// Get first page (default: 20 results)
9
const chainhooks = await client.getChainhooks();
10
11
console.log('Total chainhooks:', chainhooks.total);
12
console.log('Results:', chainhooks.results.length);
13
console.log('Limit:', chainhooks.limit);
14
console.log('Offset:', chainhooks.offset);

With options

1
// Get specific page with 50 chainhooks starting from position 100
2
const chainhooks = await client.getChainhooks({
3
limit: 50,
4
offset: 100,
5
});

getChainhooks

Retrieve a specific chainhook by UUID.

Example

1
const chainhook = await client.getChainhook('be4ab3ed-b606-4fe0-97c4-6c0b1ac9b185');

Next steps

How is this guide?