@quicknode/sdk 3.0.0-alpha.6 → 3.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -3351
- package/errors.js +7 -7
- package/index.d.ts +33 -45
- package/index.darwin-arm64.node +0 -0
- package/index.js +2 -2
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-arm64-musl.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.linux-x64-musl.node +0 -0
- package/package.json +7 -6
- package/sdk.d.ts +76 -26
- package/sdk.js +20 -34
- package/sdk.mjs +2 -2
package/errors.js
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
// message is tagged "[<kind>|<status>|<body_len>]<msg>\x1f<body>"; parseAndRethrow
|
|
3
3
|
// decodes that and throws an instance of the matching subclass below.
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class QuicknodeError extends Error {
|
|
6
6
|
constructor(message) {
|
|
7
7
|
super(message);
|
|
8
|
-
this.name = "
|
|
8
|
+
this.name = "QuicknodeError";
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
class ConfigError extends
|
|
12
|
+
class ConfigError extends QuicknodeError {
|
|
13
13
|
constructor(message) {
|
|
14
14
|
super(message);
|
|
15
15
|
this.name = "ConfigError";
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
class HttpError extends
|
|
19
|
+
class HttpError extends QuicknodeError {
|
|
20
20
|
constructor(message) {
|
|
21
21
|
super(message);
|
|
22
22
|
this.name = "HttpError";
|
|
@@ -37,7 +37,7 @@ class ConnectionError extends HttpError {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
class ApiError extends
|
|
40
|
+
class ApiError extends QuicknodeError {
|
|
41
41
|
constructor(message, status, body) {
|
|
42
42
|
super(message);
|
|
43
43
|
this.name = "ApiError";
|
|
@@ -46,7 +46,7 @@ class ApiError extends QuickNodeError {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
class DecodeError extends
|
|
49
|
+
class DecodeError extends QuicknodeError {
|
|
50
50
|
constructor(message, body) {
|
|
51
51
|
super(message);
|
|
52
52
|
this.name = "DecodeError";
|
|
@@ -109,7 +109,7 @@ function wrapClient(client) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
module.exports = {
|
|
112
|
-
|
|
112
|
+
QuicknodeError,
|
|
113
113
|
ConfigError,
|
|
114
114
|
HttpError,
|
|
115
115
|
TimeoutError,
|
package/index.d.ts
CHANGED
|
@@ -172,7 +172,7 @@ export interface ChainNetwork {
|
|
|
172
172
|
/** Numeric chain id, when applicable. */
|
|
173
173
|
chainId?: number
|
|
174
174
|
}
|
|
175
|
-
/** A blockchain supported by
|
|
175
|
+
/** A blockchain supported by Quicknode along with its networks. */
|
|
176
176
|
export interface Chain {
|
|
177
177
|
/** Chain slug (e.g. `ethereum`). */
|
|
178
178
|
slug: string
|
|
@@ -362,7 +362,7 @@ export interface CreateIpRequest {
|
|
|
362
362
|
}
|
|
363
363
|
/** Parameters for `create_domain_mask`. */
|
|
364
364
|
export interface CreateDomainMaskRequest {
|
|
365
|
-
/** Custom domain that will mask the endpoint's
|
|
365
|
+
/** Custom domain that will mask the endpoint's Quicknode URL. */
|
|
366
366
|
domainMask?: string
|
|
367
367
|
}
|
|
368
368
|
/** Parameters for `create_jwt`. */
|
|
@@ -469,7 +469,7 @@ export interface Pagination {
|
|
|
469
469
|
export interface Endpoint {
|
|
470
470
|
/** Unique endpoint identifier. */
|
|
471
471
|
id: string
|
|
472
|
-
/**
|
|
472
|
+
/** Quicknode-assigned subdomain. */
|
|
473
473
|
name: string
|
|
474
474
|
/** Human-readable label. */
|
|
475
475
|
label?: string
|
|
@@ -1638,18 +1638,6 @@ export interface StellarWalletTransactionsFilterTemplate {
|
|
|
1638
1638
|
/** Stellar wallet addresses to match against. */
|
|
1639
1639
|
wallets: Array<string>
|
|
1640
1640
|
}
|
|
1641
|
-
/**
|
|
1642
|
-
* Template identifier paired with its arguments, consumed by
|
|
1643
|
-
* `create_webhook_from_template` and `update_webhook_template`. Construct via
|
|
1644
|
-
* the typed static factory methods (one per template); do not set fields
|
|
1645
|
-
* directly.
|
|
1646
|
-
*/
|
|
1647
|
-
export interface TemplateArgs {
|
|
1648
|
-
/** Which filter template these arguments correspond to. */
|
|
1649
|
-
templateId: WebhookTemplateId
|
|
1650
|
-
/** Template arguments, pre-serialized as a JSON string. */
|
|
1651
|
-
value: string
|
|
1652
|
-
}
|
|
1653
1641
|
/** Destination configuration for a webhook. */
|
|
1654
1642
|
export interface WebhookDestinationAttributes {
|
|
1655
1643
|
/** Target URL that receives webhook payloads. */
|
|
@@ -1683,30 +1671,6 @@ export interface ActivateWebhookParams {
|
|
|
1683
1671
|
/** Position to begin (or resume) delivery from. */
|
|
1684
1672
|
startFrom: WebhookStartFrom
|
|
1685
1673
|
}
|
|
1686
|
-
/** Parameters for `create_webhook_from_template`. */
|
|
1687
|
-
export interface CreateWebhookFromTemplateParams {
|
|
1688
|
-
/** Human-readable label for the webhook. */
|
|
1689
|
-
name: string
|
|
1690
|
-
/** Blockchain network to watch (e.g. `ethereum-mainnet`). */
|
|
1691
|
-
network: string
|
|
1692
|
-
/** Optional email that receives alerts if the webhook terminates. */
|
|
1693
|
-
notificationEmail?: string
|
|
1694
|
-
/** Destination configuration for delivered payloads. */
|
|
1695
|
-
destinationAttributes: WebhookDestinationAttributes
|
|
1696
|
-
/** Filter template identifier and its arguments. */
|
|
1697
|
-
templateArgs: TemplateArgs
|
|
1698
|
-
}
|
|
1699
|
-
/** Parameters for `update_webhook_template`. */
|
|
1700
|
-
export interface UpdateWebhookTemplateParams {
|
|
1701
|
-
/** New human-readable name. */
|
|
1702
|
-
name?: string
|
|
1703
|
-
/** New notification email. */
|
|
1704
|
-
notificationEmail?: string
|
|
1705
|
-
/** New destination configuration. */
|
|
1706
|
-
destinationAttributes?: WebhookDestinationAttributes
|
|
1707
|
-
/** New template identifier and arguments. */
|
|
1708
|
-
templateArgs: TemplateArgs
|
|
1709
|
-
}
|
|
1710
1674
|
/** A webhook's full configuration and current state. */
|
|
1711
1675
|
export interface Webhook {
|
|
1712
1676
|
/** Unique webhook identifier. */
|
|
@@ -1728,10 +1692,21 @@ export interface Webhook {
|
|
|
1728
1692
|
/** Destination-specific configuration as a JSON string. */
|
|
1729
1693
|
destinationAttributes?: string
|
|
1730
1694
|
}
|
|
1695
|
+
/** Pagination metadata returned alongside a paginated webhooks list. */
|
|
1696
|
+
export interface WebhookPageInfo {
|
|
1697
|
+
/** Page size used for this response. */
|
|
1698
|
+
limit: number
|
|
1699
|
+
/** Starting index of this page within the full result set. */
|
|
1700
|
+
offset: number
|
|
1701
|
+
/** Total number of webhooks matching the query across all pages. */
|
|
1702
|
+
total: number
|
|
1703
|
+
}
|
|
1731
1704
|
/** Response from `list_webhooks`. */
|
|
1732
1705
|
export interface ListWebhooksResponse {
|
|
1733
1706
|
/** Webhooks on the current page. */
|
|
1734
1707
|
data: Array<Webhook>
|
|
1708
|
+
/** Pagination metadata for the response. */
|
|
1709
|
+
pageInfo: WebhookPageInfo
|
|
1735
1710
|
}
|
|
1736
1711
|
/** Response from `get_enabled_count` for webhooks. */
|
|
1737
1712
|
export interface WebhookEnabledCountResponse {
|
|
@@ -1830,7 +1805,20 @@ export interface ListStreamsResponseNode {
|
|
|
1830
1805
|
data: Array<StreamNode>
|
|
1831
1806
|
pageInfo: PageInfo
|
|
1832
1807
|
}
|
|
1833
|
-
export
|
|
1808
|
+
export interface CreateWebhookFromTemplateParamsNode {
|
|
1809
|
+
name: string
|
|
1810
|
+
network: string
|
|
1811
|
+
notificationEmail?: string
|
|
1812
|
+
destinationAttributes: WebhookDestinationAttributes
|
|
1813
|
+
templateArgs: any
|
|
1814
|
+
}
|
|
1815
|
+
export interface UpdateWebhookTemplateParamsNode {
|
|
1816
|
+
name?: string
|
|
1817
|
+
notificationEmail?: string
|
|
1818
|
+
destinationAttributes?: WebhookDestinationAttributes
|
|
1819
|
+
templateArgs: any
|
|
1820
|
+
}
|
|
1821
|
+
export declare class QuicknodeSdk {
|
|
1834
1822
|
/** Creates a new SDK instance from an explicit configuration. */
|
|
1835
1823
|
constructor(config: SdkFullConfig)
|
|
1836
1824
|
/** Returns the admin sub-client. */
|
|
@@ -1842,7 +1830,7 @@ export declare class QuickNodeSdk {
|
|
|
1842
1830
|
/** Returns the kvstore sub-client. */
|
|
1843
1831
|
get kvstore(): KvStoreApiClient
|
|
1844
1832
|
/** Creates a new SDK instance using configuration from environment variables. */
|
|
1845
|
-
static fromEnv():
|
|
1833
|
+
static fromEnv(): QuicknodeSdk
|
|
1846
1834
|
}
|
|
1847
1835
|
export declare class AdminApiClient {
|
|
1848
1836
|
/**
|
|
@@ -1949,7 +1937,7 @@ export declare class AdminApiClient {
|
|
|
1949
1937
|
deleteIp(id: string, ipId: string): Promise<DeleteBoolResponse>
|
|
1950
1938
|
/**
|
|
1951
1939
|
* Adds a domain mask to an endpoint — a custom domain used to hide the
|
|
1952
|
-
* endpoint's
|
|
1940
|
+
* endpoint's Quicknode URL so requests can be routed through your own
|
|
1953
1941
|
* domain.
|
|
1954
1942
|
*/
|
|
1955
1943
|
createDomainMask(id: string, params?: CreateDomainMaskRequest | undefined | null): Promise<void>
|
|
@@ -2034,7 +2022,7 @@ export declare class AdminApiClient {
|
|
|
2034
2022
|
*/
|
|
2035
2023
|
getAccountMetrics(params: GetAccountMetricsRequest): Promise<GetAccountMetricsResponse>
|
|
2036
2024
|
/**
|
|
2037
|
-
* Returns all chains supported by
|
|
2025
|
+
* Returns all chains supported by Quicknode along with their networks.
|
|
2038
2026
|
* Each entry includes the chain slug and its network slugs and names.
|
|
2039
2027
|
*/
|
|
2040
2028
|
listChains(): Promise<ListChainsResponse>
|
|
@@ -2250,7 +2238,7 @@ export declare class WebhooksApiClient {
|
|
|
2250
2238
|
* filters. An optional `notification_email` receives alerts if the
|
|
2251
2239
|
* webhook terminates.
|
|
2252
2240
|
*/
|
|
2253
|
-
createWebhookFromTemplate(params:
|
|
2241
|
+
createWebhookFromTemplate(params: CreateWebhookFromTemplateParamsNode): Promise<Webhook>
|
|
2254
2242
|
/**
|
|
2255
2243
|
* Updates an existing template-backed webhook, modifying its template
|
|
2256
2244
|
* arguments and optionally its name, notification email, and destination
|
|
@@ -2259,7 +2247,7 @@ export declare class WebhooksApiClient {
|
|
|
2259
2247
|
* generated automatically if not provided. Templates cover EVM chains,
|
|
2260
2248
|
* Solana, Bitcoin, XRPL, Hyperliquid, and Stellar.
|
|
2261
2249
|
*/
|
|
2262
|
-
updateWebhookTemplate(webhookId: string, params:
|
|
2250
|
+
updateWebhookTemplate(webhookId: string, params: UpdateWebhookTemplateParamsNode): Promise<Webhook>
|
|
2263
2251
|
}
|
|
2264
2252
|
export declare class KvStoreApiClient {
|
|
2265
2253
|
/** Creates a new set, storing a single string value under the given key. */
|
package/index.darwin-arm64.node
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -310,7 +310,7 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { StreamRegion, StreamDataset, StreamDestination, FilterLanguage, StreamMetadataLocation, ProductType, StreamStatus, WebhookTemplateId, WebhookStartFrom,
|
|
313
|
+
const { StreamRegion, StreamDataset, StreamDestination, FilterLanguage, StreamMetadataLocation, ProductType, StreamStatus, WebhookTemplateId, WebhookStartFrom, QuicknodeSdk, AdminApiClient, StreamsApiClient, WebhooksApiClient, KvStoreApiClient } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.StreamRegion = StreamRegion
|
|
316
316
|
module.exports.StreamDataset = StreamDataset
|
|
@@ -321,7 +321,7 @@ module.exports.ProductType = ProductType
|
|
|
321
321
|
module.exports.StreamStatus = StreamStatus
|
|
322
322
|
module.exports.WebhookTemplateId = WebhookTemplateId
|
|
323
323
|
module.exports.WebhookStartFrom = WebhookStartFrom
|
|
324
|
-
module.exports.
|
|
324
|
+
module.exports.QuicknodeSdk = QuicknodeSdk
|
|
325
325
|
module.exports.AdminApiClient = AdminApiClient
|
|
326
326
|
module.exports.StreamsApiClient = StreamsApiClient
|
|
327
327
|
module.exports.WebhooksApiClient = WebhooksApiClient
|
|
Binary file
|
|
Binary file
|
package/index.linux-x64-gnu.node
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicknode/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0-alpha.14",
|
|
4
4
|
"description": "Quicknode SDK",
|
|
5
5
|
"main": "sdk.js",
|
|
6
6
|
"types": "sdk.d.ts",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"sdk.mjs",
|
|
21
21
|
"errors.js",
|
|
22
22
|
"browser.js",
|
|
23
|
+
"README.md",
|
|
23
24
|
"*.node"
|
|
24
25
|
],
|
|
25
26
|
"napi": {
|
|
@@ -45,10 +46,10 @@
|
|
|
45
46
|
},
|
|
46
47
|
"license": "MIT",
|
|
47
48
|
"optionalDependencies": {
|
|
48
|
-
"@quicknode/sdk-linux-x64-gnu": "3.
|
|
49
|
-
"@quicknode/sdk-linux-arm64-gnu": "3.
|
|
50
|
-
"@quicknode/sdk-linux-x64-musl": "3.
|
|
51
|
-
"@quicknode/sdk-linux-arm64-musl": "3.
|
|
52
|
-
"@quicknode/sdk-darwin-arm64": "3.
|
|
49
|
+
"@quicknode/sdk-linux-x64-gnu": "3.1.0-alpha.14",
|
|
50
|
+
"@quicknode/sdk-linux-arm64-gnu": "3.1.0-alpha.14",
|
|
51
|
+
"@quicknode/sdk-linux-x64-musl": "3.1.0-alpha.14",
|
|
52
|
+
"@quicknode/sdk-linux-arm64-musl": "3.1.0-alpha.14",
|
|
53
|
+
"@quicknode/sdk-darwin-arm64": "3.1.0-alpha.14"
|
|
53
54
|
}
|
|
54
55
|
}
|
package/sdk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// sdk.d.ts
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
QuicknodeSdk as _QuicknodeSdk,
|
|
4
4
|
SdkFullConfig,
|
|
5
5
|
WebhookAttributes,
|
|
6
6
|
S3Attributes,
|
|
@@ -72,6 +72,36 @@ export type ListStreamsResponse = Omit<_ListStreamsResponseNode, "data"> & {
|
|
|
72
72
|
data: Stream[];
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
// Webhook template args (input). The inner key is `args` rather than the
|
|
76
|
+
// wire's `templateArgs` to avoid `templateArgs.templateArgs.wallets`; the
|
|
77
|
+
// Node binding renames it back before the request.
|
|
78
|
+
export type TemplateArgsInput =
|
|
79
|
+
| { templateId: "evmWalletFilter"; args: EvmWalletFilterTemplate }
|
|
80
|
+
| { templateId: "evmContractEvents"; args: EvmContractEventsTemplate }
|
|
81
|
+
| { templateId: "evmAbiFilter"; args: EvmAbiFilterTemplate }
|
|
82
|
+
| { templateId: "solanaWalletFilter"; args: SolanaWalletFilterTemplate }
|
|
83
|
+
| { templateId: "bitcoinWalletFilter"; args: BitcoinWalletFilterTemplate }
|
|
84
|
+
| { templateId: "xrplWalletFilter"; args: XrplWalletFilterTemplate }
|
|
85
|
+
| { templateId: "hyperliquidWalletEventsFilter"; args: HyperliquidWalletEventsFilterTemplate }
|
|
86
|
+
| {
|
|
87
|
+
templateId: "stellarWalletTransactionsSourceAccountFilter";
|
|
88
|
+
args: StellarWalletTransactionsFilterTemplate;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Replace the napi-generated JSON-blob templateArgs with typed unions.
|
|
92
|
+
type _CreateWebhookFromTemplateParamsNode = import("./index").CreateWebhookFromTemplateParamsNode;
|
|
93
|
+
type _UpdateWebhookTemplateParamsNode = import("./index").UpdateWebhookTemplateParamsNode;
|
|
94
|
+
|
|
95
|
+
export type CreateWebhookFromTemplateParams =
|
|
96
|
+
Omit<_CreateWebhookFromTemplateParamsNode, "templateArgs"> & {
|
|
97
|
+
templateArgs: TemplateArgsInput;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export type UpdateWebhookTemplateParams =
|
|
101
|
+
Omit<_UpdateWebhookTemplateParamsNode, "templateArgs"> & {
|
|
102
|
+
templateArgs: TemplateArgsInput;
|
|
103
|
+
};
|
|
104
|
+
|
|
75
105
|
export type {
|
|
76
106
|
SdkFullConfig,
|
|
77
107
|
HttpConfig,
|
|
@@ -236,11 +266,10 @@ export type {
|
|
|
236
266
|
UpdateWebhookParams,
|
|
237
267
|
Webhook,
|
|
238
268
|
ListWebhooksResponse,
|
|
269
|
+
WebhookPageInfo,
|
|
239
270
|
WebhookEnabledCountResponse,
|
|
240
271
|
WebhookDestinationAttributes,
|
|
241
272
|
ActivateWebhookParams,
|
|
242
|
-
CreateWebhookFromTemplateParams,
|
|
243
|
-
UpdateWebhookTemplateParams,
|
|
244
273
|
EvmWalletFilterTemplate,
|
|
245
274
|
EvmContractEventsTemplate,
|
|
246
275
|
EvmAbiFilterTemplate,
|
|
@@ -301,39 +330,60 @@ export interface StreamsApiClientTyped {
|
|
|
301
330
|
getEnabledCount(streamType?: string | undefined | null): Promise<import("./index").EnabledCountResponse>;
|
|
302
331
|
}
|
|
303
332
|
|
|
304
|
-
|
|
333
|
+
// Retypes napi's `any` templateArgs to the discriminated union. Keep method
|
|
334
|
+
// signatures in sync with the napi-generated WebhooksApiClient in ./index.d.ts.
|
|
335
|
+
export interface WebhooksApiClientTyped {
|
|
336
|
+
listWebhooks(params?: import("./index").GetWebhooksParams | undefined | null): Promise<import("./index").ListWebhooksResponse>;
|
|
337
|
+
deleteAllWebhooks(): Promise<void>;
|
|
338
|
+
getWebhook(id: string): Promise<import("./index").Webhook>;
|
|
339
|
+
updateWebhook(
|
|
340
|
+
id: string,
|
|
341
|
+
params: import("./index").UpdateWebhookParams
|
|
342
|
+
): Promise<import("./index").Webhook>;
|
|
343
|
+
deleteWebhook(id: string): Promise<void>;
|
|
344
|
+
pauseWebhook(id: string): Promise<void>;
|
|
345
|
+
activateWebhook(id: string, params: import("./index").ActivateWebhookParams): Promise<void>;
|
|
346
|
+
getEnabledCount(): Promise<import("./index").WebhookEnabledCountResponse>;
|
|
347
|
+
createWebhookFromTemplate(params: CreateWebhookFromTemplateParams): Promise<import("./index").Webhook>;
|
|
348
|
+
updateWebhookTemplate(
|
|
349
|
+
webhookId: string,
|
|
350
|
+
params: UpdateWebhookTemplateParams
|
|
351
|
+
): Promise<import("./index").Webhook>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export class QuicknodeSdk {
|
|
305
355
|
constructor(config: SdkFullConfig);
|
|
306
|
-
static fromEnv():
|
|
307
|
-
admin:
|
|
356
|
+
static fromEnv(): QuicknodeSdk;
|
|
357
|
+
admin: _QuicknodeSdk["admin"];
|
|
308
358
|
streams: StreamsApiClientTyped;
|
|
309
|
-
webhooks:
|
|
310
|
-
kvstore:
|
|
359
|
+
webhooks: WebhooksApiClientTyped;
|
|
360
|
+
kvstore: _QuicknodeSdk["kvstore"];
|
|
311
361
|
}
|
|
312
362
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
363
|
+
// Typed static factory methods producing each discriminated variant of
|
|
364
|
+
// TemplateArgsInput. Consumers can also construct the object literal directly.
|
|
365
|
+
export const TemplateArgs: {
|
|
366
|
+
evmWalletFilter(attrs: EvmWalletFilterTemplate): Extract<TemplateArgsInput, { templateId: "evmWalletFilter" }>;
|
|
367
|
+
evmContractEvents(attrs: EvmContractEventsTemplate): Extract<TemplateArgsInput, { templateId: "evmContractEvents" }>;
|
|
368
|
+
evmAbiFilter(attrs: EvmAbiFilterTemplate): Extract<TemplateArgsInput, { templateId: "evmAbiFilter" }>;
|
|
369
|
+
solanaWalletFilter(attrs: SolanaWalletFilterTemplate): Extract<TemplateArgsInput, { templateId: "solanaWalletFilter" }>;
|
|
370
|
+
bitcoinWalletFilter(attrs: BitcoinWalletFilterTemplate): Extract<TemplateArgsInput, { templateId: "bitcoinWalletFilter" }>;
|
|
371
|
+
xrplWalletFilter(attrs: XrplWalletFilterTemplate): Extract<TemplateArgsInput, { templateId: "xrplWalletFilter" }>;
|
|
372
|
+
hyperliquidWalletEventsFilter(attrs: HyperliquidWalletEventsFilterTemplate): Extract<TemplateArgsInput, { templateId: "hyperliquidWalletEventsFilter" }>;
|
|
373
|
+
stellarWalletTransactionsFilter(attrs: StellarWalletTransactionsFilterTemplate): Extract<TemplateArgsInput, { templateId: "stellarWalletTransactionsSourceAccountFilter" }>;
|
|
374
|
+
};
|
|
325
375
|
|
|
326
376
|
// Typed error hierarchy. Any SDK call can throw one of these; catch
|
|
327
|
-
//
|
|
328
|
-
export class
|
|
329
|
-
export class ConfigError extends
|
|
330
|
-
export class HttpError extends
|
|
377
|
+
// QuicknodeError to handle them all, or a specific subclass for finer control.
|
|
378
|
+
export class QuicknodeError extends Error {}
|
|
379
|
+
export class ConfigError extends QuicknodeError {}
|
|
380
|
+
export class HttpError extends QuicknodeError {}
|
|
331
381
|
export class TimeoutError extends HttpError {}
|
|
332
382
|
export class ConnectionError extends HttpError {}
|
|
333
|
-
export class ApiError extends
|
|
383
|
+
export class ApiError extends QuicknodeError {
|
|
334
384
|
status: number;
|
|
335
385
|
body: string;
|
|
336
386
|
}
|
|
337
|
-
export class DecodeError extends
|
|
387
|
+
export class DecodeError extends QuicknodeError {
|
|
338
388
|
body: string;
|
|
339
389
|
}
|
package/sdk.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Exported main sdk file that imports from autogenerated napi-rs file
|
|
2
2
|
//
|
|
3
3
|
const _index = require("./index.js");
|
|
4
|
-
const {
|
|
4
|
+
const { QuicknodeSdk: _QuicknodeSdk } = _index;
|
|
5
5
|
const errors = require("./errors.js");
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class QuicknodeSdk {
|
|
8
8
|
constructor(config) {
|
|
9
9
|
try {
|
|
10
|
-
this._inner = new
|
|
10
|
+
this._inner = new _QuicknodeSdk(config);
|
|
11
11
|
} catch (e) {
|
|
12
12
|
throw errors.fromNapiError(e);
|
|
13
13
|
}
|
|
@@ -18,9 +18,9 @@ class QuickNodeSdk {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
static fromEnv() {
|
|
21
|
-
const instance = Object.create(
|
|
21
|
+
const instance = Object.create(QuicknodeSdk.prototype);
|
|
22
22
|
try {
|
|
23
|
-
instance._inner =
|
|
23
|
+
instance._inner = _QuicknodeSdk.fromEnv();
|
|
24
24
|
} catch (e) {
|
|
25
25
|
throw errors.fromNapiError(e);
|
|
26
26
|
}
|
|
@@ -32,67 +32,53 @@ class QuickNodeSdk {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// TemplateArgs
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
return str.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function keysToSnakeCase(obj) {
|
|
42
|
-
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) return obj;
|
|
43
|
-
return Object.fromEntries(
|
|
44
|
-
Object.entries(obj).map(([k, v]) => [toSnakeCase(k), keysToSnakeCase(v)])
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// TemplateArgs wraps the napi-rs generated plain object with typed
|
|
49
|
-
// static factory methods. The underlying object has `templateId` (string enum)
|
|
50
|
-
// and `value` (JSON string) fields — callers should use the factory methods
|
|
51
|
-
// rather than constructing the object directly.
|
|
35
|
+
// TemplateArgs wraps the webhook template input with typed static factory
|
|
36
|
+
// methods. The underlying object is `{ templateId, args }` — callers should
|
|
37
|
+
// use the factory methods rather than constructing the object directly.
|
|
52
38
|
class TemplateArgs {
|
|
53
|
-
constructor(templateId,
|
|
39
|
+
constructor(templateId, args) {
|
|
54
40
|
this.templateId = templateId;
|
|
55
|
-
this.
|
|
41
|
+
this.args = args;
|
|
56
42
|
}
|
|
57
43
|
|
|
58
44
|
static evmWalletFilter(attrs) {
|
|
59
|
-
return new TemplateArgs("
|
|
45
|
+
return new TemplateArgs("evmWalletFilter", attrs);
|
|
60
46
|
}
|
|
61
47
|
|
|
62
48
|
static evmContractEvents(attrs) {
|
|
63
|
-
return new TemplateArgs("
|
|
49
|
+
return new TemplateArgs("evmContractEvents", attrs);
|
|
64
50
|
}
|
|
65
51
|
|
|
66
52
|
static evmAbiFilter(attrs) {
|
|
67
|
-
return new TemplateArgs("
|
|
53
|
+
return new TemplateArgs("evmAbiFilter", attrs);
|
|
68
54
|
}
|
|
69
55
|
|
|
70
56
|
static solanaWalletFilter(attrs) {
|
|
71
|
-
return new TemplateArgs("
|
|
57
|
+
return new TemplateArgs("solanaWalletFilter", attrs);
|
|
72
58
|
}
|
|
73
59
|
|
|
74
60
|
static bitcoinWalletFilter(attrs) {
|
|
75
|
-
return new TemplateArgs("
|
|
61
|
+
return new TemplateArgs("bitcoinWalletFilter", attrs);
|
|
76
62
|
}
|
|
77
63
|
|
|
78
64
|
static xrplWalletFilter(attrs) {
|
|
79
|
-
return new TemplateArgs("
|
|
65
|
+
return new TemplateArgs("xrplWalletFilter", attrs);
|
|
80
66
|
}
|
|
81
67
|
|
|
82
68
|
static hyperliquidWalletEventsFilter(attrs) {
|
|
83
|
-
return new TemplateArgs("
|
|
69
|
+
return new TemplateArgs("hyperliquidWalletEventsFilter", attrs);
|
|
84
70
|
}
|
|
85
71
|
|
|
86
72
|
static stellarWalletTransactionsFilter(attrs) {
|
|
87
|
-
return new TemplateArgs("
|
|
73
|
+
return new TemplateArgs("stellarWalletTransactionsSourceAccountFilter", attrs);
|
|
88
74
|
}
|
|
89
75
|
}
|
|
90
76
|
|
|
91
77
|
module.exports = {
|
|
92
78
|
..._index,
|
|
93
|
-
|
|
79
|
+
QuicknodeSdk,
|
|
94
80
|
TemplateArgs,
|
|
95
|
-
|
|
81
|
+
QuicknodeError: errors.QuicknodeError,
|
|
96
82
|
ConfigError: errors.ConfigError,
|
|
97
83
|
HttpError: errors.HttpError,
|
|
98
84
|
TimeoutError: errors.TimeoutError,
|
package/sdk.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import cjs from './sdk.js';
|
|
|
9
9
|
|
|
10
10
|
export default cjs;
|
|
11
11
|
export const {
|
|
12
|
-
|
|
12
|
+
QuicknodeSdk,
|
|
13
13
|
TemplateArgs,
|
|
14
14
|
StreamRegion,
|
|
15
15
|
StreamDataset,
|
|
@@ -24,7 +24,7 @@ export const {
|
|
|
24
24
|
StreamsApiClient,
|
|
25
25
|
WebhooksApiClient,
|
|
26
26
|
KvStoreApiClient,
|
|
27
|
-
|
|
27
|
+
QuicknodeError,
|
|
28
28
|
ConfigError,
|
|
29
29
|
HttpError,
|
|
30
30
|
TimeoutError,
|