@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/indexergw.gen.ts
CHANGED
|
@@ -1,79 +1,142 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// sequence-indexer v0.4.0
|
|
2
|
+
// sequence-indexer v0.4.0 b978d153702d614d5f1b9c98ff7f2e5857cccfd6
|
|
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=IndexerGateway -target=typescript -client -out=./clients/indexergw.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 = "b978d153702d614d5f1b9c98ff7f2e5857cccfd6"
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
//
|
|
18
|
+
// Client interface
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
export interface IndexerGatewayClient {
|
|
22
|
+
/**
|
|
23
|
+
* GetTokenBalances returns a balance summary/details for an specific account
|
|
24
|
+
* on all indexer nodes. By default if accountAddress is left empty, it will
|
|
25
|
+
* use the account from the jwt session.
|
|
26
|
+
*/
|
|
27
|
+
getBalanceUpdates(req: GetBalanceUpdatesRequest, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesResponse>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* GetChains returns a list of chains with their ID and name
|
|
31
|
+
*/
|
|
32
|
+
getChains(req: GetChainsRequest, headers?: object, signal?: AbortSignal): Promise<GetChainsResponse>
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* GetNativeTokenBalance queries indexer nodes for the latest native token
|
|
36
|
+
* account balance.
|
|
37
|
+
*/
|
|
38
|
+
getNativeTokenBalance(req: GetNativeTokenBalanceRequest, headers?: object, signal?: AbortSignal): Promise<GetNativeTokenBalanceResponse>
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* GetTokenBalances returns a balance summary/details for a specific account
|
|
42
|
+
* on all indexer nodes. By default if accountAddress is left empty, it will
|
|
43
|
+
* use the account from the jwt session.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Use GetTokenBalancesSummary or GetTokenBalancesDetails instead.
|
|
46
|
+
*/
|
|
47
|
+
getTokenBalances(req: GetTokenBalancesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesResponse>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* GetTokenBalancesByContract returns a balances for specific accounts and
|
|
51
|
+
* contracts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
|
|
52
|
+
* represented as individual balances.
|
|
53
|
+
*/
|
|
54
|
+
getTokenBalancesByContract(req: GetTokenBalancesByContractRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesByContractResponse>
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* GetTokenBalancesDetails returns a detailed balance summary for the given
|
|
58
|
+
* accounts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
|
|
59
|
+
* represented as individual balances.
|
|
60
|
+
*/
|
|
61
|
+
getTokenBalancesDetails(req: GetTokenBalancesDetailsRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesDetailsResponse>
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* GetTokenBalancesSummary returns a summary of token balances for the given
|
|
65
|
+
* accounts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
|
|
66
|
+
* represented as a single aggregated balance.
|
|
67
|
+
*/
|
|
68
|
+
getTokenBalancesSummary(req: GetTokenBalancesSummaryRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesSummaryResponse>
|
|
69
|
+
|
|
70
|
+
getTokenPrice(req: GetTokenPriceRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPriceResponse>
|
|
71
|
+
|
|
72
|
+
getTokenPrices(req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPricesResponse>
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* GetTransactionHistory returns the history of mined transactions for the
|
|
76
|
+
* given account on all indexer nodes, which includes a list of token transfer
|
|
77
|
+
* (sent/received) , and sent transactions from a Sequence wallet.
|
|
78
|
+
*/
|
|
79
|
+
getTransactionHistory(req: GetTransactionHistoryRequest, headers?: object, signal?: AbortSignal): Promise<GetTransactionHistoryResponse>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Ping the indexer
|
|
83
|
+
*/
|
|
84
|
+
ping(headers?: object, signal?: AbortSignal): Promise<PingResponse>
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get the current runtime health status of the indexer gatewya
|
|
88
|
+
*/
|
|
89
|
+
runtimeStatus(headers?: object, signal?: AbortSignal): Promise<RuntimeStatusResponse>
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the current version of the indexer
|
|
93
|
+
*/
|
|
94
|
+
version(headers?: object, signal?: AbortSignal): Promise<VersionResponse>
|
|
27
95
|
}
|
|
28
96
|
|
|
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
97
|
|
|
41
|
-
|
|
42
|
-
|
|
98
|
+
//
|
|
99
|
+
// Schema types
|
|
100
|
+
//
|
|
43
101
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
102
|
+
export interface Asset {
|
|
103
|
+
id: number
|
|
104
|
+
collectionId: number
|
|
105
|
+
tokenId?: string
|
|
106
|
+
url?: string
|
|
107
|
+
metadataField: string
|
|
108
|
+
name?: string
|
|
109
|
+
filesize?: number
|
|
110
|
+
mimeType?: string
|
|
111
|
+
width?: number
|
|
112
|
+
height?: number
|
|
113
|
+
updatedAt?: string
|
|
114
|
+
}
|
|
55
115
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
116
|
+
export interface BloomStats {
|
|
117
|
+
hitRatio: string
|
|
118
|
+
falsePositivesPercent: string
|
|
119
|
+
hitCount: number
|
|
120
|
+
missCount: number
|
|
121
|
+
falsePositives: number
|
|
122
|
+
}
|
|
59
123
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
schemaVersion
|
|
66
|
-
}
|
|
124
|
+
export interface BloomStatus {
|
|
125
|
+
enabled: boolean
|
|
126
|
+
initialized: boolean
|
|
127
|
+
bloomInitElapsedTime: string
|
|
128
|
+
stats: BloomStats
|
|
67
129
|
}
|
|
68
130
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
131
|
+
export interface Bond {
|
|
132
|
+
pebble: PebbleMetrics
|
|
133
|
+
estimatedDiskUsagePerTable: any
|
|
134
|
+
estimatedDiskUsageTotal: string
|
|
135
|
+
}
|
|
72
136
|
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
AVAILABLE = 'AVAILABLE'
|
|
137
|
+
export interface ChainInfo {
|
|
138
|
+
chainId: number
|
|
139
|
+
chainName: string
|
|
77
140
|
}
|
|
78
141
|
|
|
79
142
|
export interface ContractInfo {
|
|
@@ -93,56 +156,29 @@ export interface ContractInfo {
|
|
|
93
156
|
status: ResourceStatus
|
|
94
157
|
}
|
|
95
158
|
|
|
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
|
|
159
|
+
export interface ContractInfoExtensionBridgeInfo {
|
|
160
|
+
tokenAddress: string
|
|
109
161
|
}
|
|
110
162
|
|
|
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
|
|
163
|
+
export interface ContractInfoExtensionIndexingInfo {
|
|
164
|
+
useOnChainBalance: boolean
|
|
132
165
|
}
|
|
133
166
|
|
|
134
|
-
export interface
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
167
|
+
export interface ContractInfoExtensions {
|
|
168
|
+
link?: string
|
|
169
|
+
description?: string
|
|
170
|
+
categories?: Array<string>
|
|
171
|
+
bridgeInfo?: {[key: string]: ContractInfoExtensionBridgeInfo}
|
|
172
|
+
indexingInfo?: ContractInfoExtensionIndexingInfo
|
|
173
|
+
ogImage?: string
|
|
174
|
+
ogName?: string
|
|
175
|
+
originChainId?: number
|
|
176
|
+
originAddress?: string
|
|
177
|
+
blacklist?: boolean
|
|
178
|
+
verified?: boolean
|
|
179
|
+
verifiedBy?: string
|
|
180
|
+
featured?: boolean
|
|
181
|
+
featureIndex?: number
|
|
146
182
|
}
|
|
147
183
|
|
|
148
184
|
export enum ContractType {
|
|
@@ -155,90 +191,109 @@ export enum ContractType {
|
|
|
155
191
|
ERC20_BRIDGE = 'ERC20_BRIDGE',
|
|
156
192
|
ERC721_BRIDGE = 'ERC721_BRIDGE',
|
|
157
193
|
ERC1155_BRIDGE = 'ERC1155_BRIDGE',
|
|
158
|
-
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE'
|
|
194
|
+
SEQ_MARKETPLACE = 'SEQ_MARKETPLACE',
|
|
195
|
+
ERC6909 = 'ERC6909'
|
|
159
196
|
}
|
|
160
197
|
|
|
161
|
-
export enum
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
198
|
+
export enum ContractVerificationStatus {
|
|
199
|
+
VERIFIED = 'VERIFIED',
|
|
200
|
+
UNVERIFIED = 'UNVERIFIED',
|
|
201
|
+
ALL = 'ALL'
|
|
165
202
|
}
|
|
166
203
|
|
|
167
|
-
export
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
204
|
+
export interface DiskUsage {
|
|
205
|
+
humanReadable: string
|
|
206
|
+
used: number
|
|
207
|
+
size: number
|
|
208
|
+
percent: number
|
|
209
|
+
dirs: {[key: string]: string}
|
|
172
210
|
}
|
|
173
211
|
|
|
174
|
-
export
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
CANCELLED = 'CANCELLED'
|
|
212
|
+
export interface EtherBalance {
|
|
213
|
+
accountAddress: string
|
|
214
|
+
balanceWei: string
|
|
178
215
|
}
|
|
179
216
|
|
|
180
|
-
export
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
217
|
+
export interface EventDecoded {
|
|
218
|
+
topicHash: string
|
|
219
|
+
eventSig: string
|
|
220
|
+
types: Array<string>
|
|
221
|
+
names: Array<string>
|
|
222
|
+
values: Array<string>
|
|
184
223
|
}
|
|
185
224
|
|
|
186
|
-
export
|
|
187
|
-
|
|
188
|
-
|
|
225
|
+
export interface EventFilter {
|
|
226
|
+
events?: Array<string>
|
|
227
|
+
contractAddresses?: Array<string>
|
|
228
|
+
accounts?: Array<string>
|
|
229
|
+
tokenIDs?: Array<string>
|
|
189
230
|
}
|
|
190
231
|
|
|
191
|
-
export
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
232
|
+
export interface EventLog {
|
|
233
|
+
id: number
|
|
234
|
+
uid: string
|
|
235
|
+
type: EventLogType
|
|
236
|
+
blockNumber: number
|
|
237
|
+
blockHash: string
|
|
238
|
+
parentBlockHash: string
|
|
239
|
+
contractAddress: string
|
|
240
|
+
contractType: ContractType
|
|
241
|
+
txnHash: string
|
|
242
|
+
txnIndex: number
|
|
243
|
+
txnLogIndex: number
|
|
244
|
+
logDataType: EventLogDataType
|
|
245
|
+
ts: string
|
|
246
|
+
txnInfo?: TxnInfo
|
|
247
|
+
rawLog?: {[key: string]: any}
|
|
248
|
+
event?: EventDecoded
|
|
195
249
|
}
|
|
196
250
|
|
|
197
|
-
export enum
|
|
198
|
-
|
|
199
|
-
|
|
251
|
+
export enum EventLogDataType {
|
|
252
|
+
EVENT = 'EVENT',
|
|
253
|
+
TOKEN_TRANSFER = 'TOKEN_TRANSFER',
|
|
254
|
+
NATIVE_TOKEN_TRANSFER = 'NATIVE_TOKEN_TRANSFER',
|
|
255
|
+
SEQUENCE_TXN = 'SEQUENCE_TXN'
|
|
200
256
|
}
|
|
201
257
|
|
|
202
|
-
export enum
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
258
|
+
export enum EventLogType {
|
|
259
|
+
UNKNOWN = 'UNKNOWN',
|
|
260
|
+
BLOCK_ADDED = 'BLOCK_ADDED',
|
|
261
|
+
BLOCK_REMOVED = 'BLOCK_REMOVED'
|
|
206
262
|
}
|
|
207
263
|
|
|
208
|
-
export
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
ALL = 'ALL'
|
|
264
|
+
export interface GatewayBackendResponseTime {
|
|
265
|
+
percentiles: {[key: string]: number}
|
|
266
|
+
average: number
|
|
212
267
|
}
|
|
213
268
|
|
|
214
|
-
export interface
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
appVersion: string
|
|
269
|
+
export interface GatewayBackendRuntimeStatus {
|
|
270
|
+
name: string
|
|
271
|
+
chainId: number
|
|
272
|
+
responseTime: GatewayBackendResponseTime
|
|
219
273
|
}
|
|
220
274
|
|
|
221
|
-
export interface
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
uptime: number
|
|
226
|
-
ver: string
|
|
227
|
-
branch: string
|
|
228
|
-
commitHash: string
|
|
229
|
-
chainID: number
|
|
230
|
-
checks: RuntimeChecks
|
|
275
|
+
export interface GatewayEtherBalance {
|
|
276
|
+
chainId: number
|
|
277
|
+
errorReason?: string
|
|
278
|
+
result: EtherBalance
|
|
231
279
|
}
|
|
232
280
|
|
|
233
|
-
export interface
|
|
234
|
-
|
|
235
|
-
|
|
281
|
+
export interface GatewayNativeTokenBalance {
|
|
282
|
+
chainId: number
|
|
283
|
+
errorReason?: string
|
|
284
|
+
result: NativeTokenBalance
|
|
236
285
|
}
|
|
237
286
|
|
|
238
|
-
export interface
|
|
239
|
-
name: string
|
|
287
|
+
export interface GatewayNativeTokenBalances {
|
|
240
288
|
chainId: number
|
|
241
|
-
|
|
289
|
+
errorReason?: string
|
|
290
|
+
results: Array<NativeTokenBalance>
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface GatewayPrice {
|
|
294
|
+
chainID: number
|
|
295
|
+
errorReason?: string
|
|
296
|
+
results: Array<Price>
|
|
242
297
|
}
|
|
243
298
|
|
|
244
299
|
export interface GatewayRuntimeStatus {
|
|
@@ -251,113 +306,173 @@ export interface GatewayRuntimeStatus {
|
|
|
251
306
|
backends: Array<GatewayBackendRuntimeStatus>
|
|
252
307
|
}
|
|
253
308
|
|
|
254
|
-
export interface
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
309
|
+
export interface GatewayTokenBalance {
|
|
310
|
+
chainId: number
|
|
311
|
+
errorReason?: string
|
|
312
|
+
results: Array<TokenBalance>
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface GatewayTokenPriceQuery {
|
|
261
316
|
chainID: number
|
|
262
|
-
|
|
317
|
+
queries: Array<TokenPriceQuery>
|
|
263
318
|
}
|
|
264
319
|
|
|
265
|
-
export interface
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
320
|
+
export interface GatewayTransaction {
|
|
321
|
+
chainId: number
|
|
322
|
+
errorReason?: string
|
|
323
|
+
results: Array<Transaction>
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface IndexState {
|
|
327
|
+
chainId: string
|
|
272
328
|
lastBlockNum: number
|
|
273
|
-
|
|
274
|
-
bloomStatus: BloomStatus
|
|
275
|
-
bond: Bond
|
|
276
|
-
diskUsage: DiskUsage
|
|
329
|
+
lastBlockHash: string
|
|
277
330
|
}
|
|
278
331
|
|
|
279
|
-
export interface
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
size: number
|
|
283
|
-
percent: number
|
|
284
|
-
dirs: { [key: string]: string }
|
|
332
|
+
export interface IndexedBlock {
|
|
333
|
+
blockNumber: number
|
|
334
|
+
blockShortHash: string
|
|
285
335
|
}
|
|
286
336
|
|
|
287
|
-
export interface
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
estimatedDiskUsageTotal: string
|
|
337
|
+
export interface IndexerMetrics {
|
|
338
|
+
blocksPerSecond: number
|
|
339
|
+
eventsPerSecond: number
|
|
291
340
|
}
|
|
292
341
|
|
|
293
|
-
export interface
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
342
|
+
export interface MarketplaceOrder {
|
|
343
|
+
orderId: string
|
|
344
|
+
tokenContract: string
|
|
345
|
+
tokenId: string
|
|
346
|
+
isListing: boolean
|
|
347
|
+
quantity: string
|
|
348
|
+
quantityRemaining: string
|
|
349
|
+
currencyAddress: string
|
|
350
|
+
pricePerToken: string
|
|
351
|
+
expiry: string
|
|
352
|
+
orderStatus: OrderStatus
|
|
353
|
+
createdBy: string
|
|
354
|
+
blockNumber: number
|
|
355
|
+
orderbookContractAddress: string
|
|
356
|
+
createdAt: number
|
|
299
357
|
}
|
|
300
358
|
|
|
301
|
-
export interface
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
359
|
+
export interface MarketplaceOrderFilter {
|
|
360
|
+
isListing?: boolean
|
|
361
|
+
userAddresses?: Array<string>
|
|
362
|
+
currencyAddresses: Array<string>
|
|
363
|
+
orderIds: Array<string>
|
|
364
|
+
tokenIds: Array<string>
|
|
365
|
+
excludeUserAddresses?: Array<string>
|
|
366
|
+
blockNumberGt: number
|
|
367
|
+
createdAtAfter: number
|
|
368
|
+
orderStatuses: Array<OrderStatus>
|
|
369
|
+
returnExpired: boolean
|
|
305
370
|
}
|
|
306
371
|
|
|
307
|
-
export interface
|
|
308
|
-
|
|
309
|
-
|
|
372
|
+
export interface MarketplaceTopOrdersFilter {
|
|
373
|
+
currencyAddresses: Array<string>
|
|
374
|
+
tokenIds: Array<string>
|
|
375
|
+
isListing: boolean
|
|
376
|
+
priceSort: SortOrder
|
|
377
|
+
excludeUser?: string
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface MetadataOptions {
|
|
381
|
+
verifiedOnly?: boolean
|
|
382
|
+
unverifiedOnly?: boolean
|
|
383
|
+
includeContracts?: Array<string>
|
|
310
384
|
}
|
|
311
385
|
|
|
312
386
|
export interface NativeTokenBalance {
|
|
313
387
|
accountAddress: string
|
|
314
388
|
chainId: number
|
|
389
|
+
name: string
|
|
390
|
+
symbol: string
|
|
315
391
|
balance: string
|
|
392
|
+
balanceUSD: string
|
|
393
|
+
priceUSD: string
|
|
394
|
+
priceUpdatedAt?: string
|
|
316
395
|
errorReason?: string
|
|
317
396
|
}
|
|
318
397
|
|
|
319
|
-
export
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
398
|
+
export enum NetworkType {
|
|
399
|
+
MAINNETS = 'MAINNETS',
|
|
400
|
+
TESTNETS = 'TESTNETS',
|
|
401
|
+
ALL = 'ALL'
|
|
323
402
|
}
|
|
324
403
|
|
|
325
|
-
export
|
|
326
|
-
|
|
327
|
-
|
|
404
|
+
export enum OrderStatus {
|
|
405
|
+
OPEN = 'OPEN',
|
|
406
|
+
CLOSED = 'CLOSED',
|
|
407
|
+
CANCELLED = 'CANCELLED'
|
|
328
408
|
}
|
|
329
409
|
|
|
330
|
-
export interface
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
410
|
+
export interface Page {
|
|
411
|
+
page?: number
|
|
412
|
+
column?: string
|
|
413
|
+
before?: any
|
|
414
|
+
after?: any
|
|
415
|
+
sort?: Array<SortBy>
|
|
416
|
+
pageSize?: number
|
|
417
|
+
more?: boolean
|
|
334
418
|
}
|
|
335
419
|
|
|
336
|
-
export interface
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
420
|
+
export interface PebbleMetrics {
|
|
421
|
+
compactionCount: number
|
|
422
|
+
compactionEstimatedDebt: number
|
|
423
|
+
compactionInProgressBytes: number
|
|
424
|
+
compactionNumInProgress: number
|
|
425
|
+
compactionMarkedFiles: number
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface Price {
|
|
343
429
|
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
|
|
430
|
+
tokenID?: string
|
|
431
|
+
priceUSD: string
|
|
432
|
+
updatedAt?: string
|
|
353
433
|
}
|
|
354
434
|
|
|
355
|
-
export
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
435
|
+
export enum ResourceStatus {
|
|
436
|
+
NOT_AVAILABLE = 'NOT_AVAILABLE',
|
|
437
|
+
REFRESHING = 'REFRESHING',
|
|
438
|
+
AVAILABLE = 'AVAILABLE'
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface RuntimeChecks {
|
|
442
|
+
running: boolean
|
|
443
|
+
runnables: any
|
|
444
|
+
cgoEnabled: boolean
|
|
445
|
+
quotaControlEnabled: boolean
|
|
446
|
+
syncMode: string
|
|
447
|
+
percentIndexed: number
|
|
448
|
+
lastBlockNum: number
|
|
449
|
+
lastBlockNumWithState: number
|
|
450
|
+
bloomStatus: BloomStatus
|
|
451
|
+
bond: Bond
|
|
452
|
+
diskUsage: DiskUsage
|
|
453
|
+
metrics: IndexerMetrics
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export interface RuntimeStatus {
|
|
457
|
+
healthOK: boolean
|
|
458
|
+
indexerEnabled: boolean
|
|
459
|
+
startTime: string
|
|
460
|
+
uptime: number
|
|
461
|
+
ver: string
|
|
462
|
+
branch: string
|
|
463
|
+
commitHash: string
|
|
464
|
+
chainID: number
|
|
465
|
+
checks: RuntimeChecks
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export interface SortBy {
|
|
469
|
+
column: string
|
|
470
|
+
order: SortOrder
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export enum SortOrder {
|
|
474
|
+
DESC = 'DESC',
|
|
475
|
+
ASC = 'ASC'
|
|
361
476
|
}
|
|
362
477
|
|
|
363
478
|
export interface TokenBalance {
|
|
@@ -366,6 +481,9 @@ export interface TokenBalance {
|
|
|
366
481
|
accountAddress: string
|
|
367
482
|
tokenID?: string
|
|
368
483
|
balance: string
|
|
484
|
+
balanceUSD: string
|
|
485
|
+
priceUSD: string
|
|
486
|
+
priceUpdatedAt?: string
|
|
369
487
|
blockHash: string
|
|
370
488
|
blockNumber: number
|
|
371
489
|
chainId: number
|
|
@@ -375,39 +493,32 @@ export interface TokenBalance {
|
|
|
375
493
|
tokenMetadata?: TokenMetadata
|
|
376
494
|
}
|
|
377
495
|
|
|
378
|
-
export interface
|
|
379
|
-
|
|
380
|
-
|
|
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
|
|
496
|
+
export interface TokenBalanceFilter {
|
|
497
|
+
contractAddress: string
|
|
498
|
+
sinceBlockNumber: number
|
|
393
499
|
}
|
|
394
500
|
|
|
395
|
-
export interface
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
501
|
+
export interface TokenBalancesByContractFilter {
|
|
502
|
+
contractAddresses: Array<string>
|
|
503
|
+
accountAddresses?: Array<string>
|
|
504
|
+
contractStatus?: ContractVerificationStatus
|
|
505
|
+
tokenIDs?: Array<string>
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export interface TokenBalancesFilter {
|
|
509
|
+
accountAddresses: Array<string>
|
|
510
|
+
contractStatus?: ContractVerificationStatus
|
|
511
|
+
contractTypes?: Array<string>
|
|
512
|
+
contractWhitelist?: Array<string>
|
|
513
|
+
contractBlacklist?: Array<string>
|
|
514
|
+
omitNativeBalances: boolean
|
|
515
|
+
omitPrices?: boolean
|
|
516
|
+
tokenIDs?: Array<string>
|
|
405
517
|
}
|
|
406
518
|
|
|
407
519
|
export interface TokenHistory {
|
|
408
520
|
blockNumber: number
|
|
409
521
|
blockHash: string
|
|
410
|
-
accountAddress: string
|
|
411
522
|
contractAddress: string
|
|
412
523
|
contractType: ContractType
|
|
413
524
|
fromAddress: string
|
|
@@ -415,12 +526,45 @@ export interface TokenHistory {
|
|
|
415
526
|
txnHash: string
|
|
416
527
|
txnIndex: number
|
|
417
528
|
txnLogIndex: number
|
|
418
|
-
logData: string
|
|
419
529
|
tokenIDs: string
|
|
420
|
-
|
|
530
|
+
amounts: string
|
|
421
531
|
ts: string
|
|
422
532
|
}
|
|
423
533
|
|
|
534
|
+
export interface TokenIDRange {
|
|
535
|
+
start: string
|
|
536
|
+
end: string
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export interface TokenMetadata {
|
|
540
|
+
chainId?: number
|
|
541
|
+
contractAddress?: string
|
|
542
|
+
tokenId: string
|
|
543
|
+
source: string
|
|
544
|
+
name: string
|
|
545
|
+
description?: string
|
|
546
|
+
image?: string
|
|
547
|
+
video?: string
|
|
548
|
+
audio?: string
|
|
549
|
+
properties?: {[key: string]: any}
|
|
550
|
+
attributes: Array<{[key: string]: any}>
|
|
551
|
+
image_data?: string
|
|
552
|
+
external_url?: string
|
|
553
|
+
background_color?: string
|
|
554
|
+
animation_url?: string
|
|
555
|
+
decimals?: number
|
|
556
|
+
updatedAt?: string
|
|
557
|
+
assets?: Array<Asset>
|
|
558
|
+
status: ResourceStatus
|
|
559
|
+
queuedAt?: string
|
|
560
|
+
lastFetched?: string
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export interface TokenPriceQuery {
|
|
564
|
+
contractAddress: string
|
|
565
|
+
tokenID?: string
|
|
566
|
+
}
|
|
567
|
+
|
|
424
568
|
export interface TokenSupply {
|
|
425
569
|
tokenID: string
|
|
426
570
|
supply: string
|
|
@@ -439,17 +583,12 @@ export interface Transaction {
|
|
|
439
583
|
timestamp: string
|
|
440
584
|
}
|
|
441
585
|
|
|
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 }
|
|
586
|
+
export interface TransactionFilter {
|
|
587
|
+
txnHash?: string
|
|
588
|
+
from?: string
|
|
589
|
+
to?: string
|
|
590
|
+
contractAddress?: string
|
|
591
|
+
event?: string
|
|
453
592
|
}
|
|
454
593
|
|
|
455
594
|
export interface TransactionHistoryFilter {
|
|
@@ -462,14 +601,14 @@ export interface TransactionHistoryFilter {
|
|
|
462
601
|
fromBlock?: number
|
|
463
602
|
toBlock?: number
|
|
464
603
|
tokenID?: string
|
|
604
|
+
omitPrices?: boolean
|
|
465
605
|
}
|
|
466
606
|
|
|
467
|
-
export interface
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
event?: string
|
|
607
|
+
export interface TransactionLog {
|
|
608
|
+
contractAddress: string
|
|
609
|
+
topics: Array<string>
|
|
610
|
+
data: string
|
|
611
|
+
index: number
|
|
473
612
|
}
|
|
474
613
|
|
|
475
614
|
export interface TransactionReceipt {
|
|
@@ -488,31 +627,60 @@ export interface TransactionReceipt {
|
|
|
488
627
|
reorged: boolean
|
|
489
628
|
}
|
|
490
629
|
|
|
491
|
-
export
|
|
630
|
+
export enum TransactionStatus {
|
|
631
|
+
FAILED = 'FAILED',
|
|
632
|
+
SUCCESSFUL = 'SUCCESSFUL'
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export enum TransactionType {
|
|
636
|
+
LegacyTxnType = 'LegacyTxnType',
|
|
637
|
+
AccessListTxnType = 'AccessListTxnType',
|
|
638
|
+
DynamicFeeTxnType = 'DynamicFeeTxnType'
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
export interface TxnInfo {
|
|
642
|
+
from: string
|
|
643
|
+
to: string
|
|
644
|
+
value: string
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface TxnTransfer {
|
|
648
|
+
transferType: TxnTransferType
|
|
492
649
|
contractAddress: string
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
650
|
+
contractType: ContractType
|
|
651
|
+
from: string
|
|
652
|
+
to: string
|
|
653
|
+
tokenIds?: Array<string>
|
|
654
|
+
amounts: Array<string>
|
|
655
|
+
logIndex: number
|
|
656
|
+
amountsUSD?: Array<string>
|
|
657
|
+
pricesUSD?: Array<string>
|
|
658
|
+
contractInfo?: ContractInfo
|
|
659
|
+
tokenMetadata?: {[key: string]: TokenMetadata}
|
|
496
660
|
}
|
|
497
661
|
|
|
498
|
-
export
|
|
499
|
-
|
|
500
|
-
|
|
662
|
+
export enum TxnTransferType {
|
|
663
|
+
UNKNOWN = 'UNKNOWN',
|
|
664
|
+
SEND = 'SEND',
|
|
665
|
+
RECEIVE = 'RECEIVE'
|
|
501
666
|
}
|
|
502
667
|
|
|
503
|
-
export interface
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
sort?: Array<SortBy>
|
|
509
|
-
pageSize?: number
|
|
510
|
-
more?: boolean
|
|
668
|
+
export interface Version {
|
|
669
|
+
webrpcVersion: string
|
|
670
|
+
schemaVersion: string
|
|
671
|
+
schemaHash: string
|
|
672
|
+
appVersion: string
|
|
511
673
|
}
|
|
512
674
|
|
|
513
|
-
export interface
|
|
514
|
-
|
|
515
|
-
|
|
675
|
+
export interface WALWriterRuntimeStatus {
|
|
676
|
+
healthOK: boolean
|
|
677
|
+
startTime: string
|
|
678
|
+
uptime: number
|
|
679
|
+
ver: string
|
|
680
|
+
branch: string
|
|
681
|
+
commitHash: string
|
|
682
|
+
chainID: number
|
|
683
|
+
percentWALWritten: number
|
|
516
684
|
}
|
|
517
685
|
|
|
518
686
|
export interface WebhookListener {
|
|
@@ -525,108 +693,42 @@ export interface WebhookListener {
|
|
|
525
693
|
active: boolean
|
|
526
694
|
}
|
|
527
695
|
|
|
528
|
-
export interface
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
tokenIDs?: Array<string>
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
export interface TokenBalanceFilter {
|
|
696
|
+
export interface GetBalanceUpdatesRequest {
|
|
697
|
+
chainIds?: Array<number>
|
|
698
|
+
networks?: Array<string>
|
|
699
|
+
networkType?: NetworkType
|
|
536
700
|
contractAddress: string
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
export interface MetadataOptions {
|
|
541
|
-
verifiedOnly?: boolean
|
|
542
|
-
unverifiedOnly?: boolean
|
|
543
|
-
includeContracts?: Array<string>
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
export interface TokenBalancesFilter {
|
|
547
|
-
accountAddresses: Array<string>
|
|
548
|
-
contractStatus?: ContractVerificationStatus
|
|
549
|
-
contractTypes?: Array<string>
|
|
550
|
-
contractWhitelist?: Array<string>
|
|
551
|
-
contractBlacklist?: Array<string>
|
|
552
|
-
omitNativeBalances: boolean
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
export interface TokenBalancesByContractFilter {
|
|
556
|
-
contractAddresses: Array<string>
|
|
557
|
-
accountAddresses?: Array<string>
|
|
558
|
-
contractStatus?: ContractVerificationStatus
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export interface GatewayEtherBalance {
|
|
562
|
-
chainId: number
|
|
563
|
-
errorReason?: string
|
|
564
|
-
result: EtherBalance
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
export interface GatewayNativeTokenBalance {
|
|
568
|
-
chainId: number
|
|
569
|
-
errorReason?: string
|
|
570
|
-
result: NativeTokenBalance
|
|
701
|
+
lastBlockNumber: number
|
|
702
|
+
lastBlockHash?: string
|
|
703
|
+
page?: Page
|
|
571
704
|
}
|
|
572
705
|
|
|
573
|
-
export interface
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
results: Array<NativeTokenBalance>
|
|
706
|
+
export interface GetBalanceUpdatesResponse {
|
|
707
|
+
page: Page
|
|
708
|
+
balances: Array<GatewayTokenBalance>
|
|
577
709
|
}
|
|
578
710
|
|
|
579
|
-
export interface
|
|
580
|
-
|
|
581
|
-
errorReason?: string
|
|
582
|
-
results: Array<TokenBalance>
|
|
711
|
+
export interface GetChainsRequest {
|
|
712
|
+
networkType?: NetworkType
|
|
583
713
|
}
|
|
584
714
|
|
|
585
|
-
export interface
|
|
586
|
-
|
|
587
|
-
chainName: string
|
|
715
|
+
export interface GetChainsResponse {
|
|
716
|
+
chains: Array<ChainInfo>
|
|
588
717
|
}
|
|
589
718
|
|
|
590
|
-
export interface
|
|
591
|
-
getNativeTokenBalance(
|
|
592
|
-
args: GetNativeTokenBalanceArgs,
|
|
593
|
-
headers?: object,
|
|
594
|
-
signal?: AbortSignal
|
|
595
|
-
): Promise<GetNativeTokenBalanceReturn>
|
|
596
|
-
getTokenBalances(args: GetTokenBalancesArgs, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesReturn>
|
|
597
|
-
getTokenBalancesSummary(
|
|
598
|
-
args: GetTokenBalancesSummaryArgs,
|
|
599
|
-
headers?: object,
|
|
600
|
-
signal?: AbortSignal
|
|
601
|
-
): Promise<GetTokenBalancesSummaryReturn>
|
|
602
|
-
getTokenBalancesDetails(
|
|
603
|
-
args: GetTokenBalancesDetailsArgs,
|
|
604
|
-
headers?: object,
|
|
605
|
-
signal?: AbortSignal
|
|
606
|
-
): Promise<GetTokenBalancesDetailsReturn>
|
|
607
|
-
getTokenBalancesByContract(
|
|
608
|
-
args: GetTokenBalancesByContractArgs,
|
|
609
|
-
headers?: object,
|
|
610
|
-
signal?: AbortSignal
|
|
611
|
-
): Promise<GetTokenBalancesByContractReturn>
|
|
612
|
-
getBalanceUpdates(args: GetBalanceUpdatesArgs, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesReturn>
|
|
613
|
-
getChains(args: GetChainsArgs, headers?: object, signal?: AbortSignal): Promise<GetChainsReturn>
|
|
614
|
-
ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
|
|
615
|
-
version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>
|
|
616
|
-
runtimeStatus(headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn>
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
export interface GetNativeTokenBalanceArgs {
|
|
719
|
+
export interface GetNativeTokenBalanceRequest {
|
|
620
720
|
chainIds?: Array<number>
|
|
621
721
|
networks?: Array<string>
|
|
622
722
|
networkType?: NetworkType
|
|
623
723
|
accountAddress?: string
|
|
724
|
+
omitPrices?: boolean
|
|
624
725
|
}
|
|
625
726
|
|
|
626
|
-
export interface
|
|
727
|
+
export interface GetNativeTokenBalanceResponse {
|
|
627
728
|
balances: Array<GatewayNativeTokenBalance>
|
|
628
729
|
}
|
|
629
|
-
|
|
730
|
+
|
|
731
|
+
export interface GetTokenBalancesRequest {
|
|
630
732
|
chainIds?: Array<number>
|
|
631
733
|
networks?: Array<string>
|
|
632
734
|
networkType?: NetworkType
|
|
@@ -639,25 +741,26 @@ export interface GetTokenBalancesArgs {
|
|
|
639
741
|
page?: Page
|
|
640
742
|
}
|
|
641
743
|
|
|
642
|
-
export interface
|
|
744
|
+
export interface GetTokenBalancesResponse {
|
|
643
745
|
page: Page
|
|
644
746
|
balances: Array<GatewayTokenBalance>
|
|
645
747
|
}
|
|
646
|
-
|
|
748
|
+
|
|
749
|
+
export interface GetTokenBalancesByContractRequest {
|
|
647
750
|
chainIds?: Array<number>
|
|
648
751
|
networks?: Array<string>
|
|
649
752
|
networkType?: NetworkType
|
|
650
|
-
filter:
|
|
753
|
+
filter: TokenBalancesByContractFilter
|
|
651
754
|
omitMetadata?: boolean
|
|
652
755
|
page?: Page
|
|
653
756
|
}
|
|
654
757
|
|
|
655
|
-
export interface
|
|
758
|
+
export interface GetTokenBalancesByContractResponse {
|
|
656
759
|
page: Page
|
|
657
|
-
nativeBalances: Array<GatewayNativeTokenBalances>
|
|
658
760
|
balances: Array<GatewayTokenBalance>
|
|
659
761
|
}
|
|
660
|
-
|
|
762
|
+
|
|
763
|
+
export interface GetTokenBalancesDetailsRequest {
|
|
661
764
|
chainIds?: Array<number>
|
|
662
765
|
networks?: Array<string>
|
|
663
766
|
networkType?: NetworkType
|
|
@@ -666,65 +769,86 @@ export interface GetTokenBalancesDetailsArgs {
|
|
|
666
769
|
page?: Page
|
|
667
770
|
}
|
|
668
771
|
|
|
669
|
-
export interface
|
|
772
|
+
export interface GetTokenBalancesDetailsResponse {
|
|
670
773
|
page: Page
|
|
671
774
|
nativeBalances: Array<GatewayNativeTokenBalances>
|
|
672
775
|
balances: Array<GatewayTokenBalance>
|
|
673
776
|
}
|
|
674
|
-
|
|
777
|
+
|
|
778
|
+
export interface GetTokenBalancesSummaryRequest {
|
|
675
779
|
chainIds?: Array<number>
|
|
676
780
|
networks?: Array<string>
|
|
677
781
|
networkType?: NetworkType
|
|
678
|
-
filter:
|
|
782
|
+
filter: TokenBalancesFilter
|
|
679
783
|
omitMetadata?: boolean
|
|
680
784
|
page?: Page
|
|
681
785
|
}
|
|
682
786
|
|
|
683
|
-
export interface
|
|
787
|
+
export interface GetTokenBalancesSummaryResponse {
|
|
684
788
|
page: Page
|
|
789
|
+
nativeBalances: Array<GatewayNativeTokenBalances>
|
|
685
790
|
balances: Array<GatewayTokenBalance>
|
|
686
791
|
}
|
|
687
|
-
|
|
792
|
+
|
|
793
|
+
export interface GetTokenPriceRequest {
|
|
794
|
+
q: GatewayTokenPriceQuery
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
export interface GetTokenPriceResponse {
|
|
798
|
+
price: GatewayPrice
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
export interface GetTokenPricesRequest {
|
|
802
|
+
q: Array<GatewayTokenPriceQuery>
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
export interface GetTokenPricesResponse {
|
|
806
|
+
prices: Array<GatewayPrice>
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export interface GetTransactionHistoryRequest {
|
|
688
810
|
chainIds?: Array<number>
|
|
689
811
|
networks?: Array<string>
|
|
690
812
|
networkType?: NetworkType
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
813
|
+
filter: TransactionHistoryFilter
|
|
814
|
+
includeMetadata?: boolean
|
|
815
|
+
metadataOptions?: MetadataOptions
|
|
694
816
|
page?: Page
|
|
695
817
|
}
|
|
696
818
|
|
|
697
|
-
export interface
|
|
698
|
-
page: Page
|
|
699
|
-
|
|
819
|
+
export interface GetTransactionHistoryResponse {
|
|
820
|
+
page: Page
|
|
821
|
+
transactions: Array<GatewayTransaction>
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export interface PingRequest {
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export interface PingResponse {
|
|
828
|
+
status: boolean
|
|
700
829
|
}
|
|
701
|
-
|
|
702
|
-
|
|
830
|
+
|
|
831
|
+
export interface RuntimeStatusRequest {
|
|
703
832
|
}
|
|
704
833
|
|
|
705
|
-
export interface
|
|
706
|
-
|
|
834
|
+
export interface RuntimeStatusResponse {
|
|
835
|
+
status: GatewayRuntimeStatus
|
|
707
836
|
}
|
|
708
|
-
export interface PingArgs {}
|
|
709
837
|
|
|
710
|
-
export interface
|
|
711
|
-
status: boolean
|
|
838
|
+
export interface VersionRequest {
|
|
712
839
|
}
|
|
713
|
-
export interface VersionArgs {}
|
|
714
840
|
|
|
715
|
-
export interface
|
|
841
|
+
export interface VersionResponse {
|
|
716
842
|
version: Version
|
|
717
843
|
}
|
|
718
|
-
export interface RuntimeStatusArgs {}
|
|
719
844
|
|
|
720
|
-
|
|
721
|
-
status: GatewayRuntimeStatus
|
|
722
|
-
}
|
|
845
|
+
|
|
723
846
|
|
|
724
847
|
//
|
|
725
848
|
// Client
|
|
726
849
|
//
|
|
727
|
-
|
|
850
|
+
|
|
851
|
+
export class IndexerGateway implements IndexerGatewayClient {
|
|
728
852
|
protected hostname: string
|
|
729
853
|
protected fetch: Fetch
|
|
730
854
|
protected path = '/rpc/IndexerGateway/'
|
|
@@ -737,191 +861,184 @@ export class IndexerGateway implements IndexerGateway {
|
|
|
737
861
|
private url(name: string): string {
|
|
738
862
|
return this.hostname + this.path + name
|
|
739
863
|
}
|
|
864
|
+
|
|
865
|
+
queryKey = {
|
|
866
|
+
getBalanceUpdates: (req: GetBalanceUpdatesRequest) => ['IndexerGateway', 'getBalanceUpdates', req] as const,
|
|
867
|
+
getChains: (req: GetChainsRequest) => ['IndexerGateway', 'getChains', req] as const,
|
|
868
|
+
getNativeTokenBalance: (req: GetNativeTokenBalanceRequest) => ['IndexerGateway', 'getNativeTokenBalance', req] as const,
|
|
869
|
+
getTokenBalances: (req: GetTokenBalancesRequest) => ['IndexerGateway', 'getTokenBalances', req] as const,
|
|
870
|
+
getTokenBalancesByContract: (req: GetTokenBalancesByContractRequest) => ['IndexerGateway', 'getTokenBalancesByContract', req] as const,
|
|
871
|
+
getTokenBalancesDetails: (req: GetTokenBalancesDetailsRequest) => ['IndexerGateway', 'getTokenBalancesDetails', req] as const,
|
|
872
|
+
getTokenBalancesSummary: (req: GetTokenBalancesSummaryRequest) => ['IndexerGateway', 'getTokenBalancesSummary', req] as const,
|
|
873
|
+
getTokenPrice: (req: GetTokenPriceRequest) => ['IndexerGateway', 'getTokenPrice', req] as const,
|
|
874
|
+
getTokenPrices: (req: GetTokenPricesRequest) => ['IndexerGateway', 'getTokenPrices', req] as const,
|
|
875
|
+
getTransactionHistory: (req: GetTransactionHistoryRequest) => ['IndexerGateway', 'getTransactionHistory', req] as const,
|
|
876
|
+
ping: () => ['IndexerGateway', 'ping'] as const,
|
|
877
|
+
runtimeStatus: () => ['IndexerGateway', 'runtimeStatus'] as const,
|
|
878
|
+
version: () => ['IndexerGateway', 'version'] as const,
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
getBalanceUpdates = (req: GetBalanceUpdatesRequest, headers?: object, signal?: AbortSignal): Promise<GetBalanceUpdatesResponse> => {
|
|
882
|
+
return this.fetch(
|
|
883
|
+
this.url('GetBalanceUpdates'),
|
|
884
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
885
|
+
return buildResponse(res).then(_data => {
|
|
886
|
+
return JsonDecode<GetBalanceUpdatesResponse>(_data, 'GetBalanceUpdatesResponse')
|
|
887
|
+
})
|
|
888
|
+
}, (error) => {
|
|
889
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
890
|
+
})
|
|
891
|
+
}
|
|
740
892
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
})
|
|
753
|
-
},
|
|
754
|
-
error => {
|
|
755
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
756
|
-
}
|
|
757
|
-
)
|
|
893
|
+
getChains = (req: GetChainsRequest, headers?: object, signal?: AbortSignal): Promise<GetChainsResponse> => {
|
|
894
|
+
return this.fetch(
|
|
895
|
+
this.url('GetChains'),
|
|
896
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
897
|
+
return buildResponse(res).then(_data => {
|
|
898
|
+
return JsonDecode<GetChainsResponse>(_data, 'GetChainsResponse')
|
|
899
|
+
})
|
|
900
|
+
}, (error) => {
|
|
901
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
902
|
+
})
|
|
758
903
|
}
|
|
759
904
|
|
|
760
|
-
|
|
761
|
-
return this.fetch(
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
error => {
|
|
771
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
772
|
-
}
|
|
773
|
-
)
|
|
905
|
+
getNativeTokenBalance = (req: GetNativeTokenBalanceRequest, headers?: object, signal?: AbortSignal): Promise<GetNativeTokenBalanceResponse> => {
|
|
906
|
+
return this.fetch(
|
|
907
|
+
this.url('GetNativeTokenBalance'),
|
|
908
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
909
|
+
return buildResponse(res).then(_data => {
|
|
910
|
+
return JsonDecode<GetNativeTokenBalanceResponse>(_data, 'GetNativeTokenBalanceResponse')
|
|
911
|
+
})
|
|
912
|
+
}, (error) => {
|
|
913
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
914
|
+
})
|
|
774
915
|
}
|
|
775
916
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
nativeBalances: <Array<GatewayNativeTokenBalances>>_data.nativeBalances,
|
|
787
|
-
balances: <Array<GatewayTokenBalance>>_data.balances
|
|
788
|
-
}
|
|
789
|
-
})
|
|
790
|
-
},
|
|
791
|
-
error => {
|
|
792
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
793
|
-
}
|
|
794
|
-
)
|
|
917
|
+
getTokenBalances = (req: GetTokenBalancesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesResponse> => {
|
|
918
|
+
return this.fetch(
|
|
919
|
+
this.url('GetTokenBalances'),
|
|
920
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
921
|
+
return buildResponse(res).then(_data => {
|
|
922
|
+
return JsonDecode<GetTokenBalancesResponse>(_data, 'GetTokenBalancesResponse')
|
|
923
|
+
})
|
|
924
|
+
}, (error) => {
|
|
925
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
926
|
+
})
|
|
795
927
|
}
|
|
796
928
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
nativeBalances: <Array<GatewayNativeTokenBalances>>_data.nativeBalances,
|
|
808
|
-
balances: <Array<GatewayTokenBalance>>_data.balances
|
|
809
|
-
}
|
|
810
|
-
})
|
|
811
|
-
},
|
|
812
|
-
error => {
|
|
813
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
814
|
-
}
|
|
815
|
-
)
|
|
929
|
+
getTokenBalancesByContract = (req: GetTokenBalancesByContractRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesByContractResponse> => {
|
|
930
|
+
return this.fetch(
|
|
931
|
+
this.url('GetTokenBalancesByContract'),
|
|
932
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
933
|
+
return buildResponse(res).then(_data => {
|
|
934
|
+
return JsonDecode<GetTokenBalancesByContractResponse>(_data, 'GetTokenBalancesByContractResponse')
|
|
935
|
+
})
|
|
936
|
+
}, (error) => {
|
|
937
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
938
|
+
})
|
|
816
939
|
}
|
|
817
940
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
balances: <Array<GatewayTokenBalance>>_data.balances
|
|
829
|
-
}
|
|
830
|
-
})
|
|
831
|
-
},
|
|
832
|
-
error => {
|
|
833
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
834
|
-
}
|
|
835
|
-
)
|
|
941
|
+
getTokenBalancesDetails = (req: GetTokenBalancesDetailsRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesDetailsResponse> => {
|
|
942
|
+
return this.fetch(
|
|
943
|
+
this.url('GetTokenBalancesDetails'),
|
|
944
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
945
|
+
return buildResponse(res).then(_data => {
|
|
946
|
+
return JsonDecode<GetTokenBalancesDetailsResponse>(_data, 'GetTokenBalancesDetailsResponse')
|
|
947
|
+
})
|
|
948
|
+
}, (error) => {
|
|
949
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
950
|
+
})
|
|
836
951
|
}
|
|
837
952
|
|
|
838
|
-
|
|
839
|
-
return this.fetch(
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
error => {
|
|
849
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
850
|
-
}
|
|
851
|
-
)
|
|
953
|
+
getTokenBalancesSummary = (req: GetTokenBalancesSummaryRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenBalancesSummaryResponse> => {
|
|
954
|
+
return this.fetch(
|
|
955
|
+
this.url('GetTokenBalancesSummary'),
|
|
956
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
957
|
+
return buildResponse(res).then(_data => {
|
|
958
|
+
return JsonDecode<GetTokenBalancesSummaryResponse>(_data, 'GetTokenBalancesSummaryResponse')
|
|
959
|
+
})
|
|
960
|
+
}, (error) => {
|
|
961
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
962
|
+
})
|
|
852
963
|
}
|
|
853
964
|
|
|
854
|
-
|
|
855
|
-
return this.fetch(
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
865
|
-
}
|
|
866
|
-
)
|
|
965
|
+
getTokenPrice = (req: GetTokenPriceRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPriceResponse> => {
|
|
966
|
+
return this.fetch(
|
|
967
|
+
this.url('GetTokenPrice'),
|
|
968
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
969
|
+
return buildResponse(res).then(_data => {
|
|
970
|
+
return JsonDecode<GetTokenPriceResponse>(_data, 'GetTokenPriceResponse')
|
|
971
|
+
})
|
|
972
|
+
}, (error) => {
|
|
973
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
974
|
+
})
|
|
867
975
|
}
|
|
868
976
|
|
|
869
|
-
|
|
870
|
-
return this.fetch(
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
880
|
-
}
|
|
881
|
-
)
|
|
977
|
+
getTokenPrices = (req: GetTokenPricesRequest, headers?: object, signal?: AbortSignal): Promise<GetTokenPricesResponse> => {
|
|
978
|
+
return this.fetch(
|
|
979
|
+
this.url('GetTokenPrices'),
|
|
980
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
981
|
+
return buildResponse(res).then(_data => {
|
|
982
|
+
return JsonDecode<GetTokenPricesResponse>(_data, 'GetTokenPricesResponse')
|
|
983
|
+
})
|
|
984
|
+
}, (error) => {
|
|
985
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
986
|
+
})
|
|
882
987
|
}
|
|
883
988
|
|
|
884
|
-
|
|
885
|
-
return this.fetch(
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
895
|
-
}
|
|
896
|
-
)
|
|
989
|
+
getTransactionHistory = (req: GetTransactionHistoryRequest, headers?: object, signal?: AbortSignal): Promise<GetTransactionHistoryResponse> => {
|
|
990
|
+
return this.fetch(
|
|
991
|
+
this.url('GetTransactionHistory'),
|
|
992
|
+
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
993
|
+
return buildResponse(res).then(_data => {
|
|
994
|
+
return JsonDecode<GetTransactionHistoryResponse>(_data, 'GetTransactionHistoryResponse')
|
|
995
|
+
})
|
|
996
|
+
}, (error) => {
|
|
997
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
998
|
+
})
|
|
897
999
|
}
|
|
898
1000
|
|
|
899
|
-
|
|
900
|
-
return this.fetch(
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
910
|
-
}
|
|
911
|
-
)
|
|
1001
|
+
ping = (headers?: object, signal?: AbortSignal): Promise<PingResponse> => {
|
|
1002
|
+
return this.fetch(
|
|
1003
|
+
this.url('Ping'),
|
|
1004
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
1005
|
+
return buildResponse(res).then(_data => {
|
|
1006
|
+
return JsonDecode<PingResponse>(_data, 'PingResponse')
|
|
1007
|
+
})
|
|
1008
|
+
}, (error) => {
|
|
1009
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1010
|
+
})
|
|
912
1011
|
}
|
|
913
|
-
}
|
|
914
1012
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1013
|
+
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusResponse> => {
|
|
1014
|
+
return this.fetch(
|
|
1015
|
+
this.url('RuntimeStatus'),
|
|
1016
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
1017
|
+
return buildResponse(res).then(_data => {
|
|
1018
|
+
return JsonDecode<RuntimeStatusResponse>(_data, 'RuntimeStatusResponse')
|
|
1019
|
+
})
|
|
1020
|
+
}, (error) => {
|
|
1021
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1022
|
+
})
|
|
1023
|
+
}
|
|
918
1024
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1025
|
+
version = (headers?: object, signal?: AbortSignal): Promise<VersionResponse> => {
|
|
1026
|
+
return this.fetch(
|
|
1027
|
+
this.url('Version'),
|
|
1028
|
+
createHttpRequest('{}', headers, signal)).then((res) => {
|
|
1029
|
+
return buildResponse(res).then(_data => {
|
|
1030
|
+
return JsonDecode<VersionResponse>(_data, 'VersionResponse')
|
|
1031
|
+
})
|
|
1032
|
+
}, (error) => {
|
|
1033
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}` })
|
|
1034
|
+
})
|
|
924
1035
|
}
|
|
1036
|
+
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
const createHttpRequest = (body: string = '{}', headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
1040
|
+
const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json', [WebrpcHeader]: WebrpcHeaderValue }
|
|
1041
|
+
return { method: 'POST', headers: reqHeaders, body, signal }
|
|
925
1042
|
}
|
|
926
1043
|
|
|
927
1044
|
const buildResponse = (res: Response): Promise<any> => {
|
|
@@ -929,539 +1046,518 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
929
1046
|
let data
|
|
930
1047
|
try {
|
|
931
1048
|
data = JSON.parse(text)
|
|
932
|
-
} catch
|
|
933
|
-
let message = ''
|
|
934
|
-
if (error instanceof Error) {
|
|
935
|
-
message = error.message
|
|
936
|
-
}
|
|
1049
|
+
} catch(error) {
|
|
937
1050
|
throw WebrpcBadResponseError.new({
|
|
938
1051
|
status: res.status,
|
|
939
|
-
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
940
|
-
|
|
1052
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`},
|
|
1053
|
+
)
|
|
941
1054
|
}
|
|
942
1055
|
if (!res.ok) {
|
|
943
|
-
const code: number = typeof data.code === 'number' ? data.code : 0
|
|
1056
|
+
const code: number = (typeof data.code === 'number') ? data.code : 0
|
|
944
1057
|
throw (webrpcErrorByCode[code] || WebrpcError).new(data)
|
|
945
1058
|
}
|
|
946
1059
|
return data
|
|
947
1060
|
})
|
|
948
1061
|
}
|
|
949
1062
|
|
|
1063
|
+
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
export const JsonEncode = <T = any>(obj: T): string => {
|
|
1071
|
+
return JSON.stringify(obj)
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
export const JsonDecode = <T = any>(data: string | any, _typ: string = ''): T => {
|
|
1075
|
+
let parsed: any = data
|
|
1076
|
+
if (typeof data === 'string') {
|
|
1077
|
+
try { parsed = JSON.parse(data) } catch (err) {
|
|
1078
|
+
throw WebrpcBadResponseError.new({ cause: `JsonDecode: JSON.parse failed: ${(err as Error).message}` })
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return parsed as T
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
|
|
950
1085
|
//
|
|
951
1086
|
// Errors
|
|
952
1087
|
//
|
|
953
1088
|
|
|
1089
|
+
type WebrpcErrorParams = { name?: string, code?: number, message?: string, status?: number, cause?: string }
|
|
1090
|
+
|
|
954
1091
|
export class WebrpcError extends Error {
|
|
955
|
-
name: string
|
|
956
1092
|
code: number
|
|
957
|
-
message: string
|
|
958
1093
|
status: number
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
this.
|
|
967
|
-
this.code = typeof code === 'number' ? code : 0
|
|
968
|
-
this.message = message || `endpoint error ${this.code}`
|
|
969
|
-
this.msg = this.message
|
|
970
|
-
this.status = typeof status === 'number' ? status : 0
|
|
971
|
-
this.cause = cause
|
|
1094
|
+
|
|
1095
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1096
|
+
super(error.message)
|
|
1097
|
+
this.name = error.name || 'WebrpcEndpointError'
|
|
1098
|
+
this.code = typeof error.code === 'number' ? error.code : 0
|
|
1099
|
+
this.message = error.message || `endpoint error`
|
|
1100
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1101
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
972
1102
|
Object.setPrototypeOf(this, WebrpcError.prototype)
|
|
973
1103
|
}
|
|
974
1104
|
|
|
975
1105
|
static new(payload: any): WebrpcError {
|
|
976
|
-
return new this(
|
|
1106
|
+
return new this({ message: payload.message, code: payload.code, status: payload.status, cause: payload.cause })
|
|
977
1107
|
}
|
|
978
1108
|
}
|
|
979
1109
|
|
|
980
|
-
// Webrpc errors
|
|
981
1110
|
|
|
982
1111
|
export class WebrpcEndpointError extends WebrpcError {
|
|
983
|
-
constructor(
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
super(name, code, message, status, cause)
|
|
1112
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1113
|
+
super(error)
|
|
1114
|
+
this.name = error.name || 'WebrpcEndpoint'
|
|
1115
|
+
this.code = typeof error.code === 'number' ? error.code : 0
|
|
1116
|
+
this.message = error.message || `endpoint error`
|
|
1117
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1118
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
991
1119
|
Object.setPrototypeOf(this, WebrpcEndpointError.prototype)
|
|
992
1120
|
}
|
|
993
1121
|
}
|
|
994
1122
|
|
|
995
1123
|
export class WebrpcRequestFailedError extends WebrpcError {
|
|
996
|
-
constructor(
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
super(name, code, message, status, cause)
|
|
1124
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1125
|
+
super(error)
|
|
1126
|
+
this.name = error.name || 'WebrpcRequestFailed'
|
|
1127
|
+
this.code = typeof error.code === 'number' ? error.code : -1
|
|
1128
|
+
this.message = error.message || `request failed`
|
|
1129
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1130
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1004
1131
|
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype)
|
|
1005
1132
|
}
|
|
1006
1133
|
}
|
|
1007
1134
|
|
|
1008
1135
|
export class WebrpcBadRouteError extends WebrpcError {
|
|
1009
|
-
constructor(
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
super(name, code, message, status, cause)
|
|
1136
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1137
|
+
super(error)
|
|
1138
|
+
this.name = error.name || 'WebrpcBadRoute'
|
|
1139
|
+
this.code = typeof error.code === 'number' ? error.code : -2
|
|
1140
|
+
this.message = error.message || `bad route`
|
|
1141
|
+
this.status = typeof error.status === 'number' ? error.status : 404
|
|
1142
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1017
1143
|
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype)
|
|
1018
1144
|
}
|
|
1019
1145
|
}
|
|
1020
1146
|
|
|
1021
1147
|
export class WebrpcBadMethodError extends WebrpcError {
|
|
1022
|
-
constructor(
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
super(name, code, message, status, cause)
|
|
1148
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1149
|
+
super(error)
|
|
1150
|
+
this.name = error.name || 'WebrpcBadMethod'
|
|
1151
|
+
this.code = typeof error.code === 'number' ? error.code : -3
|
|
1152
|
+
this.message = error.message || `bad method`
|
|
1153
|
+
this.status = typeof error.status === 'number' ? error.status : 405
|
|
1154
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1030
1155
|
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype)
|
|
1031
1156
|
}
|
|
1032
1157
|
}
|
|
1033
1158
|
|
|
1034
1159
|
export class WebrpcBadRequestError extends WebrpcError {
|
|
1035
|
-
constructor(
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
super(name, code, message, status, cause)
|
|
1160
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1161
|
+
super(error)
|
|
1162
|
+
this.name = error.name || 'WebrpcBadRequest'
|
|
1163
|
+
this.code = typeof error.code === 'number' ? error.code : -4
|
|
1164
|
+
this.message = error.message || `bad request`
|
|
1165
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1166
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1043
1167
|
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype)
|
|
1044
1168
|
}
|
|
1045
1169
|
}
|
|
1046
1170
|
|
|
1047
1171
|
export class WebrpcBadResponseError extends WebrpcError {
|
|
1048
|
-
constructor(
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
super(name, code, message, status, cause)
|
|
1172
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1173
|
+
super(error)
|
|
1174
|
+
this.name = error.name || 'WebrpcBadResponse'
|
|
1175
|
+
this.code = typeof error.code === 'number' ? error.code : -5
|
|
1176
|
+
this.message = error.message || `bad response`
|
|
1177
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
1178
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1056
1179
|
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype)
|
|
1057
1180
|
}
|
|
1058
1181
|
}
|
|
1059
1182
|
|
|
1060
1183
|
export class WebrpcServerPanicError extends WebrpcError {
|
|
1061
|
-
constructor(
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
super(name, code, message, status, cause)
|
|
1184
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1185
|
+
super(error)
|
|
1186
|
+
this.name = error.name || 'WebrpcServerPanic'
|
|
1187
|
+
this.code = typeof error.code === 'number' ? error.code : -6
|
|
1188
|
+
this.message = error.message || `server panic`
|
|
1189
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
1190
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1069
1191
|
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype)
|
|
1070
1192
|
}
|
|
1071
1193
|
}
|
|
1072
1194
|
|
|
1073
1195
|
export class WebrpcInternalErrorError extends WebrpcError {
|
|
1074
|
-
constructor(
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
super(name, code, message, status, cause)
|
|
1196
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1197
|
+
super(error)
|
|
1198
|
+
this.name = error.name || 'WebrpcInternalError'
|
|
1199
|
+
this.code = typeof error.code === 'number' ? error.code : -7
|
|
1200
|
+
this.message = error.message || `internal error`
|
|
1201
|
+
this.status = typeof error.status === 'number' ? error.status : 500
|
|
1202
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1082
1203
|
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype)
|
|
1083
1204
|
}
|
|
1084
1205
|
}
|
|
1085
1206
|
|
|
1086
|
-
export class
|
|
1087
|
-
constructor(
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype)
|
|
1207
|
+
export class WebrpcClientAbortedError extends WebrpcError {
|
|
1208
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1209
|
+
super(error)
|
|
1210
|
+
this.name = error.name || 'WebrpcClientAborted'
|
|
1211
|
+
this.code = typeof error.code === 'number' ? error.code : -8
|
|
1212
|
+
this.message = error.message || `request aborted by client`
|
|
1213
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1214
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1215
|
+
Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype)
|
|
1096
1216
|
}
|
|
1097
1217
|
}
|
|
1098
1218
|
|
|
1099
1219
|
export class WebrpcStreamLostError extends WebrpcError {
|
|
1100
|
-
constructor(
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
super(name, code, message, status, cause)
|
|
1220
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1221
|
+
super(error)
|
|
1222
|
+
this.name = error.name || 'WebrpcStreamLost'
|
|
1223
|
+
this.code = typeof error.code === 'number' ? error.code : -9
|
|
1224
|
+
this.message = error.message || `stream lost`
|
|
1225
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1226
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1108
1227
|
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype)
|
|
1109
1228
|
}
|
|
1110
1229
|
}
|
|
1111
1230
|
|
|
1112
1231
|
export class WebrpcStreamFinishedError extends WebrpcError {
|
|
1113
|
-
constructor(
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
super(name, code, message, status, cause)
|
|
1232
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1233
|
+
super(error)
|
|
1234
|
+
this.name = error.name || 'WebrpcStreamFinished'
|
|
1235
|
+
this.code = typeof error.code === 'number' ? error.code : -10
|
|
1236
|
+
this.message = error.message || `stream finished`
|
|
1237
|
+
this.status = typeof error.status === 'number' ? error.status : 200
|
|
1238
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1121
1239
|
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype)
|
|
1122
1240
|
}
|
|
1123
1241
|
}
|
|
1124
1242
|
|
|
1243
|
+
|
|
1244
|
+
//
|
|
1125
1245
|
// Schema errors
|
|
1246
|
+
//
|
|
1126
1247
|
|
|
1127
|
-
export class
|
|
1128
|
-
constructor(
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
Object.setPrototypeOf(this, UnauthorizedError.prototype)
|
|
1248
|
+
export class AbortedError extends WebrpcError {
|
|
1249
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1250
|
+
super(error)
|
|
1251
|
+
this.name = error.name || 'Aborted'
|
|
1252
|
+
this.code = typeof error.code === 'number' ? error.code : 1005
|
|
1253
|
+
this.message = error.message || `Request aborted`
|
|
1254
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1255
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1256
|
+
Object.setPrototypeOf(this, AbortedError.prototype)
|
|
1137
1257
|
}
|
|
1138
1258
|
}
|
|
1139
1259
|
|
|
1140
|
-
export class
|
|
1141
|
-
constructor(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
Object.setPrototypeOf(this, PermissionDeniedError.prototype)
|
|
1260
|
+
export class AccessKeyMismatchError extends WebrpcError {
|
|
1261
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1262
|
+
super(error)
|
|
1263
|
+
this.name = error.name || 'AccessKeyMismatch'
|
|
1264
|
+
this.code = typeof error.code === 'number' ? error.code : 1102
|
|
1265
|
+
this.message = error.message || `Access key mismatch`
|
|
1266
|
+
this.status = typeof error.status === 'number' ? error.status : 409
|
|
1267
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1268
|
+
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype)
|
|
1150
1269
|
}
|
|
1151
1270
|
}
|
|
1152
1271
|
|
|
1153
|
-
export class
|
|
1154
|
-
constructor(
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
Object.setPrototypeOf(this, SessionExpiredError.prototype)
|
|
1272
|
+
export class AccessKeyNotFoundError extends WebrpcError {
|
|
1273
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1274
|
+
super(error)
|
|
1275
|
+
this.name = error.name || 'AccessKeyNotFound'
|
|
1276
|
+
this.code = typeof error.code === 'number' ? error.code : 1101
|
|
1277
|
+
this.message = error.message || `Access key not found`
|
|
1278
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
1279
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1280
|
+
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype)
|
|
1163
1281
|
}
|
|
1164
1282
|
}
|
|
1165
1283
|
|
|
1166
|
-
export class
|
|
1167
|
-
constructor(
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
Object.setPrototypeOf(this, MethodNotFoundError.prototype)
|
|
1284
|
+
export class AtLeastOneKeyError extends WebrpcError {
|
|
1285
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1286
|
+
super(error)
|
|
1287
|
+
this.name = error.name || 'AtLeastOneKey'
|
|
1288
|
+
this.code = typeof error.code === 'number' ? error.code : 1302
|
|
1289
|
+
this.message = error.message || `You need at least one Access Key`
|
|
1290
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1291
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1292
|
+
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype)
|
|
1176
1293
|
}
|
|
1177
1294
|
}
|
|
1178
1295
|
|
|
1179
|
-
export class
|
|
1180
|
-
constructor(
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
Object.setPrototypeOf(this, RequestConflictError.prototype)
|
|
1296
|
+
export class GeoblockedError extends WebrpcError {
|
|
1297
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1298
|
+
super(error)
|
|
1299
|
+
this.name = error.name || 'Geoblocked'
|
|
1300
|
+
this.code = typeof error.code === 'number' ? error.code : 1006
|
|
1301
|
+
this.message = error.message || `Geoblocked region`
|
|
1302
|
+
this.status = typeof error.status === 'number' ? error.status : 451
|
|
1303
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1304
|
+
Object.setPrototypeOf(this, GeoblockedError.prototype)
|
|
1189
1305
|
}
|
|
1190
1306
|
}
|
|
1191
1307
|
|
|
1192
|
-
export class
|
|
1193
|
-
constructor(
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
Object.setPrototypeOf(this, AbortedError.prototype)
|
|
1308
|
+
export class InvalidArgumentError extends WebrpcError {
|
|
1309
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1310
|
+
super(error)
|
|
1311
|
+
this.name = error.name || 'InvalidArgument'
|
|
1312
|
+
this.code = typeof error.code === 'number' ? error.code : 2001
|
|
1313
|
+
this.message = error.message || `Invalid argument`
|
|
1314
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1315
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1316
|
+
Object.setPrototypeOf(this, InvalidArgumentError.prototype)
|
|
1202
1317
|
}
|
|
1203
1318
|
}
|
|
1204
1319
|
|
|
1205
|
-
export class
|
|
1206
|
-
constructor(
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
Object.setPrototypeOf(this, GeoblockedError.prototype)
|
|
1320
|
+
export class InvalidOriginError extends WebrpcError {
|
|
1321
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1322
|
+
super(error)
|
|
1323
|
+
this.name = error.name || 'InvalidOrigin'
|
|
1324
|
+
this.code = typeof error.code === 'number' ? error.code : 1103
|
|
1325
|
+
this.message = error.message || `Invalid origin for Access Key`
|
|
1326
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1327
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1328
|
+
Object.setPrototypeOf(this, InvalidOriginError.prototype)
|
|
1215
1329
|
}
|
|
1216
1330
|
}
|
|
1217
1331
|
|
|
1218
|
-
export class
|
|
1219
|
-
constructor(
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
Object.setPrototypeOf(this, RateLimitedError.prototype)
|
|
1332
|
+
export class InvalidServiceError extends WebrpcError {
|
|
1333
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1334
|
+
super(error)
|
|
1335
|
+
this.name = error.name || 'InvalidService'
|
|
1336
|
+
this.code = typeof error.code === 'number' ? error.code : 1104
|
|
1337
|
+
this.message = error.message || `Service not enabled for Access key`
|
|
1338
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1339
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1340
|
+
Object.setPrototypeOf(this, InvalidServiceError.prototype)
|
|
1228
1341
|
}
|
|
1229
1342
|
}
|
|
1230
1343
|
|
|
1231
|
-
export class
|
|
1232
|
-
constructor(
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
Object.setPrototypeOf(this, ProjectNotFoundError.prototype)
|
|
1344
|
+
export class MaxAccessKeysError extends WebrpcError {
|
|
1345
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1346
|
+
super(error)
|
|
1347
|
+
this.name = error.name || 'MaxAccessKeys'
|
|
1348
|
+
this.code = typeof error.code === 'number' ? error.code : 1301
|
|
1349
|
+
this.message = error.message || `Access keys limit reached`
|
|
1350
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1351
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1352
|
+
Object.setPrototypeOf(this, MaxAccessKeysError.prototype)
|
|
1241
1353
|
}
|
|
1242
1354
|
}
|
|
1243
1355
|
|
|
1244
|
-
export class
|
|
1245
|
-
constructor(
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype)
|
|
1356
|
+
export class MetadataCallFailedError extends WebrpcError {
|
|
1357
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1358
|
+
super(error)
|
|
1359
|
+
this.name = error.name || 'MetadataCallFailed'
|
|
1360
|
+
this.code = typeof error.code === 'number' ? error.code : 3003
|
|
1361
|
+
this.message = error.message || `Metadata service call failed`
|
|
1362
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1363
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1364
|
+
Object.setPrototypeOf(this, MetadataCallFailedError.prototype)
|
|
1254
1365
|
}
|
|
1255
1366
|
}
|
|
1256
1367
|
|
|
1257
|
-
export class
|
|
1258
|
-
constructor(
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
Object.setPrototypeOf(this, AccessKeyMismatchError.prototype)
|
|
1368
|
+
export class MethodNotFoundError extends WebrpcError {
|
|
1369
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1370
|
+
super(error)
|
|
1371
|
+
this.name = error.name || 'MethodNotFound'
|
|
1372
|
+
this.code = typeof error.code === 'number' ? error.code : 1003
|
|
1373
|
+
this.message = error.message || `Method not found`
|
|
1374
|
+
this.status = typeof error.status === 'number' ? error.status : 404
|
|
1375
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1376
|
+
Object.setPrototypeOf(this, MethodNotFoundError.prototype)
|
|
1267
1377
|
}
|
|
1268
1378
|
}
|
|
1269
1379
|
|
|
1270
|
-
export class
|
|
1271
|
-
constructor(
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
Object.setPrototypeOf(this, InvalidOriginError.prototype)
|
|
1380
|
+
export class NoDefaultKeyError extends WebrpcError {
|
|
1381
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1382
|
+
super(error)
|
|
1383
|
+
this.name = error.name || 'NoDefaultKey'
|
|
1384
|
+
this.code = typeof error.code === 'number' ? error.code : 1300
|
|
1385
|
+
this.message = error.message || `No default access key found`
|
|
1386
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1387
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1388
|
+
Object.setPrototypeOf(this, NoDefaultKeyError.prototype)
|
|
1280
1389
|
}
|
|
1281
1390
|
}
|
|
1282
1391
|
|
|
1283
|
-
export class
|
|
1284
|
-
constructor(
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
Object.setPrototypeOf(this, InvalidServiceError.prototype)
|
|
1392
|
+
export class NotFoundError extends WebrpcError {
|
|
1393
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1394
|
+
super(error)
|
|
1395
|
+
this.name = error.name || 'NotFound'
|
|
1396
|
+
this.code = typeof error.code === 'number' ? error.code : 3000
|
|
1397
|
+
this.message = error.message || `Resource not found`
|
|
1398
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1399
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1400
|
+
Object.setPrototypeOf(this, NotFoundError.prototype)
|
|
1293
1401
|
}
|
|
1294
1402
|
}
|
|
1295
1403
|
|
|
1296
|
-
export class
|
|
1297
|
-
constructor(
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
Object.setPrototypeOf(this, UnauthorizedUserError.prototype)
|
|
1404
|
+
export class PermissionDeniedError extends WebrpcError {
|
|
1405
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1406
|
+
super(error)
|
|
1407
|
+
this.name = error.name || 'PermissionDenied'
|
|
1408
|
+
this.code = typeof error.code === 'number' ? error.code : 1001
|
|
1409
|
+
this.message = error.message || `Permission denied`
|
|
1410
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1411
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1412
|
+
Object.setPrototypeOf(this, PermissionDeniedError.prototype)
|
|
1306
1413
|
}
|
|
1307
1414
|
}
|
|
1308
1415
|
|
|
1309
|
-
export class
|
|
1310
|
-
constructor(
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
Object.setPrototypeOf(this, QuotaExceededError.prototype)
|
|
1416
|
+
export class ProjectNotFoundError extends WebrpcError {
|
|
1417
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1418
|
+
super(error)
|
|
1419
|
+
this.name = error.name || 'ProjectNotFound'
|
|
1420
|
+
this.code = typeof error.code === 'number' ? error.code : 1100
|
|
1421
|
+
this.message = error.message || `Project not found`
|
|
1422
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
1423
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1424
|
+
Object.setPrototypeOf(this, ProjectNotFoundError.prototype)
|
|
1319
1425
|
}
|
|
1320
1426
|
}
|
|
1321
1427
|
|
|
1322
|
-
export class
|
|
1323
|
-
constructor(
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
Object.setPrototypeOf(this, RateLimitError.prototype)
|
|
1428
|
+
export class QueryFailedError extends WebrpcError {
|
|
1429
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1430
|
+
super(error)
|
|
1431
|
+
this.name = error.name || 'QueryFailed'
|
|
1432
|
+
this.code = typeof error.code === 'number' ? error.code : 2003
|
|
1433
|
+
this.message = error.message || `Query failed`
|
|
1434
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1435
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1436
|
+
Object.setPrototypeOf(this, QueryFailedError.prototype)
|
|
1332
1437
|
}
|
|
1333
1438
|
}
|
|
1334
1439
|
|
|
1335
|
-
export class
|
|
1336
|
-
constructor(
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
Object.setPrototypeOf(this, NoDefaultKeyError.prototype)
|
|
1440
|
+
export class QuotaExceededError extends WebrpcError {
|
|
1441
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1442
|
+
super(error)
|
|
1443
|
+
this.name = error.name || 'QuotaExceeded'
|
|
1444
|
+
this.code = typeof error.code === 'number' ? error.code : 1200
|
|
1445
|
+
this.message = error.message || `Quota exceeded`
|
|
1446
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
1447
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1448
|
+
Object.setPrototypeOf(this, QuotaExceededError.prototype)
|
|
1345
1449
|
}
|
|
1346
1450
|
}
|
|
1347
1451
|
|
|
1348
|
-
export class
|
|
1349
|
-
constructor(
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
Object.setPrototypeOf(this, MaxAccessKeysError.prototype)
|
|
1452
|
+
export class RateLimitError extends WebrpcError {
|
|
1453
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1454
|
+
super(error)
|
|
1455
|
+
this.name = error.name || 'RateLimit'
|
|
1456
|
+
this.code = typeof error.code === 'number' ? error.code : 1201
|
|
1457
|
+
this.message = error.message || `Rate limit exceeded`
|
|
1458
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
1459
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1460
|
+
Object.setPrototypeOf(this, RateLimitError.prototype)
|
|
1358
1461
|
}
|
|
1359
1462
|
}
|
|
1360
1463
|
|
|
1361
|
-
export class
|
|
1362
|
-
constructor(
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
Object.setPrototypeOf(this, AtLeastOneKeyError.prototype)
|
|
1464
|
+
export class RateLimitedError extends WebrpcError {
|
|
1465
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1466
|
+
super(error)
|
|
1467
|
+
this.name = error.name || 'RateLimited'
|
|
1468
|
+
this.code = typeof error.code === 'number' ? error.code : 1007
|
|
1469
|
+
this.message = error.message || `Rate-limited. Please slow down.`
|
|
1470
|
+
this.status = typeof error.status === 'number' ? error.status : 429
|
|
1471
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1472
|
+
Object.setPrototypeOf(this, RateLimitedError.prototype)
|
|
1371
1473
|
}
|
|
1372
1474
|
}
|
|
1373
1475
|
|
|
1374
|
-
export class
|
|
1375
|
-
constructor(
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
Object.setPrototypeOf(this, TimeoutError.prototype)
|
|
1476
|
+
export class RequestConflictError extends WebrpcError {
|
|
1477
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1478
|
+
super(error)
|
|
1479
|
+
this.name = error.name || 'RequestConflict'
|
|
1480
|
+
this.code = typeof error.code === 'number' ? error.code : 1004
|
|
1481
|
+
this.message = error.message || `Conflict with target resource`
|
|
1482
|
+
this.status = typeof error.status === 'number' ? error.status : 409
|
|
1483
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1484
|
+
Object.setPrototypeOf(this, RequestConflictError.prototype)
|
|
1384
1485
|
}
|
|
1385
1486
|
}
|
|
1386
1487
|
|
|
1387
|
-
export class
|
|
1388
|
-
constructor(
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
Object.setPrototypeOf(this, InvalidArgumentError.prototype)
|
|
1488
|
+
export class ResourceExhaustedError extends WebrpcError {
|
|
1489
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1490
|
+
super(error)
|
|
1491
|
+
this.name = error.name || 'ResourceExhausted'
|
|
1492
|
+
this.code = typeof error.code === 'number' ? error.code : 2004
|
|
1493
|
+
this.message = error.message || `Resource exhausted`
|
|
1494
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1495
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1496
|
+
Object.setPrototypeOf(this, ResourceExhaustedError.prototype)
|
|
1397
1497
|
}
|
|
1398
1498
|
}
|
|
1399
1499
|
|
|
1400
|
-
export class
|
|
1401
|
-
constructor(
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
Object.setPrototypeOf(this, UnavailableError.prototype)
|
|
1500
|
+
export class SessionExpiredError extends WebrpcError {
|
|
1501
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1502
|
+
super(error)
|
|
1503
|
+
this.name = error.name || 'SessionExpired'
|
|
1504
|
+
this.code = typeof error.code === 'number' ? error.code : 1002
|
|
1505
|
+
this.message = error.message || `Session expired`
|
|
1506
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1507
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1508
|
+
Object.setPrototypeOf(this, SessionExpiredError.prototype)
|
|
1410
1509
|
}
|
|
1411
1510
|
}
|
|
1412
1511
|
|
|
1413
|
-
export class
|
|
1414
|
-
constructor(
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
Object.setPrototypeOf(this, QueryFailedError.prototype)
|
|
1512
|
+
export class TimeoutError extends WebrpcError {
|
|
1513
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1514
|
+
super(error)
|
|
1515
|
+
this.name = error.name || 'Timeout'
|
|
1516
|
+
this.code = typeof error.code === 'number' ? error.code : 1900
|
|
1517
|
+
this.message = error.message || `Request timed out`
|
|
1518
|
+
this.status = typeof error.status === 'number' ? error.status : 408
|
|
1519
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1520
|
+
Object.setPrototypeOf(this, TimeoutError.prototype)
|
|
1423
1521
|
}
|
|
1424
1522
|
}
|
|
1425
1523
|
|
|
1426
|
-
export class
|
|
1427
|
-
constructor(
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
Object.setPrototypeOf(this, ResourceExhaustedError.prototype)
|
|
1524
|
+
export class UnauthorizedError extends WebrpcError {
|
|
1525
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1526
|
+
super(error)
|
|
1527
|
+
this.name = error.name || 'Unauthorized'
|
|
1528
|
+
this.code = typeof error.code === 'number' ? error.code : 1000
|
|
1529
|
+
this.message = error.message || `Unauthorized access`
|
|
1530
|
+
this.status = typeof error.status === 'number' ? error.status : 401
|
|
1531
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1532
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype)
|
|
1436
1533
|
}
|
|
1437
1534
|
}
|
|
1438
1535
|
|
|
1439
|
-
export class
|
|
1440
|
-
constructor(
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
Object.setPrototypeOf(this, NotFoundError.prototype)
|
|
1536
|
+
export class UnauthorizedUserError extends WebrpcError {
|
|
1537
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1538
|
+
super(error)
|
|
1539
|
+
this.name = error.name || 'UnauthorizedUser'
|
|
1540
|
+
this.code = typeof error.code === 'number' ? error.code : 1105
|
|
1541
|
+
this.message = error.message || `Unauthorized user`
|
|
1542
|
+
this.status = typeof error.status === 'number' ? error.status : 403
|
|
1543
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1544
|
+
Object.setPrototypeOf(this, UnauthorizedUserError.prototype)
|
|
1449
1545
|
}
|
|
1450
1546
|
}
|
|
1451
1547
|
|
|
1452
|
-
export class
|
|
1453
|
-
constructor(
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
Object.setPrototypeOf(this, MetadataCallFailedError.prototype)
|
|
1548
|
+
export class UnavailableError extends WebrpcError {
|
|
1549
|
+
constructor(error: WebrpcErrorParams = {}) {
|
|
1550
|
+
super(error)
|
|
1551
|
+
this.name = error.name || 'Unavailable'
|
|
1552
|
+
this.code = typeof error.code === 'number' ? error.code : 2002
|
|
1553
|
+
this.message = error.message || `Unavailable resource`
|
|
1554
|
+
this.status = typeof error.status === 'number' ? error.status : 400
|
|
1555
|
+
if (error.cause !== undefined) this.cause = error.cause
|
|
1556
|
+
Object.setPrototypeOf(this, UnavailableError.prototype)
|
|
1462
1557
|
}
|
|
1463
1558
|
}
|
|
1464
1559
|
|
|
1560
|
+
|
|
1465
1561
|
export enum errors {
|
|
1466
1562
|
WebrpcEndpoint = 'WebrpcEndpoint',
|
|
1467
1563
|
WebrpcRequestFailed = 'WebrpcRequestFailed',
|
|
@@ -1471,38 +1567,78 @@ export enum errors {
|
|
|
1471
1567
|
WebrpcBadResponse = 'WebrpcBadResponse',
|
|
1472
1568
|
WebrpcServerPanic = 'WebrpcServerPanic',
|
|
1473
1569
|
WebrpcInternalError = 'WebrpcInternalError',
|
|
1474
|
-
|
|
1570
|
+
WebrpcClientAborted = 'WebrpcClientAborted',
|
|
1475
1571
|
WebrpcStreamLost = 'WebrpcStreamLost',
|
|
1476
1572
|
WebrpcStreamFinished = 'WebrpcStreamFinished',
|
|
1477
|
-
Unauthorized = 'Unauthorized',
|
|
1478
|
-
PermissionDenied = 'PermissionDenied',
|
|
1479
|
-
SessionExpired = 'SessionExpired',
|
|
1480
|
-
MethodNotFound = 'MethodNotFound',
|
|
1481
|
-
RequestConflict = 'RequestConflict',
|
|
1482
1573
|
Aborted = 'Aborted',
|
|
1483
|
-
Geoblocked = 'Geoblocked',
|
|
1484
|
-
RateLimited = 'RateLimited',
|
|
1485
|
-
ProjectNotFound = 'ProjectNotFound',
|
|
1486
|
-
AccessKeyNotFound = 'AccessKeyNotFound',
|
|
1487
1574
|
AccessKeyMismatch = 'AccessKeyMismatch',
|
|
1575
|
+
AccessKeyNotFound = 'AccessKeyNotFound',
|
|
1576
|
+
AtLeastOneKey = 'AtLeastOneKey',
|
|
1577
|
+
Geoblocked = 'Geoblocked',
|
|
1578
|
+
InvalidArgument = 'InvalidArgument',
|
|
1488
1579
|
InvalidOrigin = 'InvalidOrigin',
|
|
1489
1580
|
InvalidService = 'InvalidService',
|
|
1490
|
-
|
|
1581
|
+
MaxAccessKeys = 'MaxAccessKeys',
|
|
1582
|
+
MetadataCallFailed = 'MetadataCallFailed',
|
|
1583
|
+
MethodNotFound = 'MethodNotFound',
|
|
1584
|
+
NoDefaultKey = 'NoDefaultKey',
|
|
1585
|
+
NotFound = 'NotFound',
|
|
1586
|
+
PermissionDenied = 'PermissionDenied',
|
|
1587
|
+
ProjectNotFound = 'ProjectNotFound',
|
|
1588
|
+
QueryFailed = 'QueryFailed',
|
|
1491
1589
|
QuotaExceeded = 'QuotaExceeded',
|
|
1492
1590
|
RateLimit = 'RateLimit',
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1591
|
+
RateLimited = 'RateLimited',
|
|
1592
|
+
RequestConflict = 'RequestConflict',
|
|
1593
|
+
ResourceExhausted = 'ResourceExhausted',
|
|
1594
|
+
SessionExpired = 'SessionExpired',
|
|
1496
1595
|
Timeout = 'Timeout',
|
|
1497
|
-
|
|
1596
|
+
Unauthorized = 'Unauthorized',
|
|
1597
|
+
UnauthorizedUser = 'UnauthorizedUser',
|
|
1498
1598
|
Unavailable = 'Unavailable',
|
|
1499
|
-
QueryFailed = 'QueryFailed',
|
|
1500
|
-
ResourceExhausted = 'ResourceExhausted',
|
|
1501
|
-
NotFound = 'NotFound',
|
|
1502
|
-
MetadataCallFailed = 'MetadataCallFailed'
|
|
1503
1599
|
}
|
|
1504
1600
|
|
|
1505
|
-
|
|
1601
|
+
export enum WebrpcErrorCodes {
|
|
1602
|
+
WebrpcEndpoint = 0,
|
|
1603
|
+
WebrpcRequestFailed = -1,
|
|
1604
|
+
WebrpcBadRoute = -2,
|
|
1605
|
+
WebrpcBadMethod = -3,
|
|
1606
|
+
WebrpcBadRequest = -4,
|
|
1607
|
+
WebrpcBadResponse = -5,
|
|
1608
|
+
WebrpcServerPanic = -6,
|
|
1609
|
+
WebrpcInternalError = -7,
|
|
1610
|
+
WebrpcClientAborted = -8,
|
|
1611
|
+
WebrpcStreamLost = -9,
|
|
1612
|
+
WebrpcStreamFinished = -10,
|
|
1613
|
+
Aborted = 1005,
|
|
1614
|
+
AccessKeyMismatch = 1102,
|
|
1615
|
+
AccessKeyNotFound = 1101,
|
|
1616
|
+
AtLeastOneKey = 1302,
|
|
1617
|
+
Geoblocked = 1006,
|
|
1618
|
+
InvalidArgument = 2001,
|
|
1619
|
+
InvalidOrigin = 1103,
|
|
1620
|
+
InvalidService = 1104,
|
|
1621
|
+
MaxAccessKeys = 1301,
|
|
1622
|
+
MetadataCallFailed = 3003,
|
|
1623
|
+
MethodNotFound = 1003,
|
|
1624
|
+
NoDefaultKey = 1300,
|
|
1625
|
+
NotFound = 3000,
|
|
1626
|
+
PermissionDenied = 1001,
|
|
1627
|
+
ProjectNotFound = 1100,
|
|
1628
|
+
QueryFailed = 2003,
|
|
1629
|
+
QuotaExceeded = 1200,
|
|
1630
|
+
RateLimit = 1201,
|
|
1631
|
+
RateLimited = 1007,
|
|
1632
|
+
RequestConflict = 1004,
|
|
1633
|
+
ResourceExhausted = 2004,
|
|
1634
|
+
SessionExpired = 1002,
|
|
1635
|
+
Timeout = 1900,
|
|
1636
|
+
Unauthorized = 1000,
|
|
1637
|
+
UnauthorizedUser = 1105,
|
|
1638
|
+
Unavailable = 2002,
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
1506
1642
|
[0]: WebrpcEndpointError,
|
|
1507
1643
|
[-1]: WebrpcRequestFailedError,
|
|
1508
1644
|
[-2]: WebrpcBadRouteError,
|
|
@@ -1511,35 +1647,92 @@ const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
1511
1647
|
[-5]: WebrpcBadResponseError,
|
|
1512
1648
|
[-6]: WebrpcServerPanicError,
|
|
1513
1649
|
[-7]: WebrpcInternalErrorError,
|
|
1514
|
-
[-8]:
|
|
1650
|
+
[-8]: WebrpcClientAbortedError,
|
|
1515
1651
|
[-9]: WebrpcStreamLostError,
|
|
1516
1652
|
[-10]: WebrpcStreamFinishedError,
|
|
1517
|
-
[1000]: UnauthorizedError,
|
|
1518
|
-
[1001]: PermissionDeniedError,
|
|
1519
|
-
[1002]: SessionExpiredError,
|
|
1520
|
-
[1003]: MethodNotFoundError,
|
|
1521
|
-
[1004]: RequestConflictError,
|
|
1522
1653
|
[1005]: AbortedError,
|
|
1523
|
-
[1006]: GeoblockedError,
|
|
1524
|
-
[1007]: RateLimitedError,
|
|
1525
|
-
[1100]: ProjectNotFoundError,
|
|
1526
|
-
[1101]: AccessKeyNotFoundError,
|
|
1527
1654
|
[1102]: AccessKeyMismatchError,
|
|
1655
|
+
[1101]: AccessKeyNotFoundError,
|
|
1656
|
+
[1302]: AtLeastOneKeyError,
|
|
1657
|
+
[1006]: GeoblockedError,
|
|
1658
|
+
[2001]: InvalidArgumentError,
|
|
1528
1659
|
[1103]: InvalidOriginError,
|
|
1529
1660
|
[1104]: InvalidServiceError,
|
|
1530
|
-
[
|
|
1661
|
+
[1301]: MaxAccessKeysError,
|
|
1662
|
+
[3003]: MetadataCallFailedError,
|
|
1663
|
+
[1003]: MethodNotFoundError,
|
|
1664
|
+
[1300]: NoDefaultKeyError,
|
|
1665
|
+
[3000]: NotFoundError,
|
|
1666
|
+
[1001]: PermissionDeniedError,
|
|
1667
|
+
[1100]: ProjectNotFoundError,
|
|
1668
|
+
[2003]: QueryFailedError,
|
|
1531
1669
|
[1200]: QuotaExceededError,
|
|
1532
1670
|
[1201]: RateLimitError,
|
|
1533
|
-
[
|
|
1534
|
-
[
|
|
1535
|
-
[
|
|
1671
|
+
[1007]: RateLimitedError,
|
|
1672
|
+
[1004]: RequestConflictError,
|
|
1673
|
+
[2004]: ResourceExhaustedError,
|
|
1674
|
+
[1002]: SessionExpiredError,
|
|
1536
1675
|
[1900]: TimeoutError,
|
|
1537
|
-
[
|
|
1676
|
+
[1000]: UnauthorizedError,
|
|
1677
|
+
[1105]: UnauthorizedUserError,
|
|
1538
1678
|
[2002]: UnavailableError,
|
|
1539
|
-
[2003]: QueryFailedError,
|
|
1540
|
-
[2004]: ResourceExhaustedError,
|
|
1541
|
-
[3000]: NotFoundError,
|
|
1542
|
-
[3003]: MetadataCallFailedError
|
|
1543
1679
|
}
|
|
1544
1680
|
|
|
1545
|
-
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
//
|
|
1684
|
+
// Webrpc
|
|
1685
|
+
//
|
|
1686
|
+
|
|
1687
|
+
export const WebrpcHeader = "Webrpc"
|
|
1688
|
+
|
|
1689
|
+
export const WebrpcHeaderValue = "webrpc@v0.31.2;gen-typescript@v0.23.1;sequence-indexer@v0.4.0"
|
|
1690
|
+
|
|
1691
|
+
type WebrpcGenVersions = {
|
|
1692
|
+
WebrpcGenVersion: string;
|
|
1693
|
+
codeGenName: string;
|
|
1694
|
+
codeGenVersion: string;
|
|
1695
|
+
schemaName: string;
|
|
1696
|
+
schemaVersion: string;
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
1700
|
+
const headerValue = headers.get(WebrpcHeader)
|
|
1701
|
+
if (!headerValue) {
|
|
1702
|
+
return {
|
|
1703
|
+
WebrpcGenVersion: "",
|
|
1704
|
+
codeGenName: "",
|
|
1705
|
+
codeGenVersion: "",
|
|
1706
|
+
schemaName: "",
|
|
1707
|
+
schemaVersion: "",
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
return parseWebrpcGenVersions(headerValue)
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
1715
|
+
const versions = header.split(";")
|
|
1716
|
+
if (versions.length < 3) {
|
|
1717
|
+
return {
|
|
1718
|
+
WebrpcGenVersion: "",
|
|
1719
|
+
codeGenName: "",
|
|
1720
|
+
codeGenVersion: "",
|
|
1721
|
+
schemaName: "",
|
|
1722
|
+
schemaVersion: "",
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
const [_, WebrpcGenVersion] = versions[0]!.split("@")
|
|
1727
|
+
const [codeGenName, codeGenVersion] = versions[1]!.split("@")
|
|
1728
|
+
const [schemaName, schemaVersion] = versions[2]!.split("@")
|
|
1729
|
+
|
|
1730
|
+
return {
|
|
1731
|
+
WebrpcGenVersion: WebrpcGenVersion ?? "",
|
|
1732
|
+
codeGenName: codeGenName ?? "",
|
|
1733
|
+
codeGenVersion: codeGenVersion ?? "",
|
|
1734
|
+
schemaName: schemaName ?? "",
|
|
1735
|
+
schemaVersion: schemaVersion ?? "",
|
|
1736
|
+
};
|
|
1737
|
+
}
|
|
1738
|
+
|