@quicknode/sdk 2.6.0 → 3.0.0-alpha.6
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 +3500 -46
- package/browser.js +9 -0
- package/errors.js +121 -0
- package/index.d.ts +2298 -650
- package/index.darwin-arm64.node +0 -0
- package/index.js +328 -0
- 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 +47 -54
- package/sdk.d.ts +339 -0
- package/sdk.js +102 -0
- package/sdk.mjs +34 -0
- package/cjs/index.js +0 -542
- package/cjs/package.json +0 -3
- package/esm/client/client.js +0 -9
- package/esm/client/index.js +0 -2
- package/esm/core/addOns/nftTokenV2/actions.js +0 -107
- package/esm/core/addOns/nftTokenV2/types/qn_fetchNFTCollectionDetails.js +0 -10
- package/esm/core/addOns/nftTokenV2/types/qn_fetchNFTs.js +0 -13
- package/esm/core/addOns/nftTokenV2/types/qn_fetchNFTsByCollection.js +0 -13
- package/esm/core/addOns/nftTokenV2/types/qn_getTokenMetadataByContractAddress.js +0 -10
- package/esm/core/addOns/nftTokenV2/types/qn_getTokenMetadataBySymbol.js +0 -11
- package/esm/core/addOns/nftTokenV2/types/qn_getTransactionsByAddress.js +0 -18
- package/esm/core/addOns/nftTokenV2/types/qn_getTransfersByNFT.js +0 -12
- package/esm/core/addOns/nftTokenV2/types/qn_getWalletTokenBalance.js +0 -12
- package/esm/core/addOns/nftTokenV2/types/qn_getWalletTokenTransactions.js +0 -14
- package/esm/core/addOns/nftTokenV2/types/qn_verifyNFTsOwner.js +0 -11
- package/esm/core/addOns/shared/helpers.js +0 -10
- package/esm/core/chains.js +0 -118
- package/esm/core/core.js +0 -30
- package/esm/core/index.d.ts +0 -558
- package/esm/core/index.js +0 -2
- package/esm/index.js +0 -11
- package/esm/lib/constants.js +0 -4
- package/esm/lib/errors/QNChainNotSupported.js +0 -7
- package/esm/lib/errors/QNInputValidationError.js +0 -10
- package/esm/lib/errors/QNInvalidEnpointUrl.js +0 -7
- package/esm/lib/helpers/getClientHeaders.js +0 -11
- package/esm/lib/helpers/globalFetch.js +0 -13
- package/esm/lib/validation/ValidateInput.js +0 -16
- package/esm/lib/validation/validators.js +0 -15
- package/esm/package.json +0 -4
- package/esm/solana/index.d.ts +0 -76
- package/esm/solana/index.js +0 -2
- package/esm/solana/solana.js +0 -111
package/sdk.d.ts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
// sdk.d.ts
|
|
2
|
+
import {
|
|
3
|
+
QuickNodeSdk as _QuickNodeSdk,
|
|
4
|
+
SdkFullConfig,
|
|
5
|
+
WebhookAttributes,
|
|
6
|
+
S3Attributes,
|
|
7
|
+
AzureAttributes,
|
|
8
|
+
PostgresAttributes,
|
|
9
|
+
MysqlAttributes,
|
|
10
|
+
MongoAttributes,
|
|
11
|
+
ClickhouseAttributes,
|
|
12
|
+
SnowflakeAttributes,
|
|
13
|
+
KafkaAttributes,
|
|
14
|
+
RedisAttributes,
|
|
15
|
+
WebhookTemplateId,
|
|
16
|
+
EvmWalletFilterTemplate,
|
|
17
|
+
EvmContractEventsTemplate,
|
|
18
|
+
EvmAbiFilterTemplate,
|
|
19
|
+
SolanaWalletFilterTemplate,
|
|
20
|
+
BitcoinWalletFilterTemplate,
|
|
21
|
+
XrplWalletFilterTemplate,
|
|
22
|
+
HyperliquidWalletEventsFilterTemplate,
|
|
23
|
+
StellarWalletTransactionsFilterTemplate,
|
|
24
|
+
} from "./index";
|
|
25
|
+
|
|
26
|
+
// Stream destination attributes (input). The inner key is `attributes` rather
|
|
27
|
+
// than the wire's `destination_attributes` to avoid
|
|
28
|
+
// `destinationAttributes.destinationAttributes.url`; the Node binding renames
|
|
29
|
+
// it back before the request.
|
|
30
|
+
export type StreamDestinationAttributesInput =
|
|
31
|
+
| { destination: "webhook"; attributes: WebhookAttributes }
|
|
32
|
+
| { destination: "s3"; attributes: S3Attributes }
|
|
33
|
+
| { destination: "azure"; attributes: AzureAttributes }
|
|
34
|
+
| { destination: "postgres"; attributes: PostgresAttributes }
|
|
35
|
+
| { destination: "mysql"; attributes: MysqlAttributes }
|
|
36
|
+
| { destination: "mongo"; attributes: MongoAttributes }
|
|
37
|
+
| { destination: "clickhouse"; attributes: ClickhouseAttributes }
|
|
38
|
+
| { destination: "snowflake"; attributes: SnowflakeAttributes }
|
|
39
|
+
| { destination: "kafka"; attributes: KafkaAttributes }
|
|
40
|
+
| { destination: "redis"; attributes: RedisAttributes };
|
|
41
|
+
|
|
42
|
+
// Stream destination attributes (response). Mirrors the input shape so a
|
|
43
|
+
// response can be round-tripped back into an update call without renaming.
|
|
44
|
+
// The Node binding renames the wire `destination_attributes` key to
|
|
45
|
+
// `attributes` on the way out.
|
|
46
|
+
export type StreamDestinationAttributesResponse = StreamDestinationAttributesInput;
|
|
47
|
+
|
|
48
|
+
// Replace the napi-generated JSON-blob destinationAttributes with typed unions.
|
|
49
|
+
type _CreateStreamParamsNode = import("./index").CreateStreamParamsNode;
|
|
50
|
+
type _UpdateStreamParamsNode = import("./index").UpdateStreamParamsNode;
|
|
51
|
+
type _StreamNode = import("./index").StreamNode;
|
|
52
|
+
type _ListStreamsResponseNode = import("./index").ListStreamsResponseNode;
|
|
53
|
+
|
|
54
|
+
export type CreateStreamParams =
|
|
55
|
+
Omit<_CreateStreamParamsNode, "destinationAttributes" | "extraDestinations"> & {
|
|
56
|
+
destinationAttributes: StreamDestinationAttributesInput;
|
|
57
|
+
extraDestinations?: StreamDestinationAttributesInput[] | null;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type UpdateStreamParams =
|
|
61
|
+
Omit<_UpdateStreamParamsNode, "destinationAttributes" | "extraDestinations"> & {
|
|
62
|
+
destinationAttributes?: StreamDestinationAttributesInput;
|
|
63
|
+
extraDestinations?: StreamDestinationAttributesInput[] | null;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type Stream = Omit<_StreamNode, "destinationAttributes" | "extraDestinations"> & {
|
|
67
|
+
destinationAttributes?: StreamDestinationAttributesResponse;
|
|
68
|
+
extraDestinations?: StreamDestinationAttributesResponse[] | null;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type ListStreamsResponse = Omit<_ListStreamsResponseNode, "data"> & {
|
|
72
|
+
data: Stream[];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type {
|
|
76
|
+
SdkFullConfig,
|
|
77
|
+
HttpConfig,
|
|
78
|
+
AdminConfig,
|
|
79
|
+
StreamsConfig,
|
|
80
|
+
// streams
|
|
81
|
+
ListStreamsParams,
|
|
82
|
+
PageInfo,
|
|
83
|
+
TestFilterParams,
|
|
84
|
+
TestFilterResponse,
|
|
85
|
+
EnabledCountResponse,
|
|
86
|
+
WebhookAttributes,
|
|
87
|
+
S3Attributes,
|
|
88
|
+
AzureAttributes,
|
|
89
|
+
PostgresAttributes,
|
|
90
|
+
MysqlAttributes,
|
|
91
|
+
MongoAttributes,
|
|
92
|
+
ClickhouseAttributes,
|
|
93
|
+
SnowflakeAttributes,
|
|
94
|
+
KafkaAttributes,
|
|
95
|
+
RedisAttributes,
|
|
96
|
+
AddressBookConfig,
|
|
97
|
+
StreamsApiClient,
|
|
98
|
+
// billing
|
|
99
|
+
InvoiceLine,
|
|
100
|
+
Invoice,
|
|
101
|
+
ListInvoicesResponse,
|
|
102
|
+
ListInvoicesData,
|
|
103
|
+
Payment,
|
|
104
|
+
ListPaymentsResponse,
|
|
105
|
+
ListPaymentsData,
|
|
106
|
+
// chains
|
|
107
|
+
ChainNetwork,
|
|
108
|
+
Chain,
|
|
109
|
+
ListChainsResponse,
|
|
110
|
+
// metrics
|
|
111
|
+
GetEndpointMetricsRequest,
|
|
112
|
+
GetAccountMetricsRequest,
|
|
113
|
+
EndpointMetric,
|
|
114
|
+
GetEndpointMetricsResponse,
|
|
115
|
+
GetAccountMetricsResponse,
|
|
116
|
+
// rate limits
|
|
117
|
+
MethodRateLimiter,
|
|
118
|
+
GetMethodRateLimitsData,
|
|
119
|
+
GetMethodRateLimitsResponse,
|
|
120
|
+
CreateMethodRateLimitRequest,
|
|
121
|
+
CreateMethodRateLimitResponse,
|
|
122
|
+
UpdateMethodRateLimitRequest,
|
|
123
|
+
UpdateMethodRateLimitResponse,
|
|
124
|
+
RateLimitSettings,
|
|
125
|
+
UpdateRateLimitsRequest,
|
|
126
|
+
// security options
|
|
127
|
+
SecurityOption,
|
|
128
|
+
GetSecurityOptionsResponse,
|
|
129
|
+
SecurityOptionsUpdate,
|
|
130
|
+
UpdateSecurityOptionsRequest,
|
|
131
|
+
UpdateSecurityOptionsResponse,
|
|
132
|
+
CreateReferrerRequest,
|
|
133
|
+
CreateIpRequest,
|
|
134
|
+
CreateDomainMaskRequest,
|
|
135
|
+
CreateJwtRequest,
|
|
136
|
+
CreateRequestFilterRequest,
|
|
137
|
+
CreateRequestFilterResponse,
|
|
138
|
+
CreateRequestFilterData,
|
|
139
|
+
UpdateRequestFilterRequest,
|
|
140
|
+
CreateOrUpdateIpCustomHeaderRequest,
|
|
141
|
+
IpCustomHeaderData,
|
|
142
|
+
CreateOrUpdateIpCustomHeaderResponse,
|
|
143
|
+
DeleteBoolResponse,
|
|
144
|
+
// endpoints
|
|
145
|
+
GetEndpointsRequest,
|
|
146
|
+
GetEndpointsResponse,
|
|
147
|
+
Endpoint,
|
|
148
|
+
EndpointTag,
|
|
149
|
+
CreateEndpointRequest,
|
|
150
|
+
CreateEndpointResponse,
|
|
151
|
+
SingleEndpoint,
|
|
152
|
+
EndpointRateLimits,
|
|
153
|
+
EndpointSecurity,
|
|
154
|
+
EndpointSecurityOptions,
|
|
155
|
+
EndpointIpCustomHeaderOption,
|
|
156
|
+
EndpointToken,
|
|
157
|
+
EndpointJwt,
|
|
158
|
+
EndpointReferrer,
|
|
159
|
+
EndpointDomainMask,
|
|
160
|
+
EndpointIp,
|
|
161
|
+
EndpointRequestFilter,
|
|
162
|
+
ShowEndpointResponse,
|
|
163
|
+
UpdateEndpointRequest,
|
|
164
|
+
UpdateEndpointStatusRequest,
|
|
165
|
+
UpdateEndpointStatusResponse,
|
|
166
|
+
CreateTagRequest,
|
|
167
|
+
Pagination,
|
|
168
|
+
GetEndpointSecurityResponse,
|
|
169
|
+
// bulk
|
|
170
|
+
BulkOperationResult,
|
|
171
|
+
BulkUpdateEndpointStatusRequest,
|
|
172
|
+
BulkUpdateEndpointStatusData,
|
|
173
|
+
BulkUpdateEndpointStatusResponse,
|
|
174
|
+
BulkTag,
|
|
175
|
+
BulkAddTagRequest,
|
|
176
|
+
BulkAddTagData,
|
|
177
|
+
BulkAddTagResponse,
|
|
178
|
+
BulkRemoveTagRequest,
|
|
179
|
+
BulkRemoveTagData,
|
|
180
|
+
BulkRemoveTagResponse,
|
|
181
|
+
// account tags
|
|
182
|
+
AccountTag,
|
|
183
|
+
ListTagsData,
|
|
184
|
+
ListTagsResponse,
|
|
185
|
+
RenameTagRequest,
|
|
186
|
+
RenameTagResponse,
|
|
187
|
+
DeleteAccountTagData,
|
|
188
|
+
DeleteAccountTagResponse,
|
|
189
|
+
// logs
|
|
190
|
+
GetEndpointLogsRequest,
|
|
191
|
+
LogDetails,
|
|
192
|
+
EndpointLog,
|
|
193
|
+
GetEndpointLogsResponse,
|
|
194
|
+
GetLogDetailsResponse,
|
|
195
|
+
// teams
|
|
196
|
+
TeamUser,
|
|
197
|
+
TeamSummary,
|
|
198
|
+
TeamDetail,
|
|
199
|
+
ListTeamsResponse,
|
|
200
|
+
CreateTeamRequest,
|
|
201
|
+
CreateTeamData,
|
|
202
|
+
CreateTeamResponse,
|
|
203
|
+
GetTeamResponse,
|
|
204
|
+
DeleteTeamData,
|
|
205
|
+
DeleteTeamResponse,
|
|
206
|
+
TeamEndpoint,
|
|
207
|
+
ListTeamEndpointsResponse,
|
|
208
|
+
UpdateTeamEndpointsRequest,
|
|
209
|
+
UpdateTeamEndpointsData,
|
|
210
|
+
UpdateTeamEndpointsResponse,
|
|
211
|
+
InviteTeamMemberRequest,
|
|
212
|
+
InviteTeamMemberResponse,
|
|
213
|
+
RemoveTeamMemberRequest,
|
|
214
|
+
TeamMessageData,
|
|
215
|
+
RemoveTeamMemberResponse,
|
|
216
|
+
ResendTeamInviteResponse,
|
|
217
|
+
// usage
|
|
218
|
+
GetUsageRequest,
|
|
219
|
+
UsageData,
|
|
220
|
+
GetUsageResponse,
|
|
221
|
+
EndpointUsage,
|
|
222
|
+
MethodUsage,
|
|
223
|
+
ChainUsage,
|
|
224
|
+
UsageByEndpointData,
|
|
225
|
+
GetUsageByEndpointResponse,
|
|
226
|
+
UsageByMethodData,
|
|
227
|
+
GetUsageByMethodResponse,
|
|
228
|
+
UsageByChainData,
|
|
229
|
+
GetUsageByChainResponse,
|
|
230
|
+
TagUsage,
|
|
231
|
+
UsageByTagData,
|
|
232
|
+
GetUsageByTagResponse,
|
|
233
|
+
// webhooks
|
|
234
|
+
WebhooksConfig,
|
|
235
|
+
GetWebhooksParams,
|
|
236
|
+
UpdateWebhookParams,
|
|
237
|
+
Webhook,
|
|
238
|
+
ListWebhooksResponse,
|
|
239
|
+
WebhookEnabledCountResponse,
|
|
240
|
+
WebhookDestinationAttributes,
|
|
241
|
+
ActivateWebhookParams,
|
|
242
|
+
CreateWebhookFromTemplateParams,
|
|
243
|
+
UpdateWebhookTemplateParams,
|
|
244
|
+
EvmWalletFilterTemplate,
|
|
245
|
+
EvmContractEventsTemplate,
|
|
246
|
+
EvmAbiFilterTemplate,
|
|
247
|
+
SolanaWalletFilterTemplate,
|
|
248
|
+
BitcoinWalletFilterTemplate,
|
|
249
|
+
XrplWalletFilterTemplate,
|
|
250
|
+
HyperliquidWalletEventsFilterTemplate,
|
|
251
|
+
StellarWalletTransactionsFilterTemplate,
|
|
252
|
+
WebhooksApiClient,
|
|
253
|
+
// kvstore
|
|
254
|
+
KvStoreConfig,
|
|
255
|
+
KvStoreApiClient,
|
|
256
|
+
KvSetEntry,
|
|
257
|
+
CreateSetParams,
|
|
258
|
+
GetSetsParams,
|
|
259
|
+
GetSetsResponse,
|
|
260
|
+
GetSetResponse,
|
|
261
|
+
BulkSetsParams,
|
|
262
|
+
CreateListParams,
|
|
263
|
+
GetListsParams,
|
|
264
|
+
GetListsData,
|
|
265
|
+
GetListsResponse,
|
|
266
|
+
GetListParams,
|
|
267
|
+
GetListData,
|
|
268
|
+
GetListResponse,
|
|
269
|
+
UpdateListParams,
|
|
270
|
+
AddListItemParams,
|
|
271
|
+
ListContainsItemResponse,
|
|
272
|
+
} from "./index";
|
|
273
|
+
|
|
274
|
+
// const enums must use `export` (not `export type`) so they are usable as values
|
|
275
|
+
export {
|
|
276
|
+
StreamRegion,
|
|
277
|
+
StreamDataset,
|
|
278
|
+
StreamDestination,
|
|
279
|
+
FilterLanguage,
|
|
280
|
+
StreamMetadataLocation,
|
|
281
|
+
ProductType,
|
|
282
|
+
StreamStatus,
|
|
283
|
+
WebhookTemplateId,
|
|
284
|
+
WebhookStartFrom,
|
|
285
|
+
} from "./index";
|
|
286
|
+
|
|
287
|
+
// Retypes napi's `any` destination_attributes to the discriminated unions.
|
|
288
|
+
// NOTE: keep these method signatures in sync with the napi-generated
|
|
289
|
+
// StreamsApiClient in ./index.d.ts. Adding a method to crates/node/src/lib.rs
|
|
290
|
+
// requires adding it here too; there is no automated check.
|
|
291
|
+
export interface StreamsApiClientTyped {
|
|
292
|
+
createStream(params: CreateStreamParams): Promise<Stream>;
|
|
293
|
+
listStreams(params?: import("./index").ListStreamsParams | undefined | null): Promise<ListStreamsResponse>;
|
|
294
|
+
deleteAllStreams(): Promise<void>;
|
|
295
|
+
getStream(id: string): Promise<Stream>;
|
|
296
|
+
updateStream(id: string, params: UpdateStreamParams): Promise<Stream>;
|
|
297
|
+
deleteStream(id: string): Promise<void>;
|
|
298
|
+
activateStream(id: string): Promise<void>;
|
|
299
|
+
pauseStream(id: string): Promise<void>;
|
|
300
|
+
testFilter(params: import("./index").TestFilterParams): Promise<import("./index").TestFilterResponse>;
|
|
301
|
+
getEnabledCount(streamType?: string | undefined | null): Promise<import("./index").EnabledCountResponse>;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export class QuickNodeSdk {
|
|
305
|
+
constructor(config: SdkFullConfig);
|
|
306
|
+
static fromEnv(): QuickNodeSdk;
|
|
307
|
+
admin: _QuickNodeSdk["admin"];
|
|
308
|
+
streams: StreamsApiClientTyped;
|
|
309
|
+
webhooks: _QuickNodeSdk["webhooks"];
|
|
310
|
+
kvstore: _QuickNodeSdk["kvstore"];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export class TemplateArgs {
|
|
314
|
+
templateId: WebhookTemplateId;
|
|
315
|
+
value: string;
|
|
316
|
+
static evmWalletFilter(attrs: EvmWalletFilterTemplate): TemplateArgs;
|
|
317
|
+
static evmContractEvents(attrs: EvmContractEventsTemplate): TemplateArgs;
|
|
318
|
+
static evmAbiFilter(attrs: EvmAbiFilterTemplate): TemplateArgs;
|
|
319
|
+
static solanaWalletFilter(attrs: SolanaWalletFilterTemplate): TemplateArgs;
|
|
320
|
+
static bitcoinWalletFilter(attrs: BitcoinWalletFilterTemplate): TemplateArgs;
|
|
321
|
+
static xrplWalletFilter(attrs: XrplWalletFilterTemplate): TemplateArgs;
|
|
322
|
+
static hyperliquidWalletEventsFilter(attrs: HyperliquidWalletEventsFilterTemplate): TemplateArgs;
|
|
323
|
+
static stellarWalletTransactionsFilter(attrs: StellarWalletTransactionsFilterTemplate): TemplateArgs;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Typed error hierarchy. Any SDK call can throw one of these; catch
|
|
327
|
+
// QuickNodeError to handle them all, or a specific subclass for finer control.
|
|
328
|
+
export class QuickNodeError extends Error {}
|
|
329
|
+
export class ConfigError extends QuickNodeError {}
|
|
330
|
+
export class HttpError extends QuickNodeError {}
|
|
331
|
+
export class TimeoutError extends HttpError {}
|
|
332
|
+
export class ConnectionError extends HttpError {}
|
|
333
|
+
export class ApiError extends QuickNodeError {
|
|
334
|
+
status: number;
|
|
335
|
+
body: string;
|
|
336
|
+
}
|
|
337
|
+
export class DecodeError extends QuickNodeError {
|
|
338
|
+
body: string;
|
|
339
|
+
}
|
package/sdk.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Exported main sdk file that imports from autogenerated napi-rs file
|
|
2
|
+
//
|
|
3
|
+
const _index = require("./index.js");
|
|
4
|
+
const { QuickNodeSdk: _QuickNodeSdk } = _index;
|
|
5
|
+
const errors = require("./errors.js");
|
|
6
|
+
|
|
7
|
+
class QuickNodeSdk {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
try {
|
|
10
|
+
this._inner = new _QuickNodeSdk(config);
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw errors.fromNapiError(e);
|
|
13
|
+
}
|
|
14
|
+
this.admin = errors.wrapClient(this._inner.admin);
|
|
15
|
+
this.streams = errors.wrapClient(this._inner.streams);
|
|
16
|
+
this.webhooks = errors.wrapClient(this._inner.webhooks);
|
|
17
|
+
this.kvstore = errors.wrapClient(this._inner.kvstore);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static fromEnv() {
|
|
21
|
+
const instance = Object.create(QuickNodeSdk.prototype);
|
|
22
|
+
try {
|
|
23
|
+
instance._inner = _QuickNodeSdk.fromEnv();
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw errors.fromNapiError(e);
|
|
26
|
+
}
|
|
27
|
+
instance.admin = errors.wrapClient(instance._inner.admin);
|
|
28
|
+
instance.streams = errors.wrapClient(instance._inner.streams);
|
|
29
|
+
instance.webhooks = errors.wrapClient(instance._inner.webhooks);
|
|
30
|
+
instance.kvstore = errors.wrapClient(instance._inner.kvstore);
|
|
31
|
+
return instance;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// TemplateArgs.value is a pre-serialized JSON string; napi forwards camelCase
|
|
36
|
+
// keys from JS but the API expects snake_case, so stringify through these.
|
|
37
|
+
function toSnakeCase(str) {
|
|
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.
|
|
52
|
+
class TemplateArgs {
|
|
53
|
+
constructor(templateId, value) {
|
|
54
|
+
this.templateId = templateId;
|
|
55
|
+
this.value = value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static evmWalletFilter(attrs) {
|
|
59
|
+
return new TemplateArgs("EvmWalletFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static evmContractEvents(attrs) {
|
|
63
|
+
return new TemplateArgs("EvmContractEvents", JSON.stringify(keysToSnakeCase(attrs)));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static evmAbiFilter(attrs) {
|
|
67
|
+
return new TemplateArgs("EvmAbiFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static solanaWalletFilter(attrs) {
|
|
71
|
+
return new TemplateArgs("SolanaWalletFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static bitcoinWalletFilter(attrs) {
|
|
75
|
+
return new TemplateArgs("BitcoinWalletFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static xrplWalletFilter(attrs) {
|
|
79
|
+
return new TemplateArgs("XrplWalletFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static hyperliquidWalletEventsFilter(attrs) {
|
|
83
|
+
return new TemplateArgs("HyperliquidWalletEventsFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static stellarWalletTransactionsFilter(attrs) {
|
|
87
|
+
return new TemplateArgs("StellarWalletTransactionsSourceAccountFilter", JSON.stringify(keysToSnakeCase(attrs)));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = {
|
|
92
|
+
..._index,
|
|
93
|
+
QuickNodeSdk,
|
|
94
|
+
TemplateArgs,
|
|
95
|
+
QuickNodeError: errors.QuickNodeError,
|
|
96
|
+
ConfigError: errors.ConfigError,
|
|
97
|
+
HttpError: errors.HttpError,
|
|
98
|
+
TimeoutError: errors.TimeoutError,
|
|
99
|
+
ConnectionError: errors.ConnectionError,
|
|
100
|
+
ApiError: errors.ApiError,
|
|
101
|
+
DecodeError: errors.DecodeError,
|
|
102
|
+
};
|
package/sdk.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// ESM wrapper: re-exports the CJS entry via dynamic import.
|
|
2
|
+
// The native .node binary loader (index.js) uses require() for platform
|
|
3
|
+
// detection and cannot be expressed as static ESM — this wrapper bridges
|
|
4
|
+
// the gap for ESM consumers while keeping the loader intact.
|
|
5
|
+
//
|
|
6
|
+
// We re-export everything from the default export so that new types added
|
|
7
|
+
// to sdk.js are automatically available here without manual updates.
|
|
8
|
+
import cjs from './sdk.js';
|
|
9
|
+
|
|
10
|
+
export default cjs;
|
|
11
|
+
export const {
|
|
12
|
+
QuickNodeSdk,
|
|
13
|
+
TemplateArgs,
|
|
14
|
+
StreamRegion,
|
|
15
|
+
StreamDataset,
|
|
16
|
+
StreamDestination,
|
|
17
|
+
FilterLanguage,
|
|
18
|
+
StreamMetadataLocation,
|
|
19
|
+
ProductType,
|
|
20
|
+
StreamStatus,
|
|
21
|
+
WebhookTemplateId,
|
|
22
|
+
WebhookStartFrom,
|
|
23
|
+
AdminApiClient,
|
|
24
|
+
StreamsApiClient,
|
|
25
|
+
WebhooksApiClient,
|
|
26
|
+
KvStoreApiClient,
|
|
27
|
+
QuickNodeError,
|
|
28
|
+
ConfigError,
|
|
29
|
+
HttpError,
|
|
30
|
+
TimeoutError,
|
|
31
|
+
ConnectionError,
|
|
32
|
+
ApiError,
|
|
33
|
+
DecodeError,
|
|
34
|
+
} = cjs;
|