quicknode_sdk 0.1.0.pre.alpha.26 → 0.1.0

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