@0xsequence/indexer 3.0.0-beta.8 → 3.0.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.
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +5 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +91 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -47
- package/dist/indexer.gen.d.ts +993 -633
- package/dist/indexer.gen.d.ts.map +1 -1
- package/dist/indexer.gen.js +885 -632
- package/dist/indexergw.gen.d.ts +686 -455
- package/dist/indexergw.gen.d.ts.map +1 -1
- package/dist/indexergw.gen.js +684 -426
- package/eslint.config.js +4 -0
- package/package.json +8 -5
- package/src/index.ts +6 -6
- package/src/indexer.gen.ts +1904 -1487
- package/src/indexergw.gen.ts +1215 -946
- package/tsconfig.json +3 -1
package/src/indexer.gen.ts
CHANGED
|
@@ -1,79 +1,393 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// sequence-indexer v0.4.0
|
|
2
|
+
// sequence-indexer v0.4.0 2bca559c4c590bce7d70c33df115a58399efec82
|
|
3
3
|
// --
|
|
4
|
-
// Code generated by
|
|
4
|
+
// Code generated by Webrpc-gen@v0.31.2 with typescript generator. DO NOT EDIT.
|
|
5
5
|
//
|
|
6
|
-
// webrpc-gen -schema=
|
|
6
|
+
// webrpc-gen -schema=merged.gen.json -service=Indexer -target=typescript -client -out=./clients/indexer.gen.ts
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const WebrpcHeaderValue = 'webrpc@v0.21.1;gen-typescript@v0.15.1;sequence-indexer@v0.4.0'
|
|
11
|
-
|
|
12
|
-
// WebRPC description and code-gen version
|
|
13
|
-
export const WebRPCVersion = 'v1'
|
|
8
|
+
// Webrpc description and code-gen version
|
|
9
|
+
export const WebrpcVersion = 'v1'
|
|
14
10
|
|
|
15
11
|
// Schema version of your RIDL schema
|
|
16
|
-
export const
|
|
12
|
+
export const WebrpcSchemaVersion = 'v0.4.0'
|
|
17
13
|
|
|
18
14
|
// Schema hash generated from your RIDL schema
|
|
19
|
-
export const
|
|
15
|
+
export const WebrpcSchemaHash = '2bca559c4c590bce7d70c33df115a58399efec82'
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
codeGenVersion: string
|
|
25
|
-
schemaName: string
|
|
26
|
-
schemaVersion: string
|
|
27
|
-
}
|
|
17
|
+
//
|
|
18
|
+
// Client interface
|
|
19
|
+
//
|
|
28
20
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
if (!headerValue) {
|
|
32
|
-
return {
|
|
33
|
-
webrpcGenVersion: '',
|
|
34
|
-
codeGenName: '',
|
|
35
|
-
codeGenVersion: '',
|
|
36
|
-
schemaName: '',
|
|
37
|
-
schemaVersion: '',
|
|
38
|
-
}
|
|
39
|
-
}
|
|
21
|
+
export interface IndexerClient {
|
|
22
|
+
addWebhookListener(req: AddWebhookListenerRequest, headers?: object, signal?: AbortSignal): Promise<AddWebhookListenerResponse>
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Fetches a single receipt and then will stop the subscription
|
|
26
|
+
*/
|
|
27
|
+
fetchTransactionReceipt(
|
|
28
|
+
req: FetchTransactionReceiptRequest,
|
|
29
|
+
headers?: object,
|
|
30
|
+
signal?: AbortSignal
|
|
31
|
+
): Promise<FetchTransactionReceiptResponse>
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
schemaVersion: '',
|
|
53
|
-
}
|
|
54
|
-
}
|
|
33
|
+
/**
|
|
34
|
+
* Fetches a single receipt with filter and then will stop the subscription
|
|
35
|
+
*/
|
|
36
|
+
fetchTransactionReceiptWithFilter(
|
|
37
|
+
req: FetchTransactionReceiptWithFilterRequest,
|
|
38
|
+
headers?: object,
|
|
39
|
+
signal?: AbortSignal
|
|
40
|
+
): Promise<FetchTransactionReceiptWithFilterResponse>
|
|
55
41
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Webhooks
|
|
44
|
+
*/
|
|
45
|
+
getAllWebhookListeners(
|
|
46
|
+
req: GetAllWebhookListenersRequest,
|
|
47
|
+
headers?: object,
|
|
48
|
+
signal?: AbortSignal
|
|
49
|
+
): Promise<GetAllWebhookListenersResponse>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get balance update aggregate values -- useful for syncing balance details of a contract, ie. from Skyweaver.
|
|
53
|
+
* Also consider using SubscribeBalanceUpdates or SubscribeEvents as other alternatives.
|
|
54
|
+
*/
|
|
55
|
+
getBalanceUpdates(req: GetBalanceUpdatesRequest, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesResponse>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get the chain ID of the indexer
|
|
59
|
+
*/
|
|
60
|
+
getChainID(headers?: object, signal?: AbortSignal): Promise<GetChainIDResponse>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Queries an ethereum node for the latest and confirm ETH balances
|
|
64
|
+
* DEPRECATED: use GetNativeTokenBalance instead
|
|
65
|
+
*
|
|
66
|
+
* @deprecated GetNativeTokenBalance
|
|
67
|
+
*/
|
|
68
|
+
getEtherBalance(req: GetEtherBalanceRequest, headers?: object, signal?: AbortSignal): Promise<GetEtherBalanceResponse>
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* GetMarketplaceOrders queries marketplace orders with filtering and pagination.
|
|
72
|
+
*
|
|
73
|
+
* Retrieves buy orders (offers) and sell orders (listings) from a specific marketplace
|
|
74
|
+
* and collection with comprehensive filtering options.
|
|
75
|
+
*
|
|
76
|
+
* Parameters:
|
|
77
|
+
* marketplaceContractAddress: Target marketplace contract (required)
|
|
78
|
+
* collectionAddress: NFT collection contract (required)
|
|
79
|
+
* filter: MarketplaceOrderFilter with options:
|
|
80
|
+
* - isListing: true=listings, false=offers, omit=both
|
|
81
|
+
* - userAddresses: Include specific users
|
|
82
|
+
* - currencyAddresses: Filter by currencies (empty=all)
|
|
83
|
+
* - orderIds: Filter by specific order ids (empty=all)
|
|
84
|
+
* - tokenIds: Filter by specific tokens (empty=all)
|
|
85
|
+
* - excludeUserAddresses: Exclude specific users
|
|
86
|
+
* - blockNumberGt: Orders greater than block number
|
|
87
|
+
* - createdAtAfter: Orders after timestamp
|
|
88
|
+
* - orderStatuses: Filter by status (OPEN, CLOSED, CANCELLED)
|
|
89
|
+
* - returnExpired: Include expired orders
|
|
90
|
+
* page: Pagination control (optional)
|
|
91
|
+
*
|
|
92
|
+
* Returns: Updated pagination info and array of matching orders
|
|
93
|
+
*/
|
|
94
|
+
getMarketplaceOrders(
|
|
95
|
+
req: GetMarketplaceOrdersRequest,
|
|
96
|
+
headers?: object,
|
|
97
|
+
signal?: AbortSignal
|
|
98
|
+
): Promise<GetMarketplaceOrdersResponse>
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* GetMarketplaceTopOrders finds the most competitive orders for specific tokens.
|
|
102
|
+
*
|
|
103
|
+
* Optimized for price discovery, returns the best available orders for each token.
|
|
104
|
+
* Useful for displaying current market prices and finding trading opportunities.
|
|
105
|
+
*
|
|
106
|
+
* Parameters:
|
|
107
|
+
* marketplaceContractAddress: Target marketplace contract (required)
|
|
108
|
+
* collectionAddress: NFT collection contract (required)
|
|
109
|
+
* filter: MarketplaceTopOrdersFilter with options:
|
|
110
|
+
* - currencyAddresses: Consider specific currencies (empty=all)
|
|
111
|
+
* - tokenIds: Target token IDs (required, non-empty)
|
|
112
|
+
* - isListing: true=listings/sell orders, false=offers/buy orders
|
|
113
|
+
* - priceSort: ASC=lowest first, DESC=highest first
|
|
114
|
+
* - excludeUser: Hide orders from specific user
|
|
115
|
+
*
|
|
116
|
+
* Returns: Array of top-priced active orders, sorted by priceSort preference
|
|
117
|
+
*/
|
|
118
|
+
getMarketplaceTopOrders(
|
|
119
|
+
req: GetMarketplaceTopOrdersRequest,
|
|
120
|
+
headers?: object,
|
|
121
|
+
signal?: AbortSignal
|
|
122
|
+
): Promise<GetMarketplaceTopOrdersResponse>
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* GetNativeTokenBalance queries an ethereum node for the latest native token account balance.
|
|
126
|
+
* The native token is the token of the chain the indexer is connected to, for example, ETH on Ethereum
|
|
127
|
+
* and POL on Polygon.
|
|
128
|
+
*/
|
|
129
|
+
getNativeTokenBalance(
|
|
130
|
+
req: GetNativeTokenBalanceRequest,
|
|
131
|
+
headers?: object,
|
|
132
|
+
signal?: AbortSignal
|
|
133
|
+
): Promise<GetNativeTokenBalanceResponse>
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* GetTokenBalances returns a balance summary/details for a specific account. By default
|
|
137
|
+
* if accountAddress is left empty, it will use the account from the jwt session.
|
|
138
|
+
*
|
|
139
|
+
* Also, if contractAddress is undefined, then it will list all current user coins/collectibles.
|
|
140
|
+
* But, if contractAddress is provided, then it will return the token balances for the contract, this is
|
|
141
|
+
* only useful for 1155, but for other tokens, it can act as a filter for the single balance.
|
|
142
|
+
*
|
|
143
|
+
* DEPRECATED: use GetTokenBalancesSummary / GetTokenBalancesDetails
|
|
144
|
+
*
|
|
145
|
+
* @deprecated GetTokenBalancesSummary
|
|
146
|
+
*/
|
|
147
|
+
getTokenBalances(req: GetTokenBalancesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesResponse>
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* GetTokenBalancesByContract returns a balances for a specific accounts and
|
|
151
|
+
* contracts. The collection ERC721 & ERC1155 tokens are represented as
|
|
152
|
+
* individual balances.
|
|
153
|
+
*
|
|
154
|
+
* If `filter` is not provided, it will error out as it requires at least
|
|
155
|
+
* contract address.
|
|
156
|
+
*
|
|
157
|
+
* If `filter.contractStatus` is not provided, it will include verified only
|
|
158
|
+
* tokens.
|
|
159
|
+
*/
|
|
160
|
+
getTokenBalancesByContract(
|
|
161
|
+
req: GetTokenBalancesByContractRequest,
|
|
162
|
+
headers?: object,
|
|
163
|
+
signal?: AbortSignal
|
|
164
|
+
): Promise<GetTokenBalancesByContractResponse>
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* GetTokenBalancesDetails returns a detailed balance summary for a specific
|
|
168
|
+
* accounts. The collection ERC721 & ERC1155 tokens are represented as
|
|
169
|
+
* individual balances.
|
|
170
|
+
*
|
|
171
|
+
* If `filter` is not provided, it will use the filter with account from the
|
|
172
|
+
* jwt session.
|
|
173
|
+
*
|
|
174
|
+
* If `filter.contractStatus` is not provided, it will include verified only
|
|
175
|
+
* tokens.
|
|
176
|
+
*/
|
|
177
|
+
getTokenBalancesDetails(
|
|
178
|
+
req: GetTokenBalancesDetailsRequest,
|
|
179
|
+
headers?: object,
|
|
180
|
+
signal?: AbortSignal
|
|
181
|
+
): Promise<GetTokenBalancesDetailsResponse>
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* GetTokenBalancesSummary returns a summary of token balances for a specific
|
|
185
|
+
* accounts. The collection ERC721 & ERC1155 tokens are represented as a
|
|
186
|
+
* single aggregated balance.
|
|
187
|
+
*
|
|
188
|
+
* If `filter` is not provided, it will use the filter with account from the
|
|
189
|
+
* jwt session.
|
|
190
|
+
*
|
|
191
|
+
* If `filter.contractStatus` is not provided, it will include verified only
|
|
192
|
+
* tokens.
|
|
193
|
+
*/
|
|
194
|
+
getTokenBalancesSummary(
|
|
195
|
+
req: GetTokenBalancesSummaryRequest,
|
|
196
|
+
headers?: object,
|
|
197
|
+
signal?: AbortSignal
|
|
198
|
+
): Promise<GetTokenBalancesSummaryResponse>
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* GetTokenIDRanges returns the range of tokenIDs for a token collection contract.
|
|
202
|
+
* This is useful for ERC-721 and ERC-1155 contracts to get the range of valid tokenIDs. It is similar to
|
|
203
|
+
* GetTokenIDs, but returns the range of tokenIDs instead of the list of tokenIDs, which is more efficient
|
|
204
|
+
* for large collections and very easy to the caller to expand the range into a list of tokenIDs.
|
|
205
|
+
*
|
|
206
|
+
* NOTE: this method will only return up to 15,000 ranges, if there are more ranges, it will return
|
|
207
|
+
* a boolean to indicate there are more ranges beyond the first 15,000. Therefore, if `moreRanges` is
|
|
208
|
+
* false then you have all the ranges, but if true, you need to make a follow up call to fetch the next
|
|
209
|
+
* page of ranges.
|
|
210
|
+
*
|
|
211
|
+
* As an example, if a NFT collection of 100,000 tokens uses ids from 1,2,3,...,100_000 then this endpoint
|
|
212
|
+
* will return just a single range from [1,100_000], but if there are gaps between the sequence, then
|
|
213
|
+
* those will be broken into separate range entries.
|
|
214
|
+
*/
|
|
215
|
+
getTokenIDRanges(req: GetTokenIDRangesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenIDRangesResponse>
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* GetTokenIDs returns the list of each individual token id for a token collection contract.
|
|
219
|
+
* This is useful for ERC-721 and ERC-1155 contracts to get the list of valid tokenIDs.
|
|
220
|
+
*/
|
|
221
|
+
getTokenIDs(req: GetTokenIDsRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenIDsResponse>
|
|
222
|
+
|
|
223
|
+
getTokenPrice(req: GetTokenPriceRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPriceResponse>
|
|
224
|
+
|
|
225
|
+
getTokenPrices(req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPricesResponse>
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* GetTokenSupplies returns the set of tokenIDs used by a contract address, supporting ERC-20, ERC-721, and ERC-1155
|
|
229
|
+
* contracts, and their respective supply as well.
|
|
230
|
+
*/
|
|
231
|
+
getTokenSupplies(req: GetTokenSuppliesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenSuppliesResponse>
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* GetTokenSuppliesMap returns the token supplies of ERC-20 and ERC-1155 tokens as requested in the `tokenMap`
|
|
235
|
+
* represented as a map of contractAddress :: []tokenIDs.
|
|
236
|
+
*
|
|
237
|
+
* For an ERC-20 specify tokenIDs as an empty array or [0], for example, { '0xdef': [] } or { '0xdef': [0] }
|
|
238
|
+
* For ERC-1155 pass the array of tokens are strings, ie. { '0xabc': ['1', '2', '3'] }
|
|
239
|
+
*/
|
|
240
|
+
getTokenSuppliesMap(
|
|
241
|
+
req: GetTokenSuppliesMapRequest,
|
|
242
|
+
headers?: object,
|
|
243
|
+
signal?: AbortSignal
|
|
244
|
+
): Promise<GetTokenSuppliesMapResponse>
|
|
59
245
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
246
|
+
/**
|
|
247
|
+
* History of mined transactions for the account which includes a list of token transfers (sent/recieved)
|
|
248
|
+
* and sent transactions from a Sequence wallet
|
|
249
|
+
*/
|
|
250
|
+
getTransactionHistory(
|
|
251
|
+
req: GetTransactionHistoryRequest,
|
|
252
|
+
headers?: object,
|
|
253
|
+
signal?: AbortSignal
|
|
254
|
+
): Promise<GetTransactionHistoryResponse>
|
|
255
|
+
|
|
256
|
+
getWebhookListener(req: GetWebhookListenerRequest, headers?: object, signal?: AbortSignal): Promise<GetWebhookListenerResponse>
|
|
257
|
+
|
|
258
|
+
listTokenPrices(req: ListTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<ListTokenPricesResponse>
|
|
259
|
+
|
|
260
|
+
pauseAllWebhookListeners(
|
|
261
|
+
req: PauseAllWebhookListenersRequest,
|
|
262
|
+
headers?: object,
|
|
263
|
+
signal?: AbortSignal
|
|
264
|
+
): Promise<PauseAllWebhookListenersResponse>
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Ping the indexer
|
|
268
|
+
*/
|
|
269
|
+
ping(headers?: object, signal?: AbortSignal): Promise<PingResponse>
|
|
270
|
+
|
|
271
|
+
removeAllWebhookListeners(
|
|
272
|
+
req: RemoveAllWebhookListenersRequest,
|
|
273
|
+
headers?: object,
|
|
274
|
+
signal?: AbortSignal
|
|
275
|
+
): Promise<RemoveAllWebhookListenersResponse>
|
|
276
|
+
|
|
277
|
+
removeWebhookListener(
|
|
278
|
+
req: RemoveWebhookListenerRequest,
|
|
279
|
+
headers?: object,
|
|
280
|
+
signal?: AbortSignal
|
|
281
|
+
): Promise<RemoveWebhookListenerResponse>
|
|
282
|
+
|
|
283
|
+
resumeAllWebhookListeners(
|
|
284
|
+
req: ResumeAllWebhookListenersRequest,
|
|
285
|
+
headers?: object,
|
|
286
|
+
signal?: AbortSignal
|
|
287
|
+
): Promise<ResumeAllWebhookListenersResponse>
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Get the current runtime health status of the indexer
|
|
291
|
+
*/
|
|
292
|
+
runtimeStatus(headers?: object, signal?: AbortSignal): Promise<RuntimeStatusResponse>
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* SubscribeBalanceUpdates listens to balance updates for a specific contract address
|
|
296
|
+
*/
|
|
297
|
+
subscribeBalanceUpdates(
|
|
298
|
+
req: SubscribeBalanceUpdatesRequest,
|
|
299
|
+
options: WebrpcStreamOptions<SubscribeBalanceUpdatesResponse>
|
|
300
|
+
): WebrpcStreamController
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* SubscribeEvents listens to events on-chain based on the filter criteria
|
|
304
|
+
*
|
|
305
|
+
* TODO: some additional options can be passed such as block, reorg true, etc.
|
|
306
|
+
* or stay behind, etc.
|
|
307
|
+
*/
|
|
308
|
+
subscribeEvents(req: SubscribeEventsRequest, options: WebrpcStreamOptions<SubscribeEventsResponse>): WebrpcStreamController
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Listen to transaction receipts on-chain based on the filter criteria
|
|
312
|
+
*/
|
|
313
|
+
subscribeReceipts(
|
|
314
|
+
req: SubscribeReceiptsRequest,
|
|
315
|
+
options: WebrpcStreamOptions<SubscribeReceiptsResponse>
|
|
316
|
+
): WebrpcStreamController
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Re-sync an incorrect token balance with the correct on-chain balance
|
|
320
|
+
* NOTE: this method is almost never used, but we've marked it internal in case
|
|
321
|
+
* we ever want to use it again. This method was written a very long time ago in
|
|
322
|
+
* scenarios when the indexer had little bugs, but now its solid.
|
|
323
|
+
*/
|
|
324
|
+
syncBalance(req: SyncBalanceRequest, headers?: object, signal?: AbortSignal): Promise<SyncBalanceResponse>
|
|
325
|
+
|
|
326
|
+
toggleWebhookListener(
|
|
327
|
+
req: ToggleWebhookListenerRequest,
|
|
328
|
+
headers?: object,
|
|
329
|
+
signal?: AbortSignal
|
|
330
|
+
): Promise<ToggleWebhookListenerResponse>
|
|
331
|
+
|
|
332
|
+
updateWebhookListener(
|
|
333
|
+
req: UpdateWebhookListenerRequest,
|
|
334
|
+
headers?: object,
|
|
335
|
+
signal?: AbortSignal
|
|
336
|
+
): Promise<UpdateWebhookListenerResponse>
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Get the current version of the indexer
|
|
340
|
+
*/
|
|
341
|
+
version(headers?: object, signal?: AbortSignal): Promise<VersionResponse>
|
|
67
342
|
}
|
|
68
343
|
|
|
69
344
|
//
|
|
70
|
-
//
|
|
345
|
+
// Schema types
|
|
71
346
|
//
|
|
72
347
|
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
348
|
+
export interface Asset {
|
|
349
|
+
id: number
|
|
350
|
+
collectionId: number
|
|
351
|
+
tokenId?: string
|
|
352
|
+
url?: string
|
|
353
|
+
metadataField: string
|
|
354
|
+
name?: string
|
|
355
|
+
filesize?: number
|
|
356
|
+
mimeType?: string
|
|
357
|
+
width?: number
|
|
358
|
+
height?: number
|
|
359
|
+
updatedAt?: string
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export enum BackupMode {
|
|
363
|
+
INCREMENTAL = 'INCREMENTAL',
|
|
364
|
+
COMPLETE = 'COMPLETE'
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export interface BloomStats {
|
|
368
|
+
hitRatio: string
|
|
369
|
+
falsePositivesPercent: string
|
|
370
|
+
hitCount: number
|
|
371
|
+
missCount: number
|
|
372
|
+
falsePositives: number
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export interface BloomStatus {
|
|
376
|
+
enabled: boolean
|
|
377
|
+
initialized: boolean
|
|
378
|
+
bloomInitElapsedTime: string
|
|
379
|
+
stats: BloomStats
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface Bond {
|
|
383
|
+
pebble: PebbleMetrics
|
|
384
|
+
estimatedDiskUsagePerTable: any
|
|
385
|
+
estimatedDiskUsageTotal: string
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface ChainInfo {
|
|
389
|
+
chainId: number
|
|
390
|
+
chainName: string
|
|
77
391
|
}
|
|
78
392
|
|
|
79
393
|
export interface ContractInfo {
|
|
@@ -93,56 +407,29 @@ export interface ContractInfo {
|
|
|
93
407
|
status: ResourceStatus
|
|
94
408
|
}
|
|
95
409
|
|
|
96
|
-
export interface
|
|
97
|
-
|
|
98
|
-
description: string
|
|
99
|
-
categories: Array<string>
|
|
100
|
-
ogImage: string
|
|
101
|
-
ogName: string
|
|
102
|
-
originChainId: number
|
|
103
|
-
originAddress: string
|
|
104
|
-
blacklist: boolean
|
|
105
|
-
verified: boolean
|
|
106
|
-
verifiedBy: string
|
|
107
|
-
featured: boolean
|
|
108
|
-
featureIndex: number
|
|
410
|
+
export interface ContractInfoExtensionBridgeInfo {
|
|
411
|
+
tokenAddress: string
|
|
109
412
|
}
|
|
110
413
|
|
|
111
|
-
export interface
|
|
112
|
-
|
|
113
|
-
tokenId: string
|
|
114
|
-
source: string
|
|
115
|
-
name: string
|
|
116
|
-
description?: string
|
|
117
|
-
image?: string
|
|
118
|
-
video?: string
|
|
119
|
-
audio?: string
|
|
120
|
-
properties?: { [key: string]: any }
|
|
121
|
-
attributes: Array<{ [key: string]: any }>
|
|
122
|
-
image_data?: string
|
|
123
|
-
external_url?: string
|
|
124
|
-
background_color?: string
|
|
125
|
-
animation_url?: string
|
|
126
|
-
decimals?: number
|
|
127
|
-
updatedAt?: string
|
|
128
|
-
assets?: Array<Asset>
|
|
129
|
-
status: ResourceStatus
|
|
130
|
-
queuedAt?: string
|
|
131
|
-
lastFetched?: string
|
|
414
|
+
export interface ContractInfoExtensionIndexingInfo {
|
|
415
|
+
useOnChainBalance: boolean
|
|
132
416
|
}
|
|
133
417
|
|
|
134
|
-
export interface
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
418
|
+
export interface ContractInfoExtensions {
|
|
419
|
+
link?: string
|
|
420
|
+
description?: string
|
|
421
|
+
categories?: Array<string>
|
|
422
|
+
bridgeInfo?: { [key: string]: ContractInfoExtensionBridgeInfo }
|
|
423
|
+
indexingInfo?: ContractInfoExtensionIndexingInfo
|
|
424
|
+
ogImage?: string
|
|
425
|
+
ogName?: string
|
|
426
|
+
originChainId?: number
|
|
427
|
+
originAddress?: string
|
|
428
|
+
blacklist?: boolean
|
|
429
|
+
verified?: boolean
|
|
430
|
+
verifiedBy?: string
|
|
431
|
+
featured?: boolean
|
|
432
|
+
featureIndex?: number
|
|
146
433
|
}
|
|
147
434
|
|
|
148
435
|
export enum ContractType {
|
|
@@ -156,72 +443,73 @@ export enum ContractType {
|
|
|
156
443
|
ERC721_BRIDGE = 'ERC721_BRIDGE',
|
|
157
444
|
ERC1155_BRIDGE = 'ERC1155_BRIDGE',
|
|
158
445
|
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE',
|
|
446
|
+
ERC6909 = 'ERC6909'
|
|
159
447
|
}
|
|
160
448
|
|
|
161
|
-
export enum
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export enum EventLogDataType {
|
|
168
|
-
EVENT = 'EVENT',
|
|
169
|
-
TOKEN_TRANSFER = 'TOKEN_TRANSFER',
|
|
170
|
-
NATIVE_TOKEN_TRANSFER = 'NATIVE_TOKEN_TRANSFER',
|
|
171
|
-
SEQUENCE_TXN = 'SEQUENCE_TXN',
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export enum OrderStatus {
|
|
175
|
-
OPEN = 'OPEN',
|
|
176
|
-
CLOSED = 'CLOSED',
|
|
177
|
-
CANCELLED = 'CANCELLED',
|
|
449
|
+
export enum ContractVerificationStatus {
|
|
450
|
+
VERIFIED = 'VERIFIED',
|
|
451
|
+
UNVERIFIED = 'UNVERIFIED',
|
|
452
|
+
ALL = 'ALL'
|
|
178
453
|
}
|
|
179
454
|
|
|
180
|
-
export
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
455
|
+
export interface DiskUsage {
|
|
456
|
+
humanReadable: string
|
|
457
|
+
used: number
|
|
458
|
+
size: number
|
|
459
|
+
percent: number
|
|
460
|
+
dirs: { [key: string]: string }
|
|
184
461
|
}
|
|
185
462
|
|
|
186
|
-
export
|
|
187
|
-
|
|
188
|
-
|
|
463
|
+
export interface EtherBalance {
|
|
464
|
+
accountAddress: string
|
|
465
|
+
balanceWei: string
|
|
189
466
|
}
|
|
190
467
|
|
|
191
|
-
export
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
468
|
+
export interface EventDecoded {
|
|
469
|
+
topicHash: string
|
|
470
|
+
eventSig: string
|
|
471
|
+
types: Array<string>
|
|
472
|
+
names: Array<string>
|
|
473
|
+
values: Array<string>
|
|
195
474
|
}
|
|
196
475
|
|
|
197
|
-
export
|
|
198
|
-
|
|
199
|
-
|
|
476
|
+
export interface EventFilter {
|
|
477
|
+
events?: Array<string>
|
|
478
|
+
contractAddresses?: Array<string>
|
|
479
|
+
accounts?: Array<string>
|
|
480
|
+
tokenIDs?: Array<string>
|
|
200
481
|
}
|
|
201
482
|
|
|
202
|
-
export
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
483
|
+
export interface EventLog {
|
|
484
|
+
id: number
|
|
485
|
+
uid: string
|
|
486
|
+
type: EventLogType
|
|
487
|
+
blockNumber: number
|
|
488
|
+
blockHash: string
|
|
489
|
+
parentBlockHash: string
|
|
490
|
+
contractAddress: string
|
|
491
|
+
contractType: ContractType
|
|
492
|
+
txnHash: string
|
|
493
|
+
txnIndex: number
|
|
494
|
+
txnLogIndex: number
|
|
495
|
+
logDataType: EventLogDataType
|
|
496
|
+
ts: string
|
|
497
|
+
txnInfo?: TxnInfo
|
|
498
|
+
rawLog?: { [key: string]: any }
|
|
499
|
+
event?: EventDecoded
|
|
206
500
|
}
|
|
207
501
|
|
|
208
|
-
export
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
502
|
+
export enum EventLogDataType {
|
|
503
|
+
EVENT = 'EVENT',
|
|
504
|
+
TOKEN_TRANSFER = 'TOKEN_TRANSFER',
|
|
505
|
+
NATIVE_TOKEN_TRANSFER = 'NATIVE_TOKEN_TRANSFER',
|
|
506
|
+
SEQUENCE_TXN = 'SEQUENCE_TXN'
|
|
213
507
|
}
|
|
214
508
|
|
|
215
|
-
export
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
uptime: number
|
|
220
|
-
ver: string
|
|
221
|
-
branch: string
|
|
222
|
-
commitHash: string
|
|
223
|
-
chainID: number
|
|
224
|
-
checks: RuntimeChecks
|
|
509
|
+
export enum EventLogType {
|
|
510
|
+
UNKNOWN = 'UNKNOWN',
|
|
511
|
+
BLOCK_ADDED = 'BLOCK_ADDED',
|
|
512
|
+
BLOCK_REMOVED = 'BLOCK_REMOVED'
|
|
225
513
|
}
|
|
226
514
|
|
|
227
515
|
export interface GatewayBackendResponseTime {
|
|
@@ -235,6 +523,30 @@ export interface GatewayBackendRuntimeStatus {
|
|
|
235
523
|
responseTime: GatewayBackendResponseTime
|
|
236
524
|
}
|
|
237
525
|
|
|
526
|
+
export interface GatewayEtherBalance {
|
|
527
|
+
chainId: number
|
|
528
|
+
errorReason?: string
|
|
529
|
+
result: EtherBalance
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface GatewayNativeTokenBalance {
|
|
533
|
+
chainId: number
|
|
534
|
+
errorReason?: string
|
|
535
|
+
result: NativeTokenBalance
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export interface GatewayNativeTokenBalances {
|
|
539
|
+
chainId: number
|
|
540
|
+
errorReason?: string
|
|
541
|
+
results: Array<NativeTokenBalance>
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export interface GatewayPrice {
|
|
545
|
+
chainID: number
|
|
546
|
+
errorReason?: string
|
|
547
|
+
results: Array<Price>
|
|
548
|
+
}
|
|
549
|
+
|
|
238
550
|
export interface GatewayRuntimeStatus {
|
|
239
551
|
healthOK: boolean
|
|
240
552
|
startTime: string
|
|
@@ -245,43 +557,115 @@ export interface GatewayRuntimeStatus {
|
|
|
245
557
|
backends: Array<GatewayBackendRuntimeStatus>
|
|
246
558
|
}
|
|
247
559
|
|
|
248
|
-
export interface
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
560
|
+
export interface GatewayTokenBalance {
|
|
561
|
+
chainId: number
|
|
562
|
+
errorReason?: string
|
|
563
|
+
results: Array<TokenBalance>
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export interface GatewayTokenPriceQuery {
|
|
255
567
|
chainID: number
|
|
256
|
-
|
|
568
|
+
queries: Array<TokenPriceQuery>
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface GatewayTransaction {
|
|
572
|
+
chainId: number
|
|
573
|
+
errorReason?: string
|
|
574
|
+
results: Array<Transaction>
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export interface IndexState {
|
|
578
|
+
chainId: string
|
|
579
|
+
lastBlockNum: number
|
|
580
|
+
lastBlockHash: string
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export interface IndexedBlock {
|
|
584
|
+
blockNumber: number
|
|
585
|
+
blockShortHash: string
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export interface IndexerMetrics {
|
|
589
|
+
blocksPerSecond: number
|
|
590
|
+
eventsPerSecond: number
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export interface MarketplaceOrder {
|
|
594
|
+
orderId: string
|
|
595
|
+
tokenContract: string
|
|
596
|
+
tokenId: string
|
|
597
|
+
isListing: boolean
|
|
598
|
+
quantity: string
|
|
599
|
+
quantityRemaining: string
|
|
600
|
+
currencyAddress: string
|
|
601
|
+
pricePerToken: string
|
|
602
|
+
expiry: string
|
|
603
|
+
orderStatus: OrderStatus
|
|
604
|
+
createdBy: string
|
|
605
|
+
blockNumber: number
|
|
606
|
+
orderbookContractAddress: string
|
|
607
|
+
createdAt: number
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface MarketplaceOrderFilter {
|
|
611
|
+
isListing?: boolean
|
|
612
|
+
userAddresses?: Array<string>
|
|
613
|
+
currencyAddresses: Array<string>
|
|
614
|
+
orderIds: Array<string>
|
|
615
|
+
tokenIds: Array<string>
|
|
616
|
+
excludeUserAddresses?: Array<string>
|
|
617
|
+
blockNumberGt: number
|
|
618
|
+
createdAtAfter: number
|
|
619
|
+
orderStatuses: Array<OrderStatus>
|
|
620
|
+
returnExpired: boolean
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
export interface MarketplaceTopOrdersFilter {
|
|
624
|
+
currencyAddresses: Array<string>
|
|
625
|
+
tokenIds: Array<string>
|
|
626
|
+
isListing: boolean
|
|
627
|
+
priceSort: SortOrder
|
|
628
|
+
excludeUser?: string
|
|
257
629
|
}
|
|
258
630
|
|
|
259
|
-
export interface
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
quotaControlEnabled: boolean
|
|
264
|
-
syncMode: string
|
|
265
|
-
percentIndexed: number
|
|
266
|
-
lastBlockNum: number
|
|
267
|
-
lastBlockNumWithState: number
|
|
268
|
-
bloomStatus: BloomStatus
|
|
269
|
-
bond: Bond
|
|
270
|
-
diskUsage: DiskUsage
|
|
631
|
+
export interface MetadataOptions {
|
|
632
|
+
verifiedOnly?: boolean
|
|
633
|
+
unverifiedOnly?: boolean
|
|
634
|
+
includeContracts?: Array<string>
|
|
271
635
|
}
|
|
272
636
|
|
|
273
|
-
export interface
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
637
|
+
export interface NativeTokenBalance {
|
|
638
|
+
accountAddress: string
|
|
639
|
+
chainId: number
|
|
640
|
+
name: string
|
|
641
|
+
symbol: string
|
|
642
|
+
balance: string
|
|
643
|
+
balanceUSD: string
|
|
644
|
+
priceUSD: string
|
|
645
|
+
priceUpdatedAt?: string
|
|
646
|
+
errorReason?: string
|
|
279
647
|
}
|
|
280
648
|
|
|
281
|
-
export
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
649
|
+
export enum NetworkType {
|
|
650
|
+
MAINNETS = 'MAINNETS',
|
|
651
|
+
TESTNETS = 'TESTNETS',
|
|
652
|
+
ALL = 'ALL'
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export enum OrderStatus {
|
|
656
|
+
OPEN = 'OPEN',
|
|
657
|
+
CLOSED = 'CLOSED',
|
|
658
|
+
CANCELLED = 'CANCELLED'
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export interface Page {
|
|
662
|
+
page?: number
|
|
663
|
+
column?: string
|
|
664
|
+
before?: any
|
|
665
|
+
after?: any
|
|
666
|
+
sort?: Array<SortBy>
|
|
667
|
+
pageSize?: number
|
|
668
|
+
more?: boolean
|
|
285
669
|
}
|
|
286
670
|
|
|
287
671
|
export interface PebbleMetrics {
|
|
@@ -292,66 +676,54 @@ export interface PebbleMetrics {
|
|
|
292
676
|
compactionMarkedFiles: number
|
|
293
677
|
}
|
|
294
678
|
|
|
295
|
-
export interface
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
export interface EtherBalance {
|
|
302
|
-
accountAddress: string
|
|
303
|
-
balanceWei: string
|
|
679
|
+
export interface Price {
|
|
680
|
+
contractAddress: string
|
|
681
|
+
tokenID?: string
|
|
682
|
+
priceUSD: string
|
|
683
|
+
updatedAt?: string
|
|
304
684
|
}
|
|
305
685
|
|
|
306
|
-
export
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
error: string
|
|
686
|
+
export enum ResourceStatus {
|
|
687
|
+
NOT_AVAILABLE = 'NOT_AVAILABLE',
|
|
688
|
+
REFRESHING = 'REFRESHING',
|
|
689
|
+
AVAILABLE = 'AVAILABLE'
|
|
311
690
|
}
|
|
312
691
|
|
|
313
|
-
export interface
|
|
314
|
-
|
|
692
|
+
export interface RuntimeChecks {
|
|
693
|
+
running: boolean
|
|
694
|
+
runnables: any
|
|
695
|
+
cgoEnabled: boolean
|
|
696
|
+
quotaControlEnabled: boolean
|
|
697
|
+
syncMode: string
|
|
698
|
+
percentIndexed: number
|
|
315
699
|
lastBlockNum: number
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
blockShortHash: string
|
|
700
|
+
lastBlockNumWithState: number
|
|
701
|
+
bloomStatus: BloomStatus
|
|
702
|
+
bond: Bond
|
|
703
|
+
diskUsage: DiskUsage
|
|
704
|
+
metrics: IndexerMetrics
|
|
322
705
|
}
|
|
323
706
|
|
|
324
|
-
export interface
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
707
|
+
export interface RuntimeStatus {
|
|
708
|
+
healthOK: boolean
|
|
709
|
+
indexerEnabled: boolean
|
|
710
|
+
startTime: string
|
|
711
|
+
uptime: number
|
|
712
|
+
ver: string
|
|
713
|
+
branch: string
|
|
714
|
+
commitHash: string
|
|
715
|
+
chainID: number
|
|
716
|
+
checks: RuntimeChecks
|
|
328
717
|
}
|
|
329
718
|
|
|
330
|
-
export interface
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
type: EventLogType
|
|
334
|
-
blockNumber: number
|
|
335
|
-
blockHash: string
|
|
336
|
-
parentBlockHash: string
|
|
337
|
-
contractAddress: string
|
|
338
|
-
contractType: ContractType
|
|
339
|
-
txnHash: string
|
|
340
|
-
txnIndex: number
|
|
341
|
-
txnLogIndex: number
|
|
342
|
-
logDataType: EventLogDataType
|
|
343
|
-
ts: string
|
|
344
|
-
txnInfo?: TxnInfo
|
|
345
|
-
rawLog?: { [key: string]: any }
|
|
346
|
-
event?: EventDecoded
|
|
719
|
+
export interface SortBy {
|
|
720
|
+
column: string
|
|
721
|
+
order: SortOrder
|
|
347
722
|
}
|
|
348
723
|
|
|
349
|
-
export
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
types: Array<string>
|
|
353
|
-
names: Array<string>
|
|
354
|
-
values: Array<string>
|
|
724
|
+
export enum SortOrder {
|
|
725
|
+
DESC = 'DESC',
|
|
726
|
+
ASC = 'ASC'
|
|
355
727
|
}
|
|
356
728
|
|
|
357
729
|
export interface TokenBalance {
|
|
@@ -360,6 +732,9 @@ export interface TokenBalance {
|
|
|
360
732
|
accountAddress: string
|
|
361
733
|
tokenID?: string
|
|
362
734
|
balance: string
|
|
735
|
+
balanceUSD: string
|
|
736
|
+
priceUSD: string
|
|
737
|
+
priceUpdatedAt?: string
|
|
363
738
|
blockHash: string
|
|
364
739
|
blockNumber: number
|
|
365
740
|
chainId: number
|
|
@@ -369,39 +744,32 @@ export interface TokenBalance {
|
|
|
369
744
|
tokenMetadata?: TokenMetadata
|
|
370
745
|
}
|
|
371
746
|
|
|
372
|
-
export interface
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
tokenId: string
|
|
376
|
-
isListing: boolean
|
|
377
|
-
quantity: string
|
|
378
|
-
quantityRemaining: string
|
|
379
|
-
currencyAddress: string
|
|
380
|
-
pricePerToken: string
|
|
381
|
-
expiry: string
|
|
382
|
-
orderStatus: OrderStatus
|
|
383
|
-
createdBy: string
|
|
384
|
-
blockNumber: number
|
|
385
|
-
orderbookContractAddress: string
|
|
386
|
-
createdAt: number
|
|
747
|
+
export interface TokenBalanceFilter {
|
|
748
|
+
contractAddress: string
|
|
749
|
+
sinceBlockNumber: number
|
|
387
750
|
}
|
|
388
751
|
|
|
389
|
-
export interface
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
752
|
+
export interface TokenBalancesByContractFilter {
|
|
753
|
+
contractAddresses: Array<string>
|
|
754
|
+
accountAddresses?: Array<string>
|
|
755
|
+
contractStatus?: ContractVerificationStatus
|
|
756
|
+
tokenIDs?: Array<string>
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export interface TokenBalancesFilter {
|
|
760
|
+
accountAddresses: Array<string>
|
|
761
|
+
contractStatus?: ContractVerificationStatus
|
|
762
|
+
contractTypes?: Array<string>
|
|
763
|
+
contractWhitelist?: Array<string>
|
|
764
|
+
contractBlacklist?: Array<string>
|
|
765
|
+
omitNativeBalances: boolean
|
|
766
|
+
omitPrices?: boolean
|
|
767
|
+
tokenIDs?: Array<string>
|
|
399
768
|
}
|
|
400
769
|
|
|
401
770
|
export interface TokenHistory {
|
|
402
771
|
blockNumber: number
|
|
403
772
|
blockHash: string
|
|
404
|
-
accountAddress: string
|
|
405
773
|
contractAddress: string
|
|
406
774
|
contractType: ContractType
|
|
407
775
|
fromAddress: string
|
|
@@ -409,12 +777,45 @@ export interface TokenHistory {
|
|
|
409
777
|
txnHash: string
|
|
410
778
|
txnIndex: number
|
|
411
779
|
txnLogIndex: number
|
|
412
|
-
logData: string
|
|
413
780
|
tokenIDs: string
|
|
414
|
-
|
|
781
|
+
amounts: string
|
|
415
782
|
ts: string
|
|
416
783
|
}
|
|
417
784
|
|
|
785
|
+
export interface TokenIDRange {
|
|
786
|
+
start: string
|
|
787
|
+
end: string
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
export interface TokenMetadata {
|
|
791
|
+
chainId?: number
|
|
792
|
+
contractAddress?: string
|
|
793
|
+
tokenId: string
|
|
794
|
+
source: string
|
|
795
|
+
name: string
|
|
796
|
+
description?: string
|
|
797
|
+
image?: string
|
|
798
|
+
video?: string
|
|
799
|
+
audio?: string
|
|
800
|
+
properties?: { [key: string]: any }
|
|
801
|
+
attributes: Array<{ [key: string]: any }>
|
|
802
|
+
image_data?: string
|
|
803
|
+
external_url?: string
|
|
804
|
+
background_color?: string
|
|
805
|
+
animation_url?: string
|
|
806
|
+
decimals?: number
|
|
807
|
+
updatedAt?: string
|
|
808
|
+
assets?: Array<Asset>
|
|
809
|
+
status: ResourceStatus
|
|
810
|
+
queuedAt?: string
|
|
811
|
+
lastFetched?: string
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
export interface TokenPriceQuery {
|
|
815
|
+
contractAddress: string
|
|
816
|
+
tokenID?: string
|
|
817
|
+
}
|
|
818
|
+
|
|
418
819
|
export interface TokenSupply {
|
|
419
820
|
tokenID: string
|
|
420
821
|
supply: string
|
|
@@ -433,17 +834,12 @@ export interface Transaction {
|
|
|
433
834
|
timestamp: string
|
|
434
835
|
}
|
|
435
836
|
|
|
436
|
-
export interface
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
tokenIds?: Array<string>
|
|
443
|
-
amounts: Array<string>
|
|
444
|
-
logIndex: number
|
|
445
|
-
contractInfo?: ContractInfo
|
|
446
|
-
tokenMetadata?: { [key: string]: TokenMetadata }
|
|
837
|
+
export interface TransactionFilter {
|
|
838
|
+
txnHash?: string
|
|
839
|
+
from?: string
|
|
840
|
+
to?: string
|
|
841
|
+
contractAddress?: string
|
|
842
|
+
event?: string
|
|
447
843
|
}
|
|
448
844
|
|
|
449
845
|
export interface TransactionHistoryFilter {
|
|
@@ -456,14 +852,14 @@ export interface TransactionHistoryFilter {
|
|
|
456
852
|
fromBlock?: number
|
|
457
853
|
toBlock?: number
|
|
458
854
|
tokenID?: string
|
|
855
|
+
omitPrices?: boolean
|
|
459
856
|
}
|
|
460
857
|
|
|
461
|
-
export interface
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
event?: string
|
|
858
|
+
export interface TransactionLog {
|
|
859
|
+
contractAddress: string
|
|
860
|
+
topics: Array<string>
|
|
861
|
+
data: string
|
|
862
|
+
index: number
|
|
467
863
|
}
|
|
468
864
|
|
|
469
865
|
export interface TransactionReceipt {
|
|
@@ -482,31 +878,60 @@ export interface TransactionReceipt {
|
|
|
482
878
|
reorged: boolean
|
|
483
879
|
}
|
|
484
880
|
|
|
485
|
-
export
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
data: string
|
|
489
|
-
index: number
|
|
881
|
+
export enum TransactionStatus {
|
|
882
|
+
FAILED = 'FAILED',
|
|
883
|
+
SUCCESSFUL = 'SUCCESSFUL'
|
|
490
884
|
}
|
|
491
885
|
|
|
492
|
-
export
|
|
493
|
-
|
|
494
|
-
|
|
886
|
+
export enum TransactionType {
|
|
887
|
+
LegacyTxnType = 'LegacyTxnType',
|
|
888
|
+
AccessListTxnType = 'AccessListTxnType',
|
|
889
|
+
DynamicFeeTxnType = 'DynamicFeeTxnType'
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export interface TxnInfo {
|
|
893
|
+
from: string
|
|
894
|
+
to: string
|
|
895
|
+
value: string
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export interface TxnTransfer {
|
|
899
|
+
transferType: TxnTransferType
|
|
900
|
+
contractAddress: string
|
|
901
|
+
contractType: ContractType
|
|
902
|
+
from: string
|
|
903
|
+
to: string
|
|
904
|
+
tokenIds?: Array<string>
|
|
905
|
+
amounts: Array<string>
|
|
906
|
+
logIndex: number
|
|
907
|
+
amountsUSD?: Array<string>
|
|
908
|
+
pricesUSD?: Array<string>
|
|
909
|
+
contractInfo?: ContractInfo
|
|
910
|
+
tokenMetadata?: { [key: string]: TokenMetadata }
|
|
495
911
|
}
|
|
496
912
|
|
|
497
|
-
export
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
after?: any
|
|
502
|
-
sort?: Array<SortBy>
|
|
503
|
-
pageSize?: number
|
|
504
|
-
more?: boolean
|
|
913
|
+
export enum TxnTransferType {
|
|
914
|
+
UNKNOWN = 'UNKNOWN',
|
|
915
|
+
SEND = 'SEND',
|
|
916
|
+
RECEIVE = 'RECEIVE'
|
|
505
917
|
}
|
|
506
918
|
|
|
507
|
-
export interface
|
|
508
|
-
|
|
509
|
-
|
|
919
|
+
export interface Version {
|
|
920
|
+
webrpcVersion: string
|
|
921
|
+
schemaVersion: string
|
|
922
|
+
schemaHash: string
|
|
923
|
+
appVersion: string
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
export interface WALWriterRuntimeStatus {
|
|
927
|
+
healthOK: boolean
|
|
928
|
+
startTime: string
|
|
929
|
+
uptime: number
|
|
930
|
+
ver: string
|
|
931
|
+
branch: string
|
|
932
|
+
commitHash: string
|
|
933
|
+
chainID: number
|
|
934
|
+
percentWALWritten: number
|
|
510
935
|
}
|
|
511
936
|
|
|
512
937
|
export interface WebhookListener {
|
|
@@ -519,469 +944,345 @@ export interface WebhookListener {
|
|
|
519
944
|
active: boolean
|
|
520
945
|
}
|
|
521
946
|
|
|
522
|
-
export interface
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
tokenIDs?: Array<string>
|
|
947
|
+
export interface AddWebhookListenerRequest {
|
|
948
|
+
url: string
|
|
949
|
+
filters: EventFilter
|
|
950
|
+
projectId?: number
|
|
527
951
|
}
|
|
528
952
|
|
|
529
|
-
export interface
|
|
530
|
-
|
|
531
|
-
|
|
953
|
+
export interface AddWebhookListenerResponse {
|
|
954
|
+
status: boolean
|
|
955
|
+
listener: WebhookListener
|
|
532
956
|
}
|
|
533
957
|
|
|
534
|
-
export interface
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
includeContracts?: Array<string>
|
|
958
|
+
export interface FetchTransactionReceiptRequest {
|
|
959
|
+
txnHash: string
|
|
960
|
+
maxBlockWait?: number
|
|
538
961
|
}
|
|
539
962
|
|
|
540
|
-
export interface
|
|
541
|
-
|
|
542
|
-
contractStatus?: ContractVerificationStatus
|
|
543
|
-
contractTypes?: Array<string>
|
|
544
|
-
contractWhitelist?: Array<string>
|
|
545
|
-
contractBlacklist?: Array<string>
|
|
546
|
-
omitNativeBalances: boolean
|
|
963
|
+
export interface FetchTransactionReceiptResponse {
|
|
964
|
+
receipt: TransactionReceipt
|
|
547
965
|
}
|
|
548
966
|
|
|
549
|
-
export interface
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
contractStatus?: ContractVerificationStatus
|
|
967
|
+
export interface FetchTransactionReceiptWithFilterRequest {
|
|
968
|
+
filter: TransactionFilter
|
|
969
|
+
maxBlockWait?: number
|
|
553
970
|
}
|
|
554
971
|
|
|
555
|
-
export interface
|
|
556
|
-
|
|
557
|
-
error: string
|
|
558
|
-
result: EtherBalance
|
|
972
|
+
export interface FetchTransactionReceiptWithFilterResponse {
|
|
973
|
+
receipt: TransactionReceipt
|
|
559
974
|
}
|
|
560
975
|
|
|
561
|
-
export interface
|
|
562
|
-
|
|
563
|
-
error: string
|
|
564
|
-
result: NativeTokenBalance
|
|
976
|
+
export interface GetAllWebhookListenersRequest {
|
|
977
|
+
projectId?: number
|
|
565
978
|
}
|
|
566
979
|
|
|
567
|
-
export interface
|
|
568
|
-
|
|
569
|
-
error: string
|
|
570
|
-
results: Array<NativeTokenBalance>
|
|
980
|
+
export interface GetAllWebhookListenersResponse {
|
|
981
|
+
listeners: Array<WebhookListener>
|
|
571
982
|
}
|
|
572
983
|
|
|
573
|
-
export interface
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
984
|
+
export interface GetBalanceUpdatesRequest {
|
|
985
|
+
contractAddress: string
|
|
986
|
+
lastBlockNumber: number
|
|
987
|
+
lastBlockHash?: string
|
|
988
|
+
page?: Page
|
|
577
989
|
}
|
|
578
990
|
|
|
579
|
-
export interface
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
runtimeStatus(headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn>
|
|
583
|
-
getChainID(headers?: object, signal?: AbortSignal): Promise<GetChainIDReturn>
|
|
584
|
-
getEtherBalance(args: GetEtherBalanceArgs, headers?: object, signal?: AbortSignal): Promise<GetEtherBalanceReturn>
|
|
585
|
-
getNativeTokenBalance(
|
|
586
|
-
args: GetNativeTokenBalanceArgs,
|
|
587
|
-
headers?: object,
|
|
588
|
-
signal?: AbortSignal,
|
|
589
|
-
): Promise<GetNativeTokenBalanceReturn>
|
|
590
|
-
getTokenBalancesSummary(
|
|
591
|
-
args: GetTokenBalancesSummaryArgs,
|
|
592
|
-
headers?: object,
|
|
593
|
-
signal?: AbortSignal,
|
|
594
|
-
): Promise<GetTokenBalancesSummaryReturn>
|
|
595
|
-
getTokenBalancesDetails(
|
|
596
|
-
args: GetTokenBalancesDetailsArgs,
|
|
597
|
-
headers?: object,
|
|
598
|
-
signal?: AbortSignal,
|
|
599
|
-
): Promise<GetTokenBalancesDetailsReturn>
|
|
600
|
-
getTokenBalancesByContract(
|
|
601
|
-
args: GetTokenBalancesByContractArgs,
|
|
602
|
-
headers?: object,
|
|
603
|
-
signal?: AbortSignal,
|
|
604
|
-
): Promise<GetTokenBalancesByContractReturn>
|
|
605
|
-
getTokenBalances(args: GetTokenBalancesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesReturn>
|
|
606
|
-
getTokenSupplies(args: GetTokenSuppliesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenSuppliesReturn>
|
|
607
|
-
getTokenSuppliesMap(
|
|
608
|
-
args: GetTokenSuppliesMapArgs,
|
|
609
|
-
headers?: object,
|
|
610
|
-
signal?: AbortSignal,
|
|
611
|
-
): Promise<GetTokenSuppliesMapReturn>
|
|
612
|
-
getTokenIDs(args: GetTokenIDsArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenIDsReturn>
|
|
613
|
-
getTokenIDRanges(args: GetTokenIDRangesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenIDRangesReturn>
|
|
614
|
-
getBalanceUpdates(
|
|
615
|
-
args: GetBalanceUpdatesArgs,
|
|
616
|
-
headers?: object,
|
|
617
|
-
signal?: AbortSignal,
|
|
618
|
-
): Promise<GetBalanceUpdatesReturn>
|
|
619
|
-
getTransactionHistory(
|
|
620
|
-
args: GetTransactionHistoryArgs,
|
|
621
|
-
headers?: object,
|
|
622
|
-
signal?: AbortSignal,
|
|
623
|
-
): Promise<GetTransactionHistoryReturn>
|
|
624
|
-
fetchTransactionReceipt(
|
|
625
|
-
args: FetchTransactionReceiptArgs,
|
|
626
|
-
headers?: object,
|
|
627
|
-
signal?: AbortSignal,
|
|
628
|
-
): Promise<FetchTransactionReceiptReturn>
|
|
629
|
-
fetchTransactionReceiptWithFilter(
|
|
630
|
-
args: FetchTransactionReceiptWithFilterArgs,
|
|
631
|
-
headers?: object,
|
|
632
|
-
signal?: AbortSignal,
|
|
633
|
-
): Promise<FetchTransactionReceiptWithFilterReturn>
|
|
634
|
-
subscribeReceipts(args: SubscribeReceiptsArgs, options: WebrpcStreamOptions<SubscribeReceiptsReturn>): Promise<void>
|
|
635
|
-
subscribeEvents(args: SubscribeEventsArgs, options: WebrpcStreamOptions<SubscribeEventsReturn>): Promise<void>
|
|
636
|
-
subscribeBalanceUpdates(
|
|
637
|
-
args: SubscribeBalanceUpdatesArgs,
|
|
638
|
-
options: WebrpcStreamOptions<SubscribeBalanceUpdatesReturn>,
|
|
639
|
-
): Promise<void>
|
|
640
|
-
syncBalance(args: SyncBalanceArgs, headers?: object, signal?: AbortSignal): Promise<SyncBalanceReturn>
|
|
641
|
-
getAllWebhookListeners(
|
|
642
|
-
args: GetAllWebhookListenersArgs,
|
|
643
|
-
headers?: object,
|
|
644
|
-
signal?: AbortSignal,
|
|
645
|
-
): Promise<GetAllWebhookListenersReturn>
|
|
646
|
-
getWebhookListener(
|
|
647
|
-
args: GetWebhookListenerArgs,
|
|
648
|
-
headers?: object,
|
|
649
|
-
signal?: AbortSignal,
|
|
650
|
-
): Promise<GetWebhookListenerReturn>
|
|
651
|
-
addWebhookListener(
|
|
652
|
-
args: AddWebhookListenerArgs,
|
|
653
|
-
headers?: object,
|
|
654
|
-
signal?: AbortSignal,
|
|
655
|
-
): Promise<AddWebhookListenerReturn>
|
|
656
|
-
updateWebhookListener(
|
|
657
|
-
args: UpdateWebhookListenerArgs,
|
|
658
|
-
headers?: object,
|
|
659
|
-
signal?: AbortSignal,
|
|
660
|
-
): Promise<UpdateWebhookListenerReturn>
|
|
661
|
-
removeWebhookListener(
|
|
662
|
-
args: RemoveWebhookListenerArgs,
|
|
663
|
-
headers?: object,
|
|
664
|
-
signal?: AbortSignal,
|
|
665
|
-
): Promise<RemoveWebhookListenerReturn>
|
|
666
|
-
removeAllWebhookListeners(
|
|
667
|
-
args: RemoveAllWebhookListenersArgs,
|
|
668
|
-
headers?: object,
|
|
669
|
-
signal?: AbortSignal,
|
|
670
|
-
): Promise<RemoveAllWebhookListenersReturn>
|
|
671
|
-
toggleWebhookListener(
|
|
672
|
-
args: ToggleWebhookListenerArgs,
|
|
673
|
-
headers?: object,
|
|
674
|
-
signal?: AbortSignal,
|
|
675
|
-
): Promise<ToggleWebhookListenerReturn>
|
|
676
|
-
pauseAllWebhookListeners(
|
|
677
|
-
args: PauseAllWebhookListenersArgs,
|
|
678
|
-
headers?: object,
|
|
679
|
-
signal?: AbortSignal,
|
|
680
|
-
): Promise<PauseAllWebhookListenersReturn>
|
|
681
|
-
resumeAllWebhookListeners(
|
|
682
|
-
args: ResumeAllWebhookListenersArgs,
|
|
683
|
-
headers?: object,
|
|
684
|
-
signal?: AbortSignal,
|
|
685
|
-
): Promise<ResumeAllWebhookListenersReturn>
|
|
686
|
-
getOrderbookOrders(
|
|
687
|
-
args: GetOrderbookOrdersArgs,
|
|
688
|
-
headers?: object,
|
|
689
|
-
signal?: AbortSignal,
|
|
690
|
-
): Promise<GetOrderbookOrdersReturn>
|
|
691
|
-
getTopOrders(args: GetTopOrdersArgs, headers?: object, signal?: AbortSignal): Promise<GetTopOrdersReturn>
|
|
991
|
+
export interface GetBalanceUpdatesResponse {
|
|
992
|
+
page: Page
|
|
993
|
+
balances: Array<TokenBalance>
|
|
692
994
|
}
|
|
693
995
|
|
|
694
|
-
export interface
|
|
996
|
+
export interface GetChainIDRequest {}
|
|
695
997
|
|
|
696
|
-
export interface
|
|
697
|
-
|
|
998
|
+
export interface GetChainIDResponse {
|
|
999
|
+
chainID: number
|
|
698
1000
|
}
|
|
699
|
-
export interface VersionArgs {}
|
|
700
1001
|
|
|
701
|
-
export interface
|
|
702
|
-
|
|
1002
|
+
export interface GetEtherBalanceRequest {
|
|
1003
|
+
accountAddress?: string
|
|
703
1004
|
}
|
|
704
|
-
export interface RuntimeStatusArgs {}
|
|
705
1005
|
|
|
706
|
-
export interface
|
|
707
|
-
|
|
1006
|
+
export interface GetEtherBalanceResponse {
|
|
1007
|
+
balance: EtherBalance
|
|
708
1008
|
}
|
|
709
|
-
export interface GetChainIDArgs {}
|
|
710
1009
|
|
|
711
|
-
export interface
|
|
712
|
-
|
|
1010
|
+
export interface GetMarketplaceOrdersRequest {
|
|
1011
|
+
marketplaceContractAddress: string
|
|
1012
|
+
collectionAddress: string
|
|
1013
|
+
filter?: MarketplaceOrderFilter
|
|
1014
|
+
page?: Page
|
|
713
1015
|
}
|
|
714
|
-
|
|
715
|
-
|
|
1016
|
+
|
|
1017
|
+
export interface GetMarketplaceOrdersResponse {
|
|
1018
|
+
page?: Page
|
|
1019
|
+
orders: Array<MarketplaceOrder>
|
|
716
1020
|
}
|
|
717
1021
|
|
|
718
|
-
export interface
|
|
719
|
-
|
|
1022
|
+
export interface GetMarketplaceTopOrdersRequest {
|
|
1023
|
+
marketplaceContractAddress: string
|
|
1024
|
+
collectionAddress: string
|
|
1025
|
+
filter: MarketplaceTopOrdersFilter
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
export interface GetMarketplaceTopOrdersResponse {
|
|
1029
|
+
orders: Array<MarketplaceOrder>
|
|
720
1030
|
}
|
|
721
|
-
|
|
1031
|
+
|
|
1032
|
+
export interface GetNativeTokenBalanceRequest {
|
|
722
1033
|
accountAddress?: string
|
|
1034
|
+
omitPrices?: boolean
|
|
723
1035
|
}
|
|
724
1036
|
|
|
725
|
-
export interface
|
|
1037
|
+
export interface GetNativeTokenBalanceResponse {
|
|
726
1038
|
balance: NativeTokenBalance
|
|
727
1039
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
1040
|
+
|
|
1041
|
+
export interface GetTokenBalancesRequest {
|
|
1042
|
+
accountAddress?: string
|
|
1043
|
+
contractAddress?: string
|
|
1044
|
+
tokenID?: string
|
|
1045
|
+
includeMetadata?: boolean
|
|
1046
|
+
metadataOptions?: MetadataOptions
|
|
1047
|
+
includeCollectionTokens?: boolean
|
|
731
1048
|
page?: Page
|
|
732
1049
|
}
|
|
733
1050
|
|
|
734
|
-
export interface
|
|
1051
|
+
export interface GetTokenBalancesResponse {
|
|
735
1052
|
page: Page
|
|
736
|
-
nativeBalances: Array<NativeTokenBalance>
|
|
737
1053
|
balances: Array<TokenBalance>
|
|
738
1054
|
}
|
|
739
|
-
|
|
740
|
-
|
|
1055
|
+
|
|
1056
|
+
export interface GetTokenBalancesByContractRequest {
|
|
1057
|
+
filter: TokenBalancesByContractFilter
|
|
741
1058
|
omitMetadata?: boolean
|
|
742
1059
|
page?: Page
|
|
743
1060
|
}
|
|
744
1061
|
|
|
745
|
-
export interface
|
|
1062
|
+
export interface GetTokenBalancesByContractResponse {
|
|
746
1063
|
page: Page
|
|
747
|
-
nativeBalances: Array<NativeTokenBalance>
|
|
748
1064
|
balances: Array<TokenBalance>
|
|
749
1065
|
}
|
|
750
|
-
|
|
751
|
-
|
|
1066
|
+
|
|
1067
|
+
export interface GetTokenBalancesDetailsRequest {
|
|
1068
|
+
filter: TokenBalancesFilter
|
|
752
1069
|
omitMetadata?: boolean
|
|
753
1070
|
page?: Page
|
|
754
1071
|
}
|
|
755
1072
|
|
|
756
|
-
export interface
|
|
1073
|
+
export interface GetTokenBalancesDetailsResponse {
|
|
757
1074
|
page: Page
|
|
1075
|
+
nativeBalances: Array<NativeTokenBalance>
|
|
758
1076
|
balances: Array<TokenBalance>
|
|
759
1077
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
includeMetadata?: boolean
|
|
765
|
-
metadataOptions?: MetadataOptions
|
|
766
|
-
includeCollectionTokens?: boolean
|
|
1078
|
+
|
|
1079
|
+
export interface GetTokenBalancesSummaryRequest {
|
|
1080
|
+
filter: TokenBalancesFilter
|
|
1081
|
+
omitMetadata?: boolean
|
|
767
1082
|
page?: Page
|
|
768
1083
|
}
|
|
769
1084
|
|
|
770
|
-
export interface
|
|
1085
|
+
export interface GetTokenBalancesSummaryResponse {
|
|
771
1086
|
page: Page
|
|
1087
|
+
nativeBalances: Array<NativeTokenBalance>
|
|
772
1088
|
balances: Array<TokenBalance>
|
|
773
1089
|
}
|
|
774
|
-
|
|
1090
|
+
|
|
1091
|
+
export interface GetTokenIDRangesRequest {
|
|
775
1092
|
contractAddress: string
|
|
776
|
-
|
|
777
|
-
metadataOptions?: MetadataOptions
|
|
778
|
-
page?: Page
|
|
1093
|
+
lastTokenID?: string
|
|
779
1094
|
}
|
|
780
1095
|
|
|
781
|
-
export interface
|
|
782
|
-
page: Page
|
|
1096
|
+
export interface GetTokenIDRangesResponse {
|
|
783
1097
|
contractType: ContractType
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
export interface GetTokenSuppliesMapArgs {
|
|
787
|
-
tokenMap: { [key: string]: Array<string> }
|
|
788
|
-
includeMetadata?: boolean
|
|
789
|
-
metadataOptions?: MetadataOptions
|
|
1098
|
+
tokenIDRanges: Array<TokenIDRange>
|
|
1099
|
+
moreRanges: boolean
|
|
790
1100
|
}
|
|
791
1101
|
|
|
792
|
-
export interface
|
|
793
|
-
supplies: { [key: string]: Array<TokenSupply> }
|
|
794
|
-
}
|
|
795
|
-
export interface GetTokenIDsArgs {
|
|
1102
|
+
export interface GetTokenIDsRequest {
|
|
796
1103
|
contractAddress: string
|
|
797
1104
|
page?: Page
|
|
798
1105
|
}
|
|
799
1106
|
|
|
800
|
-
export interface
|
|
1107
|
+
export interface GetTokenIDsResponse {
|
|
801
1108
|
page: Page
|
|
802
1109
|
contractType: ContractType
|
|
803
1110
|
tokenIDs: Array<string>
|
|
804
1111
|
}
|
|
805
|
-
|
|
806
|
-
|
|
1112
|
+
|
|
1113
|
+
export interface GetTokenPriceRequest {
|
|
1114
|
+
q: TokenPriceQuery
|
|
807
1115
|
}
|
|
808
1116
|
|
|
809
|
-
export interface
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1117
|
+
export interface GetTokenPriceResponse {
|
|
1118
|
+
price: Price
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
export interface GetTokenPricesRequest {
|
|
1122
|
+
q: Array<TokenPriceQuery>
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export interface GetTokenPricesResponse {
|
|
1126
|
+
prices: Array<Price>
|
|
813
1127
|
}
|
|
814
|
-
|
|
1128
|
+
|
|
1129
|
+
export interface GetTokenSuppliesRequest {
|
|
815
1130
|
contractAddress: string
|
|
816
|
-
|
|
817
|
-
lastBlockHash?: string
|
|
1131
|
+
includeMetadata?: boolean
|
|
818
1132
|
page?: Page
|
|
819
1133
|
}
|
|
820
1134
|
|
|
821
|
-
export interface
|
|
1135
|
+
export interface GetTokenSuppliesResponse {
|
|
822
1136
|
page: Page
|
|
823
|
-
|
|
1137
|
+
contractType: ContractType
|
|
1138
|
+
tokenIDs: Array<TokenSupply>
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export interface GetTokenSuppliesMapRequest {
|
|
1142
|
+
tokenMap: { [key: string]: Array<string> }
|
|
1143
|
+
includeMetadata?: boolean
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
export interface GetTokenSuppliesMapResponse {
|
|
1147
|
+
supplies: { [key: string]: Array<TokenSupply> }
|
|
824
1148
|
}
|
|
825
|
-
|
|
1149
|
+
|
|
1150
|
+
export interface GetTransactionHistoryRequest {
|
|
826
1151
|
filter: TransactionHistoryFilter
|
|
827
1152
|
page?: Page
|
|
828
1153
|
includeMetadata?: boolean
|
|
829
1154
|
metadataOptions?: MetadataOptions
|
|
830
1155
|
}
|
|
831
1156
|
|
|
832
|
-
export interface
|
|
1157
|
+
export interface GetTransactionHistoryResponse {
|
|
833
1158
|
page: Page
|
|
834
1159
|
transactions: Array<Transaction>
|
|
835
1160
|
}
|
|
836
|
-
export interface FetchTransactionReceiptArgs {
|
|
837
|
-
txnHash: string
|
|
838
|
-
maxBlockWait?: number
|
|
839
|
-
}
|
|
840
1161
|
|
|
841
|
-
export interface
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
export interface FetchTransactionReceiptWithFilterArgs {
|
|
845
|
-
filter: TransactionFilter
|
|
846
|
-
maxBlockWait?: number
|
|
1162
|
+
export interface GetWebhookListenerRequest {
|
|
1163
|
+
id: number
|
|
1164
|
+
projectId?: number
|
|
847
1165
|
}
|
|
848
1166
|
|
|
849
|
-
export interface
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
export interface SubscribeReceiptsArgs {
|
|
853
|
-
filter: TransactionFilter
|
|
1167
|
+
export interface GetWebhookListenerResponse {
|
|
1168
|
+
listener: WebhookListener
|
|
854
1169
|
}
|
|
855
1170
|
|
|
856
|
-
export interface
|
|
857
|
-
|
|
858
|
-
}
|
|
859
|
-
export interface SubscribeEventsArgs {
|
|
860
|
-
filter: EventFilter
|
|
1171
|
+
export interface ListTokenPricesRequest {
|
|
1172
|
+
page?: Page
|
|
861
1173
|
}
|
|
862
1174
|
|
|
863
|
-
export interface
|
|
864
|
-
|
|
1175
|
+
export interface ListTokenPricesResponse {
|
|
1176
|
+
page: Page
|
|
1177
|
+
prices: Array<Price>
|
|
865
1178
|
}
|
|
866
|
-
|
|
867
|
-
|
|
1179
|
+
|
|
1180
|
+
export interface PauseAllWebhookListenersRequest {
|
|
1181
|
+
projectId?: number
|
|
868
1182
|
}
|
|
869
1183
|
|
|
870
|
-
export interface
|
|
871
|
-
|
|
1184
|
+
export interface PauseAllWebhookListenersResponse {
|
|
1185
|
+
status: boolean
|
|
872
1186
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1187
|
+
|
|
1188
|
+
export interface PingRequest {}
|
|
1189
|
+
|
|
1190
|
+
export interface PingResponse {
|
|
1191
|
+
status: boolean
|
|
877
1192
|
}
|
|
878
1193
|
|
|
879
|
-
export interface
|
|
880
|
-
export interface GetAllWebhookListenersArgs {
|
|
1194
|
+
export interface RemoveAllWebhookListenersRequest {
|
|
881
1195
|
projectId?: number
|
|
882
1196
|
}
|
|
883
1197
|
|
|
884
|
-
export interface
|
|
885
|
-
|
|
1198
|
+
export interface RemoveAllWebhookListenersResponse {
|
|
1199
|
+
status: boolean
|
|
886
1200
|
}
|
|
887
|
-
|
|
1201
|
+
|
|
1202
|
+
export interface RemoveWebhookListenerRequest {
|
|
888
1203
|
id: number
|
|
889
1204
|
projectId?: number
|
|
890
1205
|
}
|
|
891
1206
|
|
|
892
|
-
export interface
|
|
893
|
-
|
|
1207
|
+
export interface RemoveWebhookListenerResponse {
|
|
1208
|
+
status: boolean
|
|
894
1209
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
filters: EventFilter
|
|
1210
|
+
|
|
1211
|
+
export interface ResumeAllWebhookListenersRequest {
|
|
898
1212
|
projectId?: number
|
|
899
1213
|
}
|
|
900
1214
|
|
|
901
|
-
export interface
|
|
1215
|
+
export interface ResumeAllWebhookListenersResponse {
|
|
902
1216
|
status: boolean
|
|
903
|
-
listener: WebhookListener
|
|
904
1217
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1218
|
+
|
|
1219
|
+
export interface RuntimeStatusRequest {}
|
|
1220
|
+
|
|
1221
|
+
export interface RuntimeStatusResponse {
|
|
1222
|
+
status: RuntimeStatus
|
|
908
1223
|
}
|
|
909
1224
|
|
|
910
|
-
export interface
|
|
911
|
-
|
|
1225
|
+
export interface SubscribeBalanceUpdatesRequest {
|
|
1226
|
+
contractAddress: string
|
|
912
1227
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1228
|
+
|
|
1229
|
+
export interface SubscribeBalanceUpdatesResponse {
|
|
1230
|
+
balance: TokenBalance
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
export interface SubscribeEventsRequest {
|
|
1234
|
+
filter: EventFilter
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
export interface SubscribeEventsResponse {
|
|
1238
|
+
log: EventLog
|
|
916
1239
|
}
|
|
917
1240
|
|
|
918
|
-
export interface
|
|
919
|
-
|
|
1241
|
+
export interface SubscribeReceiptsRequest {
|
|
1242
|
+
filter: TransactionFilter
|
|
920
1243
|
}
|
|
921
|
-
|
|
922
|
-
|
|
1244
|
+
|
|
1245
|
+
export interface SubscribeReceiptsResponse {
|
|
1246
|
+
receipt: TransactionReceipt
|
|
923
1247
|
}
|
|
924
1248
|
|
|
925
|
-
export interface
|
|
926
|
-
|
|
1249
|
+
export interface SyncBalanceRequest {
|
|
1250
|
+
accountAddress: string
|
|
1251
|
+
contractAddress: string
|
|
1252
|
+
tokenID?: string
|
|
927
1253
|
}
|
|
928
|
-
|
|
1254
|
+
|
|
1255
|
+
export interface SyncBalanceResponse {}
|
|
1256
|
+
|
|
1257
|
+
export interface ToggleWebhookListenerRequest {
|
|
929
1258
|
id: number
|
|
930
1259
|
projectId?: number
|
|
931
1260
|
}
|
|
932
1261
|
|
|
933
|
-
export interface
|
|
1262
|
+
export interface ToggleWebhookListenerResponse {
|
|
934
1263
|
webhookListener: WebhookListener
|
|
935
1264
|
}
|
|
936
|
-
export interface PauseAllWebhookListenersArgs {
|
|
937
|
-
projectId?: number
|
|
938
|
-
}
|
|
939
1265
|
|
|
940
|
-
export interface
|
|
941
|
-
|
|
942
|
-
}
|
|
943
|
-
export interface ResumeAllWebhookListenersArgs {
|
|
1266
|
+
export interface UpdateWebhookListenerRequest {
|
|
1267
|
+
listener: WebhookListener
|
|
944
1268
|
projectId?: number
|
|
945
1269
|
}
|
|
946
1270
|
|
|
947
|
-
export interface
|
|
1271
|
+
export interface UpdateWebhookListenerResponse {
|
|
948
1272
|
status: boolean
|
|
949
1273
|
}
|
|
950
|
-
export interface GetOrderbookOrdersArgs {
|
|
951
|
-
page?: Page
|
|
952
|
-
orderbookContractAddress: string
|
|
953
|
-
collectionAddress: string
|
|
954
|
-
currencyAddresses: Array<string>
|
|
955
|
-
filter: OrderbookOrderFilter
|
|
956
|
-
orderStatuses: Array<OrderStatus>
|
|
957
|
-
filters: Array<OrderbookOrderFilter>
|
|
958
|
-
beforeExpiryTimestamp: number
|
|
959
|
-
blockNumberAfter: number
|
|
960
|
-
createdAtAfter: number
|
|
961
|
-
}
|
|
962
1274
|
|
|
963
|
-
export interface
|
|
964
|
-
page?: Page
|
|
965
|
-
orders: Array<OrderbookOrder>
|
|
966
|
-
}
|
|
967
|
-
export interface GetTopOrdersArgs {
|
|
968
|
-
orderbookContractAddress: string
|
|
969
|
-
collectionAddress: string
|
|
970
|
-
currencyAddresses: Array<string>
|
|
971
|
-
tokenIDs: Array<string>
|
|
972
|
-
isListing: boolean
|
|
973
|
-
priceSort: SortOrder
|
|
974
|
-
excludeUser?: string
|
|
975
|
-
}
|
|
1275
|
+
export interface VersionRequest {}
|
|
976
1276
|
|
|
977
|
-
export interface
|
|
978
|
-
|
|
1277
|
+
export interface VersionResponse {
|
|
1278
|
+
version: Version
|
|
979
1279
|
}
|
|
980
1280
|
|
|
981
1281
|
//
|
|
982
1282
|
// Client
|
|
983
1283
|
//
|
|
984
|
-
|
|
1284
|
+
|
|
1285
|
+
export class Indexer implements IndexerClient {
|
|
985
1286
|
protected hostname: string
|
|
986
1287
|
protected fetch: Fetch
|
|
987
1288
|
protected path = '/rpc/Indexer/'
|
|
@@ -995,601 +1296,652 @@ export class Indexer implements Indexer {
|
|
|
995
1296
|
return this.hostname + this.path + name
|
|
996
1297
|
}
|
|
997
1298
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1299
|
+
queryKey = {
|
|
1300
|
+
addWebhookListener: (req: AddWebhookListenerRequest) => ['Indexer', 'addWebhookListener', req] as const,
|
|
1301
|
+
fetchTransactionReceipt: (req: FetchTransactionReceiptRequest) => ['Indexer', 'fetchTransactionReceipt', req] as const,
|
|
1302
|
+
fetchTransactionReceiptWithFilter: (req: FetchTransactionReceiptWithFilterRequest) =>
|
|
1303
|
+
['Indexer', 'fetchTransactionReceiptWithFilter', req] as const,
|
|
1304
|
+
getAllWebhookListeners: (req: GetAllWebhookListenersRequest) => ['Indexer', 'getAllWebhookListeners', req] as const,
|
|
1305
|
+
getBalanceUpdates: (req: GetBalanceUpdatesRequest) => ['Indexer', 'getBalanceUpdates', req] as const,
|
|
1306
|
+
getChainID: () => ['Indexer', 'getChainID'] as const,
|
|
1307
|
+
getEtherBalance: (req: GetEtherBalanceRequest) => ['Indexer', 'getEtherBalance', req] as const,
|
|
1308
|
+
getMarketplaceOrders: (req: GetMarketplaceOrdersRequest) => ['Indexer', 'getMarketplaceOrders', req] as const,
|
|
1309
|
+
getMarketplaceTopOrders: (req: GetMarketplaceTopOrdersRequest) => ['Indexer', 'getMarketplaceTopOrders', req] as const,
|
|
1310
|
+
getNativeTokenBalance: (req: GetNativeTokenBalanceRequest) => ['Indexer', 'getNativeTokenBalance', req] as const,
|
|
1311
|
+
getTokenBalances: (req: GetTokenBalancesRequest) => ['Indexer', 'getTokenBalances', req] as const,
|
|
1312
|
+
getTokenBalancesByContract: (req: GetTokenBalancesByContractRequest) =>
|
|
1313
|
+
['Indexer', 'getTokenBalancesByContract', req] as const,
|
|
1314
|
+
getTokenBalancesDetails: (req: GetTokenBalancesDetailsRequest) => ['Indexer', 'getTokenBalancesDetails', req] as const,
|
|
1315
|
+
getTokenBalancesSummary: (req: GetTokenBalancesSummaryRequest) => ['Indexer', 'getTokenBalancesSummary', req] as const,
|
|
1316
|
+
getTokenIDRanges: (req: GetTokenIDRangesRequest) => ['Indexer', 'getTokenIDRanges', req] as const,
|
|
1317
|
+
getTokenIDs: (req: GetTokenIDsRequest) => ['Indexer', 'getTokenIDs', req] as const,
|
|
1318
|
+
getTokenPrice: (req: GetTokenPriceRequest) => ['Indexer', 'getTokenPrice', req] as const,
|
|
1319
|
+
getTokenPrices: (req: GetTokenPricesRequest) => ['Indexer', 'getTokenPrices', req] as const,
|
|
1320
|
+
getTokenSupplies: (req: GetTokenSuppliesRequest) => ['Indexer', 'getTokenSupplies', req] as const,
|
|
1321
|
+
getTokenSuppliesMap: (req: GetTokenSuppliesMapRequest) => ['Indexer', 'getTokenSuppliesMap', req] as const,
|
|
1322
|
+
getTransactionHistory: (req: GetTransactionHistoryRequest) => ['Indexer', 'getTransactionHistory', req] as const,
|
|
1323
|
+
getWebhookListener: (req: GetWebhookListenerRequest) => ['Indexer', 'getWebhookListener', req] as const,
|
|
1324
|
+
listTokenPrices: (req: ListTokenPricesRequest) => ['Indexer', 'listTokenPrices', req] as const,
|
|
1325
|
+
pauseAllWebhookListeners: (req: PauseAllWebhookListenersRequest) => ['Indexer', 'pauseAllWebhookListeners', req] as const,
|
|
1326
|
+
ping: () => ['Indexer', 'ping'] as const,
|
|
1327
|
+
removeAllWebhookListeners: (req: RemoveAllWebhookListenersRequest) => ['Indexer', 'removeAllWebhookListeners', req] as const,
|
|
1328
|
+
removeWebhookListener: (req: RemoveWebhookListenerRequest) => ['Indexer', 'removeWebhookListener', req] as const,
|
|
1329
|
+
resumeAllWebhookListeners: (req: ResumeAllWebhookListenersRequest) => ['Indexer', 'resumeAllWebhookListeners', req] as const,
|
|
1330
|
+
runtimeStatus: () => ['Indexer', 'runtimeStatus'] as const,
|
|
1331
|
+
subscribeBalanceUpdates: (req: SubscribeBalanceUpdatesRequest) => ['Indexer', 'subscribeBalanceUpdates', req] as const,
|
|
1332
|
+
subscribeEvents: (req: SubscribeEventsRequest) => ['Indexer', 'subscribeEvents', req] as const,
|
|
1333
|
+
subscribeReceipts: (req: SubscribeReceiptsRequest) => ['Indexer', 'subscribeReceipts', req] as const,
|
|
1334
|
+
syncBalance: (req: SyncBalanceRequest) => ['Indexer', 'syncBalance', req] as const,
|
|
1335
|
+
toggleWebhookListener: (req: ToggleWebhookListenerRequest) => ['Indexer', 'toggleWebhookListener', req] as const,
|
|
1336
|
+
updateWebhookListener: (req: UpdateWebhookListenerRequest) => ['Indexer', 'updateWebhookListener', req] as const,
|
|
1337
|
+
version: () => ['Indexer', 'version'] as const
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
addWebhookListener = (
|
|
1341
|
+
req: AddWebhookListenerRequest,
|
|
1342
|
+
headers?: object,
|
|
1343
|
+
signal?: AbortSignal
|
|
1344
|
+
): Promise<AddWebhookListenerResponse> => {
|
|
1345
|
+
return this.fetch(this.url('AddWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1346
|
+
res => {
|
|
1347
|
+
return buildResponse(res).then(_data => {
|
|
1348
|
+
return JsonDecode<AddWebhookListenerResponse>(_data, 'AddWebhookListenerResponse')
|
|
1005
1349
|
})
|
|
1006
1350
|
},
|
|
1007
|
-
|
|
1008
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1009
|
-
}
|
|
1351
|
+
error => {
|
|
1352
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1353
|
+
}
|
|
1010
1354
|
)
|
|
1011
1355
|
}
|
|
1012
1356
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1357
|
+
fetchTransactionReceipt = (
|
|
1358
|
+
req: FetchTransactionReceiptRequest,
|
|
1359
|
+
headers?: object,
|
|
1360
|
+
signal?: AbortSignal
|
|
1361
|
+
): Promise<FetchTransactionReceiptResponse> => {
|
|
1362
|
+
return this.fetch(this.url('FetchTransactionReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1363
|
+
res => {
|
|
1364
|
+
return buildResponse(res).then(_data => {
|
|
1365
|
+
return JsonDecode<FetchTransactionReceiptResponse>(_data, 'FetchTransactionReceiptResponse')
|
|
1020
1366
|
})
|
|
1021
1367
|
},
|
|
1022
|
-
|
|
1023
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1024
|
-
}
|
|
1368
|
+
error => {
|
|
1369
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1370
|
+
}
|
|
1025
1371
|
)
|
|
1026
1372
|
}
|
|
1027
1373
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1374
|
+
fetchTransactionReceiptWithFilter = (
|
|
1375
|
+
req: FetchTransactionReceiptWithFilterRequest,
|
|
1376
|
+
headers?: object,
|
|
1377
|
+
signal?: AbortSignal
|
|
1378
|
+
): Promise<FetchTransactionReceiptWithFilterResponse> => {
|
|
1379
|
+
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1380
|
+
res => {
|
|
1381
|
+
return buildResponse(res).then(_data => {
|
|
1382
|
+
return JsonDecode<FetchTransactionReceiptWithFilterResponse>(_data, 'FetchTransactionReceiptWithFilterResponse')
|
|
1035
1383
|
})
|
|
1036
1384
|
},
|
|
1037
|
-
|
|
1038
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1039
|
-
}
|
|
1385
|
+
error => {
|
|
1386
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1387
|
+
}
|
|
1040
1388
|
)
|
|
1041
1389
|
}
|
|
1042
1390
|
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1391
|
+
getAllWebhookListeners = (
|
|
1392
|
+
req: GetAllWebhookListenersRequest,
|
|
1393
|
+
headers?: object,
|
|
1394
|
+
signal?: AbortSignal
|
|
1395
|
+
): Promise<GetAllWebhookListenersResponse> => {
|
|
1396
|
+
return this.fetch(this.url('GetAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1397
|
+
res => {
|
|
1398
|
+
return buildResponse(res).then(_data => {
|
|
1399
|
+
return JsonDecode<GetAllWebhookListenersResponse>(_data, 'GetAllWebhookListenersResponse')
|
|
1050
1400
|
})
|
|
1051
1401
|
},
|
|
1052
|
-
|
|
1053
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1054
|
-
}
|
|
1402
|
+
error => {
|
|
1403
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1404
|
+
}
|
|
1055
1405
|
)
|
|
1056
1406
|
}
|
|
1057
1407
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1408
|
+
getBalanceUpdates = (
|
|
1409
|
+
req: GetBalanceUpdatesRequest,
|
|
1060
1410
|
headers?: object,
|
|
1061
|
-
signal?: AbortSignal
|
|
1062
|
-
): Promise<
|
|
1063
|
-
return this.fetch(this.url('
|
|
1064
|
-
|
|
1065
|
-
return buildResponse(res).then(
|
|
1066
|
-
return
|
|
1067
|
-
balance: <EtherBalance>_data.balance,
|
|
1068
|
-
}
|
|
1411
|
+
signal?: AbortSignal
|
|
1412
|
+
): Promise<GetBalanceUpdatesResponse> => {
|
|
1413
|
+
return this.fetch(this.url('GetBalanceUpdates'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1414
|
+
res => {
|
|
1415
|
+
return buildResponse(res).then(_data => {
|
|
1416
|
+
return JsonDecode<GetBalanceUpdatesResponse>(_data, 'GetBalanceUpdatesResponse')
|
|
1069
1417
|
})
|
|
1070
1418
|
},
|
|
1071
|
-
|
|
1072
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1073
|
-
}
|
|
1419
|
+
error => {
|
|
1420
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1421
|
+
}
|
|
1074
1422
|
)
|
|
1075
1423
|
}
|
|
1076
1424
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(
|
|
1083
|
-
(res) => {
|
|
1084
|
-
return buildResponse(res).then((_data) => {
|
|
1085
|
-
return {
|
|
1086
|
-
balance: <NativeTokenBalance>_data.balance,
|
|
1087
|
-
}
|
|
1425
|
+
getChainID = (headers?: object, signal?: AbortSignal): Promise<GetChainIDResponse> => {
|
|
1426
|
+
return this.fetch(this.url('GetChainID'), createHttpRequest('{}', headers, signal)).then(
|
|
1427
|
+
res => {
|
|
1428
|
+
return buildResponse(res).then(_data => {
|
|
1429
|
+
return JsonDecode<GetChainIDResponse>(_data, 'GetChainIDResponse')
|
|
1088
1430
|
})
|
|
1089
1431
|
},
|
|
1090
|
-
|
|
1091
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1432
|
+
error => {
|
|
1433
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1434
|
+
}
|
|
1435
|
+
)
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
getEtherBalance = (req: GetEtherBalanceRequest, headers?: object, signal?: AbortSignal): Promise<GetEtherBalanceResponse> => {
|
|
1439
|
+
return this.fetch(this.url('GetEtherBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1440
|
+
res => {
|
|
1441
|
+
return buildResponse(res).then(_data => {
|
|
1442
|
+
return JsonDecode<GetEtherBalanceResponse>(_data, 'GetEtherBalanceResponse')
|
|
1443
|
+
})
|
|
1092
1444
|
},
|
|
1445
|
+
error => {
|
|
1446
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1447
|
+
}
|
|
1093
1448
|
)
|
|
1094
1449
|
}
|
|
1095
1450
|
|
|
1096
|
-
|
|
1097
|
-
|
|
1451
|
+
getMarketplaceOrders = (
|
|
1452
|
+
req: GetMarketplaceOrdersRequest,
|
|
1098
1453
|
headers?: object,
|
|
1099
|
-
signal?: AbortSignal
|
|
1100
|
-
): Promise<
|
|
1101
|
-
return this.fetch(this.url('
|
|
1102
|
-
|
|
1103
|
-
return buildResponse(res).then(
|
|
1104
|
-
return
|
|
1105
|
-
page: <Page>_data.page,
|
|
1106
|
-
nativeBalances: <Array<NativeTokenBalance>>_data.nativeBalances,
|
|
1107
|
-
balances: <Array<TokenBalance>>_data.balances,
|
|
1108
|
-
}
|
|
1454
|
+
signal?: AbortSignal
|
|
1455
|
+
): Promise<GetMarketplaceOrdersResponse> => {
|
|
1456
|
+
return this.fetch(this.url('GetMarketplaceOrders'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1457
|
+
res => {
|
|
1458
|
+
return buildResponse(res).then(_data => {
|
|
1459
|
+
return JsonDecode<GetMarketplaceOrdersResponse>(_data, 'GetMarketplaceOrdersResponse')
|
|
1109
1460
|
})
|
|
1110
1461
|
},
|
|
1111
|
-
|
|
1112
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1113
|
-
}
|
|
1462
|
+
error => {
|
|
1463
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1464
|
+
}
|
|
1114
1465
|
)
|
|
1115
1466
|
}
|
|
1116
1467
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1468
|
+
getMarketplaceTopOrders = (
|
|
1469
|
+
req: GetMarketplaceTopOrdersRequest,
|
|
1119
1470
|
headers?: object,
|
|
1120
|
-
signal?: AbortSignal
|
|
1121
|
-
): Promise<
|
|
1122
|
-
return this.fetch(this.url('
|
|
1123
|
-
|
|
1124
|
-
return buildResponse(res).then(
|
|
1125
|
-
return
|
|
1126
|
-
page: <Page>_data.page,
|
|
1127
|
-
nativeBalances: <Array<NativeTokenBalance>>_data.nativeBalances,
|
|
1128
|
-
balances: <Array<TokenBalance>>_data.balances,
|
|
1129
|
-
}
|
|
1471
|
+
signal?: AbortSignal
|
|
1472
|
+
): Promise<GetMarketplaceTopOrdersResponse> => {
|
|
1473
|
+
return this.fetch(this.url('GetMarketplaceTopOrders'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1474
|
+
res => {
|
|
1475
|
+
return buildResponse(res).then(_data => {
|
|
1476
|
+
return JsonDecode<GetMarketplaceTopOrdersResponse>(_data, 'GetMarketplaceTopOrdersResponse')
|
|
1130
1477
|
})
|
|
1131
1478
|
},
|
|
1132
|
-
|
|
1133
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1134
|
-
}
|
|
1479
|
+
error => {
|
|
1480
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1481
|
+
}
|
|
1135
1482
|
)
|
|
1136
1483
|
}
|
|
1137
1484
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1485
|
+
getNativeTokenBalance = (
|
|
1486
|
+
req: GetNativeTokenBalanceRequest,
|
|
1140
1487
|
headers?: object,
|
|
1141
|
-
signal?: AbortSignal
|
|
1142
|
-
): Promise<
|
|
1143
|
-
return this.fetch(this.url('
|
|
1144
|
-
|
|
1145
|
-
return buildResponse(res).then(
|
|
1146
|
-
return
|
|
1147
|
-
page: <Page>_data.page,
|
|
1148
|
-
balances: <Array<TokenBalance>>_data.balances,
|
|
1149
|
-
}
|
|
1488
|
+
signal?: AbortSignal
|
|
1489
|
+
): Promise<GetNativeTokenBalanceResponse> => {
|
|
1490
|
+
return this.fetch(this.url('GetNativeTokenBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1491
|
+
res => {
|
|
1492
|
+
return buildResponse(res).then(_data => {
|
|
1493
|
+
return JsonDecode<GetNativeTokenBalanceResponse>(_data, 'GetNativeTokenBalanceResponse')
|
|
1150
1494
|
})
|
|
1151
1495
|
},
|
|
1152
|
-
|
|
1153
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1154
|
-
}
|
|
1496
|
+
error => {
|
|
1497
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1498
|
+
}
|
|
1155
1499
|
)
|
|
1156
1500
|
}
|
|
1157
1501
|
|
|
1158
1502
|
getTokenBalances = (
|
|
1159
|
-
|
|
1503
|
+
req: GetTokenBalancesRequest,
|
|
1160
1504
|
headers?: object,
|
|
1161
|
-
signal?: AbortSignal
|
|
1162
|
-
): Promise<
|
|
1163
|
-
return this.fetch(this.url('GetTokenBalances'),
|
|
1164
|
-
|
|
1165
|
-
return buildResponse(res).then(
|
|
1166
|
-
return
|
|
1167
|
-
page: <Page>_data.page,
|
|
1168
|
-
balances: <Array<TokenBalance>>_data.balances,
|
|
1169
|
-
}
|
|
1505
|
+
signal?: AbortSignal
|
|
1506
|
+
): Promise<GetTokenBalancesResponse> => {
|
|
1507
|
+
return this.fetch(this.url('GetTokenBalances'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1508
|
+
res => {
|
|
1509
|
+
return buildResponse(res).then(_data => {
|
|
1510
|
+
return JsonDecode<GetTokenBalancesResponse>(_data, 'GetTokenBalancesResponse')
|
|
1170
1511
|
})
|
|
1171
1512
|
},
|
|
1172
|
-
|
|
1173
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1174
|
-
}
|
|
1513
|
+
error => {
|
|
1514
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1515
|
+
}
|
|
1175
1516
|
)
|
|
1176
1517
|
}
|
|
1177
1518
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1519
|
+
getTokenBalancesByContract = (
|
|
1520
|
+
req: GetTokenBalancesByContractRequest,
|
|
1180
1521
|
headers?: object,
|
|
1181
|
-
signal?: AbortSignal
|
|
1182
|
-
): Promise<
|
|
1183
|
-
return this.fetch(this.url('
|
|
1184
|
-
|
|
1185
|
-
return buildResponse(res).then(
|
|
1186
|
-
return
|
|
1187
|
-
page: <Page>_data.page,
|
|
1188
|
-
contractType: <ContractType>_data.contractType,
|
|
1189
|
-
tokenIDs: <Array<TokenSupply>>_data.tokenIDs,
|
|
1190
|
-
}
|
|
1522
|
+
signal?: AbortSignal
|
|
1523
|
+
): Promise<GetTokenBalancesByContractResponse> => {
|
|
1524
|
+
return this.fetch(this.url('GetTokenBalancesByContract'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1525
|
+
res => {
|
|
1526
|
+
return buildResponse(res).then(_data => {
|
|
1527
|
+
return JsonDecode<GetTokenBalancesByContractResponse>(_data, 'GetTokenBalancesByContractResponse')
|
|
1191
1528
|
})
|
|
1192
1529
|
},
|
|
1193
|
-
|
|
1194
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1195
|
-
}
|
|
1530
|
+
error => {
|
|
1531
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1532
|
+
}
|
|
1196
1533
|
)
|
|
1197
1534
|
}
|
|
1198
1535
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1536
|
+
getTokenBalancesDetails = (
|
|
1537
|
+
req: GetTokenBalancesDetailsRequest,
|
|
1201
1538
|
headers?: object,
|
|
1202
|
-
signal?: AbortSignal
|
|
1203
|
-
): Promise<
|
|
1204
|
-
return this.fetch(this.url('
|
|
1205
|
-
|
|
1206
|
-
return buildResponse(res).then(
|
|
1207
|
-
return
|
|
1208
|
-
supplies: <{ [key: string]: Array<TokenSupply> }>_data.supplies,
|
|
1209
|
-
}
|
|
1539
|
+
signal?: AbortSignal
|
|
1540
|
+
): Promise<GetTokenBalancesDetailsResponse> => {
|
|
1541
|
+
return this.fetch(this.url('GetTokenBalancesDetails'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1542
|
+
res => {
|
|
1543
|
+
return buildResponse(res).then(_data => {
|
|
1544
|
+
return JsonDecode<GetTokenBalancesDetailsResponse>(_data, 'GetTokenBalancesDetailsResponse')
|
|
1210
1545
|
})
|
|
1211
1546
|
},
|
|
1212
|
-
|
|
1213
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1214
|
-
}
|
|
1547
|
+
error => {
|
|
1548
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1549
|
+
}
|
|
1215
1550
|
)
|
|
1216
1551
|
}
|
|
1217
1552
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1553
|
+
getTokenBalancesSummary = (
|
|
1554
|
+
req: GetTokenBalancesSummaryRequest,
|
|
1555
|
+
headers?: object,
|
|
1556
|
+
signal?: AbortSignal
|
|
1557
|
+
): Promise<GetTokenBalancesSummaryResponse> => {
|
|
1558
|
+
return this.fetch(this.url('GetTokenBalancesSummary'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1559
|
+
res => {
|
|
1560
|
+
return buildResponse(res).then(_data => {
|
|
1561
|
+
return JsonDecode<GetTokenBalancesSummaryResponse>(_data, 'GetTokenBalancesSummaryResponse')
|
|
1227
1562
|
})
|
|
1228
1563
|
},
|
|
1229
|
-
|
|
1230
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1231
|
-
}
|
|
1564
|
+
error => {
|
|
1565
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1566
|
+
}
|
|
1232
1567
|
)
|
|
1233
1568
|
}
|
|
1234
1569
|
|
|
1235
1570
|
getTokenIDRanges = (
|
|
1236
|
-
|
|
1571
|
+
req: GetTokenIDRangesRequest,
|
|
1237
1572
|
headers?: object,
|
|
1238
|
-
signal?: AbortSignal
|
|
1239
|
-
): Promise<
|
|
1240
|
-
return this.fetch(this.url('GetTokenIDRanges'),
|
|
1241
|
-
|
|
1242
|
-
return buildResponse(res).then(
|
|
1243
|
-
return
|
|
1244
|
-
contractType: <ContractType>_data.contractType,
|
|
1245
|
-
tokenIDRanges: <Array<TokenIDRange>>_data.tokenIDRanges,
|
|
1246
|
-
moreRanges: <boolean>_data.moreRanges,
|
|
1247
|
-
}
|
|
1573
|
+
signal?: AbortSignal
|
|
1574
|
+
): Promise<GetTokenIDRangesResponse> => {
|
|
1575
|
+
return this.fetch(this.url('GetTokenIDRanges'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1576
|
+
res => {
|
|
1577
|
+
return buildResponse(res).then(_data => {
|
|
1578
|
+
return JsonDecode<GetTokenIDRangesResponse>(_data, 'GetTokenIDRangesResponse')
|
|
1248
1579
|
})
|
|
1249
1580
|
},
|
|
1250
|
-
|
|
1251
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1252
|
-
}
|
|
1581
|
+
error => {
|
|
1582
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1583
|
+
}
|
|
1253
1584
|
)
|
|
1254
1585
|
}
|
|
1255
1586
|
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(
|
|
1262
|
-
(res) => {
|
|
1263
|
-
return buildResponse(res).then((_data) => {
|
|
1264
|
-
return {
|
|
1265
|
-
page: <Page>_data.page,
|
|
1266
|
-
balances: <Array<TokenBalance>>_data.balances,
|
|
1267
|
-
}
|
|
1587
|
+
getTokenIDs = (req: GetTokenIDsRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenIDsResponse> => {
|
|
1588
|
+
return this.fetch(this.url('GetTokenIDs'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1589
|
+
res => {
|
|
1590
|
+
return buildResponse(res).then(_data => {
|
|
1591
|
+
return JsonDecode<GetTokenIDsResponse>(_data, 'GetTokenIDsResponse')
|
|
1268
1592
|
})
|
|
1269
1593
|
},
|
|
1270
|
-
|
|
1271
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1272
|
-
}
|
|
1594
|
+
error => {
|
|
1595
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1596
|
+
}
|
|
1273
1597
|
)
|
|
1274
1598
|
}
|
|
1275
1599
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest(args, headers, signal)).then(
|
|
1282
|
-
(res) => {
|
|
1283
|
-
return buildResponse(res).then((_data) => {
|
|
1284
|
-
return {
|
|
1285
|
-
page: <Page>_data.page,
|
|
1286
|
-
transactions: <Array<Transaction>>_data.transactions,
|
|
1287
|
-
}
|
|
1600
|
+
getTokenPrice = (req: GetTokenPriceRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPriceResponse> => {
|
|
1601
|
+
return this.fetch(this.url('GetTokenPrice'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1602
|
+
res => {
|
|
1603
|
+
return buildResponse(res).then(_data => {
|
|
1604
|
+
return JsonDecode<GetTokenPriceResponse>(_data, 'GetTokenPriceResponse')
|
|
1288
1605
|
})
|
|
1289
1606
|
},
|
|
1290
|
-
|
|
1291
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1292
|
-
}
|
|
1607
|
+
error => {
|
|
1608
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1609
|
+
}
|
|
1293
1610
|
)
|
|
1294
1611
|
}
|
|
1295
1612
|
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest(args, headers, signal)).then(
|
|
1302
|
-
(res) => {
|
|
1303
|
-
return buildResponse(res).then((_data) => {
|
|
1304
|
-
return {
|
|
1305
|
-
receipt: <TransactionReceipt>_data.receipt,
|
|
1306
|
-
}
|
|
1613
|
+
getTokenPrices = (req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPricesResponse> => {
|
|
1614
|
+
return this.fetch(this.url('GetTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1615
|
+
res => {
|
|
1616
|
+
return buildResponse(res).then(_data => {
|
|
1617
|
+
return JsonDecode<GetTokenPricesResponse>(_data, 'GetTokenPricesResponse')
|
|
1307
1618
|
})
|
|
1308
1619
|
},
|
|
1309
|
-
|
|
1310
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1311
|
-
}
|
|
1620
|
+
error => {
|
|
1621
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1622
|
+
}
|
|
1312
1623
|
)
|
|
1313
1624
|
}
|
|
1314
1625
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1626
|
+
getTokenSupplies = (
|
|
1627
|
+
req: GetTokenSuppliesRequest,
|
|
1317
1628
|
headers?: object,
|
|
1318
|
-
signal?: AbortSignal
|
|
1319
|
-
): Promise<
|
|
1320
|
-
return this.fetch(this.url('
|
|
1321
|
-
|
|
1322
|
-
return buildResponse(res).then(
|
|
1323
|
-
return
|
|
1324
|
-
receipt: <TransactionReceipt>_data.receipt,
|
|
1325
|
-
}
|
|
1629
|
+
signal?: AbortSignal
|
|
1630
|
+
): Promise<GetTokenSuppliesResponse> => {
|
|
1631
|
+
return this.fetch(this.url('GetTokenSupplies'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1632
|
+
res => {
|
|
1633
|
+
return buildResponse(res).then(_data => {
|
|
1634
|
+
return JsonDecode<GetTokenSuppliesResponse>(_data, 'GetTokenSuppliesResponse')
|
|
1326
1635
|
})
|
|
1327
1636
|
},
|
|
1328
|
-
|
|
1329
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1330
|
-
}
|
|
1637
|
+
error => {
|
|
1638
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1639
|
+
}
|
|
1331
1640
|
)
|
|
1332
1641
|
}
|
|
1333
1642
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
(error) => {
|
|
1344
|
-
options.onError(error, _fetch)
|
|
1345
|
-
},
|
|
1346
|
-
)
|
|
1347
|
-
return _fetch()
|
|
1348
|
-
}
|
|
1349
|
-
subscribeEvents = (args: SubscribeEventsArgs, options: WebrpcStreamOptions<SubscribeEventsReturn>): Promise<void> => {
|
|
1350
|
-
const _fetch = () =>
|
|
1351
|
-
this.fetch(this.url('SubscribeEvents'), createHTTPRequest(args, options.headers, options.signal)).then(
|
|
1352
|
-
async (res) => {
|
|
1353
|
-
await sseResponse(res, options, _fetch)
|
|
1354
|
-
},
|
|
1355
|
-
(error) => {
|
|
1356
|
-
options.onError(error, _fetch)
|
|
1357
|
-
},
|
|
1358
|
-
)
|
|
1359
|
-
return _fetch()
|
|
1360
|
-
}
|
|
1361
|
-
subscribeBalanceUpdates = (
|
|
1362
|
-
args: SubscribeBalanceUpdatesArgs,
|
|
1363
|
-
options: WebrpcStreamOptions<SubscribeBalanceUpdatesReturn>,
|
|
1364
|
-
): Promise<void> => {
|
|
1365
|
-
const _fetch = () =>
|
|
1366
|
-
this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest(args, options.headers, options.signal)).then(
|
|
1367
|
-
async (res) => {
|
|
1368
|
-
await sseResponse(res, options, _fetch)
|
|
1369
|
-
},
|
|
1370
|
-
(error) => {
|
|
1371
|
-
options.onError(error, _fetch)
|
|
1372
|
-
},
|
|
1373
|
-
)
|
|
1374
|
-
return _fetch()
|
|
1375
|
-
}
|
|
1376
|
-
syncBalance = (args: SyncBalanceArgs, headers?: object, signal?: AbortSignal): Promise<SyncBalanceReturn> => {
|
|
1377
|
-
return this.fetch(this.url('SyncBalance'), createHTTPRequest(args, headers, signal)).then(
|
|
1378
|
-
(res) => {
|
|
1379
|
-
return buildResponse(res).then((_data) => {
|
|
1380
|
-
return {}
|
|
1643
|
+
getTokenSuppliesMap = (
|
|
1644
|
+
req: GetTokenSuppliesMapRequest,
|
|
1645
|
+
headers?: object,
|
|
1646
|
+
signal?: AbortSignal
|
|
1647
|
+
): Promise<GetTokenSuppliesMapResponse> => {
|
|
1648
|
+
return this.fetch(this.url('GetTokenSuppliesMap'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1649
|
+
res => {
|
|
1650
|
+
return buildResponse(res).then(_data => {
|
|
1651
|
+
return JsonDecode<GetTokenSuppliesMapResponse>(_data, 'GetTokenSuppliesMapResponse')
|
|
1381
1652
|
})
|
|
1382
1653
|
},
|
|
1383
|
-
|
|
1384
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1385
|
-
}
|
|
1654
|
+
error => {
|
|
1655
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1656
|
+
}
|
|
1386
1657
|
)
|
|
1387
1658
|
}
|
|
1388
1659
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1660
|
+
getTransactionHistory = (
|
|
1661
|
+
req: GetTransactionHistoryRequest,
|
|
1391
1662
|
headers?: object,
|
|
1392
|
-
signal?: AbortSignal
|
|
1393
|
-
): Promise<
|
|
1394
|
-
return this.fetch(this.url('
|
|
1395
|
-
|
|
1396
|
-
return buildResponse(res).then(
|
|
1397
|
-
return
|
|
1398
|
-
listeners: <Array<WebhookListener>>_data.listeners,
|
|
1399
|
-
}
|
|
1663
|
+
signal?: AbortSignal
|
|
1664
|
+
): Promise<GetTransactionHistoryResponse> => {
|
|
1665
|
+
return this.fetch(this.url('GetTransactionHistory'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1666
|
+
res => {
|
|
1667
|
+
return buildResponse(res).then(_data => {
|
|
1668
|
+
return JsonDecode<GetTransactionHistoryResponse>(_data, 'GetTransactionHistoryResponse')
|
|
1400
1669
|
})
|
|
1401
1670
|
},
|
|
1402
|
-
|
|
1403
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1404
|
-
}
|
|
1671
|
+
error => {
|
|
1672
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1673
|
+
}
|
|
1405
1674
|
)
|
|
1406
1675
|
}
|
|
1407
1676
|
|
|
1408
1677
|
getWebhookListener = (
|
|
1409
|
-
|
|
1678
|
+
req: GetWebhookListenerRequest,
|
|
1410
1679
|
headers?: object,
|
|
1411
|
-
signal?: AbortSignal
|
|
1412
|
-
): Promise<
|
|
1413
|
-
return this.fetch(this.url('GetWebhookListener'),
|
|
1414
|
-
|
|
1415
|
-
return buildResponse(res).then(
|
|
1416
|
-
return
|
|
1417
|
-
listener: <WebhookListener>_data.listener,
|
|
1418
|
-
}
|
|
1680
|
+
signal?: AbortSignal
|
|
1681
|
+
): Promise<GetWebhookListenerResponse> => {
|
|
1682
|
+
return this.fetch(this.url('GetWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1683
|
+
res => {
|
|
1684
|
+
return buildResponse(res).then(_data => {
|
|
1685
|
+
return JsonDecode<GetWebhookListenerResponse>(_data, 'GetWebhookListenerResponse')
|
|
1419
1686
|
})
|
|
1420
1687
|
},
|
|
1421
|
-
|
|
1422
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1688
|
+
error => {
|
|
1689
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1690
|
+
}
|
|
1691
|
+
)
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
listTokenPrices = (req: ListTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<ListTokenPricesResponse> => {
|
|
1695
|
+
return this.fetch(this.url('ListTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1696
|
+
res => {
|
|
1697
|
+
return buildResponse(res).then(_data => {
|
|
1698
|
+
return JsonDecode<ListTokenPricesResponse>(_data, 'ListTokenPricesResponse')
|
|
1699
|
+
})
|
|
1423
1700
|
},
|
|
1701
|
+
error => {
|
|
1702
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1703
|
+
}
|
|
1424
1704
|
)
|
|
1425
1705
|
}
|
|
1426
1706
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1707
|
+
pauseAllWebhookListeners = (
|
|
1708
|
+
req: PauseAllWebhookListenersRequest,
|
|
1429
1709
|
headers?: object,
|
|
1430
|
-
signal?: AbortSignal
|
|
1431
|
-
): Promise<
|
|
1432
|
-
return this.fetch(this.url('
|
|
1433
|
-
|
|
1434
|
-
return buildResponse(res).then(
|
|
1435
|
-
return
|
|
1436
|
-
status: <boolean>_data.status,
|
|
1437
|
-
listener: <WebhookListener>_data.listener,
|
|
1438
|
-
}
|
|
1710
|
+
signal?: AbortSignal
|
|
1711
|
+
): Promise<PauseAllWebhookListenersResponse> => {
|
|
1712
|
+
return this.fetch(this.url('PauseAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1713
|
+
res => {
|
|
1714
|
+
return buildResponse(res).then(_data => {
|
|
1715
|
+
return JsonDecode<PauseAllWebhookListenersResponse>(_data, 'PauseAllWebhookListenersResponse')
|
|
1439
1716
|
})
|
|
1440
1717
|
},
|
|
1441
|
-
|
|
1442
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1718
|
+
error => {
|
|
1719
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1720
|
+
}
|
|
1721
|
+
)
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
ping = (headers?: object, signal?: AbortSignal): Promise<PingResponse> => {
|
|
1725
|
+
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(
|
|
1726
|
+
res => {
|
|
1727
|
+
return buildResponse(res).then(_data => {
|
|
1728
|
+
return JsonDecode<PingResponse>(_data, 'PingResponse')
|
|
1729
|
+
})
|
|
1443
1730
|
},
|
|
1731
|
+
error => {
|
|
1732
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1733
|
+
}
|
|
1444
1734
|
)
|
|
1445
1735
|
}
|
|
1446
1736
|
|
|
1447
|
-
|
|
1448
|
-
|
|
1737
|
+
removeAllWebhookListeners = (
|
|
1738
|
+
req: RemoveAllWebhookListenersRequest,
|
|
1449
1739
|
headers?: object,
|
|
1450
|
-
signal?: AbortSignal
|
|
1451
|
-
): Promise<
|
|
1452
|
-
return this.fetch(this.url('
|
|
1453
|
-
|
|
1454
|
-
return buildResponse(res).then(
|
|
1455
|
-
return
|
|
1456
|
-
status: <boolean>_data.status,
|
|
1457
|
-
}
|
|
1740
|
+
signal?: AbortSignal
|
|
1741
|
+
): Promise<RemoveAllWebhookListenersResponse> => {
|
|
1742
|
+
return this.fetch(this.url('RemoveAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1743
|
+
res => {
|
|
1744
|
+
return buildResponse(res).then(_data => {
|
|
1745
|
+
return JsonDecode<RemoveAllWebhookListenersResponse>(_data, 'RemoveAllWebhookListenersResponse')
|
|
1458
1746
|
})
|
|
1459
1747
|
},
|
|
1460
|
-
|
|
1461
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1462
|
-
}
|
|
1748
|
+
error => {
|
|
1749
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1750
|
+
}
|
|
1463
1751
|
)
|
|
1464
1752
|
}
|
|
1465
1753
|
|
|
1466
1754
|
removeWebhookListener = (
|
|
1467
|
-
|
|
1755
|
+
req: RemoveWebhookListenerRequest,
|
|
1468
1756
|
headers?: object,
|
|
1469
|
-
signal?: AbortSignal
|
|
1470
|
-
): Promise<
|
|
1471
|
-
return this.fetch(this.url('RemoveWebhookListener'),
|
|
1472
|
-
|
|
1473
|
-
return buildResponse(res).then(
|
|
1474
|
-
return
|
|
1475
|
-
status: <boolean>_data.status,
|
|
1476
|
-
}
|
|
1757
|
+
signal?: AbortSignal
|
|
1758
|
+
): Promise<RemoveWebhookListenerResponse> => {
|
|
1759
|
+
return this.fetch(this.url('RemoveWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1760
|
+
res => {
|
|
1761
|
+
return buildResponse(res).then(_data => {
|
|
1762
|
+
return JsonDecode<RemoveWebhookListenerResponse>(_data, 'RemoveWebhookListenerResponse')
|
|
1477
1763
|
})
|
|
1478
1764
|
},
|
|
1479
|
-
|
|
1480
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1481
|
-
}
|
|
1765
|
+
error => {
|
|
1766
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1767
|
+
}
|
|
1482
1768
|
)
|
|
1483
1769
|
}
|
|
1484
1770
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1771
|
+
resumeAllWebhookListeners = (
|
|
1772
|
+
req: ResumeAllWebhookListenersRequest,
|
|
1487
1773
|
headers?: object,
|
|
1488
|
-
signal?: AbortSignal
|
|
1489
|
-
): Promise<
|
|
1490
|
-
return this.fetch(this.url('
|
|
1491
|
-
|
|
1492
|
-
return buildResponse(res).then(
|
|
1493
|
-
return
|
|
1494
|
-
status: <boolean>_data.status,
|
|
1495
|
-
}
|
|
1774
|
+
signal?: AbortSignal
|
|
1775
|
+
): Promise<ResumeAllWebhookListenersResponse> => {
|
|
1776
|
+
return this.fetch(this.url('ResumeAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1777
|
+
res => {
|
|
1778
|
+
return buildResponse(res).then(_data => {
|
|
1779
|
+
return JsonDecode<ResumeAllWebhookListenersResponse>(_data, 'ResumeAllWebhookListenersResponse')
|
|
1496
1780
|
})
|
|
1497
1781
|
},
|
|
1498
|
-
|
|
1499
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1500
|
-
}
|
|
1782
|
+
error => {
|
|
1783
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1784
|
+
}
|
|
1501
1785
|
)
|
|
1502
1786
|
}
|
|
1503
1787
|
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest(args, headers, signal)).then(
|
|
1510
|
-
(res) => {
|
|
1511
|
-
return buildResponse(res).then((_data) => {
|
|
1512
|
-
return {
|
|
1513
|
-
webhookListener: <WebhookListener>_data.webhookListener,
|
|
1514
|
-
}
|
|
1788
|
+
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusResponse> => {
|
|
1789
|
+
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(
|
|
1790
|
+
res => {
|
|
1791
|
+
return buildResponse(res).then(_data => {
|
|
1792
|
+
return JsonDecode<RuntimeStatusResponse>(_data, 'RuntimeStatusResponse')
|
|
1515
1793
|
})
|
|
1516
1794
|
},
|
|
1517
|
-
|
|
1518
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1519
|
-
}
|
|
1795
|
+
error => {
|
|
1796
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1797
|
+
}
|
|
1520
1798
|
)
|
|
1521
1799
|
}
|
|
1522
1800
|
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1801
|
+
subscribeBalanceUpdates = (
|
|
1802
|
+
req: SubscribeBalanceUpdatesRequest,
|
|
1803
|
+
options: WebrpcStreamOptions<SubscribeBalanceUpdatesResponse>
|
|
1804
|
+
): WebrpcStreamController => {
|
|
1805
|
+
const abortController = new AbortController()
|
|
1806
|
+
const abortSignal = abortController.signal
|
|
1807
|
+
|
|
1808
|
+
if (options.signal) {
|
|
1809
|
+
abortSignal.addEventListener('abort', () => abortController.abort(options.signal?.reason), {
|
|
1810
|
+
signal: options.signal
|
|
1811
|
+
})
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
const _fetch = () =>
|
|
1815
|
+
this.fetch(this.url('SubscribeBalanceUpdates'), createHttpRequest(JsonEncode(req), options.headers, abortSignal)).then(
|
|
1816
|
+
async res => {
|
|
1817
|
+
await sseResponse(res, options, _fetch)
|
|
1818
|
+
},
|
|
1819
|
+
error => {
|
|
1820
|
+
options.onError(error, _fetch)
|
|
1821
|
+
}
|
|
1822
|
+
)
|
|
1823
|
+
|
|
1824
|
+
const resp = _fetch()
|
|
1825
|
+
return {
|
|
1826
|
+
abort: abortController.abort.bind(abortController),
|
|
1827
|
+
closed: resp
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
subscribeEvents = (
|
|
1831
|
+
req: SubscribeEventsRequest,
|
|
1832
|
+
options: WebrpcStreamOptions<SubscribeEventsResponse>
|
|
1833
|
+
): WebrpcStreamController => {
|
|
1834
|
+
const abortController = new AbortController()
|
|
1835
|
+
const abortSignal = abortController.signal
|
|
1836
|
+
|
|
1837
|
+
if (options.signal) {
|
|
1838
|
+
abortSignal.addEventListener('abort', () => abortController.abort(options.signal?.reason), {
|
|
1839
|
+
signal: options.signal
|
|
1840
|
+
})
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
const _fetch = () =>
|
|
1844
|
+
this.fetch(this.url('SubscribeEvents'), createHttpRequest(JsonEncode(req), options.headers, abortSignal)).then(
|
|
1845
|
+
async res => {
|
|
1846
|
+
await sseResponse(res, options, _fetch)
|
|
1847
|
+
},
|
|
1848
|
+
error => {
|
|
1849
|
+
options.onError(error, _fetch)
|
|
1850
|
+
}
|
|
1851
|
+
)
|
|
1852
|
+
|
|
1853
|
+
const resp = _fetch()
|
|
1854
|
+
return {
|
|
1855
|
+
abort: abortController.abort.bind(abortController),
|
|
1856
|
+
closed: resp
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
subscribeReceipts = (
|
|
1860
|
+
req: SubscribeReceiptsRequest,
|
|
1861
|
+
options: WebrpcStreamOptions<SubscribeReceiptsResponse>
|
|
1862
|
+
): WebrpcStreamController => {
|
|
1863
|
+
const abortController = new AbortController()
|
|
1864
|
+
const abortSignal = abortController.signal
|
|
1865
|
+
|
|
1866
|
+
if (options.signal) {
|
|
1867
|
+
abortSignal.addEventListener('abort', () => abortController.abort(options.signal?.reason), {
|
|
1868
|
+
signal: options.signal
|
|
1869
|
+
})
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
const _fetch = () =>
|
|
1873
|
+
this.fetch(this.url('SubscribeReceipts'), createHttpRequest(JsonEncode(req), options.headers, abortSignal)).then(
|
|
1874
|
+
async res => {
|
|
1875
|
+
await sseResponse(res, options, _fetch)
|
|
1876
|
+
},
|
|
1877
|
+
error => {
|
|
1878
|
+
options.onError(error, _fetch)
|
|
1879
|
+
}
|
|
1880
|
+
)
|
|
1881
|
+
|
|
1882
|
+
const resp = _fetch()
|
|
1883
|
+
return {
|
|
1884
|
+
abort: abortController.abort.bind(abortController),
|
|
1885
|
+
closed: resp
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
syncBalance = (req: SyncBalanceRequest, headers?: object, signal?: AbortSignal): Promise<SyncBalanceResponse> => {
|
|
1889
|
+
return this.fetch(this.url('SyncBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1890
|
+
res => {
|
|
1891
|
+
return buildResponse(res).then(_data => {
|
|
1892
|
+
return JsonDecode<SyncBalanceResponse>(_data, 'SyncBalanceResponse')
|
|
1534
1893
|
})
|
|
1535
1894
|
},
|
|
1536
|
-
|
|
1537
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1538
|
-
}
|
|
1895
|
+
error => {
|
|
1896
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1897
|
+
}
|
|
1539
1898
|
)
|
|
1540
1899
|
}
|
|
1541
1900
|
|
|
1542
|
-
|
|
1543
|
-
|
|
1901
|
+
toggleWebhookListener = (
|
|
1902
|
+
req: ToggleWebhookListenerRequest,
|
|
1544
1903
|
headers?: object,
|
|
1545
|
-
signal?: AbortSignal
|
|
1546
|
-
): Promise<
|
|
1547
|
-
return this.fetch(this.url('
|
|
1548
|
-
|
|
1549
|
-
return buildResponse(res).then(
|
|
1550
|
-
return
|
|
1551
|
-
status: <boolean>_data.status,
|
|
1552
|
-
}
|
|
1904
|
+
signal?: AbortSignal
|
|
1905
|
+
): Promise<ToggleWebhookListenerResponse> => {
|
|
1906
|
+
return this.fetch(this.url('ToggleWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1907
|
+
res => {
|
|
1908
|
+
return buildResponse(res).then(_data => {
|
|
1909
|
+
return JsonDecode<ToggleWebhookListenerResponse>(_data, 'ToggleWebhookListenerResponse')
|
|
1553
1910
|
})
|
|
1554
1911
|
},
|
|
1555
|
-
|
|
1556
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1557
|
-
}
|
|
1912
|
+
error => {
|
|
1913
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1914
|
+
}
|
|
1558
1915
|
)
|
|
1559
1916
|
}
|
|
1560
1917
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1918
|
+
updateWebhookListener = (
|
|
1919
|
+
req: UpdateWebhookListenerRequest,
|
|
1563
1920
|
headers?: object,
|
|
1564
|
-
signal?: AbortSignal
|
|
1565
|
-
): Promise<
|
|
1566
|
-
return this.fetch(this.url('
|
|
1567
|
-
|
|
1568
|
-
return buildResponse(res).then(
|
|
1569
|
-
return
|
|
1570
|
-
page: <Page>_data.page,
|
|
1571
|
-
orders: <Array<OrderbookOrder>>_data.orders,
|
|
1572
|
-
}
|
|
1921
|
+
signal?: AbortSignal
|
|
1922
|
+
): Promise<UpdateWebhookListenerResponse> => {
|
|
1923
|
+
return this.fetch(this.url('UpdateWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(
|
|
1924
|
+
res => {
|
|
1925
|
+
return buildResponse(res).then(_data => {
|
|
1926
|
+
return JsonDecode<UpdateWebhookListenerResponse>(_data, 'UpdateWebhookListenerResponse')
|
|
1573
1927
|
})
|
|
1574
1928
|
},
|
|
1575
|
-
|
|
1576
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1577
|
-
}
|
|
1929
|
+
error => {
|
|
1930
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1931
|
+
}
|
|
1578
1932
|
)
|
|
1579
1933
|
}
|
|
1580
1934
|
|
|
1581
|
-
|
|
1582
|
-
return this.fetch(this.url('
|
|
1583
|
-
|
|
1584
|
-
return buildResponse(res).then(
|
|
1585
|
-
return
|
|
1586
|
-
orders: <Array<OrderbookOrder>>_data.orders,
|
|
1587
|
-
}
|
|
1935
|
+
version = (headers?: object, signal?: AbortSignal): Promise<VersionResponse> => {
|
|
1936
|
+
return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then(
|
|
1937
|
+
res => {
|
|
1938
|
+
return buildResponse(res).then(_data => {
|
|
1939
|
+
return JsonDecode<VersionResponse>(_data, 'VersionResponse')
|
|
1588
1940
|
})
|
|
1589
1941
|
},
|
|
1590
|
-
|
|
1591
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message
|
|
1592
|
-
}
|
|
1942
|
+
error => {
|
|
1943
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1944
|
+
}
|
|
1593
1945
|
)
|
|
1594
1946
|
}
|
|
1595
1947
|
}
|
|
@@ -1611,9 +1963,9 @@ const sseResponse = async (res: Response, options: WebrpcStreamOptions<any>, ret
|
|
|
1611
1963
|
onError(
|
|
1612
1964
|
WebrpcBadResponseError.new({
|
|
1613
1965
|
status: res.status,
|
|
1614
|
-
cause: 'Invalid response, missing body'
|
|
1966
|
+
cause: 'Invalid response, missing body'
|
|
1615
1967
|
}),
|
|
1616
|
-
retryFetch
|
|
1968
|
+
retryFetch
|
|
1617
1969
|
)
|
|
1618
1970
|
return
|
|
1619
1971
|
}
|
|
@@ -1643,27 +1995,22 @@ const sseResponse = async (res: Response, options: WebrpcStreamOptions<any>, ret
|
|
|
1643
1995
|
lastReadTime = Date.now()
|
|
1644
1996
|
buffer += decoder.decode(value, { stream: true })
|
|
1645
1997
|
} catch (error) {
|
|
1646
|
-
let message = ''
|
|
1647
|
-
if (error instanceof Error) {
|
|
1648
|
-
message = error.message
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
1998
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
1652
1999
|
onError(
|
|
1653
|
-
|
|
2000
|
+
WebrpcClientAbortedError.new({
|
|
1654
2001
|
message: 'AbortError',
|
|
1655
|
-
cause: `AbortError: ${message}
|
|
2002
|
+
cause: `AbortError: ${error instanceof Error ? error.message : String(error)}`
|
|
1656
2003
|
}),
|
|
1657
2004
|
() => {
|
|
1658
2005
|
throw new Error('Abort signal cannot be used to reconnect')
|
|
1659
|
-
}
|
|
2006
|
+
}
|
|
1660
2007
|
)
|
|
1661
2008
|
} else {
|
|
1662
2009
|
onError(
|
|
1663
2010
|
WebrpcStreamLostError.new({
|
|
1664
|
-
cause: `reader.read(): ${message}
|
|
2011
|
+
cause: `reader.read(): ${error instanceof Error ? error.message : String(error)}`
|
|
1665
2012
|
}),
|
|
1666
|
-
retryFetch
|
|
2013
|
+
retryFetch
|
|
1667
2014
|
)
|
|
1668
2015
|
}
|
|
1669
2016
|
return
|
|
@@ -1671,12 +2018,13 @@ const sseResponse = async (res: Response, options: WebrpcStreamOptions<any>, ret
|
|
|
1671
2018
|
|
|
1672
2019
|
let lines = buffer.split('\n')
|
|
1673
2020
|
for (let i = 0; i < lines.length - 1; i++) {
|
|
1674
|
-
|
|
2021
|
+
const line = lines[i]
|
|
2022
|
+
if (line?.length === 0) {
|
|
1675
2023
|
continue
|
|
1676
2024
|
}
|
|
1677
2025
|
let data: any
|
|
1678
2026
|
try {
|
|
1679
|
-
data = JSON.parse(
|
|
2027
|
+
data = JSON.parse(line)
|
|
1680
2028
|
if (data.hasOwnProperty('webrpcError')) {
|
|
1681
2029
|
const error = data.webrpcError
|
|
1682
2030
|
const code: number = typeof error.code === 'number' ? error.code : 0
|
|
@@ -1690,17 +2038,17 @@ const sseResponse = async (res: Response, options: WebrpcStreamOptions<any>, ret
|
|
|
1690
2038
|
onError(
|
|
1691
2039
|
WebrpcBadResponseError.new({
|
|
1692
2040
|
status: res.status,
|
|
1693
|
-
|
|
1694
|
-
cause: `JSON.parse(): ${error.message}`,
|
|
2041
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}`
|
|
1695
2042
|
}),
|
|
1696
|
-
retryFetch
|
|
2043
|
+
retryFetch
|
|
1697
2044
|
)
|
|
1698
2045
|
}
|
|
1699
2046
|
onMessage(data)
|
|
1700
2047
|
}
|
|
1701
2048
|
|
|
1702
2049
|
if (!done) {
|
|
1703
|
-
|
|
2050
|
+
const lastLine = lines[lines.length - 1]
|
|
2051
|
+
buffer = lastLine || ''
|
|
1704
2052
|
continue
|
|
1705
2053
|
}
|
|
1706
2054
|
|
|
@@ -1709,31 +2057,24 @@ const sseResponse = async (res: Response, options: WebrpcStreamOptions<any>, ret
|
|
|
1709
2057
|
}
|
|
1710
2058
|
}
|
|
1711
2059
|
|
|
1712
|
-
const
|
|
1713
|
-
const reqHeaders: { [key: string]: string } = {
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
method: 'POST',
|
|
1718
|
-
headers: reqHeaders,
|
|
1719
|
-
body: JSON.stringify(body || {}),
|
|
1720
|
-
signal,
|
|
2060
|
+
const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
2061
|
+
const reqHeaders: { [key: string]: string } = {
|
|
2062
|
+
...headers,
|
|
2063
|
+
'Content-Type': 'application/json',
|
|
2064
|
+
[WebrpcHeader]: WebrpcHeaderValue
|
|
1721
2065
|
}
|
|
2066
|
+
return { method: 'POST', headers: reqHeaders, body, signal }
|
|
1722
2067
|
}
|
|
1723
2068
|
|
|
1724
2069
|
const buildResponse = (res: Response): Promise<any> => {
|
|
1725
|
-
return res.text().then(
|
|
2070
|
+
return res.text().then(text => {
|
|
1726
2071
|
let data
|
|
1727
2072
|
try {
|
|
1728
2073
|
data = JSON.parse(text)
|
|
1729
2074
|
} catch (error) {
|
|
1730
|
-
let message = ''
|
|
1731
|
-
if (error instanceof Error) {
|
|
1732
|
-
message = error.message
|
|
1733
|
-
}
|
|
1734
2075
|
throw WebrpcBadResponseError.new({
|
|
1735
2076
|
status: res.status,
|
|
1736
|
-
cause: `JSON.parse(): ${message}: response text: ${text}
|
|
2077
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`
|
|
1737
2078
|
})
|
|
1738
2079
|
}
|
|
1739
2080
|
if (!res.ok) {
|
|
@@ -1744,518 +2085,511 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
1744
2085
|
})
|
|
1745
2086
|
}
|
|
1746
2087
|
|
|
2088
|
+
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
2089
|
+
|
|
2090
|
+
export interface WebrpcStreamOptions<T> extends WebrpcOptions {
|
|
2091
|
+
onMessage: (message: T) => void
|
|
2092
|
+
onError: (error: WebrpcError, reconnect: () => void) => void
|
|
2093
|
+
onOpen?: () => void
|
|
2094
|
+
onClose?: () => void
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
export interface WebrpcOptions {
|
|
2098
|
+
headers?: HeadersInit
|
|
2099
|
+
signal?: AbortSignal
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
export interface WebrpcStreamController {
|
|
2103
|
+
abort: (reason?: any) => void
|
|
2104
|
+
closed: Promise<void>
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
export const JsonEncode = <T = any>(obj: T): string => {
|
|
2108
|
+
return JSON.stringify(obj)
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
export const JsonDecode = <T = any>(data: string | any, _typ: string = ''): T => {
|
|
2112
|
+
let parsed: any = data
|
|
2113
|
+
if (typeof data === 'string') {
|
|
2114
|
+
try {
|
|
2115
|
+
parsed = JSON.parse(data)
|
|
2116
|
+
} catch (err) {
|
|
2117
|
+
throw WebrpcBadResponseError.new({ cause: `JsonDecode: JSON.parse failed: ${(err as Error).message}` })
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
return parsed as T
|
|
2121
|
+
}
|
|
2122
|
+
|
|
1747
2123
|
//
|
|
1748
2124
|
// Errors
|
|
1749
2125
|
//
|
|
1750
2126
|
|
|
2127
|
+
type WebrpcErrorParams = { name?: string; code?: number; message?: string; status?: number; cause?: string }
|
|
2128
|
+
|
|
1751
2129
|
export class WebrpcError extends Error {
|
|
1752
|
-
name: string
|
|
1753
2130
|
code: number
|
|
1754
|
-
message: string
|
|
1755
2131
|
status: number
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
this.
|
|
1764
|
-
this.code = typeof code === 'number' ? code : 0
|
|
1765
|
-
this.message = message || `endpoint error ${this.code}`
|
|
1766
|
-
this.msg = this.message
|
|
1767
|
-
this.status = typeof status === 'number' ? status : 0
|
|
1768
|
-
this.cause = cause
|
|
2132
|
+
|
|
2133
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2134
|
+
super(error.message)
|
|
2135
|
+
this.name = error.name || 'WebrpcEndpointError'
|
|
2136
|
+
this.code = typeof error.code === 'number' ? error.code : 0
|
|
2137
|
+
this.message = error.message || `endpoint error`
|
|
2138
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2139
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1769
2140
|
Object.setPrototypeOf(this, WebrpcError.prototype)
|
|
1770
2141
|
}
|
|
1771
2142
|
|
|
1772
2143
|
static new(payload: any): WebrpcError {
|
|
1773
|
-
return new this(
|
|
2144
|
+
return new this({ message: payload.message, code: payload.code, status: payload.status, cause: payload.cause })
|
|
1774
2145
|
}
|
|
1775
2146
|
}
|
|
1776
2147
|
|
|
1777
|
-
// Webrpc errors
|
|
1778
|
-
|
|
1779
2148
|
export class WebrpcEndpointError extends WebrpcError {
|
|
1780
|
-
constructor(
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
super(name, code, message, status, cause)
|
|
2149
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2150
|
+
super(error)
|
|
2151
|
+
this.name = error.name || 'WebrpcEndpoint'
|
|
2152
|
+
this.code = typeof error.code === 'number' ? error.code : 0
|
|
2153
|
+
this.message = error.message || `endpoint error`
|
|
2154
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2155
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1788
2156
|
Object.setPrototypeOf(this, WebrpcEndpointError.prototype)
|
|
1789
2157
|
}
|
|
1790
2158
|
}
|
|
1791
2159
|
|
|
1792
2160
|
export class WebrpcRequestFailedError extends WebrpcError {
|
|
1793
|
-
constructor(
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
super(name, code, message, status, cause)
|
|
2161
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2162
|
+
super(error)
|
|
2163
|
+
this.name = error.name || 'WebrpcRequestFailed'
|
|
2164
|
+
this.code = typeof error.code === 'number' ? error.code : -1
|
|
2165
|
+
this.message = error.message || `request failed`
|
|
2166
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2167
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1801
2168
|
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype)
|
|
1802
2169
|
}
|
|
1803
2170
|
}
|
|
1804
2171
|
|
|
1805
2172
|
export class WebrpcBadRouteError extends WebrpcError {
|
|
1806
|
-
constructor(
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
super(name, code, message, status, cause)
|
|
2173
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2174
|
+
super(error)
|
|
2175
|
+
this.name = error.name || 'WebrpcBadRoute'
|
|
2176
|
+
this.code = typeof error.code === 'number' ? error.code : -2
|
|
2177
|
+
this.message = error.message || `bad route`
|
|
2178
|
+
this.status = typeof error.status === 'number' ? error.status : 404
|
|
2179
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1814
2180
|
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype)
|
|
1815
2181
|
}
|
|
1816
2182
|
}
|
|
1817
2183
|
|
|
1818
2184
|
export class WebrpcBadMethodError extends WebrpcError {
|
|
1819
|
-
constructor(
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
super(name, code, message, status, cause)
|
|
2185
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2186
|
+
super(error)
|
|
2187
|
+
this.name = error.name || 'WebrpcBadMethod'
|
|
2188
|
+
this.code = typeof error.code === 'number' ? error.code : -3
|
|
2189
|
+
this.message = error.message || `bad method`
|
|
2190
|
+
this.status = typeof error.status === 'number' ? error.status : 405
|
|
2191
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1827
2192
|
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype)
|
|
1828
2193
|
}
|
|
1829
2194
|
}
|
|
1830
2195
|
|
|
1831
2196
|
export class WebrpcBadRequestError extends WebrpcError {
|
|
1832
|
-
constructor(
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
super(name, code, message, status, cause)
|
|
2197
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2198
|
+
super(error)
|
|
2199
|
+
this.name = error.name || 'WebrpcBadRequest'
|
|
2200
|
+
this.code = typeof error.code === 'number' ? error.code : -4
|
|
2201
|
+
this.message = error.message || `bad request`
|
|
2202
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2203
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1840
2204
|
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype)
|
|
1841
2205
|
}
|
|
1842
2206
|
}
|
|
1843
2207
|
|
|
1844
2208
|
export class WebrpcBadResponseError extends WebrpcError {
|
|
1845
|
-
constructor(
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
super(name, code, message, status, cause)
|
|
2209
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2210
|
+
super(error)
|
|
2211
|
+
this.name = error.name || 'WebrpcBadResponse'
|
|
2212
|
+
this.code = typeof error.code === 'number' ? error.code : -5
|
|
2213
|
+
this.message = error.message || `bad response`
|
|
2214
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
2215
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1853
2216
|
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype)
|
|
1854
2217
|
}
|
|
1855
2218
|
}
|
|
1856
2219
|
|
|
1857
2220
|
export class WebrpcServerPanicError extends WebrpcError {
|
|
1858
|
-
constructor(
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
super(name, code, message, status, cause)
|
|
2221
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2222
|
+
super(error)
|
|
2223
|
+
this.name = error.name || 'WebrpcServerPanic'
|
|
2224
|
+
this.code = typeof error.code === 'number' ? error.code : -6
|
|
2225
|
+
this.message = error.message || `server panic`
|
|
2226
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
2227
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1866
2228
|
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype)
|
|
1867
2229
|
}
|
|
1868
2230
|
}
|
|
1869
2231
|
|
|
1870
2232
|
export class WebrpcInternalErrorError extends WebrpcError {
|
|
1871
|
-
constructor(
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
super(name, code, message, status, cause)
|
|
2233
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2234
|
+
super(error)
|
|
2235
|
+
this.name = error.name || 'WebrpcInternalError'
|
|
2236
|
+
this.code = typeof error.code === 'number' ? error.code : -7
|
|
2237
|
+
this.message = error.message || `internal error`
|
|
2238
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
2239
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1879
2240
|
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype)
|
|
1880
2241
|
}
|
|
1881
2242
|
}
|
|
1882
2243
|
|
|
1883
|
-
export class
|
|
1884
|
-
constructor(
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype)
|
|
2244
|
+
export class WebrpcClientAbortedError extends WebrpcError {
|
|
2245
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2246
|
+
super(error)
|
|
2247
|
+
this.name = error.name || 'WebrpcClientAborted'
|
|
2248
|
+
this.code = typeof error.code === 'number' ? error.code : -8
|
|
2249
|
+
this.message = error.message || `request aborted by client`
|
|
2250
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2251
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2252
|
+
Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype)
|
|
1893
2253
|
}
|
|
1894
2254
|
}
|
|
1895
2255
|
|
|
1896
2256
|
export class WebrpcStreamLostError extends WebrpcError {
|
|
1897
|
-
constructor(
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
super(name, code, message, status, cause)
|
|
2257
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2258
|
+
super(error)
|
|
2259
|
+
this.name = error.name || 'WebrpcStreamLost'
|
|
2260
|
+
this.code = typeof error.code === 'number' ? error.code : -9
|
|
2261
|
+
this.message = error.message || `stream lost`
|
|
2262
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2263
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1905
2264
|
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype)
|
|
1906
2265
|
}
|
|
1907
2266
|
}
|
|
1908
2267
|
|
|
1909
2268
|
export class WebrpcStreamFinishedError extends WebrpcError {
|
|
1910
|
-
constructor(
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
super(name, code, message, status, cause)
|
|
2269
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2270
|
+
super(error)
|
|
2271
|
+
this.name = error.name || 'WebrpcStreamFinished'
|
|
2272
|
+
this.code = typeof error.code === 'number' ? error.code : -10
|
|
2273
|
+
this.message = error.message || `stream finished`
|
|
2274
|
+
this.status = typeof error.status === 'number' ? error.status : 200
|
|
2275
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1918
2276
|
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype)
|
|
1919
2277
|
}
|
|
1920
2278
|
}
|
|
1921
2279
|
|
|
2280
|
+
//
|
|
1922
2281
|
// Schema errors
|
|
2282
|
+
//
|
|
1923
2283
|
|
|
1924
|
-
export class
|
|
1925
|
-
constructor(
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
Object.setPrototypeOf(this, UnauthorizedError.prototype)
|
|
2284
|
+
export class AbortedError extends WebrpcError {
|
|
2285
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2286
|
+
super(error)
|
|
2287
|
+
this.name = error.name || 'Aborted'
|
|
2288
|
+
this.code = typeof error.code === 'number' ? error.code : 1005
|
|
2289
|
+
this.message = error.message || `Request aborted`
|
|
2290
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2291
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2292
|
+
Object.setPrototypeOf(this, AbortedError.prototype)
|
|
1934
2293
|
}
|
|
1935
2294
|
}
|
|
1936
2295
|
|
|
1937
|
-
export class
|
|
1938
|
-
constructor(
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
Object.setPrototypeOf(this, PermissionDeniedError.prototype)
|
|
2296
|
+
export class AccessKeyMismatchError extends WebrpcError {
|
|
2297
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2298
|
+
super(error)
|
|
2299
|
+
this.name = error.name || 'AccessKeyMismatch'
|
|
2300
|
+
this.code = typeof error.code === 'number' ? error.code : 1102
|
|
2301
|
+
this.message = error.message || `Access key mismatch`
|
|
2302
|
+
this.status = typeof error.status === 'number' ? error.status : 409
|
|
2303
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2304
|
+
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype)
|
|
1947
2305
|
}
|
|
1948
2306
|
}
|
|
1949
2307
|
|
|
1950
|
-
export class
|
|
1951
|
-
constructor(
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
Object.setPrototypeOf(this, SessionExpiredError.prototype)
|
|
2308
|
+
export class AccessKeyNotFoundError extends WebrpcError {
|
|
2309
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2310
|
+
super(error)
|
|
2311
|
+
this.name = error.name || 'AccessKeyNotFound'
|
|
2312
|
+
this.code = typeof error.code === 'number' ? error.code : 1101
|
|
2313
|
+
this.message = error.message || `Access key not found`
|
|
2314
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
2315
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2316
|
+
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype)
|
|
1960
2317
|
}
|
|
1961
2318
|
}
|
|
1962
2319
|
|
|
1963
|
-
export class
|
|
1964
|
-
constructor(
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
Object.setPrototypeOf(this, MethodNotFoundError.prototype)
|
|
2320
|
+
export class AtLeastOneKeyError extends WebrpcError {
|
|
2321
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2322
|
+
super(error)
|
|
2323
|
+
this.name = error.name || 'AtLeastOneKey'
|
|
2324
|
+
this.code = typeof error.code === 'number' ? error.code : 1302
|
|
2325
|
+
this.message = error.message || `You need at least one Access Key`
|
|
2326
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2327
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2328
|
+
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype)
|
|
1973
2329
|
}
|
|
1974
2330
|
}
|
|
1975
2331
|
|
|
1976
|
-
export class
|
|
1977
|
-
constructor(
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
Object.setPrototypeOf(this, RequestConflictError.prototype)
|
|
2332
|
+
export class GeoblockedError extends WebrpcError {
|
|
2333
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2334
|
+
super(error)
|
|
2335
|
+
this.name = error.name || 'Geoblocked'
|
|
2336
|
+
this.code = typeof error.code === 'number' ? error.code : 1006
|
|
2337
|
+
this.message = error.message || `Geoblocked region`
|
|
2338
|
+
this.status = typeof error.status === 'number' ? error.status : 451
|
|
2339
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2340
|
+
Object.setPrototypeOf(this, GeoblockedError.prototype)
|
|
1986
2341
|
}
|
|
1987
2342
|
}
|
|
1988
2343
|
|
|
1989
|
-
export class
|
|
1990
|
-
constructor(
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
Object.setPrototypeOf(this, AbortedError.prototype)
|
|
2344
|
+
export class InvalidArgumentError extends WebrpcError {
|
|
2345
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2346
|
+
super(error)
|
|
2347
|
+
this.name = error.name || 'InvalidArgument'
|
|
2348
|
+
this.code = typeof error.code === 'number' ? error.code : 2001
|
|
2349
|
+
this.message = error.message || `Invalid argument`
|
|
2350
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2351
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2352
|
+
Object.setPrototypeOf(this, InvalidArgumentError.prototype)
|
|
1999
2353
|
}
|
|
2000
2354
|
}
|
|
2001
2355
|
|
|
2002
|
-
export class
|
|
2003
|
-
constructor(
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
Object.setPrototypeOf(this, GeoblockedError.prototype)
|
|
2356
|
+
export class InvalidOriginError extends WebrpcError {
|
|
2357
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2358
|
+
super(error)
|
|
2359
|
+
this.name = error.name || 'InvalidOrigin'
|
|
2360
|
+
this.code = typeof error.code === 'number' ? error.code : 1103
|
|
2361
|
+
this.message = error.message || `Invalid origin for Access Key`
|
|
2362
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2363
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2364
|
+
Object.setPrototypeOf(this, InvalidOriginError.prototype)
|
|
2012
2365
|
}
|
|
2013
2366
|
}
|
|
2014
2367
|
|
|
2015
|
-
export class
|
|
2016
|
-
constructor(
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
Object.setPrototypeOf(this, RateLimitedError.prototype)
|
|
2368
|
+
export class InvalidServiceError extends WebrpcError {
|
|
2369
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2370
|
+
super(error)
|
|
2371
|
+
this.name = error.name || 'InvalidService'
|
|
2372
|
+
this.code = typeof error.code === 'number' ? error.code : 1104
|
|
2373
|
+
this.message = error.message || `Service not enabled for Access key`
|
|
2374
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2375
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2376
|
+
Object.setPrototypeOf(this, InvalidServiceError.prototype)
|
|
2025
2377
|
}
|
|
2026
2378
|
}
|
|
2027
2379
|
|
|
2028
|
-
export class
|
|
2029
|
-
constructor(
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
Object.setPrototypeOf(this, ProjectNotFoundError.prototype)
|
|
2380
|
+
export class MaxAccessKeysError extends WebrpcError {
|
|
2381
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2382
|
+
super(error)
|
|
2383
|
+
this.name = error.name || 'MaxAccessKeys'
|
|
2384
|
+
this.code = typeof error.code === 'number' ? error.code : 1301
|
|
2385
|
+
this.message = error.message || `Access keys limit reached`
|
|
2386
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2387
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2388
|
+
Object.setPrototypeOf(this, MaxAccessKeysError.prototype)
|
|
2038
2389
|
}
|
|
2039
2390
|
}
|
|
2040
2391
|
|
|
2041
|
-
export class
|
|
2042
|
-
constructor(
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype)
|
|
2392
|
+
export class MetadataCallFailedError extends WebrpcError {
|
|
2393
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2394
|
+
super(error)
|
|
2395
|
+
this.name = error.name || 'MetadataCallFailed'
|
|
2396
|
+
this.code = typeof error.code === 'number' ? error.code : 3003
|
|
2397
|
+
this.message = error.message || `Metadata service call failed`
|
|
2398
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2399
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2400
|
+
Object.setPrototypeOf(this, MetadataCallFailedError.prototype)
|
|
2051
2401
|
}
|
|
2052
2402
|
}
|
|
2053
2403
|
|
|
2054
|
-
export class
|
|
2055
|
-
constructor(
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype)
|
|
2404
|
+
export class MethodNotFoundError extends WebrpcError {
|
|
2405
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2406
|
+
super(error)
|
|
2407
|
+
this.name = error.name || 'MethodNotFound'
|
|
2408
|
+
this.code = typeof error.code === 'number' ? error.code : 1003
|
|
2409
|
+
this.message = error.message || `Method not found`
|
|
2410
|
+
this.status = typeof error.status === 'number' ? error.status : 404
|
|
2411
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2412
|
+
Object.setPrototypeOf(this, MethodNotFoundError.prototype)
|
|
2064
2413
|
}
|
|
2065
2414
|
}
|
|
2066
2415
|
|
|
2067
|
-
export class
|
|
2068
|
-
constructor(
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
Object.setPrototypeOf(this, InvalidOriginError.prototype)
|
|
2416
|
+
export class NoDefaultKeyError extends WebrpcError {
|
|
2417
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2418
|
+
super(error)
|
|
2419
|
+
this.name = error.name || 'NoDefaultKey'
|
|
2420
|
+
this.code = typeof error.code === 'number' ? error.code : 1300
|
|
2421
|
+
this.message = error.message || `No default access key found`
|
|
2422
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2423
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2424
|
+
Object.setPrototypeOf(this, NoDefaultKeyError.prototype)
|
|
2077
2425
|
}
|
|
2078
2426
|
}
|
|
2079
2427
|
|
|
2080
|
-
export class
|
|
2081
|
-
constructor(
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
Object.setPrototypeOf(this, InvalidServiceError.prototype)
|
|
2428
|
+
export class NotFoundError extends WebrpcError {
|
|
2429
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2430
|
+
super(error)
|
|
2431
|
+
this.name = error.name || 'NotFound'
|
|
2432
|
+
this.code = typeof error.code === 'number' ? error.code : 3000
|
|
2433
|
+
this.message = error.message || `Resource not found`
|
|
2434
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2435
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2436
|
+
Object.setPrototypeOf(this, NotFoundError.prototype)
|
|
2090
2437
|
}
|
|
2091
2438
|
}
|
|
2092
2439
|
|
|
2093
|
-
export class
|
|
2094
|
-
constructor(
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
Object.setPrototypeOf(this, UnauthorizedUserError.prototype)
|
|
2440
|
+
export class PermissionDeniedError extends WebrpcError {
|
|
2441
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2442
|
+
super(error)
|
|
2443
|
+
this.name = error.name || 'PermissionDenied'
|
|
2444
|
+
this.code = typeof error.code === 'number' ? error.code : 1001
|
|
2445
|
+
this.message = error.message || `Permission denied`
|
|
2446
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2447
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2448
|
+
Object.setPrototypeOf(this, PermissionDeniedError.prototype)
|
|
2103
2449
|
}
|
|
2104
2450
|
}
|
|
2105
2451
|
|
|
2106
|
-
export class
|
|
2107
|
-
constructor(
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
Object.setPrototypeOf(this, QuotaExceededError.prototype)
|
|
2452
|
+
export class ProjectNotFoundError extends WebrpcError {
|
|
2453
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2454
|
+
super(error)
|
|
2455
|
+
this.name = error.name || 'ProjectNotFound'
|
|
2456
|
+
this.code = typeof error.code === 'number' ? error.code : 1100
|
|
2457
|
+
this.message = error.message || `Project not found`
|
|
2458
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
2459
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2460
|
+
Object.setPrototypeOf(this, ProjectNotFoundError.prototype)
|
|
2116
2461
|
}
|
|
2117
2462
|
}
|
|
2118
2463
|
|
|
2119
|
-
export class
|
|
2120
|
-
constructor(
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
Object.setPrototypeOf(this, RateLimitError.prototype)
|
|
2464
|
+
export class QueryFailedError extends WebrpcError {
|
|
2465
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2466
|
+
super(error)
|
|
2467
|
+
this.name = error.name || 'QueryFailed'
|
|
2468
|
+
this.code = typeof error.code === 'number' ? error.code : 2003
|
|
2469
|
+
this.message = error.message || `Query failed`
|
|
2470
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2471
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2472
|
+
Object.setPrototypeOf(this, QueryFailedError.prototype)
|
|
2129
2473
|
}
|
|
2130
2474
|
}
|
|
2131
2475
|
|
|
2132
|
-
export class
|
|
2133
|
-
constructor(
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
Object.setPrototypeOf(this, NoDefaultKeyError.prototype)
|
|
2476
|
+
export class QuotaExceededError extends WebrpcError {
|
|
2477
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2478
|
+
super(error)
|
|
2479
|
+
this.name = error.name || 'QuotaExceeded'
|
|
2480
|
+
this.code = typeof error.code === 'number' ? error.code : 1200
|
|
2481
|
+
this.message = error.message || `Quota exceeded`
|
|
2482
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
2483
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2484
|
+
Object.setPrototypeOf(this, QuotaExceededError.prototype)
|
|
2142
2485
|
}
|
|
2143
2486
|
}
|
|
2144
2487
|
|
|
2145
|
-
export class
|
|
2146
|
-
constructor(
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
Object.setPrototypeOf(this, MaxAccessKeysError.prototype)
|
|
2488
|
+
export class RateLimitError extends WebrpcError {
|
|
2489
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2490
|
+
super(error)
|
|
2491
|
+
this.name = error.name || 'RateLimit'
|
|
2492
|
+
this.code = typeof error.code === 'number' ? error.code : 1201
|
|
2493
|
+
this.message = error.message || `Rate limit exceeded`
|
|
2494
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
2495
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2496
|
+
Object.setPrototypeOf(this, RateLimitError.prototype)
|
|
2155
2497
|
}
|
|
2156
2498
|
}
|
|
2157
2499
|
|
|
2158
|
-
export class
|
|
2159
|
-
constructor(
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype)
|
|
2500
|
+
export class RateLimitedError extends WebrpcError {
|
|
2501
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2502
|
+
super(error)
|
|
2503
|
+
this.name = error.name || 'RateLimited'
|
|
2504
|
+
this.code = typeof error.code === 'number' ? error.code : 1007
|
|
2505
|
+
this.message = error.message || `Rate-limited. Please slow down.`
|
|
2506
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
2507
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2508
|
+
Object.setPrototypeOf(this, RateLimitedError.prototype)
|
|
2168
2509
|
}
|
|
2169
2510
|
}
|
|
2170
2511
|
|
|
2171
|
-
export class
|
|
2172
|
-
constructor(
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
Object.setPrototypeOf(this, TimeoutError.prototype)
|
|
2512
|
+
export class RequestConflictError extends WebrpcError {
|
|
2513
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2514
|
+
super(error)
|
|
2515
|
+
this.name = error.name || 'RequestConflict'
|
|
2516
|
+
this.code = typeof error.code === 'number' ? error.code : 1004
|
|
2517
|
+
this.message = error.message || `Conflict with target resource`
|
|
2518
|
+
this.status = typeof error.status === 'number' ? error.status : 409
|
|
2519
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2520
|
+
Object.setPrototypeOf(this, RequestConflictError.prototype)
|
|
2181
2521
|
}
|
|
2182
2522
|
}
|
|
2183
2523
|
|
|
2184
|
-
export class
|
|
2185
|
-
constructor(
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
Object.setPrototypeOf(this, InvalidArgumentError.prototype)
|
|
2524
|
+
export class ResourceExhaustedError extends WebrpcError {
|
|
2525
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2526
|
+
super(error)
|
|
2527
|
+
this.name = error.name || 'ResourceExhausted'
|
|
2528
|
+
this.code = typeof error.code === 'number' ? error.code : 2004
|
|
2529
|
+
this.message = error.message || `Resource exhausted`
|
|
2530
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2531
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2532
|
+
Object.setPrototypeOf(this, ResourceExhaustedError.prototype)
|
|
2194
2533
|
}
|
|
2195
2534
|
}
|
|
2196
2535
|
|
|
2197
|
-
export class
|
|
2198
|
-
constructor(
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
Object.setPrototypeOf(this, UnavailableError.prototype)
|
|
2536
|
+
export class SessionExpiredError extends WebrpcError {
|
|
2537
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2538
|
+
super(error)
|
|
2539
|
+
this.name = error.name || 'SessionExpired'
|
|
2540
|
+
this.code = typeof error.code === 'number' ? error.code : 1002
|
|
2541
|
+
this.message = error.message || `Session expired`
|
|
2542
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2543
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2544
|
+
Object.setPrototypeOf(this, SessionExpiredError.prototype)
|
|
2207
2545
|
}
|
|
2208
2546
|
}
|
|
2209
2547
|
|
|
2210
|
-
export class
|
|
2211
|
-
constructor(
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
Object.setPrototypeOf(this, QueryFailedError.prototype)
|
|
2548
|
+
export class TimeoutError extends WebrpcError {
|
|
2549
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2550
|
+
super(error)
|
|
2551
|
+
this.name = error.name || 'Timeout'
|
|
2552
|
+
this.code = typeof error.code === 'number' ? error.code : 1900
|
|
2553
|
+
this.message = error.message || `Request timed out`
|
|
2554
|
+
this.status = typeof error.status === 'number' ? error.status : 408
|
|
2555
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2556
|
+
Object.setPrototypeOf(this, TimeoutError.prototype)
|
|
2220
2557
|
}
|
|
2221
2558
|
}
|
|
2222
2559
|
|
|
2223
|
-
export class
|
|
2224
|
-
constructor(
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
Object.setPrototypeOf(this, ResourceExhaustedError.prototype)
|
|
2560
|
+
export class UnauthorizedError extends WebrpcError {
|
|
2561
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2562
|
+
super(error)
|
|
2563
|
+
this.name = error.name || 'Unauthorized'
|
|
2564
|
+
this.code = typeof error.code === 'number' ? error.code : 1000
|
|
2565
|
+
this.message = error.message || `Unauthorized access`
|
|
2566
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
2567
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2568
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype)
|
|
2233
2569
|
}
|
|
2234
2570
|
}
|
|
2235
2571
|
|
|
2236
|
-
export class
|
|
2237
|
-
constructor(
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
Object.setPrototypeOf(this, NotFoundError.prototype)
|
|
2572
|
+
export class UnauthorizedUserError extends WebrpcError {
|
|
2573
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2574
|
+
super(error)
|
|
2575
|
+
this.name = error.name || 'UnauthorizedUser'
|
|
2576
|
+
this.code = typeof error.code === 'number' ? error.code : 1105
|
|
2577
|
+
this.message = error.message || `Unauthorized user`
|
|
2578
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
2579
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2580
|
+
Object.setPrototypeOf(this, UnauthorizedUserError.prototype)
|
|
2246
2581
|
}
|
|
2247
2582
|
}
|
|
2248
2583
|
|
|
2249
|
-
export class
|
|
2250
|
-
constructor(
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
Object.setPrototypeOf(this, MetadataCallFailedError.prototype)
|
|
2584
|
+
export class UnavailableError extends WebrpcError {
|
|
2585
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
2586
|
+
super(error)
|
|
2587
|
+
this.name = error.name || 'Unavailable'
|
|
2588
|
+
this.code = typeof error.code === 'number' ? error.code : 2002
|
|
2589
|
+
this.message = error.message || `Unavailable resource`
|
|
2590
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
2591
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
2592
|
+
Object.setPrototypeOf(this, UnavailableError.prototype)
|
|
2259
2593
|
}
|
|
2260
2594
|
}
|
|
2261
2595
|
|
|
@@ -2268,38 +2602,78 @@ export enum errors {
|
|
|
2268
2602
|
WebrpcBadResponse = 'WebrpcBadResponse',
|
|
2269
2603
|
WebrpcServerPanic = 'WebrpcServerPanic',
|
|
2270
2604
|
WebrpcInternalError = 'WebrpcInternalError',
|
|
2271
|
-
|
|
2605
|
+
WebrpcClientAborted = 'WebrpcClientAborted',
|
|
2272
2606
|
WebrpcStreamLost = 'WebrpcStreamLost',
|
|
2273
2607
|
WebrpcStreamFinished = 'WebrpcStreamFinished',
|
|
2274
|
-
Unauthorized = 'Unauthorized',
|
|
2275
|
-
PermissionDenied = 'PermissionDenied',
|
|
2276
|
-
SessionExpired = 'SessionExpired',
|
|
2277
|
-
MethodNotFound = 'MethodNotFound',
|
|
2278
|
-
RequestConflict = 'RequestConflict',
|
|
2279
2608
|
Aborted = 'Aborted',
|
|
2280
|
-
Geoblocked = 'Geoblocked',
|
|
2281
|
-
RateLimited = 'RateLimited',
|
|
2282
|
-
ProjectNotFound = 'ProjectNotFound',
|
|
2283
|
-
AccessKeyNotFound = 'AccessKeyNotFound',
|
|
2284
2609
|
AccessKeyMismatch = 'AccessKeyMismatch',
|
|
2610
|
+
AccessKeyNotFound = 'AccessKeyNotFound',
|
|
2611
|
+
AtLeastOneKey = 'AtLeastOneKey',
|
|
2612
|
+
Geoblocked = 'Geoblocked',
|
|
2613
|
+
InvalidArgument = 'InvalidArgument',
|
|
2285
2614
|
InvalidOrigin = 'InvalidOrigin',
|
|
2286
2615
|
InvalidService = 'InvalidService',
|
|
2287
|
-
UnauthorizedUser = 'UnauthorizedUser',
|
|
2288
|
-
QuotaExceeded = 'QuotaExceeded',
|
|
2289
|
-
RateLimit = 'RateLimit',
|
|
2290
|
-
NoDefaultKey = 'NoDefaultKey',
|
|
2291
2616
|
MaxAccessKeys = 'MaxAccessKeys',
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2617
|
+
MetadataCallFailed = 'MetadataCallFailed',
|
|
2618
|
+
MethodNotFound = 'MethodNotFound',
|
|
2619
|
+
NoDefaultKey = 'NoDefaultKey',
|
|
2620
|
+
NotFound = 'NotFound',
|
|
2621
|
+
PermissionDenied = 'PermissionDenied',
|
|
2622
|
+
ProjectNotFound = 'ProjectNotFound',
|
|
2296
2623
|
QueryFailed = 'QueryFailed',
|
|
2624
|
+
QuotaExceeded = 'QuotaExceeded',
|
|
2625
|
+
RateLimit = 'RateLimit',
|
|
2626
|
+
RateLimited = 'RateLimited',
|
|
2627
|
+
RequestConflict = 'RequestConflict',
|
|
2297
2628
|
ResourceExhausted = 'ResourceExhausted',
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2629
|
+
SessionExpired = 'SessionExpired',
|
|
2630
|
+
Timeout = 'Timeout',
|
|
2631
|
+
Unauthorized = 'Unauthorized',
|
|
2632
|
+
UnauthorizedUser = 'UnauthorizedUser',
|
|
2633
|
+
Unavailable = 'Unavailable'
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
export enum WebrpcErrorCodes {
|
|
2637
|
+
WebrpcEndpoint = 0,
|
|
2638
|
+
WebrpcRequestFailed = -1,
|
|
2639
|
+
WebrpcBadRoute = -2,
|
|
2640
|
+
WebrpcBadMethod = -3,
|
|
2641
|
+
WebrpcBadRequest = -4,
|
|
2642
|
+
WebrpcBadResponse = -5,
|
|
2643
|
+
WebrpcServerPanic = -6,
|
|
2644
|
+
WebrpcInternalError = -7,
|
|
2645
|
+
WebrpcClientAborted = -8,
|
|
2646
|
+
WebrpcStreamLost = -9,
|
|
2647
|
+
WebrpcStreamFinished = -10,
|
|
2648
|
+
Aborted = 1005,
|
|
2649
|
+
AccessKeyMismatch = 1102,
|
|
2650
|
+
AccessKeyNotFound = 1101,
|
|
2651
|
+
AtLeastOneKey = 1302,
|
|
2652
|
+
Geoblocked = 1006,
|
|
2653
|
+
InvalidArgument = 2001,
|
|
2654
|
+
InvalidOrigin = 1103,
|
|
2655
|
+
InvalidService = 1104,
|
|
2656
|
+
MaxAccessKeys = 1301,
|
|
2657
|
+
MetadataCallFailed = 3003,
|
|
2658
|
+
MethodNotFound = 1003,
|
|
2659
|
+
NoDefaultKey = 1300,
|
|
2660
|
+
NotFound = 3000,
|
|
2661
|
+
PermissionDenied = 1001,
|
|
2662
|
+
ProjectNotFound = 1100,
|
|
2663
|
+
QueryFailed = 2003,
|
|
2664
|
+
QuotaExceeded = 1200,
|
|
2665
|
+
RateLimit = 1201,
|
|
2666
|
+
RateLimited = 1007,
|
|
2667
|
+
RequestConflict = 1004,
|
|
2668
|
+
ResourceExhausted = 2004,
|
|
2669
|
+
SessionExpired = 1002,
|
|
2670
|
+
Timeout = 1900,
|
|
2671
|
+
Unauthorized = 1000,
|
|
2672
|
+
UnauthorizedUser = 1105,
|
|
2673
|
+
Unavailable = 2002
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
2303
2677
|
[0]: WebrpcEndpointError,
|
|
2304
2678
|
[-1]: WebrpcRequestFailedError,
|
|
2305
2679
|
[-2]: WebrpcBadRouteError,
|
|
@@ -2308,46 +2682,89 @@ const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
2308
2682
|
[-5]: WebrpcBadResponseError,
|
|
2309
2683
|
[-6]: WebrpcServerPanicError,
|
|
2310
2684
|
[-7]: WebrpcInternalErrorError,
|
|
2311
|
-
[-8]:
|
|
2685
|
+
[-8]: WebrpcClientAbortedError,
|
|
2312
2686
|
[-9]: WebrpcStreamLostError,
|
|
2313
2687
|
[-10]: WebrpcStreamFinishedError,
|
|
2314
|
-
[1000]: UnauthorizedError,
|
|
2315
|
-
[1001]: PermissionDeniedError,
|
|
2316
|
-
[1002]: SessionExpiredError,
|
|
2317
|
-
[1003]: MethodNotFoundError,
|
|
2318
|
-
[1004]: RequestConflictError,
|
|
2319
2688
|
[1005]: AbortedError,
|
|
2320
|
-
[1006]: GeoblockedError,
|
|
2321
|
-
[1007]: RateLimitedError,
|
|
2322
|
-
[1100]: ProjectNotFoundError,
|
|
2323
|
-
[1101]: AccessKeyNotFoundError,
|
|
2324
2689
|
[1102]: AccessKeyMismatchError,
|
|
2690
|
+
[1101]: AccessKeyNotFoundError,
|
|
2691
|
+
[1302]: AtLeastOneKeyError,
|
|
2692
|
+
[1006]: GeoblockedError,
|
|
2693
|
+
[2001]: InvalidArgumentError,
|
|
2325
2694
|
[1103]: InvalidOriginError,
|
|
2326
2695
|
[1104]: InvalidServiceError,
|
|
2327
|
-
[1105]: UnauthorizedUserError,
|
|
2328
|
-
[1200]: QuotaExceededError,
|
|
2329
|
-
[1201]: RateLimitError,
|
|
2330
|
-
[1300]: NoDefaultKeyError,
|
|
2331
2696
|
[1301]: MaxAccessKeysError,
|
|
2332
|
-
[
|
|
2333
|
-
[
|
|
2334
|
-
[
|
|
2335
|
-
[
|
|
2697
|
+
[3003]: MetadataCallFailedError,
|
|
2698
|
+
[1003]: MethodNotFoundError,
|
|
2699
|
+
[1300]: NoDefaultKeyError,
|
|
2700
|
+
[3000]: NotFoundError,
|
|
2701
|
+
[1001]: PermissionDeniedError,
|
|
2702
|
+
[1100]: ProjectNotFoundError,
|
|
2336
2703
|
[2003]: QueryFailedError,
|
|
2704
|
+
[1200]: QuotaExceededError,
|
|
2705
|
+
[1201]: RateLimitError,
|
|
2706
|
+
[1007]: RateLimitedError,
|
|
2707
|
+
[1004]: RequestConflictError,
|
|
2337
2708
|
[2004]: ResourceExhaustedError,
|
|
2338
|
-
[
|
|
2339
|
-
[
|
|
2709
|
+
[1002]: SessionExpiredError,
|
|
2710
|
+
[1900]: TimeoutError,
|
|
2711
|
+
[1000]: UnauthorizedError,
|
|
2712
|
+
[1105]: UnauthorizedUserError,
|
|
2713
|
+
[2002]: UnavailableError
|
|
2340
2714
|
}
|
|
2341
2715
|
|
|
2342
|
-
|
|
2716
|
+
//
|
|
2717
|
+
// Webrpc
|
|
2718
|
+
//
|
|
2343
2719
|
|
|
2344
|
-
export
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2720
|
+
export const WebrpcHeader = 'Webrpc'
|
|
2721
|
+
|
|
2722
|
+
export const WebrpcHeaderValue = 'webrpc@v0.31.2;gen-typescript@v0.23.1;sequence-indexer@v0.4.0'
|
|
2723
|
+
|
|
2724
|
+
type WebrpcGenVersions = {
|
|
2725
|
+
WebrpcGenVersion: string
|
|
2726
|
+
codeGenName: string
|
|
2727
|
+
codeGenVersion: string
|
|
2728
|
+
schemaName: string
|
|
2729
|
+
schemaVersion: string
|
|
2349
2730
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2731
|
+
|
|
2732
|
+
export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
2733
|
+
const headerValue = headers.get(WebrpcHeader)
|
|
2734
|
+
if (!headerValue) {
|
|
2735
|
+
return {
|
|
2736
|
+
WebrpcGenVersion: '',
|
|
2737
|
+
codeGenName: '',
|
|
2738
|
+
codeGenVersion: '',
|
|
2739
|
+
schemaName: '',
|
|
2740
|
+
schemaVersion: ''
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
return parseWebrpcGenVersions(headerValue)
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
2748
|
+
const versions = header.split(';')
|
|
2749
|
+
if (versions.length < 3) {
|
|
2750
|
+
return {
|
|
2751
|
+
WebrpcGenVersion: '',
|
|
2752
|
+
codeGenName: '',
|
|
2753
|
+
codeGenVersion: '',
|
|
2754
|
+
schemaName: '',
|
|
2755
|
+
schemaVersion: ''
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
const [_, WebrpcGenVersion] = versions[0]!.split('@')
|
|
2760
|
+
const [codeGenName, codeGenVersion] = versions[1]!.split('@')
|
|
2761
|
+
const [schemaName, schemaVersion] = versions[2]!.split('@')
|
|
2762
|
+
|
|
2763
|
+
return {
|
|
2764
|
+
WebrpcGenVersion: WebrpcGenVersion ?? '',
|
|
2765
|
+
codeGenName: codeGenName ?? '',
|
|
2766
|
+
codeGenVersion: codeGenVersion ?? '',
|
|
2767
|
+
schemaName: schemaName ?? '',
|
|
2768
|
+
schemaVersion: schemaVersion ?? ''
|
|
2769
|
+
}
|
|
2353
2770
|
}
|