@quicknode/sdk 2.6.0 → 3.0.0-alpha.5
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/browser.js +9 -0
- package/index.d.ts +2298 -650
- package/index.darwin-arm64.node +0 -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 +46 -54
- package/sdk.d.ts +339 -0
- package/sdk.js +102 -0
- package/sdk.mjs +34 -0
- package/README.md +0 -80
- 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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,61 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicknode/sdk",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"version": "2.6.0",
|
|
10
|
-
"main": "./cjs/index.js",
|
|
11
|
-
"module": "./esm/index.js",
|
|
12
|
-
"types": "./index.d.ts",
|
|
13
|
-
"sideEffects": false,
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@solana/web3.js": "^1.91",
|
|
16
|
-
"cross-fetch": "^3.1.6",
|
|
17
|
-
"tslib": "^2.5.3",
|
|
18
|
-
"viem": "^2.43.1",
|
|
19
|
-
"zod": "^3.21.4"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@pollyjs/adapter-node-http": "^6.0.5",
|
|
23
|
-
"@pollyjs/core": "^6.0.5",
|
|
24
|
-
"@pollyjs/persister-fs": "^6.0.5",
|
|
25
|
-
"@types/jest": "^29.5.1",
|
|
26
|
-
"@types/mocha": "^10.0.1",
|
|
27
|
-
"@types/node": "^18.13.0",
|
|
28
|
-
"@types/supertest": "^2.0.12",
|
|
29
|
-
"dotenv": "^16.0.3",
|
|
30
|
-
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
31
|
-
"supertest": "^6.3.3"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {},
|
|
3
|
+
"version": "3.0.0-alpha.5",
|
|
4
|
+
"description": "Quicknode SDK",
|
|
5
|
+
"main": "sdk.js",
|
|
6
|
+
"types": "sdk.d.ts",
|
|
34
7
|
"exports": {
|
|
35
8
|
".": {
|
|
36
|
-
"import": "./
|
|
37
|
-
"require": "./
|
|
38
|
-
"types": "./
|
|
39
|
-
},
|
|
40
|
-
"./core": {
|
|
41
|
-
"import": "./esm/core/index.js",
|
|
42
|
-
"default": "./cjs/core/index.js",
|
|
43
|
-
"types": "./esm/core/index.d.ts"
|
|
44
|
-
},
|
|
45
|
-
"./solana": {
|
|
46
|
-
"import": "./esm/solana/index.js",
|
|
47
|
-
"default": "./cjs/solana/index.js",
|
|
48
|
-
"types": "./esm/solana/index.d.ts"
|
|
9
|
+
"import": "./sdk.mjs",
|
|
10
|
+
"require": "./sdk.js",
|
|
11
|
+
"types": "./sdk.d.ts"
|
|
49
12
|
}
|
|
50
13
|
},
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
14
|
+
"browser": "./browser.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"index.js",
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"sdk.js",
|
|
19
|
+
"sdk.d.ts",
|
|
20
|
+
"sdk.mjs",
|
|
21
|
+
"browser.js",
|
|
22
|
+
"*.node"
|
|
23
|
+
],
|
|
24
|
+
"napi": {
|
|
25
|
+
"binaryName": "quicknode-sdk",
|
|
26
|
+
"targets": [
|
|
27
|
+
"x86_64-unknown-linux-gnu",
|
|
28
|
+
"aarch64-unknown-linux-gnu",
|
|
29
|
+
"x86_64-unknown-linux-musl",
|
|
30
|
+
"aarch64-unknown-linux-musl",
|
|
31
|
+
"aarch64-apple-darwin"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "napi build --platform --release --cargo-cwd ../crates/node",
|
|
36
|
+
"build:debug": "napi build --platform --cargo-cwd ../crates/node",
|
|
37
|
+
"test": "node test.js",
|
|
38
|
+
"test:ts": "npx tsx example.ts"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@napi-rs/cli": "^2.18.0",
|
|
42
|
+
"tsx": "^4.7.0",
|
|
43
|
+
"typescript": "^5.3.0"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"optionalDependencies": {
|
|
47
|
+
"@quicknode/sdk-linux-x64-gnu": "3.0.0-alpha.5",
|
|
48
|
+
"@quicknode/sdk-linux-arm64-gnu": "3.0.0-alpha.5",
|
|
49
|
+
"@quicknode/sdk-linux-x64-musl": "3.0.0-alpha.5",
|
|
50
|
+
"@quicknode/sdk-linux-arm64-musl": "3.0.0-alpha.5",
|
|
51
|
+
"@quicknode/sdk-darwin-arm64": "3.0.0-alpha.5"
|
|
60
52
|
}
|
|
61
|
-
}
|
|
53
|
+
}
|
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;
|
package/README.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# QuickNode SDK
|
|
2
|
-
|
|
3
|
-
A SDK from [QuickNode](https://www.quicknode.com/) making it easy for developers to interact with QuickNode's services.
|
|
4
|
-
|
|
5
|
-
QuickNode's SDK is a JavaScript and TypeScript framework-agnostic library that supports both CommonJS and ES module systems.
|
|
6
|
-
|
|
7
|
-
> :grey_question: We want to hear from you! Please take a few minutes to fill out our [QuickNode SDK feedback form](https://forms.gle/vWFXDDjEUySjWUof6) and let us know what you currently think about the SDK. This helps us further improve the SDK.
|
|
8
|
-
|
|
9
|
-
[](https://coveralls.io/github/quiknode-labs/qn-oss?branch=main)
|
|
10
|
-
[](https://www.npmjs.com/package/@quicknode/sdk)
|
|
11
|
-
[](https://www.npmjs.com/package/@quicknode/sdk)
|
|
12
|
-

|
|
13
|
-
[](https://github.com/quiknode-labs/qn-oss/blob/main/LICENSE.txt)
|
|
14
|
-
[](https://github.com/quiknode-labs/qn-oss/issues)
|
|
15
|
-
[](https://discord.gg/DkdgEqE)
|
|
16
|
-
|
|
17
|
-
<br>
|
|
18
|
-
|
|
19
|
-
## Getting Started
|
|
20
|
-
|
|
21
|
-
### Installation
|
|
22
|
-
|
|
23
|
-
- Requires Node.js v16 or higher
|
|
24
|
-
- `npm install @quicknode/sdk` or `yarn add @quicknode/sdk`
|
|
25
|
-
|
|
26
|
-
<br>
|
|
27
|
-
|
|
28
|
-
### Quickstart
|
|
29
|
-
|
|
30
|
-
```ts
|
|
31
|
-
import Core from '@quicknode/sdk/core';
|
|
32
|
-
|
|
33
|
-
const core = new Core({ endpointUrl: 'replaceme' });
|
|
34
|
-
|
|
35
|
-
const blockNumber = core.client.getBlockNumber().then((response) => console.log(response));
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Full example app implementation [here](https://github.com/quiknode-labs/qn-oss/tree/main/packages/apps/examples/sdk-api)
|
|
39
|
-
|
|
40
|
-
<br>
|
|
41
|
-
|
|
42
|
-
## Documentation
|
|
43
|
-
|
|
44
|
-
Please see [the official QuickNode SDK documentation](https://www.quicknode.com/docs/quicknode-sdk/getting-started) for the full documentation of SDK functions.
|
|
45
|
-
|
|
46
|
-
<br>
|
|
47
|
-
|
|
48
|
-
## Contributing corner
|
|
49
|
-
|
|
50
|
-
### Issues
|
|
51
|
-
|
|
52
|
-
Please submit any issues or feature requests as an [issue in Github](https://github.com/quiknode-labs/qn-oss/issues).
|
|
53
|
-
|
|
54
|
-
<br>
|
|
55
|
-
|
|
56
|
-
### Development
|
|
57
|
-
|
|
58
|
-
We recommend using the example application to develop
|
|
59
|
-
|
|
60
|
-
1. In `qn-oss` monorepo root directory, run `yarn install`
|
|
61
|
-
1. cd `packages/apps/examples/sdk-api` from `qn-oss` monorepo root
|
|
62
|
-
1. `cp .env.example .env` and add api key
|
|
63
|
-
1. `nx serve apps-examples-sdk-api`
|
|
64
|
-
1. Then you can send requests to the API, for example: `curl http://localhost:3333/api/nftsByAddress/0xbc08dadccc79c00587d7e6a75bb68ff5fd30f9e0`
|
|
65
|
-
|
|
66
|
-
<br>
|
|
67
|
-
|
|
68
|
-
### Running tests
|
|
69
|
-
|
|
70
|
-
Run `nx test libs-sdk` to execute the tests via [Jest](https://jestjs.io).
|
|
71
|
-
|
|
72
|
-
API responses are recorded using [polly.js](https://github.com/Netflix/pollyjs). You can re-record live requests by passing in an API key, copy `.env.test.example` to `.env.test` and fill out with your API key and re-record tests `nx test libs-sdk -- -u`
|
|
73
|
-
|
|
74
|
-
<br>
|
|
75
|
-
|
|
76
|
-
### Running linting
|
|
77
|
-
|
|
78
|
-
Run `nx lint libs-sdk` to execute the lint via [ESLint](https://eslint.org/).
|
|
79
|
-
|
|
80
|
-
<br>
|