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