@quicknode/sdk 3.1.0-alpha.17 → 3.1.0-alpha.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,195 +1,1603 @@
1
- # Quicknode SDK
1
+ # @quicknode/sdk (Node.js)
2
2
 
3
- A unified SDK for building on Quicknode.
3
+ Node.js / TypeScript bindings for the Quicknode SDK.
4
4
 
5
- Rust SDK with Python, Node.js, and Ruby bindings.
5
+ This is one of four language bindings published from the same Rust core. See the [project README](https://github.com/quiknode-labs/sdk/blob/main/README.md) for the polyglot overview, development setup, and release process.
6
6
 
7
7
  ## Table of Contents
8
8
 
9
- - [Per-language docs](#per-language-docs)
10
- - [Project Structure](#project-structure)
11
9
  - [Installation](#installation)
12
- - [Development](#development)
13
- - [Prerequisites](#prerequisites)
14
- - [Build Commands](#build-commands)
15
- - [Testing](#testing)
16
- - [Examples](#examples)
17
- - [Releasing](#releasing)
18
- - [Two-phase flow](#two-phase-flow)
19
- - [Building blocks](#building-blocks)
20
- - [Version conventions](#version-conventions)
21
- - [First-time setup](#first-time-setup)
10
+ - [Quick Start](#quick-start)
11
+ - [Configuration](#configuration)
12
+ - [API Reference](#api-reference)
13
+ - [Admin Client](#admin-client)
14
+ - [Endpoints](#endpoints)
15
+ - [Endpoint Tags](#endpoint-tags)
16
+ - [Teams](#teams)
17
+ - [Usage](#usage)
18
+ - [Logs](#logs)
19
+ - [Endpoint Security](#endpoint-security)
20
+ - [Security Options](#security-options)
21
+ - [Tokens](#tokens)
22
+ - [Referrers](#referrers)
23
+ - [IPs](#ips)
24
+ - [Domain Masks](#domain-masks)
25
+ - [JWTs](#jwts)
26
+ - [Request Filters](#request-filters)
27
+ - [Multichain](#multichain)
28
+ - [IP Custom Headers](#ip-custom-headers)
29
+ - [Method Rate Limits](#method-rate-limits)
30
+ - [Endpoint Rate Limits](#endpoint-rate-limits)
31
+ - [Endpoint URLs](#endpoint-urls)
32
+ - [Metrics](#metrics)
33
+ - [Chains](#chains)
34
+ - [Billing](#billing)
35
+ - [Bulk Operations](#bulk-operations)
36
+ - [Account Tags](#account-tags)
37
+ - [Streams Client](#streams-client)
38
+ - [Datasets, Regions, and Destinations](#datasets-regions-and-destinations)
39
+ - [Streams methods](#streams-methods)
40
+ - [Webhooks Client](#webhooks-client)
41
+ - [Templates and destination](#templates-and-destination)
42
+ - [Webhooks methods](#webhooks-methods)
43
+ - [KV Store Client](#kv-store-client)
44
+ - [Sets](#sets)
45
+ - [Lists](#lists)
46
+ - [Error Handling](#error-handling)
22
47
  - [License](#license)
23
48
 
24
- ## Per-language docs
49
+ ## Installation
50
+
51
+ `npm install @quicknode/sdk`
52
+
53
+ ## Quick Start
54
+
55
+ Construct the SDK once, then reach into the four sub-clients (`admin`, `streams`, `webhooks`, `kvstore`). Subsequent API Reference snippets assume you have a `qn` handle from one of these blocks.
56
+
57
+ ```typescript
58
+ // Node.js
59
+ import { QuicknodeSdk } from "quicknode-sdk";
60
+
61
+ const qn = QuicknodeSdk.fromEnv();
62
+ const resp = await qn.admin.getEndpoints();
63
+ console.log(`${resp.data.length} endpoints`);
64
+ ```
65
+
66
+ ## Configuration
67
+
68
+ There are two ways to configure the SDK.
69
+
70
+ ### Option A — Pass config directly
71
+
72
+ ```typescript
73
+ // Node.js
74
+ import { QuicknodeSdk } from "quicknode-sdk";
75
+ const qn = new QuicknodeSdk({ apiKey: "your-key", http: { timeoutSecs: 30 } });
76
+ ```
77
+
78
+ ### Option B — Load from environment (`from_env()`)
79
+
80
+ ```typescript
81
+ // Node.js
82
+ const qn = QuicknodeSdk.fromEnv();
83
+ ```
84
+
85
+ Environment variables (prefix `QN_SDK__`, separator `__`):
86
+
87
+ | Variable | Required | Default | Description |
88
+ |----------|----------|---------|-------------|
89
+ | `QN_SDK__API_KEY` | yes | — | Your Quicknode API key |
90
+ | `QN_SDK__HTTP__TIMEOUT_SECS` | no | 30 | HTTP request timeout in seconds |
91
+ | `QN_SDK__HTTP__POOL_MAX_IDLE_PER_HOST` | no | — | Max idle HTTP connections per host |
92
+ | `QN_SDK__ADMIN__BASE_URL` | no | `https://api.quicknode.com/v0/` | Override admin API base URL (HTTPS, must end with `/`) |
93
+ | `QN_SDK__STREAMS__BASE_URL` | no | `https://api.quicknode.com/streams/rest/v1/` | Override streams base URL |
94
+ | `QN_SDK__WEBHOOKS__BASE_URL` | no | `https://api.quicknode.com/webhooks/rest/v1/` | Override webhooks base URL |
95
+ | `QN_SDK__KVSTORE__BASE_URL` | no | `https://api.quicknode.com/kv/rest/v1/` | Override KV store base URL |
96
+
97
+ ## API Reference
98
+
99
+ Snippets assume `qn` was already constructed via the Quick Start. Optional parameters are skipped unless showing one is needed to illustrate usage.
100
+
101
+ ### Language conventions
102
+
103
+ - Methods are `async` and take a single options object with camelCase keys.
104
+
105
+ ---
106
+
107
+ ### Admin Client
108
+
109
+ Accessed as `qn.admin`. Manages endpoints, tags, teams, billing, usage, metrics, security, and rate limits. Backed by `https://api.quicknode.com/v0/`.
110
+
111
+ #### Endpoints
112
+
113
+ ##### `get_endpoints` / `getEndpoints`
114
+
115
+ Returns a paginated list of endpoints on the account with optional search, filters (networks, statuses, labels, tags, dedicated, flat-rate), sorting, and pagination.
116
+
117
+ **Parameters** (all optional): `limit` (i32), `offset` (i32), `search` (string), `sort_by` (string), `sort_direction` (`"asc"` | `"desc"`), `networks` (string[]), `statuses` (string[]), `labels` (string[]), `dedicated` (bool), `is_flat_rate` (bool), `tag_ids` (i32[]), `tag_labels` (string[]).
118
+
119
+ **Returns**: `GetEndpointsResponse` — `{ data: Endpoint[], pagination?: Pagination }`.
120
+
121
+ ```typescript
122
+ // Node.js
123
+ const resp = await qn.admin.getEndpoints({
124
+ limit: 20,
125
+ sortBy: "created_at",
126
+ sortDirection: "desc",
127
+ });
128
+ ```
129
+
130
+ ##### `create_endpoint` / `createEndpoint`
131
+
132
+ Creates a new endpoint for the given blockchain and network.
133
+
134
+ **Parameters**: `chain` (string, optional), `network` (string, optional).
135
+
136
+ **Returns**: `CreateEndpointResponse` with `data: SingleEndpoint`.
137
+
138
+ ```typescript
139
+ // Node.js
140
+ const resp = await qn.admin.createEndpoint({ chain: "ethereum", network: "mainnet" });
141
+ ```
142
+
143
+ ##### `show_endpoint` / `showEndpoint`
144
+
145
+ Fetches a single endpoint by id, including its full security configuration and rate limits.
146
+
147
+ **Parameters**: `id` (string, required).
148
+
149
+ **Returns**: `ShowEndpointResponse` with `data: SingleEndpoint`.
150
+
151
+ ```typescript
152
+ // Node.js
153
+ const resp = await qn.admin.showEndpoint("ep-123");
154
+ ```
155
+
156
+ ##### `update_endpoint` / `updateEndpoint`
157
+
158
+ Updates editable fields on an endpoint. Currently supports `label`.
159
+
160
+ **Parameters**: `id` (string, required); body: `label` (string, optional).
161
+
162
+ **Returns**: nothing.
163
+
164
+ ```typescript
165
+ // Node.js
166
+ await qn.admin.updateEndpoint("ep-123", { label: "my label" });
167
+ ```
168
+
169
+ ##### `archive_endpoint` / `archiveEndpoint`
170
+
171
+ Archives an endpoint. The HTTP verb is `DELETE` but the effect is archival, not permanent deletion.
172
+
173
+ **Parameters**: `id` (string, required).
174
+
175
+ **Returns**: nothing.
176
+
177
+ ```typescript
178
+ // Node.js
179
+ await qn.admin.archiveEndpoint("ep-123");
180
+ ```
181
+
182
+ ##### `update_endpoint_status` / `updateEndpointStatus`
183
+
184
+ Pauses or unpauses an endpoint.
185
+
186
+ **Parameters**: `id` (string, required); body: `status` (string, required — `"active"` or `"paused"`).
187
+
188
+ **Returns**: `UpdateEndpointStatusResponse`.
189
+
190
+ ```typescript
191
+ // Node.js
192
+ await qn.admin.updateEndpointStatus("ep-123", { status: "paused" });
193
+ ```
194
+
195
+ #### Endpoint Tags
196
+
197
+ Per-endpoint tag add/remove. For account-wide tag management see [Account Tags](#account-tags).
198
+
199
+ ##### `create_tag` / `createTag`
200
+
201
+ Tags an endpoint with the given label. Creates the tag on the account if it does not exist.
202
+
203
+ **Parameters**: `id` (string, required); body: `label` (string, optional).
204
+
205
+ **Returns**: nothing.
206
+
207
+ ```typescript
208
+ // Node.js
209
+ await qn.admin.createTag("ep-123", { label: "prod" });
210
+ ```
211
+
212
+ ##### `delete_tag` / `deleteTag`
213
+
214
+ Removes a tag from a specific endpoint.
215
+
216
+ **Parameters**: `id` (endpoint id, string, required), `tag_id` (string, required).
217
+
218
+ **Returns**: nothing.
219
+
220
+ ```typescript
221
+ // Node.js
222
+ await qn.admin.deleteTag("ep-123", "42");
223
+ ```
224
+
225
+ #### Teams
226
+
227
+ ##### `list_teams` / `listTeams`
228
+
229
+ Lists all teams on the account.
230
+
231
+ **Parameters**: none.
232
+
233
+ **Returns**: `ListTeamsResponse` with `data: TeamSummary[]`.
234
+
235
+ ```typescript
236
+ // Node.js
237
+ const resp = await qn.admin.listTeams();
238
+ ```
239
+
240
+ ##### `create_team` / `createTeam`
241
+
242
+ Creates a new team.
243
+
244
+ **Parameters**: `name` (string, required).
245
+
246
+ **Returns**: `CreateTeamResponse` with `data: CreateTeamData`.
247
+
248
+ ```typescript
249
+ // Node.js
250
+ const resp = await qn.admin.createTeam({ name: "Payments" });
251
+ ```
252
+
253
+ ##### `get_team` / `getTeam`
254
+
255
+ Fetches team detail including pending invites.
256
+
257
+ **Parameters**: `id` (i64, required).
258
+
259
+ **Returns**: `GetTeamResponse` with `data: TeamDetail`.
260
+
261
+ ```typescript
262
+ // Node.js
263
+ const resp = await qn.admin.getTeam(42);
264
+ ```
265
+
266
+ ##### `delete_team` / `deleteTeam`
267
+
268
+ Deletes a team.
269
+
270
+ **Parameters**: `id` (i64, required).
271
+
272
+ **Returns**: `DeleteTeamResponse`.
273
+
274
+ ```typescript
275
+ // Node.js
276
+ await qn.admin.deleteTeam(42);
277
+ ```
278
+
279
+ ##### `list_team_endpoints` / `listTeamEndpoints`
280
+
281
+ Lists endpoints accessible to a team.
282
+
283
+ **Parameters**: `id` (i64, required).
284
+
285
+ **Returns**: `ListTeamEndpointsResponse` with `data: TeamEndpoint[]`.
286
+
287
+ ```typescript
288
+ // Node.js
289
+ const resp = await qn.admin.listTeamEndpoints(42);
290
+ ```
291
+
292
+ ##### `update_team_endpoints` / `updateTeamEndpoints`
293
+
294
+ Replaces the set of endpoints associated with a team. Pass an empty array to remove all.
295
+
296
+ **Parameters**: `id` (i64, required); body: `endpoint_ids` (string[], required).
297
+
298
+ **Returns**: `UpdateTeamEndpointsResponse`.
299
+
300
+ ```typescript
301
+ // Node.js
302
+ await qn.admin.updateTeamEndpoints(42, { endpointIds: ["ep-123", "ep-456"] });
303
+ ```
304
+
305
+ ##### `invite_team_member` / `inviteTeamMember`
306
+
307
+ Invites a user to a team. Existing users only need `email`; new users require `full_name` and `role`.
308
+
309
+ **Parameters**: `id` (i64, required); body: `email` (string, required), `full_name` (string, optional), `role` (string, optional — `admin` | `viewer` | `billing`).
310
+
311
+ **Returns**: `InviteTeamMemberResponse`.
312
+
313
+ ```typescript
314
+ // Node.js
315
+ await qn.admin.inviteTeamMember(42, { email: "alice@example.com", role: "viewer" });
316
+ ```
317
+
318
+ ##### `remove_team_member` / `removeTeamMember`
319
+
320
+ Removes a user from a team.
321
+
322
+ **Parameters**: `id` (team id, i64, required), `user_id` (i64, required).
323
+
324
+ **Returns**: `RemoveTeamMemberResponse`.
325
+
326
+ ```typescript
327
+ // Node.js
328
+ await qn.admin.removeTeamMember(42, 7);
329
+ ```
330
+
331
+ ##### `resend_team_invite` / `resendTeamInvite`
332
+
333
+ Re-sends a pending team invitation.
334
+
335
+ **Parameters**: `id` (team id, i64, required), `user_id` (i64, required).
336
+
337
+ **Returns**: `ResendTeamInviteResponse`.
338
+
339
+ ```typescript
340
+ // Node.js
341
+ await qn.admin.resendTeamInvite(42, 7);
342
+ ```
343
+
344
+ #### Usage
345
+
346
+ All usage methods accept optional `start_time` and `end_time` Unix timestamps. Omit both for account-to-date totals.
347
+
348
+ ##### `get_usage` / `getUsage`
349
+
350
+ Aggregate account usage for a time window.
351
+
352
+ **Returns**: `GetUsageResponse` with `data: UsageData` (`credits_used`, `credits_remaining`, `limit`, `overages`, `start_time`, `end_time`).
353
+
354
+ ```typescript
355
+ // Node.js
356
+ const resp = await qn.admin.getUsage();
357
+ ```
358
+
359
+ ##### `get_usage_by_endpoint` / `getUsageByEndpoint`
360
+
361
+ Per-endpoint usage breakdown.
362
+
363
+ **Returns**: `GetUsageByEndpointResponse` with `data.endpoints: EndpointUsage[]`.
364
+
365
+ ```typescript
366
+ // Node.js
367
+ const resp = await qn.admin.getUsageByEndpoint();
368
+ ```
369
+
370
+ ##### `get_usage_by_method` / `getUsageByMethod`
371
+
372
+ Per-RPC-method usage breakdown.
373
+
374
+ **Returns**: `GetUsageByMethodResponse` with `data.methods: MethodUsage[]`.
375
+
376
+ ```typescript
377
+ // Node.js
378
+ const resp = await qn.admin.getUsageByMethod();
379
+ ```
380
+
381
+ ##### `get_usage_by_chain` / `getUsageByChain`
382
+
383
+ Per-chain usage breakdown.
384
+
385
+ **Returns**: `GetUsageByChainResponse` with `data.chains: ChainUsage[]`.
386
+
387
+ ```typescript
388
+ // Node.js
389
+ const resp = await qn.admin.getUsageByChain();
390
+ ```
391
+
392
+ ##### `get_usage_by_tag` / `getUsageByTag`
393
+
394
+ Per-tag usage breakdown.
395
+
396
+ **Returns**: `GetUsageByTagResponse` with `data.tags: TagUsage[]`.
397
+
398
+ ```typescript
399
+ // Node.js
400
+ const resp = await qn.admin.getUsageByTag();
401
+ ```
402
+
403
+ #### Logs
404
+
405
+ ##### `get_endpoint_logs` / `getEndpointLogs`
406
+
407
+ Fetches a page of request logs for an endpoint. Set `include_details=true` for full request/response payloads (truncated at 2 KB each).
408
+
409
+ **Parameters**: `id` (endpoint id, required); body: `from` (string timestamp, required), `to` (string timestamp, required), `include_details` (bool, optional), `limit` (i32, optional), `next_at` (string cursor, optional).
410
+
411
+ **Returns**: `GetEndpointLogsResponse` — `{ data: EndpointLog[], next_at?: string }`.
412
+
413
+ ```typescript
414
+ // Node.js
415
+ const resp = await qn.admin.getEndpointLogs("ep-123", {
416
+ from: "2026-04-01T00:00:00Z",
417
+ to: "2026-04-02T00:00:00Z",
418
+ limit: 100,
419
+ });
420
+ ```
421
+
422
+ ##### `get_log_details` / `getLogDetails`
423
+
424
+ Returns the full request/response payloads for a single log entry.
425
+
426
+ **Parameters**: `id` (endpoint id, required), `request_id` (log request uuid, required).
427
+
428
+ **Returns**: `GetLogDetailsResponse` with `data: LogDetails`.
429
+
430
+ ```typescript
431
+ // Node.js
432
+ const resp = await qn.admin.getLogDetails("ep-123", "req-abc");
433
+ ```
434
+
435
+ #### Endpoint Security
436
+
437
+ ##### `get_endpoint_security` / `getEndpointSecurity`
438
+
439
+ Returns the full security configuration for an endpoint: tokens, JWTs, referrers, domain masks, IPs, request filters, and their per-feature toggles.
440
+
441
+ **Parameters**: `id` (string, required).
442
+
443
+ **Returns**: `GetEndpointSecurityResponse` with `data: EndpointSecurity`.
444
+
445
+ ```typescript
446
+ // Node.js
447
+ const resp = await qn.admin.getEndpointSecurity("ep-123");
448
+ ```
449
+
450
+ #### Security Options
451
+
452
+ ##### `get_security_options` / `getSecurityOptions`
453
+
454
+ Returns the list of security features and their enabled state for an endpoint.
455
+
456
+ **Parameters**: `id` (string, required).
457
+
458
+ **Returns**: `GetSecurityOptionsResponse` with `data: SecurityOption[]`.
459
+
460
+ ```typescript
461
+ // Node.js
462
+ const resp = await qn.admin.getSecurityOptions("ep-123");
463
+ ```
464
+
465
+ ##### `update_security_options` / `updateSecurityOptions`
466
+
467
+ Enables or disables individual security features. Each field accepts `"enabled"` or `"disabled"`.
468
+
469
+ **Parameters**: `id` (string, required); `options`: `SecurityOptionsUpdate` (`tokens`, `referrers`, `jwts`, `ips`, `domain_masks`, `hsts`, `cors`, `request_filters`, `ip_custom_header`).
470
+
471
+ **Returns**: `UpdateSecurityOptionsResponse` with updated `SecurityOption[]`.
472
+
473
+ ```typescript
474
+ // Node.js
475
+ await qn.admin.updateSecurityOptions("ep-123", {
476
+ options: { tokens: "enabled", jwts: "disabled" },
477
+ });
478
+ ```
479
+
480
+ #### Tokens
481
+
482
+ ##### `create_token` / `createToken`
483
+
484
+ Generates a new auth token on an endpoint.
485
+
486
+ **Parameters**: `id` (endpoint id, required).
487
+
488
+ **Returns**: nothing.
489
+
490
+ ```typescript
491
+ // Node.js
492
+ await qn.admin.createToken("ep-123");
493
+ ```
494
+
495
+ ##### `delete_token` / `deleteToken`
496
+
497
+ Revokes a token on an endpoint.
498
+
499
+ **Parameters**: `id` (endpoint id, required), `token_id` (string, required).
500
+
501
+ **Returns**: nothing.
502
+
503
+ ```typescript
504
+ // Node.js
505
+ await qn.admin.deleteToken("ep-123", "tok-1");
506
+ ```
507
+
508
+ #### Referrers
509
+
510
+ ##### `create_referrer` / `createReferrer`
511
+
512
+ Whitelists a referrer URL or domain on an endpoint.
513
+
514
+ **Parameters**: `id` (endpoint id, required); body: `referrer` (string, optional).
515
+
516
+ **Returns**: nothing.
517
+
518
+ ```typescript
519
+ // Node.js
520
+ await qn.admin.createReferrer("ep-123", { referrer: "example.com" });
521
+ ```
522
+
523
+ ##### `delete_referrer` / `deleteReferrer`
524
+
525
+ Removes a referrer from the whitelist.
526
+
527
+ **Parameters**: `id` (endpoint id, required), `referrer_id` (string, required).
528
+
529
+ **Returns**: nothing.
530
+
531
+ ```typescript
532
+ // Node.js
533
+ await qn.admin.deleteReferrer("ep-123", "ref-1");
534
+ ```
535
+
536
+ #### IPs
537
+
538
+ ##### `create_ip` / `createIp`
539
+
540
+ Whitelists an IP address on an endpoint.
541
+
542
+ **Parameters**: `id` (endpoint id, required); body: `ip` (string, optional).
543
+
544
+ **Returns**: nothing.
545
+
546
+ ```typescript
547
+ // Node.js
548
+ await qn.admin.createIp("ep-123", { ip: "198.51.100.7" });
549
+ ```
550
+
551
+ ##### `delete_ip` / `deleteIp`
552
+
553
+ Removes an IP from the whitelist.
554
+
555
+ **Parameters**: `id` (endpoint id, required), `ip_id` (string, required).
556
+
557
+ **Returns**: `DeleteBoolResponse`.
558
+
559
+ ```typescript
560
+ // Node.js
561
+ await qn.admin.deleteIp("ep-123", "ip-1");
562
+ ```
563
+
564
+ #### Domain Masks
565
+
566
+ ##### `create_domain_mask` / `createDomainMask`
567
+
568
+ Adds a custom domain mask to an endpoint.
569
+
570
+ **Parameters**: `id` (endpoint id, required); body: `domain_mask` (string, optional).
571
+
572
+ **Returns**: nothing.
573
+
574
+ ```typescript
575
+ // Node.js
576
+ await qn.admin.createDomainMask("ep-123", { domainMask: "rpc.example.com" });
577
+ ```
578
+
579
+ ##### `delete_domain_mask` / `deleteDomainMask`
580
+
581
+ Removes a domain mask.
582
+
583
+ **Parameters**: `id` (endpoint id, required), `domain_mask_id` (string, required).
584
+
585
+ **Returns**: nothing.
586
+
587
+ ```typescript
588
+ // Node.js
589
+ await qn.admin.deleteDomainMask("ep-123", "dm-1");
590
+ ```
591
+
592
+ #### JWTs
593
+
594
+ ##### `create_jwt` / `createJwt`
595
+
596
+ Configures JWT validation on an endpoint.
597
+
598
+ **Parameters**: `id` (endpoint id, required); body: `public_key` (string, optional), `kid` (string, optional), `name` (string, optional).
599
+
600
+ **Returns**: nothing.
601
+
602
+ ```typescript
603
+ // Node.js
604
+ await qn.admin.createJwt("ep-123", {
605
+ publicKey: "-----BEGIN PUBLIC KEY-----\n...",
606
+ kid: "key-1",
607
+ name: "primary",
608
+ });
609
+ ```
610
+
611
+ ##### `delete_jwt` / `deleteJwt`
612
+
613
+ Removes a JWT configuration.
614
+
615
+ **Parameters**: `id` (endpoint id, required), `jwt_id` (string, required).
616
+
617
+ **Returns**: nothing.
618
+
619
+ ```typescript
620
+ // Node.js
621
+ await qn.admin.deleteJwt("ep-123", "jwt-1");
622
+ ```
623
+
624
+ #### Request Filters
625
+
626
+ Whitelist specific RPC methods on an endpoint. Requests for methods not on the list are blocked when the feature is enabled.
627
+
628
+ ##### `create_request_filter` / `createRequestFilter`
629
+
630
+ **Parameters**: `id` (endpoint id, required); body: `method` (string[], optional). Ruby's Hash key is `methods` (plural).
631
+
632
+ **Returns**: `CreateRequestFilterResponse` with `data.id`.
633
+
634
+ ```typescript
635
+ // Node.js
636
+ const resp = await qn.admin.createRequestFilter("ep-123", {
637
+ method: ["eth_blockNumber", "eth_getBalance"],
638
+ });
639
+ ```
640
+
641
+ ##### `update_request_filter` / `updateRequestFilter`
642
+
643
+ **Parameters**: `id` (endpoint id, required), `request_filter_id` (string, required); body: `method` (string[], optional). Ruby's Hash keys are `request_filter_id` and `methods` (plural).
644
+
645
+ **Returns**: nothing.
646
+
647
+ ```typescript
648
+ // Node.js
649
+ await qn.admin.updateRequestFilter("ep-123", "f-1", { method: ["eth_call"] });
650
+ ```
651
+
652
+ ##### `delete_request_filter` / `deleteRequestFilter`
653
+
654
+ **Parameters**: `id` (endpoint id, required), `request_filter_id` (string, required).
655
+
656
+ **Returns**: nothing.
657
+
658
+ ```typescript
659
+ // Node.js
660
+ await qn.admin.deleteRequestFilter("ep-123", "f-1");
661
+ ```
662
+
663
+ #### Multichain
664
+
665
+ ##### `enable_multichain` / `enableMultichain`
666
+
667
+ Enables multichain on an endpoint.
668
+
669
+ **Parameters**: `id` (endpoint id, required).
670
+
671
+ **Returns**: nothing.
672
+
673
+ ```typescript
674
+ // Node.js
675
+ await qn.admin.enableMultichain("ep-123");
676
+ ```
677
+
678
+ ##### `disable_multichain` / `disableMultichain`
679
+
680
+ Disables multichain on an endpoint.
681
+
682
+ **Parameters**: `id` (endpoint id, required).
683
+
684
+ **Returns**: nothing.
685
+
686
+ ```typescript
687
+ // Node.js
688
+ await qn.admin.disableMultichain("ep-123");
689
+ ```
690
+
691
+ #### IP Custom Headers
692
+
693
+ ##### `create_or_update_ip_custom_header` / `createOrUpdateIpCustomHeader`
694
+
695
+ Sets the custom header used to identify the client IP (e.g. when traffic is proxied).
696
+
697
+ **Parameters**: `id` (endpoint id, required); body: `header_name` (string, required).
698
+
699
+ **Returns**: `CreateOrUpdateIpCustomHeaderResponse` with `data.header_name`.
700
+
701
+ ```typescript
702
+ // Node.js
703
+ await qn.admin.createOrUpdateIpCustomHeader("ep-123", { headerName: "X-Forwarded-For" });
704
+ ```
705
+
706
+ ##### `delete_ip_custom_header` / `deleteIpCustomHeader`
707
+
708
+ Removes the custom IP header configuration.
709
+
710
+ **Parameters**: `id` (endpoint id, required).
711
+
712
+ **Returns**: `DeleteBoolResponse`.
713
+
714
+ ```typescript
715
+ // Node.js
716
+ await qn.admin.deleteIpCustomHeader("ep-123");
717
+ ```
718
+
719
+ #### Method Rate Limits
720
+
721
+ ##### `get_method_rate_limits` / `getMethodRateLimits`
722
+
723
+ Lists method-level rate limiters configured on an endpoint.
724
+
725
+ **Parameters**: `id` (endpoint id, required).
726
+
727
+ **Returns**: `GetMethodRateLimitsResponse` with `data.rate_limiters: MethodRateLimiter[]`.
728
+
729
+ ```typescript
730
+ // Node.js
731
+ const resp = await qn.admin.getMethodRateLimits("ep-123");
732
+ ```
733
+
734
+ ##### `create_method_rate_limit` / `createMethodRateLimit`
735
+
736
+ Creates a new method-level rate limiter.
737
+
738
+ **Parameters**: `id` (endpoint id, required); body: `interval` (string, e.g. `"second"`), `methods` (string[]), `rate` (i32).
739
+
740
+ **Returns**: `CreateMethodRateLimitResponse` with `data: MethodRateLimiter`.
741
+
742
+ ```typescript
743
+ // Node.js
744
+ const resp = await qn.admin.createMethodRateLimit("ep-123", {
745
+ interval: "second",
746
+ methods: ["eth_call"],
747
+ rate: 10,
748
+ });
749
+ ```
750
+
751
+ ##### `update_method_rate_limit` / `updateMethodRateLimit`
752
+
753
+ Updates an existing rate limiter. Only provided fields change.
754
+
755
+ **Parameters**: `id` (endpoint id, required), `method_rate_limit_id` (string, required); body: `methods` (string[], optional), `status` (`"enabled"` | `"disabled"`, optional), `rate` (i32, optional).
756
+
757
+ **Returns**: `UpdateMethodRateLimitResponse`.
758
+
759
+ ```typescript
760
+ // Node.js
761
+ await qn.admin.updateMethodRateLimit("ep-123", "rl-1", { rate: 50 });
762
+ ```
763
+
764
+ ##### `delete_method_rate_limit` / `deleteMethodRateLimit`
765
+
766
+ Deletes a rate limiter.
767
+
768
+ **Parameters**: `id` (endpoint id, required), `method_rate_limit_id` (string, required).
769
+
770
+ **Returns**: nothing.
771
+
772
+ ```typescript
773
+ // Node.js
774
+ await qn.admin.deleteMethodRateLimit("ep-123", "rl-1");
775
+ ```
776
+
777
+ #### Endpoint Rate Limits
778
+
779
+ ##### `update_rate_limits` / `updateRateLimits`
780
+
781
+ Partial update of the endpoint-level RPS / RPM / RPD caps. Only buckets included in the request are modified — omitted buckets are left unchanged. Values are capped by the account's plan tier. Sends `PATCH`.
782
+
783
+ **Parameters**: `id` (endpoint id, required); `rate_limits`: `RateLimitSettings` (`rps`, `rpm`, `rpd`, all optional).
784
+
785
+ **Returns**: nothing.
786
+
787
+ ```typescript
788
+ // Node.js
789
+ await qn.admin.updateRateLimits("ep-123", { rateLimits: { rps: 100, rpm: 5000 } });
790
+ ```
791
+
792
+ ##### `get_rate_limits` / `getRateLimits`
793
+
794
+ Returns the rate-limit rows currently enforced on the endpoint, each identifying its `bucket` (`"rps"` / `"rpm"` / `"rpd"`), `rateLimit`, and `source` (`"plan_default"` or `"user_override"`). User-set overrides expose an `id` you can pass to `deleteRateLimitOverride`.
795
+
796
+ **Parameters**: `id` (endpoint id, required).
797
+
798
+ **Returns**: `GetRateLimitsResponse` with `data.rateLimits: RateLimitEntry[]`.
799
+
800
+ ```typescript
801
+ // Node.js
802
+ const resp = await qn.admin.getRateLimits("123");
803
+ for (const row of resp.data.rateLimits) {
804
+ console.log(row.bucket, row.rateLimit, row.source, row.id);
805
+ }
806
+ ```
807
+
808
+ ##### `delete_rate_limit_override` / `deleteRateLimitOverride`
809
+
810
+ Deletes a user-set rate-limit override by UUID. Plan defaults are not deletable — passing a UUID that does not match a user-set override on the endpoint returns 404.
811
+
812
+ **Parameters**: `id` (endpoint id, required); `override_id` / `overrideId` (UUID returned by `getRateLimits`, required).
813
+
814
+ **Returns**: nothing.
815
+
816
+ ```typescript
817
+ // Node.js
818
+ await qn.admin.deleteRateLimitOverride("123", "ovr-uuid");
819
+ ```
820
+
821
+ #### Endpoint URLs
822
+
823
+ ##### `get_endpoint_urls` / `getEndpointUrls`
824
+
825
+ Returns the HTTP and WebSocket URLs for the endpoint without fetching the full endpoint record. For multichain endpoints, `multichain_urls` / `multichainUrls` is a per-network map of additional URLs; for single-chain endpoints it is `null`.
826
+
827
+ **Parameters**: `id` (endpoint id, required).
828
+
829
+ **Returns**: `GetEndpointUrlsResponse` with `data.httpUrl`, `data.wssUrl`, and `data.multichainUrls`.
830
+
831
+ ```typescript
832
+ // Node.js
833
+ const resp = await qn.admin.getEndpointUrls("123");
834
+ console.log(resp.data.httpUrl);
835
+ if (resp.data.multichainUrls) {
836
+ for (const [network, urls] of Object.entries(resp.data.multichainUrls)) {
837
+ console.log(network, urls.httpUrl);
838
+ }
839
+ }
840
+ ```
841
+
842
+ #### Metrics
843
+
844
+ ##### `get_endpoint_metrics` / `getEndpointMetrics`
845
+
846
+ Returns metric series for an endpoint over a time period.
847
+
848
+ **Parameters**: `id` (endpoint id, required); body: `period` (`"hour"` | `"day"` | `"week"` | `"month"`), `metric` (e.g. `"method_calls_over_time"`, `"response_status_breakdown"`).
849
+
850
+ **Returns**: `GetEndpointMetricsResponse` with `data: EndpointMetric[]`. Each `EndpointMetric` has a `tag: string[]` and a `data: [timestamp, value][]`. Single-axis series (e.g. `response_time_over_time` with a percentile) come back as a one-element tag like `["p95"]`; multi-axis series come back as `["network", "arbitrum-mainnet"]`.
851
+
852
+ ```typescript
853
+ // Node.js
854
+ const resp = await qn.admin.getEndpointMetrics("ep-123", {
855
+ period: "day",
856
+ metric: "method_calls_over_time",
857
+ });
858
+ ```
859
+
860
+ ##### `get_account_metrics` / `getAccountMetrics`
861
+
862
+ Returns account-level metric series. Supports an optional `percentile` (e.g. `"p50"`, `"p95"`, `"p99"`) for latency metrics.
863
+
864
+ **Parameters**: `period` (required), `metric` (required), `percentile` (string, optional).
25
865
 
26
- API reference, configuration, and error handling for each language live next to the package those are also the docs that render on each package listing.
866
+ **Returns**: `GetAccountMetricsResponse` with `data: EndpointMetric[]`. See `getEndpointMetrics` above for the `tag: string[]` shape.
27
867
 
28
- - **Rust** — [`crates/core/README.md`](crates/core/README.md) (`quicknode-sdk` on crates.io)
29
- - **Python** — [`python/README.md`](python/README.md) (`quicknode-sdk` on PyPI)
30
- - **Node.js** [`npm/README.md`](npm/README.md) (`@quicknode/sdk` on npm)
31
- - **Ruby** — [`ruby/README.md`](ruby/README.md) (`quicknode_sdk` on RubyGems)
868
+ ```typescript
869
+ // Node.js
870
+ const resp = await qn.admin.getAccountMetrics({
871
+ period: "day",
872
+ metric: "credits_over_time",
873
+ });
874
+ ```
875
+
876
+ #### Chains
877
+
878
+ ##### `list_chains` / `listChains`
879
+
880
+ Lists the blockchains supported by Quicknode along with their networks.
32
881
 
33
- This file covers project structure, install index, and how to develop and release the SDK.
882
+ **Parameters**: none.
34
883
 
35
- ## Project Structure
884
+ **Returns**: `ListChainsResponse` with `data: Chain[]`.
36
885
 
886
+ ```typescript
887
+ // Node.js
888
+ const resp = await qn.admin.listChains();
37
889
  ```
38
- sdk/
39
- ├── crates/
40
- │ ├── core/ # Pure Rust business logic
41
- │ ├── python/ # PyO3 bindings
42
- │ ├── node/ # napi-rs bindings
43
- │ └── ruby/ # magnus bindings
44
- ├── python/sdk/ # Python package with type hints
45
- ├── npm/ # Node.js package with TypeScript types
46
- ├── ruby/ # Ruby package
47
- └── pyproject.toml # maturin build config
890
+
891
+ #### Billing
892
+
893
+ ##### `list_invoices` / `listInvoices`
894
+
895
+ Lists invoices on the account.
896
+
897
+ **Parameters**: none.
898
+
899
+ **Returns**: `ListInvoicesResponse` with `data.invoices: Invoice[]`.
900
+
901
+ ```typescript
902
+ // Node.js
903
+ const resp = await qn.admin.listInvoices();
48
904
  ```
49
905
 
50
- ## Installation
906
+ ##### `list_payments` / `listPayments`
51
907
 
52
- | Language | Install |
53
- |---|---|
54
- | Rust | `cargo add quicknode-sdk` — see [`crates/core/README.md`](crates/core/README.md) |
55
- | Python | `uv add quicknode-sdk` — see [`python/README.md`](python/README.md) |
56
- | Node.js | `npm install @quicknode/sdk` — see [`npm/README.md`](npm/README.md) |
57
- | Ruby | `gem install quicknode_sdk` — see [`ruby/README.md`](ruby/README.md) |
908
+ Lists payments on the account.
909
+
910
+ **Parameters**: none.
911
+
912
+ **Returns**: `ListPaymentsResponse` with `data.payments: Payment[]`.
913
+
914
+ ```typescript
915
+ // Node.js
916
+ const resp = await qn.admin.listPayments();
917
+ ```
58
918
 
59
- ## Development
919
+ #### Bulk Operations
60
920
 
61
- ### Prerequisites
921
+ ##### `bulk_update_endpoint_status` / `bulkUpdateEndpointStatus`
62
922
 
63
- - Rust (stable)
64
- - Python 3.8+ with [uv](https://docs.astral.sh/uv/)
65
- - Node.js 18+
66
- - Ruby 3.0+
67
- - [just](https://github.com/casey/just)
923
+ Activates or pauses many endpoints at once.
68
924
 
69
- ### Build Commands
925
+ **Parameters**: `ids` (string[], required), `status` (`"active"` | `"paused"`, required).
70
926
 
71
- Use the commands in the `Justfile` for the setup and build commands.
927
+ **Returns**: `BulkUpdateEndpointStatusResponse` with per-endpoint `results`.
72
928
 
73
- ```bash
74
- # Core library
75
- cargo check
76
- cargo test -p quicknode-sdk
929
+ ```typescript
930
+ // Node.js
931
+ const resp = await qn.admin.bulkUpdateEndpointStatus({
932
+ ids: ["ep-1", "ep-2"],
933
+ status: "paused",
934
+ });
935
+ ```
936
+
937
+ ##### `bulk_add_tag` / `bulkAddTag`
77
938
 
78
- # Python (from project root)
79
- just python-setup
80
- just python-build
939
+ Applies a tag (created if missing) to many endpoints at once.
81
940
 
82
- # Node.js (from npm/)
83
- just node-build
941
+ **Parameters**: `ids` (string[], required), `label` (string, required).
84
942
 
85
- # Ruby
86
- just ruby-build
943
+ **Returns**: `BulkAddTagResponse`.
87
944
 
88
- # Rust
89
- cargo build -p quicknode-sdk
945
+ ```typescript
946
+ // Node.js
947
+ const resp = await qn.admin.bulkAddTag({ ids: ["ep-1", "ep-2"], label: "prod" });
90
948
  ```
91
949
 
92
- ### Testing
950
+ ##### `bulk_remove_tag` / `bulkRemoveTag`
951
+
952
+ Removes a tag from many endpoints at once.
953
+
954
+ **Parameters**: `ids` (string[], required), `tag_id` (i32, required).
93
955
 
94
- ```bash
95
- just test
956
+ **Returns**: `BulkRemoveTagResponse`.
957
+
958
+ ```typescript
959
+ // Node.js
960
+ const resp = await qn.admin.bulkRemoveTag({ ids: ["ep-1", "ep-2"], tagId: 42 });
96
961
  ```
97
962
 
98
- Runs the Rust unit tests for `quicknode-sdk` using [wiremock](https://github.com/LukeMathWalker/wiremock-rs) to mock HTTP responses — no API key required.
963
+ #### Account Tags
99
964
 
100
- ### Examples
965
+ ##### `list_tags` / `listTags`
101
966
 
102
- ```bash
103
- # Rust
104
- QN_SDK__API_KEY=replaceme cargo run --example admin -p quicknode-sdk --features rust
967
+ Lists every tag on the account along with usage counts.
105
968
 
106
- # Python
107
- QN_SDK__API_KEY=replaceme uv run python/examples/admin.py
108
- QN_SDK__API_KEY=replaceme uv run python/examples/streams.py
969
+ **Parameters**: none.
109
970
 
110
- # Node.js
111
- cd npm && QN_SDK__API_KEY=replaceme npx tsx examples/admin.ts
112
- cd npm && QN_SDK__API_KEY=replaceme npx tsx examples/streams.ts
971
+ **Returns**: `ListTagsResponse` with `data.tags: AccountTag[]`.
113
972
 
114
- # Ruby (build first, then run)
115
- just ruby-build
116
- QN_SDK__API_KEY=replaceme ruby ruby/examples/admin.rb
117
- QN_SDK__API_KEY=replaceme ruby ruby/examples/admin_e2e.rb
118
- QN_SDK__API_KEY=replaceme ruby ruby/examples/streams.rb
973
+ ```typescript
974
+ // Node.js
975
+ const resp = await qn.admin.listTags();
119
976
  ```
120
977
 
121
- ### Releasing
978
+ ##### `rename_tag` / `renameTag`
979
+
980
+ Renames an account-level tag.
122
981
 
123
- All four packages (Rust crate, Python wheels, Node `.node` module, Ruby gem) ship together from a single project version. The release flow is split into two `just` commands:
982
+ **Parameters**: `tag_id` (i32, required); body: `label` (string, required).
124
983
 
125
- - **`just release-prepare <version>`** — bump versions, push, tag, build all Linux + macOS artifacts, attach them to a GitHub release. **No registry publish yet.**
126
- - **`just release-publish <version>`** — push to crates.io and trigger the PyPI / npm / RubyGems publish workflows.
984
+ **Returns**: `RenameTagResponse` with updated `AccountTag`.
127
985
 
128
- The pause between the two commands is the natural review point: inspect the GitHub release page and confirm all artifacts are present before anything goes public.
986
+ ```typescript
987
+ // Node.js
988
+ const resp = await qn.admin.renameTag(42, { label: "staging" });
989
+ ```
129
990
 
130
- Requires the [`gh` CLI](https://cli.github.com/) authenticated to the repo, an Apple Silicon Mac (macOS arm64 artifacts are built locally to avoid the ~10× CI runner cost), and `cargo login` with a crates.io token.
991
+ ##### `delete_account_tag` / `deleteAccountTag`
131
992
 
132
- #### Two-phase flow
993
+ Deletes a tag from the account. The tag must first be removed from any endpoints using it.
133
994
 
134
- ```bash
135
- # Phase 1: build a fully-staged GitHub release
136
- just release-prepare 0.2.0
995
+ **Parameters**: `id` (i32, required).
137
996
 
138
- # Inspect https://github.com/<org>/<repo>/releases/tag/v0.2.0
139
- # Confirm: Linux Python wheels, Linux .node files, Linux Ruby gem,
140
- # macOS arm64 wheels, index.darwin-arm64.node, arm64-darwin .gem.
997
+ **Returns**: `DeleteAccountTagResponse`.
141
998
 
142
- # Phase 2: publish to crates.io + trigger registry publish workflows
143
- just release-publish 0.2.0
999
+ ```typescript
1000
+ // Node.js
1001
+ await qn.admin.deleteAccountTag(42);
144
1002
  ```
145
1003
 
146
- `release-prepare` prompts twice — once up front before bumping, and once after the bump (showing the diff) before pushing the tag. `release-publish` prompts once before any registry write. Pass `yes=1` to skip prompts (e.g. for automation): `just release-prepare 0.2.0 yes=1`.
1004
+ ---
147
1005
 
148
- #### Building blocks
1006
+ ### Streams Client
149
1007
 
150
- If a phase fails partway, resume with the individual recipes they are also useful for reruns:
1008
+ Accessed as `qn.streams`. Creates and manages blockchain data streams that deliver filtered on-chain events to configured destinations. Backed by `https://api.quicknode.com/streams/rest/v1/`.
151
1009
 
152
- | Recipe | Purpose |
153
- |---|---|
154
- | `release-bump <version>` | Bump versions in all manifests, commit + tag locally |
155
- | `release-push <version>` | `git push` + push tag |
156
- | `release-create-tag <version>` | `gh release create` (triggers Linux CI build) |
157
- | `release-wait-ci <version>` | Block until `release.yml` finishes attaching Linux artifacts |
158
- | `macos-build-and-publish <version>` | Build macOS arm64 wheels / `.node` / `.gem` and `gh release upload` |
159
- | `release-cargo-publish-check` | `cargo publish -p quicknode-sdk --dry-run` |
160
- | `release-cargo-publish` | `cargo publish -p quicknode-sdk` |
161
- | `release-trigger-pypi <version>` | Dispatch `publish-pypi.yml` |
162
- | `release-trigger-npm <version> [npm_tag]` | Dispatch `publish-npm.yml` (default tag: `next`) |
163
- | `release-trigger-rubygems <version>` | Dispatch `publish-rubygems.yml` |
164
- | `release-trigger-all <version> [npm_tag]` | All three trigger recipes in sequence |
165
-
166
- #### Version conventions
167
-
168
- A single version argument drives every manifest, with two automatic translations applied by `release-bump`:
169
-
170
- | Manifest | Format example for `0.1.0-alpha.6` |
1010
+ #### Datasets, Regions, and Destinations
1011
+
1012
+ Enums used across stream methods:
1013
+
1014
+ - **`StreamRegion`**: `UsaEast`, `EuropeCentral`, `AsiaEast` (wire values: `usa_east`, `europe_central`, `asia_east`).
1015
+ - **`StreamDataset`**: `Block`, `BlockWithReceipts`, `Transactions`, `Logs`, `Receipts`, `TraceBlocks`, `DebugTraces`, `BlockWithReceiptsDebugTrace`, `BlockWithReceiptsTraceBlock`, `BlobSidecars`, `ProgramsWithLogs`, `Ledger`, `Events`, `Orders`, `Trades`, `BookUpdates`, `Twap`, `WriterActions`.
1016
+ - **`StreamStatus`**: `Active`, `Paused`, `Terminated`, `Completed`, `Blocked`.
1017
+ - **`FilterLanguage`**: `Javascript`, `Go`, `Wasm`.
1018
+ - **`StreamMetadataLocation`**: `Body`, `Header`, `None`.
1019
+
1020
+ Destinations are expressed via `DestinationAttributes`. Each variant wraps an attribute struct:
1021
+
1022
+ | Variant | Struct | Key fields |
1023
+ |---|---|---|
1024
+ | `Webhook` | `WebhookAttributes` | `url`, `max_retry`, `retry_interval_sec`, `post_timeout_sec`, `compression`, `security_token?` |
1025
+ | `S3` | `S3Attributes` | `endpoint`, `access_key`, `secret_key`, `bucket`, `object_prefix`, `compression`, `file_type`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
1026
+ | `Azure` | `AzureAttributes` | `storage_account`, `sas_token`, `container`, `compression`, `file_type`, `max_retry`, `retry_interval_sec`, `blob_prefix?` |
1027
+ | `Postgres` | `PostgresAttributes` | `host`, `port`, `username`, `password`, `database`, `schema`, `table`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
1028
+ | `Mysql` | `MysqlAttributes` | `host`, `port`, `username`, `password`, `database`, `table`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
1029
+ | `Mongo` | `MongoAttributes` | `connection_string`, `database`, `collection`, `max_retry`, `retry_interval_sec` |
1030
+ | `Clickhouse` | `ClickhouseAttributes` | `host`, `port`, `username`, `password`, `database`, `table`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
1031
+ | `Snowflake` | `SnowflakeAttributes` | `account`, `warehouse`, `database`, `schema`, `table`, `username`, `private_key`, `max_retry`, `retry_interval_sec` |
1032
+ | `Kafka` | `KafkaAttributes` | `bootstrap_servers`, `topic`, `compression`, `max_retry`, `retry_interval_sec` |
1033
+ | `Redis` | `RedisAttributes` | `host`, `port`, `username`, `password`, `key`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
1034
+
1035
+ Wrapper naming per language:
1036
+
1037
+ - **Rust**: `DestinationAttributes::Webhook(WebhookAttributes { .. })` etc.
1038
+ - **Python**: `StreamWebhookDestination(WebhookAttributes(...))`, `StreamS3Destination(S3Attributes(...))`, etc.
1039
+ - **Node.js**: a discriminated object `{ destination: "webhook", attributes: { ... } }` using string discriminators.
1040
+ - **Ruby**: factory methods on `QuicknodeSdk::DestinationAttributes`, e.g. `QuicknodeSdk::DestinationAttributes.webhook(url: ..., ...)`.
1041
+
1042
+ #### Streams methods
1043
+
1044
+ ##### `create_stream` / `createStream`
1045
+
1046
+ Creates a new stream that delivers filtered data to the configured destination. Start from a specific block for backfills or from the tip for real-time streaming. Supports filters, reorg handling, distance-from-tip, elastic batching, notification emails, and extra destinations.
1047
+
1048
+ **Parameters**: `CreateStreamParams` — required: `name`, `region`, `network`, `dataset`, `start_range` (i64), `end_range` (i64, `-1` = follow tip), `destination_attributes`, `plan`, `threshold_fetch_buffer`. Common optional fields: `dataset_batch_size`, `include_stream_metadata`, `fix_block_reorgs`, `keep_distance_from_tip`, `elastic_batch_enabled`, `filter_function`, `filter_language`, `status`, `notification_email`, `extra_destinations`.
1049
+
1050
+ **Returns**: `Stream`.
1051
+
1052
+ ```typescript
1053
+ // Node.js
1054
+ import { StreamDataset, StreamRegion, StreamStatus } from "quicknode-sdk";
1055
+
1056
+ const stream = await qn.streams.createStream({
1057
+ name: "My Stream",
1058
+ network: "ethereum-mainnet",
1059
+ dataset: StreamDataset.Block,
1060
+ region: StreamRegion.UsaEast,
1061
+ startRange: 24691804,
1062
+ endRange: 24691904,
1063
+ destinationAttributes: {
1064
+ destination: "webhook",
1065
+ attributes: {
1066
+ url: "https://webhook.site/...",
1067
+ maxRetry: 3,
1068
+ retryIntervalSec: 1,
1069
+ postTimeoutSec: 10,
1070
+ compression: "none",
1071
+ },
1072
+ },
1073
+ plan: "growth_plan",
1074
+ thresholdFetchBuffer: 1000,
1075
+ status: StreamStatus.Active,
1076
+ });
1077
+ ```
1078
+
1079
+ ##### `list_streams` / `listStreams`
1080
+
1081
+ Paginated list of streams on the account.
1082
+
1083
+ **Parameters** (all optional): `offset` (i64), `limit` (i64), `order_by` (string), `order_direction` (`"asc"` | `"desc"`), `stream_type` (string).
1084
+
1085
+ **Returns**: `ListStreamsResponse` with `data: Stream[]` and `page_info`.
1086
+
1087
+ ```typescript
1088
+ // Node.js
1089
+ const resp = await qn.streams.listStreams();
1090
+ ```
1091
+
1092
+ ##### `get_stream` / `getStream`
1093
+
1094
+ Fetches one stream by id.
1095
+
1096
+ **Parameters**: `id` (string, required).
1097
+
1098
+ **Returns**: `Stream`.
1099
+
1100
+ ```typescript
1101
+ // Node.js
1102
+ const stream = await qn.streams.getStream("stream-id");
1103
+ ```
1104
+
1105
+ ##### `update_stream` / `updateStream`
1106
+
1107
+ Partially updates a stream. Omitted fields are left unchanged.
1108
+
1109
+ **Parameters**: `id` (string, required); body: any field from `CreateStreamParams` (all optional).
1110
+
1111
+ **Returns**: updated `Stream`.
1112
+
1113
+ ```typescript
1114
+ // Node.js
1115
+ const stream = await qn.streams.updateStream("stream-id", { name: "Renamed" });
1116
+ ```
1117
+
1118
+ ##### `delete_stream` / `deleteStream`
1119
+
1120
+ Deletes one stream by id.
1121
+
1122
+ **Parameters**: `id` (string, required).
1123
+
1124
+ **Returns**: nothing.
1125
+
1126
+ ```typescript
1127
+ // Node.js
1128
+ await qn.streams.deleteStream("stream-id");
1129
+ ```
1130
+
1131
+ ##### `delete_all_streams` / `deleteAllStreams`
1132
+
1133
+ Deletes every stream on the account. Destructive and takes no arguments.
1134
+
1135
+ **Parameters**: none.
1136
+
1137
+ **Returns**: nothing.
1138
+
1139
+ ```typescript
1140
+ // Node.js
1141
+ await qn.streams.deleteAllStreams();
1142
+ ```
1143
+
1144
+ ##### `activate_stream` / `activateStream`
1145
+
1146
+ Resumes delivery on a stream from its current position.
1147
+
1148
+ **Parameters**: `id` (string, required).
1149
+
1150
+ **Returns**: nothing.
1151
+
1152
+ ```typescript
1153
+ // Node.js
1154
+ await qn.streams.activateStream("stream-id");
1155
+ ```
1156
+
1157
+ ##### `pause_stream` / `pauseStream`
1158
+
1159
+ Halts delivery on a stream.
1160
+
1161
+ **Parameters**: `id` (string, required).
1162
+
1163
+ **Returns**: nothing.
1164
+
1165
+ ```typescript
1166
+ // Node.js
1167
+ await qn.streams.pauseStream("stream-id");
1168
+ ```
1169
+
1170
+ ##### `test_filter` / `testFilter`
1171
+
1172
+ Runs a filter function against a block so it can be validated before being attached to a live stream.
1173
+
1174
+ **Parameters**: `network` (string, required), `dataset` (`StreamDataset`, required), `block` (string, required), `filter_function` (string, optional), `filter_language` (`FilterLanguage`, optional), `address_book_config` (optional).
1175
+
1176
+ **Returns**: `TestFilterResponse` with `result` and `logs`.
1177
+
1178
+ ```typescript
1179
+ // Node.js
1180
+ import { StreamDataset } from "quicknode-sdk";
1181
+
1182
+ const resp = await qn.streams.testFilter({
1183
+ network: "ethereum-mainnet",
1184
+ dataset: StreamDataset.Block,
1185
+ block: "17811625",
1186
+ });
1187
+ ```
1188
+
1189
+ ##### `get_enabled_count` / `getEnabledCount`
1190
+
1191
+ Counts currently enabled (active) streams, optionally filtered by type.
1192
+
1193
+ **Parameters**: `stream_type` (string, optional).
1194
+
1195
+ **Returns**: `EnabledCountResponse` with `total`.
1196
+
1197
+ ```typescript
1198
+ // Node.js
1199
+ const resp = await qn.streams.getEnabledCount();
1200
+ ```
1201
+
1202
+ ---
1203
+
1204
+ ### Webhooks Client
1205
+
1206
+ Accessed as `qn.webhooks`. Creates webhooks from filter templates and manages their lifecycle. Backed by `https://api.quicknode.com/webhooks/rest/v1/`.
1207
+
1208
+ #### Templates and destination
1209
+
1210
+ `WebhookTemplateId` identifies the filter template:
1211
+
1212
+ | Variant | Wire value |
171
1213
  |---|---|
172
- | `Cargo.toml` (workspace) | `0.1.0-alpha.6` |
173
- | `crates/core/Cargo.toml` | `0.1.0-alpha.6` |
174
- | `pyproject.toml` (PEP 440) | `0.1.0a6` |
175
- | `ruby/quicknode_sdk.gemspec` | `0.1.0-alpha.6` |
176
- | `npm/package.json` | `3.0.0-alpha.6` (`0.x` → `3.x` because `@quicknode/sdk` 2.x already exists on npm) |
177
-
178
- Pre-release identifiers use SemVer 2.0 syntax: `MAJOR.MINOR.PATCH-<id>.<N>` — e.g. `0.1.0-alpha.4`, `0.2.0-beta.1`, `0.2.0-rc.1`. The npm pre-release period uses the `next` dist-tag so `npm install @quicknode/sdk` continues to resolve to legacy 2.x while `npm install @quicknode/sdk@next` pulls the rewrite.
179
-
180
- `release-bump` only accepts versions starting with `0.`. The `0.x → 3.x` mapping (and the recipe's guard) needs to be revisited when the project graduates to `1.0`.
181
-
182
- #### First-time setup
183
-
184
- - The first crates.io publish claims the `quicknode-sdk` name permanently. Published versions are immutable (only `cargo yank` is reversible, and it only hides).
185
- - The first PyPI upload needs a user-scoped `PYPI_API_TOKEN`; rotate to a project-scoped token after.
186
- - Verify a release reached each registry:
187
- ```bash
188
- cargo search quicknode-sdk
189
- pip install quicknode-sdk==0.1.0a6
190
- npm view @quicknode/sdk dist-tags
191
- gem search -e quicknode_sdk
192
- ```
1214
+ | `EvmWalletFilter` | `evmWalletFilter` |
1215
+ | `EvmContractEvents` | `evmContractEvents` |
1216
+ | `EvmAbiFilter` | `evmAbiFilter` |
1217
+ | `SolanaWalletFilter` | `solanaWalletFilter` |
1218
+ | `BitcoinWalletFilter` | `bitcoinWalletFilter` |
1219
+ | `XrplWalletFilter` | `xrplWalletFilter` |
1220
+ | `HyperliquidWalletEventsFilter` | `hyperliquidWalletEventsFilter` |
1221
+ | `StellarWalletTransactionsSourceAccountFilter` | `stellarWalletTransactionsSourceAccountFilter` |
1222
+
1223
+ `TemplateArgs` carries the arguments; construct one per template via the factory methods:
1224
+
1225
+ | Factory | Argument struct | Fields |
1226
+ |---|---|---|
1227
+ | `evm_wallet_filter` | `EvmWalletFilterTemplate` | `wallets: string[]` |
1228
+ | `evm_contract_events` | `EvmContractEventsTemplate` | `contracts: string[]`, `event_hashes?: string[]` |
1229
+ | `evm_abi_filter` | `EvmAbiFilterTemplate` | `abi: string` (JSON), `contracts: string[]` |
1230
+ | `solana_wallet_filter` | `SolanaWalletFilterTemplate` | `accounts: string[]` |
1231
+ | `bitcoin_wallet_filter` | `BitcoinWalletFilterTemplate` | `wallets: string[]` |
1232
+ | `xrpl_wallet_filter` | `XrplWalletFilterTemplate` | `wallets: string[]` |
1233
+ | `hyperliquid_wallet_events_filter` | `HyperliquidWalletEventsFilterTemplate` | `wallets: string[]` |
1234
+ | `stellar_wallet_transactions_filter` | `StellarWalletTransactionsFilterTemplate` | `source_accounts: string[]` |
1235
+
1236
+ `WebhookDestinationAttributes`: `url` (required), `security_token` (optional — auto-generated if omitted), `compression` (optional — `"none"` | `"gzip"`).
1237
+
1238
+ `WebhookStartFrom`: `Last` (resume from last delivered block) or `Latest` (start from newest).
1239
+
1240
+ In Ruby, `template_args` is passed as a JSON string under the key `template_args_json`; destination is passed as a JSON string under `destination_attributes_json`.
1241
+
1242
+ #### Webhooks methods
1243
+
1244
+ ##### `list_webhooks` / `listWebhooks`
1245
+
1246
+ Paginated list of webhooks.
1247
+
1248
+ **Parameters** (all optional): `limit` (i64), `offset` (i64).
1249
+
1250
+ **Returns**: `ListWebhooksResponse` with `data: Webhook[]` and `pageInfo: WebhookPageInfo { limit, offset, total }`.
1251
+
1252
+ ```typescript
1253
+ // Node.js
1254
+ const resp = await qn.webhooks.listWebhooks();
1255
+ ```
1256
+
1257
+ ##### `get_webhook` / `getWebhook`
1258
+
1259
+ Fetches a webhook by id.
1260
+
1261
+ **Parameters**: `id` (string, required).
1262
+
1263
+ **Returns**: `Webhook`.
1264
+
1265
+ ```typescript
1266
+ // Node.js
1267
+ const webhook = await qn.webhooks.getWebhook("wh-1");
1268
+ ```
1269
+
1270
+ ##### `create_webhook_from_template` / `createWebhookFromTemplate`
1271
+
1272
+ Creates a webhook from a predefined filter template.
1273
+
1274
+ **Parameters**: `name` (required), `network` (required), `destination_attributes` (`WebhookDestinationAttributes`, required), `template_args` (required — use the `TemplateArgs` enum variant for the chosen template), `notification_email` (optional).
1275
+
1276
+ **Returns**: `Webhook`.
1277
+
1278
+ ```typescript
1279
+ // Node.js
1280
+ import { TemplateArgs } from "quicknode-sdk";
1281
+
1282
+ const webhook = await qn.webhooks.createWebhookFromTemplate({
1283
+ name: "Wallet Webhook",
1284
+ network: "ethereum-mainnet",
1285
+ destinationAttributes: { url: "https://webhook.site/..." },
1286
+ templateArgs: TemplateArgs.evmWalletFilter({
1287
+ wallets: ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
1288
+ }),
1289
+ });
1290
+ ```
1291
+
1292
+ ##### `update_webhook` / `updateWebhook`
1293
+
1294
+ Partially updates a webhook's name, notification email, and/or destination. If `destination_attributes` is supplied without `security_token`, a new token is generated automatically.
1295
+
1296
+ **Parameters**: `id` (required); body — all optional: `name`, `notification_email`, `destination_attributes`. In Ruby, `destination_attributes` is passed as a JSON string under the key `destination_attributes_json`.
1297
+
1298
+ **Returns**: updated `Webhook`.
1299
+
1300
+ ```typescript
1301
+ // Node.js
1302
+ const webhook = await qn.webhooks.updateWebhook("wh-1", { name: "Renamed Webhook" });
1303
+ ```
1304
+
1305
+ ##### `update_webhook_template` / `updateWebhookTemplate`
1306
+
1307
+ Updates the template args (and optionally name, email, destination) on an existing template-backed webhook.
1308
+
1309
+ **Parameters**: `webhook_id` (required), `template_args` (required); optional: `name`, `notification_email`, `destination_attributes`.
1310
+
1311
+ **Returns**: updated `Webhook`.
1312
+
1313
+ ```typescript
1314
+ // Node.js
1315
+ const webhook = await qn.webhooks.updateWebhookTemplate("wh-1", {
1316
+ templateArgs: TemplateArgs.evmWalletFilter({ wallets: ["0xnewwallet"] }),
1317
+ });
1318
+ ```
1319
+
1320
+ ##### `delete_webhook` / `deleteWebhook`
1321
+
1322
+ Deletes a webhook.
1323
+
1324
+ **Parameters**: `id` (required).
1325
+
1326
+ **Returns**: nothing.
1327
+
1328
+ ```typescript
1329
+ // Node.js
1330
+ await qn.webhooks.deleteWebhook("wh-1");
1331
+ ```
1332
+
1333
+ ##### `delete_all_webhooks` / `deleteAllWebhooks`
1334
+
1335
+ Deletes every webhook on the account. Destructive and takes no arguments.
1336
+
1337
+ **Parameters**: none.
1338
+
1339
+ **Returns**: nothing.
1340
+
1341
+ ```typescript
1342
+ // Node.js
1343
+ await qn.webhooks.deleteAllWebhooks();
1344
+ ```
1345
+
1346
+ ##### `pause_webhook` / `pauseWebhook`
1347
+
1348
+ Pauses a webhook so it stops delivering events.
1349
+
1350
+ **Parameters**: `id` (required).
1351
+
1352
+ **Returns**: nothing.
1353
+
1354
+ ```typescript
1355
+ // Node.js
1356
+ await qn.webhooks.pauseWebhook("wh-1");
1357
+ ```
1358
+
1359
+ ##### `activate_webhook` / `activateWebhook`
1360
+
1361
+ Activates a paused or new webhook so it resumes delivering events. `start_from` determines where processing resumes.
1362
+
1363
+ **Parameters**: `id` (required), `start_from` (`WebhookStartFrom`, required — `Last` or `Latest`).
1364
+
1365
+ **Returns**: nothing.
1366
+
1367
+ ```typescript
1368
+ // Node.js
1369
+ import { WebhookStartFrom } from "quicknode-sdk";
1370
+
1371
+ await qn.webhooks.activateWebhook("wh-1", { startFrom: WebhookStartFrom.Latest });
1372
+ ```
1373
+
1374
+ ##### `get_enabled_count` / `getEnabledCount`
1375
+
1376
+ Counts currently enabled webhooks.
1377
+
1378
+ **Parameters**: none.
1379
+
1380
+ **Returns**: `WebhookEnabledCountResponse` with `total`.
1381
+
1382
+ ```typescript
1383
+ // Node.js
1384
+ const resp = await qn.webhooks.getEnabledCount();
1385
+ ```
1386
+
1387
+ ---
1388
+
1389
+ ### KV Store Client
1390
+
1391
+ Accessed as `qn.kvstore`. Provides two primitives — **sets** (single string values under a key) and **lists** (ordered collections of strings under a key). Backed by `https://api.quicknode.com/kv/rest/v1/`.
1392
+
1393
+ #### Sets
1394
+
1395
+ ##### `create_set` / `createSet`
1396
+
1397
+ Stores a single string value under a key.
1398
+
1399
+ **Parameters**: `key` (string, required), `value` (string, required).
1400
+
1401
+ **Returns**: nothing.
1402
+
1403
+ ```typescript
1404
+ // Node.js
1405
+ await qn.kvstore.createSet({ key: "my-key", value: "hello" });
1406
+ ```
1407
+
1408
+ ##### `get_sets` / `getSets`
1409
+
1410
+ Paginated page of key/value entries.
1411
+
1412
+ **Parameters** (all optional): `limit` (i64), `cursor` (string).
1413
+
1414
+ **Returns**: `GetSetsResponse` — `{ data: KvSetEntry[], cursor: string }`.
1415
+
1416
+ ```typescript
1417
+ // Node.js
1418
+ const resp = await qn.kvstore.getSets();
1419
+ ```
1420
+
1421
+ ##### `get_set` / `getSet`
1422
+
1423
+ Returns the value stored under a key.
1424
+
1425
+ **Parameters**: `key` (string, required).
1426
+
1427
+ **Returns**: `GetSetResponse` with `value`.
1428
+
1429
+ ```typescript
1430
+ // Node.js
1431
+ const resp = await qn.kvstore.getSet("my-key");
1432
+ ```
1433
+
1434
+ ##### `bulk_sets` / `bulkSets`
1435
+
1436
+ Adds and/or deletes multiple sets in a single request.
1437
+
1438
+ **Parameters** (at least one required): `add_sets` (map<string,string>, optional), `delete_sets` (string[], optional).
1439
+
1440
+ **Returns**: nothing.
1441
+
1442
+ ```typescript
1443
+ // Node.js
1444
+ await qn.kvstore.bulkSets({
1445
+ addSets: { k1: "v1" },
1446
+ deleteSets: ["old-key"],
1447
+ });
1448
+ ```
1449
+
1450
+ ##### `delete_set` / `deleteSet`
1451
+
1452
+ Deletes a single set.
1453
+
1454
+ **Parameters**: `key` (string, required).
1455
+
1456
+ **Returns**: nothing.
1457
+
1458
+ ```typescript
1459
+ // Node.js
1460
+ await qn.kvstore.deleteSet("my-key");
1461
+ ```
1462
+
1463
+ #### Lists
1464
+
1465
+ ##### `create_list` / `createList`
1466
+
1467
+ Creates a list under a key, seeded with the initial items.
1468
+
1469
+ **Parameters**: `key` (string, required), `items` (string[], required).
1470
+
1471
+ **Returns**: nothing.
1472
+
1473
+ ```typescript
1474
+ // Node.js
1475
+ await qn.kvstore.createList({ key: "my-list", items: ["0xabc", "0xdef"] });
1476
+ ```
1477
+
1478
+ ##### `get_lists` / `getLists`
1479
+
1480
+ Paginated page of list keys.
1481
+
1482
+ **Parameters** (all optional): `limit` (i64), `cursor` (string).
1483
+
1484
+ **Returns**: `GetListsResponse` — `{ data: { keys: string[] }, cursor: string }`.
1485
+
1486
+ ```typescript
1487
+ // Node.js
1488
+ const resp = await qn.kvstore.getLists();
1489
+ ```
1490
+
1491
+ ##### `get_list` / `getList`
1492
+
1493
+ Paginated page of items for a specific list.
1494
+
1495
+ **Parameters**: `key` (string, required); optional `limit` (i64), `cursor` (string).
1496
+
1497
+ **Returns**: `GetListResponse` — `{ data: { items: string[] }, cursor: string }`.
1498
+
1499
+ ```typescript
1500
+ // Node.js
1501
+ const resp = await qn.kvstore.getList("my-list");
1502
+ ```
1503
+
1504
+ ##### `update_list` / `updateList`
1505
+
1506
+ Adds and/or removes items in a single operation.
1507
+
1508
+ **Parameters**: `key` (string, required); optional: `add_items` (string[]), `remove_items` (string[]).
1509
+
1510
+ **Returns**: nothing.
1511
+
1512
+ ```typescript
1513
+ // Node.js
1514
+ await qn.kvstore.updateList("my-list", {
1515
+ addItems: ["0x456"],
1516
+ removeItems: ["0xabc"],
1517
+ });
1518
+ ```
1519
+
1520
+ ##### `add_list_item` / `addListItem`
1521
+
1522
+ Appends a single item to a list.
1523
+
1524
+ **Parameters**: `key` (string, required), `item` (string, required).
1525
+
1526
+ **Returns**: nothing.
1527
+
1528
+ ```typescript
1529
+ // Node.js
1530
+ await qn.kvstore.addListItem("my-list", { item: "0x123" });
1531
+ ```
1532
+
1533
+ ##### `list_contains_item` / `listContainsItem`
1534
+
1535
+ Checks whether a list contains a specific item.
1536
+
1537
+ **Parameters**: `key` (string, required), `item` (string, required).
1538
+
1539
+ **Returns**: `ListContainsItemResponse` with `exists: bool`.
1540
+
1541
+ ```typescript
1542
+ // Node.js
1543
+ const resp = await qn.kvstore.listContainsItem("my-list", "0x123");
1544
+ ```
1545
+
1546
+ ##### `delete_list_item` / `deleteListItem`
1547
+
1548
+ Removes a single item from a list.
1549
+
1550
+ **Parameters**: `key` (string, required), `item` (string, required).
1551
+
1552
+ **Returns**: nothing.
1553
+
1554
+ ```typescript
1555
+ // Node.js
1556
+ await qn.kvstore.deleteListItem("my-list", "0x123");
1557
+ ```
1558
+
1559
+ ##### `delete_list` / `deleteList`
1560
+
1561
+ Deletes a list and all of its items.
1562
+
1563
+ **Parameters**: `key` (string, required).
1564
+
1565
+ **Returns**: nothing.
1566
+
1567
+ ```typescript
1568
+ // Node.js
1569
+ await qn.kvstore.deleteList("my-list");
1570
+ ```
1571
+
1572
+ ## Error Handling
1573
+
1574
+ Every binding exposes a typed exception hierarchy derived from the core `SdkError`
1575
+ enum (`crates/core/src/errors.rs`). Catch the base class (`QuicknodeError`) for any SDK-originated failure, or a specific
1576
+ subclass to branch on transport vs. API semantics.
1577
+
1578
+ | Logical class | When it fires | Extra fields |
1579
+ |----------------------|-------------------------------------------------------------|----------------------|
1580
+ | `QuicknodeError` | base class; catches everything below | — |
1581
+ | `ConfigError` | invalid config or URL surfaced at construction time | — |
1582
+ | `HttpError` | transport failure that isn't a timeout/connect | — |
1583
+ | `TimeoutError` | request timed out (subclass of `HttpError`) | — |
1584
+ | `ConnectionError` | connection refused / DNS / TLS (subclass of `HttpError`) | — |
1585
+ | `ApiError` | non-2xx HTTP response | `status`, `body` |
1586
+ | `DecodeError` | 2xx response but JSON parse failed | `body` |
1587
+
1588
+ Class names: Importable from `@quicknode/sdk`: `QuicknodeError`, `ConfigError`, `HttpError`, `TimeoutError`, `ConnectionError`, `ApiError`, `DecodeError`. All extend `Error`.
1589
+
1590
+ ```typescript
1591
+ // Node.js
1592
+ import { ApiError, TimeoutError } from "@quicknode/sdk";
1593
+ try {
1594
+ await qn.admin.showEndpoint("missing");
1595
+ } catch (e) {
1596
+ if (e instanceof ApiError && e.status === 404) console.error("not found:", e.body);
1597
+ else if (e instanceof TimeoutError) console.error("timed out");
1598
+ else throw e;
1599
+ }
1600
+ ```
193
1601
 
194
1602
  ## License
195
1603