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