@0xsequence/indexer 2.3.39 → 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.
@@ -13,69 +13,29 @@ function _extends() {
13
13
  }
14
14
 
15
15
  /* eslint-disable */
16
- // sequence-indexer v0.4.0 f9220b18008af826218980db21a68ec39989fb80
16
+ // sequence-indexer v0.4.0 caf5c4c3677ac2dce41858dce7cd727a7810845f
17
17
  // --
18
- // Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT.
18
+ // Code generated by Webrpc-gen@v0.31.2 with typescript generator. DO NOT EDIT.
19
19
  //
20
- // webrpc-gen -schema=indexer.ridl -service=Indexer -target=typescript -client -out=./clients/indexer.gen.ts
20
+ // webrpc-gen -schema=merged.gen.json -service=Indexer -target=typescript -client -out=./clients/indexer.gen.ts
21
21
 
22
- const WebrpcHeader$1 = 'Webrpc';
23
- const WebrpcHeaderValue$1 = 'webrpc@v0.21.1;gen-typescript@v0.15.1;sequence-indexer@v0.4.0';
24
-
25
- // WebRPC description and code-gen version
26
- const WebRPCVersion$1 = 'v1';
22
+ // Webrpc description and code-gen version
23
+ const WebrpcVersion$1 = "v1";
27
24
 
28
25
  // Schema version of your RIDL schema
29
- const WebRPCSchemaVersion$1 = 'v0.4.0';
26
+ const WebrpcSchemaVersion$1 = "v0.4.0";
30
27
 
31
28
  // Schema hash generated from your RIDL schema
32
- const WebRPCSchemaHash$1 = 'f9220b18008af826218980db21a68ec39989fb80';
33
- function VersionFromHeader$1(headers) {
34
- const headerValue = headers.get(WebrpcHeader$1);
35
- if (!headerValue) {
36
- return {
37
- webrpcGenVersion: '',
38
- codeGenName: '',
39
- codeGenVersion: '',
40
- schemaName: '',
41
- schemaVersion: ''
42
- };
43
- }
44
- return parseWebrpcGenVersions$1(headerValue);
45
- }
46
- function parseWebrpcGenVersions$1(header) {
47
- const versions = header.split(';');
48
- if (versions.length < 3) {
49
- return {
50
- webrpcGenVersion: '',
51
- codeGenName: '',
52
- codeGenVersion: '',
53
- schemaName: '',
54
- schemaVersion: ''
55
- };
56
- }
57
- const [_, webrpcGenVersion] = versions[0].split('@');
58
- const [codeGenName, codeGenVersion] = versions[1].split('@');
59
- const [schemaName, schemaVersion] = versions[2].split('@');
60
- return {
61
- webrpcGenVersion,
62
- codeGenName,
63
- codeGenVersion,
64
- schemaName,
65
- schemaVersion
66
- };
67
- }
29
+ const WebrpcSchemaHash$1 = "caf5c4c3677ac2dce41858dce7cd727a7810845f";
68
30
 
69
31
  //
70
- // Types
32
+ // Client interface
33
+ //
34
+
35
+ //
36
+ // Schema types
71
37
  //
72
38
 
73
- let ResourceStatus$1 = /*#__PURE__*/function (ResourceStatus) {
74
- ResourceStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
75
- ResourceStatus["REFRESHING"] = "REFRESHING";
76
- ResourceStatus["AVAILABLE"] = "AVAILABLE";
77
- return ResourceStatus;
78
- }({});
79
39
  let ContractType$1 = /*#__PURE__*/function (ContractType) {
80
40
  ContractType["UNKNOWN"] = "UNKNOWN";
81
41
  ContractType["NATIVE"] = "NATIVE";
@@ -87,13 +47,14 @@ let ContractType$1 = /*#__PURE__*/function (ContractType) {
87
47
  ContractType["ERC721_BRIDGE"] = "ERC721_BRIDGE";
88
48
  ContractType["ERC1155_BRIDGE"] = "ERC1155_BRIDGE";
89
49
  ContractType["SEQ_MARKETPLACE"] = "SEQ_MARKETPLACE";
50
+ ContractType["ERC6909"] = "ERC6909";
90
51
  return ContractType;
91
52
  }({});
92
- let EventLogType$1 = /*#__PURE__*/function (EventLogType) {
93
- EventLogType["UNKNOWN"] = "UNKNOWN";
94
- EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
95
- EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
96
- return EventLogType;
53
+ let ContractVerificationStatus$1 = /*#__PURE__*/function (ContractVerificationStatus) {
54
+ ContractVerificationStatus["VERIFIED"] = "VERIFIED";
55
+ ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
56
+ ContractVerificationStatus["ALL"] = "ALL";
57
+ return ContractVerificationStatus;
97
58
  }({});
98
59
  let EventLogDataType$1 = /*#__PURE__*/function (EventLogDataType) {
99
60
  EventLogDataType["EVENT"] = "EVENT";
@@ -102,17 +63,34 @@ let EventLogDataType$1 = /*#__PURE__*/function (EventLogDataType) {
102
63
  EventLogDataType["SEQUENCE_TXN"] = "SEQUENCE_TXN";
103
64
  return EventLogDataType;
104
65
  }({});
66
+ let EventLogType$1 = /*#__PURE__*/function (EventLogType) {
67
+ EventLogType["UNKNOWN"] = "UNKNOWN";
68
+ EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
69
+ EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
70
+ return EventLogType;
71
+ }({});
72
+ let NetworkType$1 = /*#__PURE__*/function (NetworkType) {
73
+ NetworkType["MAINNETS"] = "MAINNETS";
74
+ NetworkType["TESTNETS"] = "TESTNETS";
75
+ NetworkType["ALL"] = "ALL";
76
+ return NetworkType;
77
+ }({});
105
78
  let OrderStatus$1 = /*#__PURE__*/function (OrderStatus) {
106
79
  OrderStatus["OPEN"] = "OPEN";
107
80
  OrderStatus["CLOSED"] = "CLOSED";
108
81
  OrderStatus["CANCELLED"] = "CANCELLED";
109
82
  return OrderStatus;
110
83
  }({});
111
- let TxnTransferType$1 = /*#__PURE__*/function (TxnTransferType) {
112
- TxnTransferType["UNKNOWN"] = "UNKNOWN";
113
- TxnTransferType["SEND"] = "SEND";
114
- TxnTransferType["RECEIVE"] = "RECEIVE";
115
- return TxnTransferType;
84
+ let ResourceStatus$1 = /*#__PURE__*/function (ResourceStatus) {
85
+ ResourceStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
86
+ ResourceStatus["REFRESHING"] = "REFRESHING";
87
+ ResourceStatus["AVAILABLE"] = "AVAILABLE";
88
+ return ResourceStatus;
89
+ }({});
90
+ let SortOrder$1 = /*#__PURE__*/function (SortOrder) {
91
+ SortOrder["DESC"] = "DESC";
92
+ SortOrder["ASC"] = "ASC";
93
+ return SortOrder;
116
94
  }({});
117
95
  let TransactionStatus$1 = /*#__PURE__*/function (TransactionStatus) {
118
96
  TransactionStatus["FAILED"] = "FAILED";
@@ -125,456 +103,485 @@ let TransactionType$1 = /*#__PURE__*/function (TransactionType) {
125
103
  TransactionType["DynamicFeeTxnType"] = "DynamicFeeTxnType";
126
104
  return TransactionType;
127
105
  }({});
128
- let SortOrder$1 = /*#__PURE__*/function (SortOrder) {
129
- SortOrder["DESC"] = "DESC";
130
- SortOrder["ASC"] = "ASC";
131
- return SortOrder;
132
- }({});
133
- let ContractVerificationStatus$1 = /*#__PURE__*/function (ContractVerificationStatus) {
134
- ContractVerificationStatus["VERIFIED"] = "VERIFIED";
135
- ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
136
- ContractVerificationStatus["ALL"] = "ALL";
137
- return ContractVerificationStatus;
138
- }({});
139
- let NetworkType$1 = /*#__PURE__*/function (NetworkType) {
140
- NetworkType["MAINNETS"] = "MAINNETS";
141
- NetworkType["TESTNETS"] = "TESTNETS";
142
- NetworkType["ALL"] = "ALL";
143
- return NetworkType;
106
+ let TxnTransferType$1 = /*#__PURE__*/function (TxnTransferType) {
107
+ TxnTransferType["UNKNOWN"] = "UNKNOWN";
108
+ TxnTransferType["SEND"] = "SEND";
109
+ TxnTransferType["RECEIVE"] = "RECEIVE";
110
+ return TxnTransferType;
144
111
  }({});
145
112
  //
146
113
  // Client
147
114
  //
115
+
148
116
  class Indexer {
149
117
  constructor(hostname, fetch) {
150
118
  this.hostname = void 0;
151
119
  this.fetch = void 0;
152
120
  this.path = '/rpc/Indexer/';
153
- this.ping = (headers, signal) => {
154
- return this.fetch(this.url('Ping'), createHTTPRequest$1({}, headers, signal)).then(res => {
121
+ this.queryKey = {
122
+ addWebhookListener: req => ['Indexer', 'addWebhookListener', req],
123
+ fetchTransactionReceipt: req => ['Indexer', 'fetchTransactionReceipt', req],
124
+ fetchTransactionReceiptWithFilter: req => ['Indexer', 'fetchTransactionReceiptWithFilter', req],
125
+ getAllWebhookListeners: req => ['Indexer', 'getAllWebhookListeners', req],
126
+ getBalanceUpdates: req => ['Indexer', 'getBalanceUpdates', req],
127
+ getChainID: () => ['Indexer', 'getChainID'],
128
+ getEtherBalance: req => ['Indexer', 'getEtherBalance', req],
129
+ getMarketplaceOrders: req => ['Indexer', 'getMarketplaceOrders', req],
130
+ getMarketplaceTopOrders: req => ['Indexer', 'getMarketplaceTopOrders', req],
131
+ getNativeTokenBalance: req => ['Indexer', 'getNativeTokenBalance', req],
132
+ getTokenBalances: req => ['Indexer', 'getTokenBalances', req],
133
+ getTokenBalancesByContract: req => ['Indexer', 'getTokenBalancesByContract', req],
134
+ getTokenBalancesDetails: req => ['Indexer', 'getTokenBalancesDetails', req],
135
+ getTokenBalancesSummary: req => ['Indexer', 'getTokenBalancesSummary', req],
136
+ getTokenIDRanges: req => ['Indexer', 'getTokenIDRanges', req],
137
+ getTokenIDs: req => ['Indexer', 'getTokenIDs', req],
138
+ getTokenPrice: req => ['Indexer', 'getTokenPrice', req],
139
+ getTokenPrices: req => ['Indexer', 'getTokenPrices', req],
140
+ getTokenSupplies: req => ['Indexer', 'getTokenSupplies', req],
141
+ getTokenSuppliesMap: req => ['Indexer', 'getTokenSuppliesMap', req],
142
+ getTransactionHistory: req => ['Indexer', 'getTransactionHistory', req],
143
+ getWebhookListener: req => ['Indexer', 'getWebhookListener', req],
144
+ listTokenPrices: req => ['Indexer', 'listTokenPrices', req],
145
+ pauseAllWebhookListeners: req => ['Indexer', 'pauseAllWebhookListeners', req],
146
+ ping: () => ['Indexer', 'ping'],
147
+ removeAllWebhookListeners: req => ['Indexer', 'removeAllWebhookListeners', req],
148
+ removeWebhookListener: req => ['Indexer', 'removeWebhookListener', req],
149
+ resumeAllWebhookListeners: req => ['Indexer', 'resumeAllWebhookListeners', req],
150
+ runtimeStatus: () => ['Indexer', 'runtimeStatus'],
151
+ subscribeBalanceUpdates: req => ['Indexer', 'subscribeBalanceUpdates', req],
152
+ subscribeEvents: req => ['Indexer', 'subscribeEvents', req],
153
+ subscribeReceipts: req => ['Indexer', 'subscribeReceipts', req],
154
+ syncBalance: req => ['Indexer', 'syncBalance', req],
155
+ toggleWebhookListener: req => ['Indexer', 'toggleWebhookListener', req],
156
+ updateWebhookListener: req => ['Indexer', 'updateWebhookListener', req],
157
+ version: () => ['Indexer', 'version']
158
+ };
159
+ this.addWebhookListener = (req, headers, signal) => {
160
+ return this.fetch(this.url('AddWebhookListener'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
155
161
  return buildResponse$1(res).then(_data => {
156
- return {
157
- status: _data.status
158
- };
162
+ return JsonDecode$1(_data, 'AddWebhookListenerResponse');
159
163
  });
160
164
  }, error => {
161
165
  throw WebrpcRequestFailedError$1.new({
162
- cause: `fetch(): ${error.message || ''}`
166
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
163
167
  });
164
168
  });
165
169
  };
166
- this.version = (headers, signal) => {
167
- return this.fetch(this.url('Version'), createHTTPRequest$1({}, headers, signal)).then(res => {
170
+ this.fetchTransactionReceipt = (req, headers, signal) => {
171
+ return this.fetch(this.url('FetchTransactionReceipt'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
168
172
  return buildResponse$1(res).then(_data => {
169
- return {
170
- version: _data.version
171
- };
173
+ return JsonDecode$1(_data, 'FetchTransactionReceiptResponse');
172
174
  });
173
175
  }, error => {
174
176
  throw WebrpcRequestFailedError$1.new({
175
- cause: `fetch(): ${error.message || ''}`
177
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
176
178
  });
177
179
  });
178
180
  };
179
- this.runtimeStatus = (headers, signal) => {
180
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest$1({}, headers, signal)).then(res => {
181
+ this.fetchTransactionReceiptWithFilter = (req, headers, signal) => {
182
+ return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
181
183
  return buildResponse$1(res).then(_data => {
182
- return {
183
- status: _data.status
184
- };
184
+ return JsonDecode$1(_data, 'FetchTransactionReceiptWithFilterResponse');
185
185
  });
186
186
  }, error => {
187
187
  throw WebrpcRequestFailedError$1.new({
188
- cause: `fetch(): ${error.message || ''}`
188
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
189
189
  });
190
190
  });
191
191
  };
192
- this.getChainID = (headers, signal) => {
193
- return this.fetch(this.url('GetChainID'), createHTTPRequest$1({}, headers, signal)).then(res => {
192
+ this.getAllWebhookListeners = (req, headers, signal) => {
193
+ return this.fetch(this.url('GetAllWebhookListeners'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
194
194
  return buildResponse$1(res).then(_data => {
195
- return {
196
- chainID: _data.chainID
197
- };
195
+ return JsonDecode$1(_data, 'GetAllWebhookListenersResponse');
198
196
  });
199
197
  }, error => {
200
198
  throw WebrpcRequestFailedError$1.new({
201
- cause: `fetch(): ${error.message || ''}`
199
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
202
200
  });
203
201
  });
204
202
  };
205
- this.getEtherBalance = (args, headers, signal) => {
206
- return this.fetch(this.url('GetEtherBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
203
+ this.getBalanceUpdates = (req, headers, signal) => {
204
+ return this.fetch(this.url('GetBalanceUpdates'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
207
205
  return buildResponse$1(res).then(_data => {
208
- return {
209
- balance: _data.balance
210
- };
206
+ return JsonDecode$1(_data, 'GetBalanceUpdatesResponse');
211
207
  });
212
208
  }, error => {
213
209
  throw WebrpcRequestFailedError$1.new({
214
- cause: `fetch(): ${error.message || ''}`
210
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
215
211
  });
216
212
  });
217
213
  };
218
- this.getNativeTokenBalance = (args, headers, signal) => {
219
- return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
214
+ this.getChainID = (headers, signal) => {
215
+ return this.fetch(this.url('GetChainID'), createHttpRequest$1('{}', headers, signal)).then(res => {
220
216
  return buildResponse$1(res).then(_data => {
221
- return {
222
- balance: _data.balance
223
- };
217
+ return JsonDecode$1(_data, 'GetChainIDResponse');
224
218
  });
225
219
  }, error => {
226
220
  throw WebrpcRequestFailedError$1.new({
227
- cause: `fetch(): ${error.message || ''}`
221
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
228
222
  });
229
223
  });
230
224
  };
231
- this.getTokenBalancesSummary = (args, headers, signal) => {
232
- return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest$1(args, headers, signal)).then(res => {
225
+ this.getEtherBalance = (req, headers, signal) => {
226
+ return this.fetch(this.url('GetEtherBalance'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
233
227
  return buildResponse$1(res).then(_data => {
234
- return {
235
- page: _data.page,
236
- nativeBalances: _data.nativeBalances,
237
- balances: _data.balances
238
- };
228
+ return JsonDecode$1(_data, 'GetEtherBalanceResponse');
239
229
  });
240
230
  }, error => {
241
231
  throw WebrpcRequestFailedError$1.new({
242
- cause: `fetch(): ${error.message || ''}`
232
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
243
233
  });
244
234
  });
245
235
  };
246
- this.getTokenBalancesDetails = (args, headers, signal) => {
247
- return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest$1(args, headers, signal)).then(res => {
236
+ this.getMarketplaceOrders = (req, headers, signal) => {
237
+ return this.fetch(this.url('GetMarketplaceOrders'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
248
238
  return buildResponse$1(res).then(_data => {
249
- return {
250
- page: _data.page,
251
- nativeBalances: _data.nativeBalances,
252
- balances: _data.balances
253
- };
239
+ return JsonDecode$1(_data, 'GetMarketplaceOrdersResponse');
254
240
  });
255
241
  }, error => {
256
242
  throw WebrpcRequestFailedError$1.new({
257
- cause: `fetch(): ${error.message || ''}`
243
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
258
244
  });
259
245
  });
260
246
  };
261
- this.getTokenBalancesByContract = (args, headers, signal) => {
262
- return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest$1(args, headers, signal)).then(res => {
247
+ this.getMarketplaceTopOrders = (req, headers, signal) => {
248
+ return this.fetch(this.url('GetMarketplaceTopOrders'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
263
249
  return buildResponse$1(res).then(_data => {
264
- return {
265
- page: _data.page,
266
- balances: _data.balances
267
- };
250
+ return JsonDecode$1(_data, 'GetMarketplaceTopOrdersResponse');
268
251
  });
269
252
  }, error => {
270
253
  throw WebrpcRequestFailedError$1.new({
271
- cause: `fetch(): ${error.message || ''}`
254
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
272
255
  });
273
256
  });
274
257
  };
275
- this.getTokenBalances = (args, headers, signal) => {
276
- return this.fetch(this.url('GetTokenBalances'), createHTTPRequest$1(args, headers, signal)).then(res => {
258
+ this.getNativeTokenBalance = (req, headers, signal) => {
259
+ return this.fetch(this.url('GetNativeTokenBalance'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
277
260
  return buildResponse$1(res).then(_data => {
278
- return {
279
- page: _data.page,
280
- balances: _data.balances
281
- };
261
+ return JsonDecode$1(_data, 'GetNativeTokenBalanceResponse');
282
262
  });
283
263
  }, error => {
284
264
  throw WebrpcRequestFailedError$1.new({
285
- cause: `fetch(): ${error.message || ''}`
265
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
286
266
  });
287
267
  });
288
268
  };
289
- this.getTokenSupplies = (args, headers, signal) => {
290
- return this.fetch(this.url('GetTokenSupplies'), createHTTPRequest$1(args, headers, signal)).then(res => {
269
+ this.getTokenBalances = (req, headers, signal) => {
270
+ return this.fetch(this.url('GetTokenBalances'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
291
271
  return buildResponse$1(res).then(_data => {
292
- return {
293
- page: _data.page,
294
- contractType: _data.contractType,
295
- tokenIDs: _data.tokenIDs
296
- };
272
+ return JsonDecode$1(_data, 'GetTokenBalancesResponse');
297
273
  });
298
274
  }, error => {
299
275
  throw WebrpcRequestFailedError$1.new({
300
- cause: `fetch(): ${error.message || ''}`
276
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
301
277
  });
302
278
  });
303
279
  };
304
- this.getTokenSuppliesMap = (args, headers, signal) => {
305
- return this.fetch(this.url('GetTokenSuppliesMap'), createHTTPRequest$1(args, headers, signal)).then(res => {
280
+ this.getTokenBalancesByContract = (req, headers, signal) => {
281
+ return this.fetch(this.url('GetTokenBalancesByContract'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
306
282
  return buildResponse$1(res).then(_data => {
307
- return {
308
- supplies: _data.supplies
309
- };
283
+ return JsonDecode$1(_data, 'GetTokenBalancesByContractResponse');
310
284
  });
311
285
  }, error => {
312
286
  throw WebrpcRequestFailedError$1.new({
313
- cause: `fetch(): ${error.message || ''}`
287
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
314
288
  });
315
289
  });
316
290
  };
317
- this.getTokenIDs = (args, headers, signal) => {
318
- return this.fetch(this.url('GetTokenIDs'), createHTTPRequest$1(args, headers, signal)).then(res => {
291
+ this.getTokenBalancesDetails = (req, headers, signal) => {
292
+ return this.fetch(this.url('GetTokenBalancesDetails'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
319
293
  return buildResponse$1(res).then(_data => {
320
- return {
321
- page: _data.page,
322
- contractType: _data.contractType,
323
- tokenIDs: _data.tokenIDs
324
- };
294
+ return JsonDecode$1(_data, 'GetTokenBalancesDetailsResponse');
325
295
  });
326
296
  }, error => {
327
297
  throw WebrpcRequestFailedError$1.new({
328
- cause: `fetch(): ${error.message || ''}`
298
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
329
299
  });
330
300
  });
331
301
  };
332
- this.getTokenIDRanges = (args, headers, signal) => {
333
- return this.fetch(this.url('GetTokenIDRanges'), createHTTPRequest$1(args, headers, signal)).then(res => {
302
+ this.getTokenBalancesSummary = (req, headers, signal) => {
303
+ return this.fetch(this.url('GetTokenBalancesSummary'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
334
304
  return buildResponse$1(res).then(_data => {
335
- return {
336
- contractType: _data.contractType,
337
- tokenIDRanges: _data.tokenIDRanges,
338
- moreRanges: _data.moreRanges
339
- };
305
+ return JsonDecode$1(_data, 'GetTokenBalancesSummaryResponse');
340
306
  });
341
307
  }, error => {
342
308
  throw WebrpcRequestFailedError$1.new({
343
- cause: `fetch(): ${error.message || ''}`
309
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
344
310
  });
345
311
  });
346
312
  };
347
- this.getBalanceUpdates = (args, headers, signal) => {
348
- return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest$1(args, headers, signal)).then(res => {
313
+ this.getTokenIDRanges = (req, headers, signal) => {
314
+ return this.fetch(this.url('GetTokenIDRanges'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
349
315
  return buildResponse$1(res).then(_data => {
350
- return {
351
- page: _data.page,
352
- balances: _data.balances
353
- };
316
+ return JsonDecode$1(_data, 'GetTokenIDRangesResponse');
354
317
  });
355
318
  }, error => {
356
319
  throw WebrpcRequestFailedError$1.new({
357
- cause: `fetch(): ${error.message || ''}`
320
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
358
321
  });
359
322
  });
360
323
  };
361
- this.getTransactionHistory = (args, headers, signal) => {
362
- return this.fetch(this.url('GetTransactionHistory'), createHTTPRequest$1(args, headers, signal)).then(res => {
324
+ this.getTokenIDs = (req, headers, signal) => {
325
+ return this.fetch(this.url('GetTokenIDs'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
363
326
  return buildResponse$1(res).then(_data => {
364
- return {
365
- page: _data.page,
366
- transactions: _data.transactions
367
- };
327
+ return JsonDecode$1(_data, 'GetTokenIDsResponse');
368
328
  });
369
329
  }, error => {
370
330
  throw WebrpcRequestFailedError$1.new({
371
- cause: `fetch(): ${error.message || ''}`
331
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
372
332
  });
373
333
  });
374
334
  };
375
- this.fetchTransactionReceipt = (args, headers, signal) => {
376
- return this.fetch(this.url('FetchTransactionReceipt'), createHTTPRequest$1(args, headers, signal)).then(res => {
335
+ this.getTokenPrice = (req, headers, signal) => {
336
+ return this.fetch(this.url('GetTokenPrice'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
377
337
  return buildResponse$1(res).then(_data => {
378
- return {
379
- receipt: _data.receipt
380
- };
338
+ return JsonDecode$1(_data, 'GetTokenPriceResponse');
381
339
  });
382
340
  }, error => {
383
341
  throw WebrpcRequestFailedError$1.new({
384
- cause: `fetch(): ${error.message || ''}`
342
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
385
343
  });
386
344
  });
387
345
  };
388
- this.fetchTransactionReceiptWithFilter = (args, headers, signal) => {
389
- return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHTTPRequest$1(args, headers, signal)).then(res => {
346
+ this.getTokenPrices = (req, headers, signal) => {
347
+ return this.fetch(this.url('GetTokenPrices'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
390
348
  return buildResponse$1(res).then(_data => {
391
- return {
392
- receipt: _data.receipt
393
- };
349
+ return JsonDecode$1(_data, 'GetTokenPricesResponse');
394
350
  });
395
351
  }, error => {
396
352
  throw WebrpcRequestFailedError$1.new({
397
- cause: `fetch(): ${error.message || ''}`
353
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
398
354
  });
399
355
  });
400
356
  };
401
- this.subscribeReceipts = (args, options) => {
402
- const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
403
- await sseResponse(res, options, _fetch);
357
+ this.getTokenSupplies = (req, headers, signal) => {
358
+ return this.fetch(this.url('GetTokenSupplies'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
359
+ return buildResponse$1(res).then(_data => {
360
+ return JsonDecode$1(_data, 'GetTokenSuppliesResponse');
361
+ });
404
362
  }, error => {
405
- options.onError(error, _fetch);
363
+ throw WebrpcRequestFailedError$1.new({
364
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
365
+ });
406
366
  });
407
- return _fetch();
408
367
  };
409
- this.subscribeEvents = (args, options) => {
410
- const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
411
- await sseResponse(res, options, _fetch);
368
+ this.getTokenSuppliesMap = (req, headers, signal) => {
369
+ return this.fetch(this.url('GetTokenSuppliesMap'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
370
+ return buildResponse$1(res).then(_data => {
371
+ return JsonDecode$1(_data, 'GetTokenSuppliesMapResponse');
372
+ });
412
373
  }, error => {
413
- options.onError(error, _fetch);
374
+ throw WebrpcRequestFailedError$1.new({
375
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
376
+ });
414
377
  });
415
- return _fetch();
416
378
  };
417
- this.subscribeBalanceUpdates = (args, options) => {
418
- const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHTTPRequest$1(args, options.headers, options.signal)).then(async function (res) {
419
- await sseResponse(res, options, _fetch);
379
+ this.getTransactionHistory = (req, headers, signal) => {
380
+ return this.fetch(this.url('GetTransactionHistory'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
381
+ return buildResponse$1(res).then(_data => {
382
+ return JsonDecode$1(_data, 'GetTransactionHistoryResponse');
383
+ });
420
384
  }, error => {
421
- options.onError(error, _fetch);
385
+ throw WebrpcRequestFailedError$1.new({
386
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
387
+ });
422
388
  });
423
- return _fetch();
424
389
  };
425
- this.syncBalance = (args, headers, signal) => {
426
- return this.fetch(this.url('SyncBalance'), createHTTPRequest$1(args, headers, signal)).then(res => {
390
+ this.getWebhookListener = (req, headers, signal) => {
391
+ return this.fetch(this.url('GetWebhookListener'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
427
392
  return buildResponse$1(res).then(_data => {
428
- return {};
393
+ return JsonDecode$1(_data, 'GetWebhookListenerResponse');
429
394
  });
430
395
  }, error => {
431
396
  throw WebrpcRequestFailedError$1.new({
432
- cause: `fetch(): ${error.message || ''}`
397
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
433
398
  });
434
399
  });
435
400
  };
436
- this.getAllWebhookListeners = (args, headers, signal) => {
437
- return this.fetch(this.url('GetAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
401
+ this.listTokenPrices = (req, headers, signal) => {
402
+ return this.fetch(this.url('ListTokenPrices'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
438
403
  return buildResponse$1(res).then(_data => {
439
- return {
440
- listeners: _data.listeners
441
- };
404
+ return JsonDecode$1(_data, 'ListTokenPricesResponse');
442
405
  });
443
406
  }, error => {
444
407
  throw WebrpcRequestFailedError$1.new({
445
- cause: `fetch(): ${error.message || ''}`
408
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
446
409
  });
447
410
  });
448
411
  };
449
- this.getWebhookListener = (args, headers, signal) => {
450
- return this.fetch(this.url('GetWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
412
+ this.pauseAllWebhookListeners = (req, headers, signal) => {
413
+ return this.fetch(this.url('PauseAllWebhookListeners'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
451
414
  return buildResponse$1(res).then(_data => {
452
- return {
453
- listener: _data.listener
454
- };
415
+ return JsonDecode$1(_data, 'PauseAllWebhookListenersResponse');
455
416
  });
456
417
  }, error => {
457
418
  throw WebrpcRequestFailedError$1.new({
458
- cause: `fetch(): ${error.message || ''}`
419
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
459
420
  });
460
421
  });
461
422
  };
462
- this.addWebhookListener = (args, headers, signal) => {
463
- return this.fetch(this.url('AddWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
423
+ this.ping = (headers, signal) => {
424
+ return this.fetch(this.url('Ping'), createHttpRequest$1('{}', headers, signal)).then(res => {
464
425
  return buildResponse$1(res).then(_data => {
465
- return {
466
- status: _data.status,
467
- listener: _data.listener
468
- };
426
+ return JsonDecode$1(_data, 'PingResponse');
469
427
  });
470
428
  }, error => {
471
429
  throw WebrpcRequestFailedError$1.new({
472
- cause: `fetch(): ${error.message || ''}`
430
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
473
431
  });
474
432
  });
475
433
  };
476
- this.updateWebhookListener = (args, headers, signal) => {
477
- return this.fetch(this.url('UpdateWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
434
+ this.removeAllWebhookListeners = (req, headers, signal) => {
435
+ return this.fetch(this.url('RemoveAllWebhookListeners'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
478
436
  return buildResponse$1(res).then(_data => {
479
- return {
480
- status: _data.status
481
- };
437
+ return JsonDecode$1(_data, 'RemoveAllWebhookListenersResponse');
482
438
  });
483
439
  }, error => {
484
440
  throw WebrpcRequestFailedError$1.new({
485
- cause: `fetch(): ${error.message || ''}`
441
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
486
442
  });
487
443
  });
488
444
  };
489
- this.removeWebhookListener = (args, headers, signal) => {
490
- return this.fetch(this.url('RemoveWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
445
+ this.removeWebhookListener = (req, headers, signal) => {
446
+ return this.fetch(this.url('RemoveWebhookListener'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
491
447
  return buildResponse$1(res).then(_data => {
492
- return {
493
- status: _data.status
494
- };
448
+ return JsonDecode$1(_data, 'RemoveWebhookListenerResponse');
495
449
  });
496
450
  }, error => {
497
451
  throw WebrpcRequestFailedError$1.new({
498
- cause: `fetch(): ${error.message || ''}`
452
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
499
453
  });
500
454
  });
501
455
  };
502
- this.removeAllWebhookListeners = (args, headers, signal) => {
503
- return this.fetch(this.url('RemoveAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
456
+ this.resumeAllWebhookListeners = (req, headers, signal) => {
457
+ return this.fetch(this.url('ResumeAllWebhookListeners'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
504
458
  return buildResponse$1(res).then(_data => {
505
- return {
506
- status: _data.status
507
- };
459
+ return JsonDecode$1(_data, 'ResumeAllWebhookListenersResponse');
508
460
  });
509
461
  }, error => {
510
462
  throw WebrpcRequestFailedError$1.new({
511
- cause: `fetch(): ${error.message || ''}`
463
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
512
464
  });
513
465
  });
514
466
  };
515
- this.toggleWebhookListener = (args, headers, signal) => {
516
- return this.fetch(this.url('ToggleWebhookListener'), createHTTPRequest$1(args, headers, signal)).then(res => {
467
+ this.runtimeStatus = (headers, signal) => {
468
+ return this.fetch(this.url('RuntimeStatus'), createHttpRequest$1('{}', headers, signal)).then(res => {
517
469
  return buildResponse$1(res).then(_data => {
518
- return {
519
- webhookListener: _data.webhookListener
520
- };
470
+ return JsonDecode$1(_data, 'RuntimeStatusResponse');
521
471
  });
522
472
  }, error => {
523
473
  throw WebrpcRequestFailedError$1.new({
524
- cause: `fetch(): ${error.message || ''}`
474
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
475
+ });
476
+ });
477
+ };
478
+ this.subscribeBalanceUpdates = (req, options) => {
479
+ const abortController = new AbortController();
480
+ const abortSignal = abortController.signal;
481
+ if (options.signal) {
482
+ abortSignal.addEventListener("abort", () => {
483
+ var _options$signal;
484
+ return abortController.abort((_options$signal = options.signal) == null ? void 0 : _options$signal.reason);
485
+ }, {
486
+ signal: options.signal
487
+ });
488
+ }
489
+ const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHttpRequest$1(JsonEncode$1(req), options.headers, abortSignal)).then(async function (res) {
490
+ await sseResponse(res, options, _fetch);
491
+ }, error => {
492
+ options.onError(error, _fetch);
493
+ });
494
+ const resp = _fetch();
495
+ return {
496
+ abort: abortController.abort.bind(abortController),
497
+ closed: resp
498
+ };
499
+ };
500
+ this.subscribeEvents = (req, options) => {
501
+ const abortController = new AbortController();
502
+ const abortSignal = abortController.signal;
503
+ if (options.signal) {
504
+ abortSignal.addEventListener("abort", () => {
505
+ var _options$signal2;
506
+ return abortController.abort((_options$signal2 = options.signal) == null ? void 0 : _options$signal2.reason);
507
+ }, {
508
+ signal: options.signal
509
+ });
510
+ }
511
+ const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHttpRequest$1(JsonEncode$1(req), options.headers, abortSignal)).then(async function (res) {
512
+ await sseResponse(res, options, _fetch);
513
+ }, error => {
514
+ options.onError(error, _fetch);
515
+ });
516
+ const resp = _fetch();
517
+ return {
518
+ abort: abortController.abort.bind(abortController),
519
+ closed: resp
520
+ };
521
+ };
522
+ this.subscribeReceipts = (req, options) => {
523
+ const abortController = new AbortController();
524
+ const abortSignal = abortController.signal;
525
+ if (options.signal) {
526
+ abortSignal.addEventListener("abort", () => {
527
+ var _options$signal3;
528
+ return abortController.abort((_options$signal3 = options.signal) == null ? void 0 : _options$signal3.reason);
529
+ }, {
530
+ signal: options.signal
525
531
  });
532
+ }
533
+ const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHttpRequest$1(JsonEncode$1(req), options.headers, abortSignal)).then(async function (res) {
534
+ await sseResponse(res, options, _fetch);
535
+ }, error => {
536
+ options.onError(error, _fetch);
526
537
  });
538
+ const resp = _fetch();
539
+ return {
540
+ abort: abortController.abort.bind(abortController),
541
+ closed: resp
542
+ };
527
543
  };
528
- this.pauseAllWebhookListeners = (args, headers, signal) => {
529
- return this.fetch(this.url('PauseAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
544
+ this.syncBalance = (req, headers, signal) => {
545
+ return this.fetch(this.url('SyncBalance'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
530
546
  return buildResponse$1(res).then(_data => {
531
- return {
532
- status: _data.status
533
- };
547
+ return JsonDecode$1(_data, 'SyncBalanceResponse');
534
548
  });
535
549
  }, error => {
536
550
  throw WebrpcRequestFailedError$1.new({
537
- cause: `fetch(): ${error.message || ''}`
551
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
538
552
  });
539
553
  });
540
554
  };
541
- this.resumeAllWebhookListeners = (args, headers, signal) => {
542
- return this.fetch(this.url('ResumeAllWebhookListeners'), createHTTPRequest$1(args, headers, signal)).then(res => {
555
+ this.toggleWebhookListener = (req, headers, signal) => {
556
+ return this.fetch(this.url('ToggleWebhookListener'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
543
557
  return buildResponse$1(res).then(_data => {
544
- return {
545
- status: _data.status
546
- };
558
+ return JsonDecode$1(_data, 'ToggleWebhookListenerResponse');
547
559
  });
548
560
  }, error => {
549
561
  throw WebrpcRequestFailedError$1.new({
550
- cause: `fetch(): ${error.message || ''}`
562
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
551
563
  });
552
564
  });
553
565
  };
554
- this.getOrderbookOrders = (args, headers, signal) => {
555
- return this.fetch(this.url('GetOrderbookOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
566
+ this.updateWebhookListener = (req, headers, signal) => {
567
+ return this.fetch(this.url('UpdateWebhookListener'), createHttpRequest$1(JsonEncode$1(req), headers, signal)).then(res => {
556
568
  return buildResponse$1(res).then(_data => {
557
- return {
558
- page: _data.page,
559
- orders: _data.orders
560
- };
569
+ return JsonDecode$1(_data, 'UpdateWebhookListenerResponse');
561
570
  });
562
571
  }, error => {
563
572
  throw WebrpcRequestFailedError$1.new({
564
- cause: `fetch(): ${error.message || ''}`
573
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
565
574
  });
566
575
  });
567
576
  };
568
- this.getTopOrders = (args, headers, signal) => {
569
- return this.fetch(this.url('GetTopOrders'), createHTTPRequest$1(args, headers, signal)).then(res => {
577
+ this.version = (headers, signal) => {
578
+ return this.fetch(this.url('Version'), createHttpRequest$1('{}', headers, signal)).then(res => {
570
579
  return buildResponse$1(res).then(_data => {
571
- return {
572
- orders: _data.orders
573
- };
580
+ return JsonDecode$1(_data, 'VersionResponse');
574
581
  });
575
582
  }, error => {
576
583
  throw WebrpcRequestFailedError$1.new({
577
- cause: `fetch(): ${error.message || ''}`
584
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
578
585
  });
579
586
  });
580
587
  };
@@ -604,14 +611,14 @@ const sseResponse = async (res, options, retryFetch) => {
604
611
  if (!res.body) {
605
612
  onError(WebrpcBadResponseError$1.new({
606
613
  status: res.status,
607
- cause: 'Invalid response, missing body'
614
+ cause: "Invalid response, missing body"
608
615
  }), retryFetch);
609
616
  return;
610
617
  }
611
618
  onOpen && onOpen();
612
619
  const reader = res.body.getReader();
613
620
  const decoder = new TextDecoder();
614
- let buffer = '';
621
+ let buffer = "";
615
622
  let lastReadTime = Date.now();
616
623
  const timeout = (10 + 1) * 1000;
617
624
  let timeoutError = false;
@@ -626,78 +633,74 @@ const sseResponse = async (res, options, retryFetch) => {
626
633
  let value;
627
634
  let done;
628
635
  try {
629
- ;
630
636
  ({
631
637
  value,
632
638
  done
633
639
  } = await reader.read());
634
- if (timeoutError) throw new Error('Timeout, no data or heartbeat received');
640
+ if (timeoutError) throw new Error("Timeout, no data or heartbeat received");
635
641
  lastReadTime = Date.now();
636
642
  buffer += decoder.decode(value, {
637
643
  stream: true
638
644
  });
639
645
  } catch (error) {
640
- let message = '';
641
- if (error instanceof Error) {
642
- message = error.message;
643
- }
644
- if (error instanceof DOMException && error.name === 'AbortError') {
645
- onError(WebrpcRequestFailedError$1.new({
646
- message: 'AbortError',
647
- cause: `AbortError: ${message}`
646
+ if (error instanceof DOMException && error.name === "AbortError") {
647
+ onError(WebrpcClientAbortedError$1.new({
648
+ message: "AbortError",
649
+ cause: `AbortError: ${error instanceof Error ? error.message : String(error)}`
648
650
  }), () => {
649
- throw new Error('Abort signal cannot be used to reconnect');
651
+ throw new Error("Abort signal cannot be used to reconnect");
650
652
  });
651
653
  } else {
652
654
  onError(WebrpcStreamLostError$1.new({
653
- cause: `reader.read(): ${message}`
655
+ cause: `reader.read(): ${error instanceof Error ? error.message : String(error)}`
654
656
  }), retryFetch);
655
657
  }
656
658
  return;
657
659
  }
658
- let lines = buffer.split('\n');
660
+ let lines = buffer.split("\n");
659
661
  for (let i = 0; i < lines.length - 1; i++) {
660
- if (lines[i].length == 0) {
662
+ const line = lines[i];
663
+ if ((line == null ? void 0 : line.length) === 0) {
661
664
  continue;
662
665
  }
663
666
  let data;
664
667
  try {
665
- data = JSON.parse(lines[i]);
666
- if (data.hasOwnProperty('webrpcError')) {
668
+ data = JSON.parse(line);
669
+ if (data.hasOwnProperty("webrpcError")) {
667
670
  const error = data.webrpcError;
668
- const code = typeof error.code === 'number' ? error.code : 0;
671
+ const code = typeof error.code === "number" ? error.code : 0;
669
672
  onError((webrpcErrorByCode$1[code] || WebrpcError$1).new(error), retryFetch);
670
673
  return;
671
674
  }
672
675
  } catch (error) {
673
- if (error instanceof Error && error.message === 'Abort signal cannot be used to reconnect') {
676
+ if (error instanceof Error && error.message === "Abort signal cannot be used to reconnect") {
674
677
  throw error;
675
678
  }
676
679
  onError(WebrpcBadResponseError$1.new({
677
680
  status: res.status,
678
- // @ts-ignore
679
- cause: `JSON.parse(): ${error.message}`
681
+ cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}`
680
682
  }), retryFetch);
681
683
  }
682
684
  onMessage(data);
683
685
  }
684
686
  if (!done) {
685
- buffer = lines[lines.length - 1];
687
+ const lastLine = lines[lines.length - 1];
688
+ buffer = lastLine || "";
686
689
  continue;
687
690
  }
688
691
  onClose && onClose();
689
692
  return;
690
693
  }
691
694
  };
692
- const createHTTPRequest$1 = (body = {}, headers = {}, signal = null) => {
695
+ const createHttpRequest$1 = (body = '{}', headers = {}, signal = null) => {
693
696
  const reqHeaders = _extends({}, headers, {
694
- 'Content-Type': 'application/json'
697
+ 'Content-Type': 'application/json',
698
+ [WebrpcHeader$1]: WebrpcHeaderValue$1
695
699
  });
696
- reqHeaders[WebrpcHeader$1] = WebrpcHeaderValue$1;
697
700
  return {
698
701
  method: 'POST',
699
702
  headers: reqHeaders,
700
- body: JSON.stringify(body || {}),
703
+ body,
701
704
  signal
702
705
  };
703
706
  };
@@ -707,13 +710,9 @@ const buildResponse$1 = res => {
707
710
  try {
708
711
  data = JSON.parse(text);
709
712
  } catch (error) {
710
- let message = '';
711
- if (error instanceof Error) {
712
- message = error.message;
713
- }
714
713
  throw WebrpcBadResponseError$1.new({
715
714
  status: res.status,
716
- cause: `JSON.parse(): ${message}: response text: ${text}`
715
+ cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`
717
716
  });
718
717
  }
719
718
  if (!res.ok) {
@@ -723,259 +722,458 @@ const buildResponse$1 = res => {
723
722
  return data;
724
723
  });
725
724
  };
725
+ const JsonEncode$1 = obj => {
726
+ return JSON.stringify(obj);
727
+ };
728
+ const JsonDecode$1 = (data, _typ = '') => {
729
+ let parsed = data;
730
+ if (typeof data === 'string') {
731
+ try {
732
+ parsed = JSON.parse(data);
733
+ } catch (err) {
734
+ throw WebrpcBadResponseError$1.new({
735
+ cause: `JsonDecode: JSON.parse failed: ${err.message}`
736
+ });
737
+ }
738
+ }
739
+ return parsed;
740
+ };
726
741
 
727
742
  //
728
743
  // Errors
729
744
  //
730
745
 
731
746
  class WebrpcError$1 extends Error {
732
- constructor(name, code, message, status, cause) {
733
- super(message);
734
- this.name = void 0;
747
+ constructor(error = {}) {
748
+ super(error.message);
735
749
  this.code = void 0;
736
- this.message = void 0;
737
750
  this.status = void 0;
738
- this.cause = void 0;
739
- /** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
740
- this.msg = void 0;
741
- this.name = name || 'WebrpcError';
742
- this.code = typeof code === 'number' ? code : 0;
743
- this.message = message || `endpoint error ${this.code}`;
744
- this.msg = this.message;
745
- this.status = typeof status === 'number' ? status : 0;
746
- this.cause = cause;
751
+ this.name = error.name || 'WebrpcEndpointError';
752
+ this.code = typeof error.code === 'number' ? error.code : 0;
753
+ this.message = error.message || `endpoint error`;
754
+ this.status = typeof error.status === 'number' ? error.status : 400;
755
+ if (error.cause !== undefined) this.cause = error.cause;
747
756
  Object.setPrototypeOf(this, WebrpcError$1.prototype);
748
757
  }
749
758
  static new(payload) {
750
- return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
759
+ return new this({
760
+ message: payload.message,
761
+ code: payload.code,
762
+ status: payload.status,
763
+ cause: payload.cause
764
+ });
751
765
  }
752
766
  }
753
-
754
- // Webrpc errors
755
-
756
767
  class WebrpcEndpointError$1 extends WebrpcError$1 {
757
- constructor(name = 'WebrpcEndpoint', code = 0, message = 'endpoint error', status = 0, cause) {
758
- super(name, code, message, status, cause);
768
+ constructor(error = {}) {
769
+ super(error);
770
+ this.name = error.name || 'WebrpcEndpoint';
771
+ this.code = typeof error.code === 'number' ? error.code : 0;
772
+ this.message = error.message || `endpoint error`;
773
+ this.status = typeof error.status === 'number' ? error.status : 400;
774
+ if (error.cause !== undefined) this.cause = error.cause;
759
775
  Object.setPrototypeOf(this, WebrpcEndpointError$1.prototype);
760
776
  }
761
777
  }
762
778
  class WebrpcRequestFailedError$1 extends WebrpcError$1 {
763
- constructor(name = 'WebrpcRequestFailed', code = -1, message = 'request failed', status = 0, cause) {
764
- super(name, code, message, status, cause);
779
+ constructor(error = {}) {
780
+ super(error);
781
+ this.name = error.name || 'WebrpcRequestFailed';
782
+ this.code = typeof error.code === 'number' ? error.code : -1;
783
+ this.message = error.message || `request failed`;
784
+ this.status = typeof error.status === 'number' ? error.status : 400;
785
+ if (error.cause !== undefined) this.cause = error.cause;
765
786
  Object.setPrototypeOf(this, WebrpcRequestFailedError$1.prototype);
766
787
  }
767
788
  }
768
789
  class WebrpcBadRouteError$1 extends WebrpcError$1 {
769
- constructor(name = 'WebrpcBadRoute', code = -2, message = 'bad route', status = 0, cause) {
770
- super(name, code, message, status, cause);
790
+ constructor(error = {}) {
791
+ super(error);
792
+ this.name = error.name || 'WebrpcBadRoute';
793
+ this.code = typeof error.code === 'number' ? error.code : -2;
794
+ this.message = error.message || `bad route`;
795
+ this.status = typeof error.status === 'number' ? error.status : 404;
796
+ if (error.cause !== undefined) this.cause = error.cause;
771
797
  Object.setPrototypeOf(this, WebrpcBadRouteError$1.prototype);
772
798
  }
773
799
  }
774
800
  class WebrpcBadMethodError$1 extends WebrpcError$1 {
775
- constructor(name = 'WebrpcBadMethod', code = -3, message = 'bad method', status = 0, cause) {
776
- super(name, code, message, status, cause);
801
+ constructor(error = {}) {
802
+ super(error);
803
+ this.name = error.name || 'WebrpcBadMethod';
804
+ this.code = typeof error.code === 'number' ? error.code : -3;
805
+ this.message = error.message || `bad method`;
806
+ this.status = typeof error.status === 'number' ? error.status : 405;
807
+ if (error.cause !== undefined) this.cause = error.cause;
777
808
  Object.setPrototypeOf(this, WebrpcBadMethodError$1.prototype);
778
809
  }
779
810
  }
780
811
  class WebrpcBadRequestError$1 extends WebrpcError$1 {
781
- constructor(name = 'WebrpcBadRequest', code = -4, message = 'bad request', status = 0, cause) {
782
- super(name, code, message, status, cause);
812
+ constructor(error = {}) {
813
+ super(error);
814
+ this.name = error.name || 'WebrpcBadRequest';
815
+ this.code = typeof error.code === 'number' ? error.code : -4;
816
+ this.message = error.message || `bad request`;
817
+ this.status = typeof error.status === 'number' ? error.status : 400;
818
+ if (error.cause !== undefined) this.cause = error.cause;
783
819
  Object.setPrototypeOf(this, WebrpcBadRequestError$1.prototype);
784
820
  }
785
821
  }
786
822
  class WebrpcBadResponseError$1 extends WebrpcError$1 {
787
- constructor(name = 'WebrpcBadResponse', code = -5, message = 'bad response', status = 0, cause) {
788
- super(name, code, message, status, cause);
823
+ constructor(error = {}) {
824
+ super(error);
825
+ this.name = error.name || 'WebrpcBadResponse';
826
+ this.code = typeof error.code === 'number' ? error.code : -5;
827
+ this.message = error.message || `bad response`;
828
+ this.status = typeof error.status === 'number' ? error.status : 500;
829
+ if (error.cause !== undefined) this.cause = error.cause;
789
830
  Object.setPrototypeOf(this, WebrpcBadResponseError$1.prototype);
790
831
  }
791
832
  }
792
833
  class WebrpcServerPanicError$1 extends WebrpcError$1 {
793
- constructor(name = 'WebrpcServerPanic', code = -6, message = 'server panic', status = 0, cause) {
794
- super(name, code, message, status, cause);
834
+ constructor(error = {}) {
835
+ super(error);
836
+ this.name = error.name || 'WebrpcServerPanic';
837
+ this.code = typeof error.code === 'number' ? error.code : -6;
838
+ this.message = error.message || `server panic`;
839
+ this.status = typeof error.status === 'number' ? error.status : 500;
840
+ if (error.cause !== undefined) this.cause = error.cause;
795
841
  Object.setPrototypeOf(this, WebrpcServerPanicError$1.prototype);
796
842
  }
797
843
  }
798
844
  class WebrpcInternalErrorError$1 extends WebrpcError$1 {
799
- constructor(name = 'WebrpcInternalError', code = -7, message = 'internal error', status = 0, cause) {
800
- super(name, code, message, status, cause);
845
+ constructor(error = {}) {
846
+ super(error);
847
+ this.name = error.name || 'WebrpcInternalError';
848
+ this.code = typeof error.code === 'number' ? error.code : -7;
849
+ this.message = error.message || `internal error`;
850
+ this.status = typeof error.status === 'number' ? error.status : 500;
851
+ if (error.cause !== undefined) this.cause = error.cause;
801
852
  Object.setPrototypeOf(this, WebrpcInternalErrorError$1.prototype);
802
853
  }
803
854
  }
804
- class WebrpcClientDisconnectedError$1 extends WebrpcError$1 {
805
- constructor(name = 'WebrpcClientDisconnected', code = -8, message = 'client disconnected', status = 0, cause) {
806
- super(name, code, message, status, cause);
807
- Object.setPrototypeOf(this, WebrpcClientDisconnectedError$1.prototype);
855
+ class WebrpcClientAbortedError$1 extends WebrpcError$1 {
856
+ constructor(error = {}) {
857
+ super(error);
858
+ this.name = error.name || 'WebrpcClientAborted';
859
+ this.code = typeof error.code === 'number' ? error.code : -8;
860
+ this.message = error.message || `request aborted by client`;
861
+ this.status = typeof error.status === 'number' ? error.status : 400;
862
+ if (error.cause !== undefined) this.cause = error.cause;
863
+ Object.setPrototypeOf(this, WebrpcClientAbortedError$1.prototype);
808
864
  }
809
865
  }
810
866
  class WebrpcStreamLostError$1 extends WebrpcError$1 {
811
- constructor(name = 'WebrpcStreamLost', code = -9, message = 'stream lost', status = 0, cause) {
812
- super(name, code, message, status, cause);
867
+ constructor(error = {}) {
868
+ super(error);
869
+ this.name = error.name || 'WebrpcStreamLost';
870
+ this.code = typeof error.code === 'number' ? error.code : -9;
871
+ this.message = error.message || `stream lost`;
872
+ this.status = typeof error.status === 'number' ? error.status : 400;
873
+ if (error.cause !== undefined) this.cause = error.cause;
813
874
  Object.setPrototypeOf(this, WebrpcStreamLostError$1.prototype);
814
875
  }
815
876
  }
816
877
  class WebrpcStreamFinishedError$1 extends WebrpcError$1 {
817
- constructor(name = 'WebrpcStreamFinished', code = -10, message = 'stream finished', status = 0, cause) {
818
- super(name, code, message, status, cause);
878
+ constructor(error = {}) {
879
+ super(error);
880
+ this.name = error.name || 'WebrpcStreamFinished';
881
+ this.code = typeof error.code === 'number' ? error.code : -10;
882
+ this.message = error.message || `stream finished`;
883
+ this.status = typeof error.status === 'number' ? error.status : 200;
884
+ if (error.cause !== undefined) this.cause = error.cause;
819
885
  Object.setPrototypeOf(this, WebrpcStreamFinishedError$1.prototype);
820
886
  }
821
887
  }
822
888
 
889
+ //
823
890
  // Schema errors
891
+ //
824
892
 
825
- class UnauthorizedError$1 extends WebrpcError$1 {
826
- constructor(name = 'Unauthorized', code = 1000, message = 'Unauthorized access', status = 0, cause) {
827
- super(name, code, message, status, cause);
828
- Object.setPrototypeOf(this, UnauthorizedError$1.prototype);
829
- }
830
- }
831
- class PermissionDeniedError$1 extends WebrpcError$1 {
832
- constructor(name = 'PermissionDenied', code = 1001, message = 'Permission denied', status = 0, cause) {
833
- super(name, code, message, status, cause);
834
- Object.setPrototypeOf(this, PermissionDeniedError$1.prototype);
835
- }
836
- }
837
- class SessionExpiredError$1 extends WebrpcError$1 {
838
- constructor(name = 'SessionExpired', code = 1002, message = 'Session expired', status = 0, cause) {
839
- super(name, code, message, status, cause);
840
- Object.setPrototypeOf(this, SessionExpiredError$1.prototype);
841
- }
842
- }
843
- class MethodNotFoundError$1 extends WebrpcError$1 {
844
- constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) {
845
- super(name, code, message, status, cause);
846
- Object.setPrototypeOf(this, MethodNotFoundError$1.prototype);
847
- }
848
- }
849
- class RequestConflictError$1 extends WebrpcError$1 {
850
- constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) {
851
- super(name, code, message, status, cause);
852
- Object.setPrototypeOf(this, RequestConflictError$1.prototype);
853
- }
854
- }
855
893
  class AbortedError$1 extends WebrpcError$1 {
856
- constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) {
857
- super(name, code, message, status, cause);
894
+ constructor(error = {}) {
895
+ super(error);
896
+ this.name = error.name || 'Aborted';
897
+ this.code = typeof error.code === 'number' ? error.code : 1005;
898
+ this.message = error.message || `Request aborted`;
899
+ this.status = typeof error.status === 'number' ? error.status : 400;
900
+ if (error.cause !== undefined) this.cause = error.cause;
858
901
  Object.setPrototypeOf(this, AbortedError$1.prototype);
859
902
  }
860
903
  }
861
- class GeoblockedError$1 extends WebrpcError$1 {
862
- constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) {
863
- super(name, code, message, status, cause);
864
- Object.setPrototypeOf(this, GeoblockedError$1.prototype);
904
+ class AccessKeyMismatchError$1 extends WebrpcError$1 {
905
+ constructor(error = {}) {
906
+ super(error);
907
+ this.name = error.name || 'AccessKeyMismatch';
908
+ this.code = typeof error.code === 'number' ? error.code : 1102;
909
+ this.message = error.message || `Access key mismatch`;
910
+ this.status = typeof error.status === 'number' ? error.status : 409;
911
+ if (error.cause !== undefined) this.cause = error.cause;
912
+ Object.setPrototypeOf(this, AccessKeyMismatchError$1.prototype);
865
913
  }
866
914
  }
867
- class RateLimitedError$1 extends WebrpcError$1 {
868
- constructor(name = 'RateLimited', code = 1007, message = 'Rate-limited. Please slow down.', status = 0, cause) {
869
- super(name, code, message, status, cause);
870
- Object.setPrototypeOf(this, RateLimitedError$1.prototype);
915
+ class AccessKeyNotFoundError$1 extends WebrpcError$1 {
916
+ constructor(error = {}) {
917
+ super(error);
918
+ this.name = error.name || 'AccessKeyNotFound';
919
+ this.code = typeof error.code === 'number' ? error.code : 1101;
920
+ this.message = error.message || `Access key not found`;
921
+ this.status = typeof error.status === 'number' ? error.status : 401;
922
+ if (error.cause !== undefined) this.cause = error.cause;
923
+ Object.setPrototypeOf(this, AccessKeyNotFoundError$1.prototype);
871
924
  }
872
925
  }
873
- class ProjectNotFoundError$1 extends WebrpcError$1 {
874
- constructor(name = 'ProjectNotFound', code = 1100, message = 'Project not found', status = 0, cause) {
875
- super(name, code, message, status, cause);
876
- Object.setPrototypeOf(this, ProjectNotFoundError$1.prototype);
926
+ class AtLeastOneKeyError$1 extends WebrpcError$1 {
927
+ constructor(error = {}) {
928
+ super(error);
929
+ this.name = error.name || 'AtLeastOneKey';
930
+ this.code = typeof error.code === 'number' ? error.code : 1302;
931
+ this.message = error.message || `You need at least one Access Key`;
932
+ this.status = typeof error.status === 'number' ? error.status : 403;
933
+ if (error.cause !== undefined) this.cause = error.cause;
934
+ Object.setPrototypeOf(this, AtLeastOneKeyError$1.prototype);
877
935
  }
878
936
  }
879
- class AccessKeyNotFoundError$1 extends WebrpcError$1 {
880
- constructor(name = 'AccessKeyNotFound', code = 1101, message = 'Access key not found', status = 0, cause) {
881
- super(name, code, message, status, cause);
882
- Object.setPrototypeOf(this, AccessKeyNotFoundError$1.prototype);
937
+ class GeoblockedError$1 extends WebrpcError$1 {
938
+ constructor(error = {}) {
939
+ super(error);
940
+ this.name = error.name || 'Geoblocked';
941
+ this.code = typeof error.code === 'number' ? error.code : 1006;
942
+ this.message = error.message || `Geoblocked region`;
943
+ this.status = typeof error.status === 'number' ? error.status : 451;
944
+ if (error.cause !== undefined) this.cause = error.cause;
945
+ Object.setPrototypeOf(this, GeoblockedError$1.prototype);
883
946
  }
884
947
  }
885
- class AccessKeyMismatchError$1 extends WebrpcError$1 {
886
- constructor(name = 'AccessKeyMismatch', code = 1102, message = 'Access key mismatch', status = 0, cause) {
887
- super(name, code, message, status, cause);
888
- Object.setPrototypeOf(this, AccessKeyMismatchError$1.prototype);
948
+ class InvalidArgumentError$1 extends WebrpcError$1 {
949
+ constructor(error = {}) {
950
+ super(error);
951
+ this.name = error.name || 'InvalidArgument';
952
+ this.code = typeof error.code === 'number' ? error.code : 2001;
953
+ this.message = error.message || `Invalid argument`;
954
+ this.status = typeof error.status === 'number' ? error.status : 400;
955
+ if (error.cause !== undefined) this.cause = error.cause;
956
+ Object.setPrototypeOf(this, InvalidArgumentError$1.prototype);
889
957
  }
890
958
  }
891
959
  class InvalidOriginError$1 extends WebrpcError$1 {
892
- constructor(name = 'InvalidOrigin', code = 1103, message = 'Invalid origin for Access Key', status = 0, cause) {
893
- super(name, code, message, status, cause);
960
+ constructor(error = {}) {
961
+ super(error);
962
+ this.name = error.name || 'InvalidOrigin';
963
+ this.code = typeof error.code === 'number' ? error.code : 1103;
964
+ this.message = error.message || `Invalid origin for Access Key`;
965
+ this.status = typeof error.status === 'number' ? error.status : 403;
966
+ if (error.cause !== undefined) this.cause = error.cause;
894
967
  Object.setPrototypeOf(this, InvalidOriginError$1.prototype);
895
968
  }
896
969
  }
897
970
  class InvalidServiceError$1 extends WebrpcError$1 {
898
- constructor(name = 'InvalidService', code = 1104, message = 'Service not enabled for Access key', status = 0, cause) {
899
- super(name, code, message, status, cause);
971
+ constructor(error = {}) {
972
+ super(error);
973
+ this.name = error.name || 'InvalidService';
974
+ this.code = typeof error.code === 'number' ? error.code : 1104;
975
+ this.message = error.message || `Service not enabled for Access key`;
976
+ this.status = typeof error.status === 'number' ? error.status : 403;
977
+ if (error.cause !== undefined) this.cause = error.cause;
900
978
  Object.setPrototypeOf(this, InvalidServiceError$1.prototype);
901
979
  }
902
980
  }
903
- class UnauthorizedUserError$1 extends WebrpcError$1 {
904
- constructor(name = 'UnauthorizedUser', code = 1105, message = 'Unauthorized user', status = 0, cause) {
905
- super(name, code, message, status, cause);
906
- Object.setPrototypeOf(this, UnauthorizedUserError$1.prototype);
981
+ class MaxAccessKeysError$1 extends WebrpcError$1 {
982
+ constructor(error = {}) {
983
+ super(error);
984
+ this.name = error.name || 'MaxAccessKeys';
985
+ this.code = typeof error.code === 'number' ? error.code : 1301;
986
+ this.message = error.message || `Access keys limit reached`;
987
+ this.status = typeof error.status === 'number' ? error.status : 403;
988
+ if (error.cause !== undefined) this.cause = error.cause;
989
+ Object.setPrototypeOf(this, MaxAccessKeysError$1.prototype);
907
990
  }
908
991
  }
909
- class QuotaExceededError$1 extends WebrpcError$1 {
910
- constructor(name = 'QuotaExceeded', code = 1200, message = 'Quota exceeded', status = 0, cause) {
911
- super(name, code, message, status, cause);
912
- Object.setPrototypeOf(this, QuotaExceededError$1.prototype);
992
+ class MetadataCallFailedError$1 extends WebrpcError$1 {
993
+ constructor(error = {}) {
994
+ super(error);
995
+ this.name = error.name || 'MetadataCallFailed';
996
+ this.code = typeof error.code === 'number' ? error.code : 3003;
997
+ this.message = error.message || `Metadata service call failed`;
998
+ this.status = typeof error.status === 'number' ? error.status : 400;
999
+ if (error.cause !== undefined) this.cause = error.cause;
1000
+ Object.setPrototypeOf(this, MetadataCallFailedError$1.prototype);
913
1001
  }
914
1002
  }
915
- class RateLimitError$1 extends WebrpcError$1 {
916
- constructor(name = 'RateLimit', code = 1201, message = 'Rate limit exceeded', status = 0, cause) {
917
- super(name, code, message, status, cause);
918
- Object.setPrototypeOf(this, RateLimitError$1.prototype);
1003
+ class MethodNotFoundError$1 extends WebrpcError$1 {
1004
+ constructor(error = {}) {
1005
+ super(error);
1006
+ this.name = error.name || 'MethodNotFound';
1007
+ this.code = typeof error.code === 'number' ? error.code : 1003;
1008
+ this.message = error.message || `Method not found`;
1009
+ this.status = typeof error.status === 'number' ? error.status : 404;
1010
+ if (error.cause !== undefined) this.cause = error.cause;
1011
+ Object.setPrototypeOf(this, MethodNotFoundError$1.prototype);
919
1012
  }
920
1013
  }
921
1014
  class NoDefaultKeyError$1 extends WebrpcError$1 {
922
- constructor(name = 'NoDefaultKey', code = 1300, message = 'No default access key found', status = 0, cause) {
923
- super(name, code, message, status, cause);
1015
+ constructor(error = {}) {
1016
+ super(error);
1017
+ this.name = error.name || 'NoDefaultKey';
1018
+ this.code = typeof error.code === 'number' ? error.code : 1300;
1019
+ this.message = error.message || `No default access key found`;
1020
+ this.status = typeof error.status === 'number' ? error.status : 403;
1021
+ if (error.cause !== undefined) this.cause = error.cause;
924
1022
  Object.setPrototypeOf(this, NoDefaultKeyError$1.prototype);
925
1023
  }
926
1024
  }
927
- class MaxAccessKeysError$1 extends WebrpcError$1 {
928
- constructor(name = 'MaxAccessKeys', code = 1301, message = 'Access keys limit reached', status = 0, cause) {
929
- super(name, code, message, status, cause);
930
- Object.setPrototypeOf(this, MaxAccessKeysError$1.prototype);
1025
+ class NotFoundError$1 extends WebrpcError$1 {
1026
+ constructor(error = {}) {
1027
+ super(error);
1028
+ this.name = error.name || 'NotFound';
1029
+ this.code = typeof error.code === 'number' ? error.code : 3000;
1030
+ this.message = error.message || `Resource not found`;
1031
+ this.status = typeof error.status === 'number' ? error.status : 400;
1032
+ if (error.cause !== undefined) this.cause = error.cause;
1033
+ Object.setPrototypeOf(this, NotFoundError$1.prototype);
931
1034
  }
932
1035
  }
933
- class AtLeastOneKeyError$1 extends WebrpcError$1 {
934
- constructor(name = 'AtLeastOneKey', code = 1302, message = 'You need at least one Access Key', status = 0, cause) {
935
- super(name, code, message, status, cause);
936
- Object.setPrototypeOf(this, AtLeastOneKeyError$1.prototype);
1036
+ class PermissionDeniedError$1 extends WebrpcError$1 {
1037
+ constructor(error = {}) {
1038
+ super(error);
1039
+ this.name = error.name || 'PermissionDenied';
1040
+ this.code = typeof error.code === 'number' ? error.code : 1001;
1041
+ this.message = error.message || `Permission denied`;
1042
+ this.status = typeof error.status === 'number' ? error.status : 403;
1043
+ if (error.cause !== undefined) this.cause = error.cause;
1044
+ Object.setPrototypeOf(this, PermissionDeniedError$1.prototype);
937
1045
  }
938
1046
  }
939
- class TimeoutError$1 extends WebrpcError$1 {
940
- constructor(name = 'Timeout', code = 1900, message = 'Request timed out', status = 0, cause) {
941
- super(name, code, message, status, cause);
942
- Object.setPrototypeOf(this, TimeoutError$1.prototype);
1047
+ class ProjectNotFoundError$1 extends WebrpcError$1 {
1048
+ constructor(error = {}) {
1049
+ super(error);
1050
+ this.name = error.name || 'ProjectNotFound';
1051
+ this.code = typeof error.code === 'number' ? error.code : 1100;
1052
+ this.message = error.message || `Project not found`;
1053
+ this.status = typeof error.status === 'number' ? error.status : 401;
1054
+ if (error.cause !== undefined) this.cause = error.cause;
1055
+ Object.setPrototypeOf(this, ProjectNotFoundError$1.prototype);
943
1056
  }
944
1057
  }
945
- class InvalidArgumentError$1 extends WebrpcError$1 {
946
- constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) {
947
- super(name, code, message, status, cause);
948
- Object.setPrototypeOf(this, InvalidArgumentError$1.prototype);
1058
+ class QueryFailedError$1 extends WebrpcError$1 {
1059
+ constructor(error = {}) {
1060
+ super(error);
1061
+ this.name = error.name || 'QueryFailed';
1062
+ this.code = typeof error.code === 'number' ? error.code : 2003;
1063
+ this.message = error.message || `Query failed`;
1064
+ this.status = typeof error.status === 'number' ? error.status : 400;
1065
+ if (error.cause !== undefined) this.cause = error.cause;
1066
+ Object.setPrototypeOf(this, QueryFailedError$1.prototype);
949
1067
  }
950
1068
  }
951
- class UnavailableError$1 extends WebrpcError$1 {
952
- constructor(name = 'Unavailable', code = 2002, message = 'Unavailable resource', status = 0, cause) {
953
- super(name, code, message, status, cause);
954
- Object.setPrototypeOf(this, UnavailableError$1.prototype);
1069
+ class QuotaExceededError$1 extends WebrpcError$1 {
1070
+ constructor(error = {}) {
1071
+ super(error);
1072
+ this.name = error.name || 'QuotaExceeded';
1073
+ this.code = typeof error.code === 'number' ? error.code : 1200;
1074
+ this.message = error.message || `Quota exceeded`;
1075
+ this.status = typeof error.status === 'number' ? error.status : 429;
1076
+ if (error.cause !== undefined) this.cause = error.cause;
1077
+ Object.setPrototypeOf(this, QuotaExceededError$1.prototype);
955
1078
  }
956
1079
  }
957
- class QueryFailedError$1 extends WebrpcError$1 {
958
- constructor(name = 'QueryFailed', code = 2003, message = 'Query failed', status = 0, cause) {
959
- super(name, code, message, status, cause);
960
- Object.setPrototypeOf(this, QueryFailedError$1.prototype);
1080
+ class RateLimitError$1 extends WebrpcError$1 {
1081
+ constructor(error = {}) {
1082
+ super(error);
1083
+ this.name = error.name || 'RateLimit';
1084
+ this.code = typeof error.code === 'number' ? error.code : 1201;
1085
+ this.message = error.message || `Rate limit exceeded`;
1086
+ this.status = typeof error.status === 'number' ? error.status : 429;
1087
+ if (error.cause !== undefined) this.cause = error.cause;
1088
+ Object.setPrototypeOf(this, RateLimitError$1.prototype);
1089
+ }
1090
+ }
1091
+ class RateLimitedError$1 extends WebrpcError$1 {
1092
+ constructor(error = {}) {
1093
+ super(error);
1094
+ this.name = error.name || 'RateLimited';
1095
+ this.code = typeof error.code === 'number' ? error.code : 1007;
1096
+ this.message = error.message || `Rate-limited. Please slow down.`;
1097
+ this.status = typeof error.status === 'number' ? error.status : 429;
1098
+ if (error.cause !== undefined) this.cause = error.cause;
1099
+ Object.setPrototypeOf(this, RateLimitedError$1.prototype);
1100
+ }
1101
+ }
1102
+ class RequestConflictError$1 extends WebrpcError$1 {
1103
+ constructor(error = {}) {
1104
+ super(error);
1105
+ this.name = error.name || 'RequestConflict';
1106
+ this.code = typeof error.code === 'number' ? error.code : 1004;
1107
+ this.message = error.message || `Conflict with target resource`;
1108
+ this.status = typeof error.status === 'number' ? error.status : 409;
1109
+ if (error.cause !== undefined) this.cause = error.cause;
1110
+ Object.setPrototypeOf(this, RequestConflictError$1.prototype);
961
1111
  }
962
1112
  }
963
1113
  class ResourceExhaustedError$1 extends WebrpcError$1 {
964
- constructor(name = 'ResourceExhausted', code = 2004, message = 'Resource exhausted', status = 0, cause) {
965
- super(name, code, message, status, cause);
1114
+ constructor(error = {}) {
1115
+ super(error);
1116
+ this.name = error.name || 'ResourceExhausted';
1117
+ this.code = typeof error.code === 'number' ? error.code : 2004;
1118
+ this.message = error.message || `Resource exhausted`;
1119
+ this.status = typeof error.status === 'number' ? error.status : 400;
1120
+ if (error.cause !== undefined) this.cause = error.cause;
966
1121
  Object.setPrototypeOf(this, ResourceExhaustedError$1.prototype);
967
1122
  }
968
1123
  }
969
- class NotFoundError$1 extends WebrpcError$1 {
970
- constructor(name = 'NotFound', code = 3000, message = 'Resource not found', status = 0, cause) {
971
- super(name, code, message, status, cause);
972
- Object.setPrototypeOf(this, NotFoundError$1.prototype);
1124
+ class SessionExpiredError$1 extends WebrpcError$1 {
1125
+ constructor(error = {}) {
1126
+ super(error);
1127
+ this.name = error.name || 'SessionExpired';
1128
+ this.code = typeof error.code === 'number' ? error.code : 1002;
1129
+ this.message = error.message || `Session expired`;
1130
+ this.status = typeof error.status === 'number' ? error.status : 403;
1131
+ if (error.cause !== undefined) this.cause = error.cause;
1132
+ Object.setPrototypeOf(this, SessionExpiredError$1.prototype);
973
1133
  }
974
1134
  }
975
- class MetadataCallFailedError$1 extends WebrpcError$1 {
976
- constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {
977
- super(name, code, message, status, cause);
978
- Object.setPrototypeOf(this, MetadataCallFailedError$1.prototype);
1135
+ class TimeoutError$1 extends WebrpcError$1 {
1136
+ constructor(error = {}) {
1137
+ super(error);
1138
+ this.name = error.name || 'Timeout';
1139
+ this.code = typeof error.code === 'number' ? error.code : 1900;
1140
+ this.message = error.message || `Request timed out`;
1141
+ this.status = typeof error.status === 'number' ? error.status : 408;
1142
+ if (error.cause !== undefined) this.cause = error.cause;
1143
+ Object.setPrototypeOf(this, TimeoutError$1.prototype);
1144
+ }
1145
+ }
1146
+ class UnauthorizedError$1 extends WebrpcError$1 {
1147
+ constructor(error = {}) {
1148
+ super(error);
1149
+ this.name = error.name || 'Unauthorized';
1150
+ this.code = typeof error.code === 'number' ? error.code : 1000;
1151
+ this.message = error.message || `Unauthorized access`;
1152
+ this.status = typeof error.status === 'number' ? error.status : 401;
1153
+ if (error.cause !== undefined) this.cause = error.cause;
1154
+ Object.setPrototypeOf(this, UnauthorizedError$1.prototype);
1155
+ }
1156
+ }
1157
+ class UnauthorizedUserError$1 extends WebrpcError$1 {
1158
+ constructor(error = {}) {
1159
+ super(error);
1160
+ this.name = error.name || 'UnauthorizedUser';
1161
+ this.code = typeof error.code === 'number' ? error.code : 1105;
1162
+ this.message = error.message || `Unauthorized user`;
1163
+ this.status = typeof error.status === 'number' ? error.status : 403;
1164
+ if (error.cause !== undefined) this.cause = error.cause;
1165
+ Object.setPrototypeOf(this, UnauthorizedUserError$1.prototype);
1166
+ }
1167
+ }
1168
+ class UnavailableError$1 extends WebrpcError$1 {
1169
+ constructor(error = {}) {
1170
+ super(error);
1171
+ this.name = error.name || 'Unavailable';
1172
+ this.code = typeof error.code === 'number' ? error.code : 2002;
1173
+ this.message = error.message || `Unavailable resource`;
1174
+ this.status = typeof error.status === 'number' ? error.status : 400;
1175
+ if (error.cause !== undefined) this.cause = error.cause;
1176
+ Object.setPrototypeOf(this, UnavailableError$1.prototype);
979
1177
  }
980
1178
  }
981
1179
  let errors$1 = /*#__PURE__*/function (errors) {
@@ -987,37 +1185,77 @@ let errors$1 = /*#__PURE__*/function (errors) {
987
1185
  errors["WebrpcBadResponse"] = "WebrpcBadResponse";
988
1186
  errors["WebrpcServerPanic"] = "WebrpcServerPanic";
989
1187
  errors["WebrpcInternalError"] = "WebrpcInternalError";
990
- errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
1188
+ errors["WebrpcClientAborted"] = "WebrpcClientAborted";
991
1189
  errors["WebrpcStreamLost"] = "WebrpcStreamLost";
992
1190
  errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
993
- errors["Unauthorized"] = "Unauthorized";
994
- errors["PermissionDenied"] = "PermissionDenied";
995
- errors["SessionExpired"] = "SessionExpired";
996
- errors["MethodNotFound"] = "MethodNotFound";
997
- errors["RequestConflict"] = "RequestConflict";
998
1191
  errors["Aborted"] = "Aborted";
999
- errors["Geoblocked"] = "Geoblocked";
1000
- errors["RateLimited"] = "RateLimited";
1001
- errors["ProjectNotFound"] = "ProjectNotFound";
1002
- errors["AccessKeyNotFound"] = "AccessKeyNotFound";
1003
1192
  errors["AccessKeyMismatch"] = "AccessKeyMismatch";
1193
+ errors["AccessKeyNotFound"] = "AccessKeyNotFound";
1194
+ errors["AtLeastOneKey"] = "AtLeastOneKey";
1195
+ errors["Geoblocked"] = "Geoblocked";
1196
+ errors["InvalidArgument"] = "InvalidArgument";
1004
1197
  errors["InvalidOrigin"] = "InvalidOrigin";
1005
1198
  errors["InvalidService"] = "InvalidService";
1006
- errors["UnauthorizedUser"] = "UnauthorizedUser";
1199
+ errors["MaxAccessKeys"] = "MaxAccessKeys";
1200
+ errors["MetadataCallFailed"] = "MetadataCallFailed";
1201
+ errors["MethodNotFound"] = "MethodNotFound";
1202
+ errors["NoDefaultKey"] = "NoDefaultKey";
1203
+ errors["NotFound"] = "NotFound";
1204
+ errors["PermissionDenied"] = "PermissionDenied";
1205
+ errors["ProjectNotFound"] = "ProjectNotFound";
1206
+ errors["QueryFailed"] = "QueryFailed";
1007
1207
  errors["QuotaExceeded"] = "QuotaExceeded";
1008
1208
  errors["RateLimit"] = "RateLimit";
1009
- errors["NoDefaultKey"] = "NoDefaultKey";
1010
- errors["MaxAccessKeys"] = "MaxAccessKeys";
1011
- errors["AtLeastOneKey"] = "AtLeastOneKey";
1209
+ errors["RateLimited"] = "RateLimited";
1210
+ errors["RequestConflict"] = "RequestConflict";
1211
+ errors["ResourceExhausted"] = "ResourceExhausted";
1212
+ errors["SessionExpired"] = "SessionExpired";
1012
1213
  errors["Timeout"] = "Timeout";
1013
- errors["InvalidArgument"] = "InvalidArgument";
1214
+ errors["Unauthorized"] = "Unauthorized";
1215
+ errors["UnauthorizedUser"] = "UnauthorizedUser";
1014
1216
  errors["Unavailable"] = "Unavailable";
1015
- errors["QueryFailed"] = "QueryFailed";
1016
- errors["ResourceExhausted"] = "ResourceExhausted";
1017
- errors["NotFound"] = "NotFound";
1018
- errors["MetadataCallFailed"] = "MetadataCallFailed";
1019
1217
  return errors;
1020
1218
  }({});
1219
+ let WebrpcErrorCodes$1 = /*#__PURE__*/function (WebrpcErrorCodes) {
1220
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint";
1221
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed";
1222
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute";
1223
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod";
1224
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest";
1225
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse";
1226
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic";
1227
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError";
1228
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientAborted"] = -8] = "WebrpcClientAborted";
1229
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost";
1230
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished";
1231
+ WebrpcErrorCodes[WebrpcErrorCodes["Aborted"] = 1005] = "Aborted";
1232
+ WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyMismatch"] = 1102] = "AccessKeyMismatch";
1233
+ WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyNotFound"] = 1101] = "AccessKeyNotFound";
1234
+ WebrpcErrorCodes[WebrpcErrorCodes["AtLeastOneKey"] = 1302] = "AtLeastOneKey";
1235
+ WebrpcErrorCodes[WebrpcErrorCodes["Geoblocked"] = 1006] = "Geoblocked";
1236
+ WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2001] = "InvalidArgument";
1237
+ WebrpcErrorCodes[WebrpcErrorCodes["InvalidOrigin"] = 1103] = "InvalidOrigin";
1238
+ WebrpcErrorCodes[WebrpcErrorCodes["InvalidService"] = 1104] = "InvalidService";
1239
+ WebrpcErrorCodes[WebrpcErrorCodes["MaxAccessKeys"] = 1301] = "MaxAccessKeys";
1240
+ WebrpcErrorCodes[WebrpcErrorCodes["MetadataCallFailed"] = 3003] = "MetadataCallFailed";
1241
+ WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound";
1242
+ WebrpcErrorCodes[WebrpcErrorCodes["NoDefaultKey"] = 1300] = "NoDefaultKey";
1243
+ WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound";
1244
+ WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied";
1245
+ WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 1100] = "ProjectNotFound";
1246
+ WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed";
1247
+ WebrpcErrorCodes[WebrpcErrorCodes["QuotaExceeded"] = 1200] = "QuotaExceeded";
1248
+ WebrpcErrorCodes[WebrpcErrorCodes["RateLimit"] = 1201] = "RateLimit";
1249
+ WebrpcErrorCodes[WebrpcErrorCodes["RateLimited"] = 1007] = "RateLimited";
1250
+ WebrpcErrorCodes[WebrpcErrorCodes["RequestConflict"] = 1004] = "RequestConflict";
1251
+ WebrpcErrorCodes[WebrpcErrorCodes["ResourceExhausted"] = 2004] = "ResourceExhausted";
1252
+ WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired";
1253
+ WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 1900] = "Timeout";
1254
+ WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized";
1255
+ WebrpcErrorCodes[WebrpcErrorCodes["UnauthorizedUser"] = 1105] = "UnauthorizedUser";
1256
+ WebrpcErrorCodes[WebrpcErrorCodes["Unavailable"] = 2002] = "Unavailable";
1257
+ return WebrpcErrorCodes;
1258
+ }({});
1021
1259
  const webrpcErrorByCode$1 = {
1022
1260
  [0]: WebrpcEndpointError$1,
1023
1261
  [-1]: WebrpcRequestFailedError$1,
@@ -1027,101 +1265,103 @@ const webrpcErrorByCode$1 = {
1027
1265
  [-5]: WebrpcBadResponseError$1,
1028
1266
  [-6]: WebrpcServerPanicError$1,
1029
1267
  [-7]: WebrpcInternalErrorError$1,
1030
- [-8]: WebrpcClientDisconnectedError$1,
1268
+ [-8]: WebrpcClientAbortedError$1,
1031
1269
  [-9]: WebrpcStreamLostError$1,
1032
1270
  [-10]: WebrpcStreamFinishedError$1,
1033
- [1000]: UnauthorizedError$1,
1034
- [1001]: PermissionDeniedError$1,
1035
- [1002]: SessionExpiredError$1,
1036
- [1003]: MethodNotFoundError$1,
1037
- [1004]: RequestConflictError$1,
1038
1271
  [1005]: AbortedError$1,
1039
- [1006]: GeoblockedError$1,
1040
- [1007]: RateLimitedError$1,
1041
- [1100]: ProjectNotFoundError$1,
1042
- [1101]: AccessKeyNotFoundError$1,
1043
1272
  [1102]: AccessKeyMismatchError$1,
1273
+ [1101]: AccessKeyNotFoundError$1,
1274
+ [1302]: AtLeastOneKeyError$1,
1275
+ [1006]: GeoblockedError$1,
1276
+ [2001]: InvalidArgumentError$1,
1044
1277
  [1103]: InvalidOriginError$1,
1045
1278
  [1104]: InvalidServiceError$1,
1046
- [1105]: UnauthorizedUserError$1,
1047
- [1200]: QuotaExceededError$1,
1048
- [1201]: RateLimitError$1,
1049
- [1300]: NoDefaultKeyError$1,
1050
1279
  [1301]: MaxAccessKeysError$1,
1051
- [1302]: AtLeastOneKeyError$1,
1052
- [1900]: TimeoutError$1,
1053
- [2001]: InvalidArgumentError$1,
1054
- [2002]: UnavailableError$1,
1280
+ [3003]: MetadataCallFailedError$1,
1281
+ [1003]: MethodNotFoundError$1,
1282
+ [1300]: NoDefaultKeyError$1,
1283
+ [3000]: NotFoundError$1,
1284
+ [1001]: PermissionDeniedError$1,
1285
+ [1100]: ProjectNotFoundError$1,
1055
1286
  [2003]: QueryFailedError$1,
1287
+ [1200]: QuotaExceededError$1,
1288
+ [1201]: RateLimitError$1,
1289
+ [1007]: RateLimitedError$1,
1290
+ [1004]: RequestConflictError$1,
1056
1291
  [2004]: ResourceExhaustedError$1,
1057
- [3000]: NotFoundError$1,
1058
- [3003]: MetadataCallFailedError$1
1292
+ [1002]: SessionExpiredError$1,
1293
+ [1900]: TimeoutError$1,
1294
+ [1000]: UnauthorizedError$1,
1295
+ [1105]: UnauthorizedUserError$1,
1296
+ [2002]: UnavailableError$1
1059
1297
  };
1060
1298
 
1061
- /* eslint-disable */
1062
- // sequence-indexer v0.4.0 399517e791d272fddd35b036260f7bbbe6cea0e5
1063
- // --
1064
- // Code generated by webrpc-gen@v0.21.1 with typescript generator. DO NOT EDIT.
1065
1299
  //
1066
- // webrpc-gen -schema=indexer.ridl -service=IndexerGateway -target=typescript -client -out=./clients/indexergw.gen.ts
1067
-
1068
- const WebrpcHeader = 'Webrpc';
1069
- const WebrpcHeaderValue = 'webrpc@v0.21.1;gen-typescript@v0.15.1;sequence-indexer@v0.4.0';
1070
-
1071
- // WebRPC description and code-gen version
1072
- const WebRPCVersion = 'v1';
1073
-
1074
- // Schema version of your RIDL schema
1075
- const WebRPCSchemaVersion = 'v0.4.0';
1300
+ // Webrpc
1301
+ //
1076
1302
 
1077
- // Schema hash generated from your RIDL schema
1078
- const WebRPCSchemaHash = '399517e791d272fddd35b036260f7bbbe6cea0e5';
1079
- function VersionFromHeader(headers) {
1080
- const headerValue = headers.get(WebrpcHeader);
1303
+ const WebrpcHeader$1 = "Webrpc";
1304
+ const WebrpcHeaderValue$1 = "webrpc@v0.31.2;gen-typescript@v0.23.1;sequence-indexer@v0.4.0";
1305
+ function VersionFromHeader$1(headers) {
1306
+ const headerValue = headers.get(WebrpcHeader$1);
1081
1307
  if (!headerValue) {
1082
1308
  return {
1083
- webrpcGenVersion: '',
1084
- codeGenName: '',
1085
- codeGenVersion: '',
1086
- schemaName: '',
1087
- schemaVersion: ''
1309
+ WebrpcGenVersion: "",
1310
+ codeGenName: "",
1311
+ codeGenVersion: "",
1312
+ schemaName: "",
1313
+ schemaVersion: ""
1088
1314
  };
1089
1315
  }
1090
- return parseWebrpcGenVersions(headerValue);
1316
+ return parseWebrpcGenVersions$1(headerValue);
1091
1317
  }
1092
- function parseWebrpcGenVersions(header) {
1093
- const versions = header.split(';');
1318
+ function parseWebrpcGenVersions$1(header) {
1319
+ const versions = header.split(";");
1094
1320
  if (versions.length < 3) {
1095
1321
  return {
1096
- webrpcGenVersion: '',
1097
- codeGenName: '',
1098
- codeGenVersion: '',
1099
- schemaName: '',
1100
- schemaVersion: ''
1322
+ WebrpcGenVersion: "",
1323
+ codeGenName: "",
1324
+ codeGenVersion: "",
1325
+ schemaName: "",
1326
+ schemaVersion: ""
1101
1327
  };
1102
1328
  }
1103
- const [_, webrpcGenVersion] = versions[0].split('@');
1104
- const [codeGenName, codeGenVersion] = versions[1].split('@');
1105
- const [schemaName, schemaVersion] = versions[2].split('@');
1329
+ const [_, WebrpcGenVersion] = versions[0].split("@");
1330
+ const [codeGenName, codeGenVersion] = versions[1].split("@");
1331
+ const [schemaName, schemaVersion] = versions[2].split("@");
1106
1332
  return {
1107
- webrpcGenVersion,
1108
- codeGenName,
1109
- codeGenVersion,
1110
- schemaName,
1111
- schemaVersion
1333
+ WebrpcGenVersion: WebrpcGenVersion != null ? WebrpcGenVersion : "",
1334
+ codeGenName: codeGenName != null ? codeGenName : "",
1335
+ codeGenVersion: codeGenVersion != null ? codeGenVersion : "",
1336
+ schemaName: schemaName != null ? schemaName : "",
1337
+ schemaVersion: schemaVersion != null ? schemaVersion : ""
1112
1338
  };
1113
1339
  }
1114
1340
 
1341
+ /* eslint-disable */
1342
+ // sequence-indexer v0.4.0 b978d153702d614d5f1b9c98ff7f2e5857cccfd6
1343
+ // --
1344
+ // Code generated by Webrpc-gen@v0.31.2 with typescript generator. DO NOT EDIT.
1115
1345
  //
1116
- // Types
1346
+ // webrpc-gen -schema=merged.gen.json -service=IndexerGateway -target=typescript -client -out=./clients/indexergw.gen.ts
1347
+
1348
+ // Webrpc description and code-gen version
1349
+ const WebrpcVersion = "v1";
1350
+
1351
+ // Schema version of your RIDL schema
1352
+ const WebrpcSchemaVersion = "v0.4.0";
1353
+
1354
+ // Schema hash generated from your RIDL schema
1355
+ const WebrpcSchemaHash = "b978d153702d614d5f1b9c98ff7f2e5857cccfd6";
1356
+
1357
+ //
1358
+ // Client interface
1359
+ //
1360
+
1361
+ //
1362
+ // Schema types
1117
1363
  //
1118
1364
 
1119
- let ResourceStatus = /*#__PURE__*/function (ResourceStatus) {
1120
- ResourceStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
1121
- ResourceStatus["REFRESHING"] = "REFRESHING";
1122
- ResourceStatus["AVAILABLE"] = "AVAILABLE";
1123
- return ResourceStatus;
1124
- }({});
1125
1365
  let ContractType = /*#__PURE__*/function (ContractType) {
1126
1366
  ContractType["UNKNOWN"] = "UNKNOWN";
1127
1367
  ContractType["NATIVE"] = "NATIVE";
@@ -1133,13 +1373,14 @@ let ContractType = /*#__PURE__*/function (ContractType) {
1133
1373
  ContractType["ERC721_BRIDGE"] = "ERC721_BRIDGE";
1134
1374
  ContractType["ERC1155_BRIDGE"] = "ERC1155_BRIDGE";
1135
1375
  ContractType["SEQ_MARKETPLACE"] = "SEQ_MARKETPLACE";
1376
+ ContractType["ERC6909"] = "ERC6909";
1136
1377
  return ContractType;
1137
1378
  }({});
1138
- let EventLogType = /*#__PURE__*/function (EventLogType) {
1139
- EventLogType["UNKNOWN"] = "UNKNOWN";
1140
- EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
1141
- EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
1142
- return EventLogType;
1379
+ let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
1380
+ ContractVerificationStatus["VERIFIED"] = "VERIFIED";
1381
+ ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
1382
+ ContractVerificationStatus["ALL"] = "ALL";
1383
+ return ContractVerificationStatus;
1143
1384
  }({});
1144
1385
  let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
1145
1386
  EventLogDataType["EVENT"] = "EVENT";
@@ -1148,17 +1389,34 @@ let EventLogDataType = /*#__PURE__*/function (EventLogDataType) {
1148
1389
  EventLogDataType["SEQUENCE_TXN"] = "SEQUENCE_TXN";
1149
1390
  return EventLogDataType;
1150
1391
  }({});
1392
+ let EventLogType = /*#__PURE__*/function (EventLogType) {
1393
+ EventLogType["UNKNOWN"] = "UNKNOWN";
1394
+ EventLogType["BLOCK_ADDED"] = "BLOCK_ADDED";
1395
+ EventLogType["BLOCK_REMOVED"] = "BLOCK_REMOVED";
1396
+ return EventLogType;
1397
+ }({});
1398
+ let NetworkType = /*#__PURE__*/function (NetworkType) {
1399
+ NetworkType["MAINNETS"] = "MAINNETS";
1400
+ NetworkType["TESTNETS"] = "TESTNETS";
1401
+ NetworkType["ALL"] = "ALL";
1402
+ return NetworkType;
1403
+ }({});
1151
1404
  let OrderStatus = /*#__PURE__*/function (OrderStatus) {
1152
1405
  OrderStatus["OPEN"] = "OPEN";
1153
1406
  OrderStatus["CLOSED"] = "CLOSED";
1154
1407
  OrderStatus["CANCELLED"] = "CANCELLED";
1155
1408
  return OrderStatus;
1156
1409
  }({});
1157
- let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
1158
- TxnTransferType["UNKNOWN"] = "UNKNOWN";
1159
- TxnTransferType["SEND"] = "SEND";
1160
- TxnTransferType["RECEIVE"] = "RECEIVE";
1161
- return TxnTransferType;
1410
+ let ResourceStatus = /*#__PURE__*/function (ResourceStatus) {
1411
+ ResourceStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
1412
+ ResourceStatus["REFRESHING"] = "REFRESHING";
1413
+ ResourceStatus["AVAILABLE"] = "AVAILABLE";
1414
+ return ResourceStatus;
1415
+ }({});
1416
+ let SortOrder = /*#__PURE__*/function (SortOrder) {
1417
+ SortOrder["DESC"] = "DESC";
1418
+ SortOrder["ASC"] = "ASC";
1419
+ return SortOrder;
1162
1420
  }({});
1163
1421
  let TransactionStatus = /*#__PURE__*/function (TransactionStatus) {
1164
1422
  TransactionStatus["FAILED"] = "FAILED";
@@ -1171,165 +1429,176 @@ let TransactionType = /*#__PURE__*/function (TransactionType) {
1171
1429
  TransactionType["DynamicFeeTxnType"] = "DynamicFeeTxnType";
1172
1430
  return TransactionType;
1173
1431
  }({});
1174
- let SortOrder = /*#__PURE__*/function (SortOrder) {
1175
- SortOrder["DESC"] = "DESC";
1176
- SortOrder["ASC"] = "ASC";
1177
- return SortOrder;
1178
- }({});
1179
- let ContractVerificationStatus = /*#__PURE__*/function (ContractVerificationStatus) {
1180
- ContractVerificationStatus["VERIFIED"] = "VERIFIED";
1181
- ContractVerificationStatus["UNVERIFIED"] = "UNVERIFIED";
1182
- ContractVerificationStatus["ALL"] = "ALL";
1183
- return ContractVerificationStatus;
1184
- }({});
1185
- let NetworkType = /*#__PURE__*/function (NetworkType) {
1186
- NetworkType["MAINNETS"] = "MAINNETS";
1187
- NetworkType["TESTNETS"] = "TESTNETS";
1188
- NetworkType["ALL"] = "ALL";
1189
- return NetworkType;
1432
+ let TxnTransferType = /*#__PURE__*/function (TxnTransferType) {
1433
+ TxnTransferType["UNKNOWN"] = "UNKNOWN";
1434
+ TxnTransferType["SEND"] = "SEND";
1435
+ TxnTransferType["RECEIVE"] = "RECEIVE";
1436
+ return TxnTransferType;
1190
1437
  }({});
1191
1438
  //
1192
1439
  // Client
1193
1440
  //
1441
+
1194
1442
  class IndexerGateway {
1195
1443
  constructor(hostname, fetch) {
1196
1444
  this.hostname = void 0;
1197
1445
  this.fetch = void 0;
1198
1446
  this.path = '/rpc/IndexerGateway/';
1199
- this.getNativeTokenBalance = (args, headers, signal) => {
1200
- return this.fetch(this.url('GetNativeTokenBalance'), createHTTPRequest(args, headers, signal)).then(res => {
1447
+ this.queryKey = {
1448
+ getBalanceUpdates: req => ['IndexerGateway', 'getBalanceUpdates', req],
1449
+ getChains: req => ['IndexerGateway', 'getChains', req],
1450
+ getNativeTokenBalance: req => ['IndexerGateway', 'getNativeTokenBalance', req],
1451
+ getTokenBalances: req => ['IndexerGateway', 'getTokenBalances', req],
1452
+ getTokenBalancesByContract: req => ['IndexerGateway', 'getTokenBalancesByContract', req],
1453
+ getTokenBalancesDetails: req => ['IndexerGateway', 'getTokenBalancesDetails', req],
1454
+ getTokenBalancesSummary: req => ['IndexerGateway', 'getTokenBalancesSummary', req],
1455
+ getTokenPrice: req => ['IndexerGateway', 'getTokenPrice', req],
1456
+ getTokenPrices: req => ['IndexerGateway', 'getTokenPrices', req],
1457
+ getTransactionHistory: req => ['IndexerGateway', 'getTransactionHistory', req],
1458
+ ping: () => ['IndexerGateway', 'ping'],
1459
+ runtimeStatus: () => ['IndexerGateway', 'runtimeStatus'],
1460
+ version: () => ['IndexerGateway', 'version']
1461
+ };
1462
+ this.getBalanceUpdates = (req, headers, signal) => {
1463
+ return this.fetch(this.url('GetBalanceUpdates'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1201
1464
  return buildResponse(res).then(_data => {
1202
- return {
1203
- balances: _data.balances
1204
- };
1465
+ return JsonDecode(_data, 'GetBalanceUpdatesResponse');
1205
1466
  });
1206
1467
  }, error => {
1207
1468
  throw WebrpcRequestFailedError.new({
1208
- cause: `fetch(): ${error.message || ''}`
1469
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1209
1470
  });
1210
1471
  });
1211
1472
  };
1212
- this.getTokenBalances = (args, headers, signal) => {
1213
- return this.fetch(this.url('GetTokenBalances'), createHTTPRequest(args, headers, signal)).then(res => {
1473
+ this.getChains = (req, headers, signal) => {
1474
+ return this.fetch(this.url('GetChains'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1214
1475
  return buildResponse(res).then(_data => {
1215
- return {
1216
- page: _data.page,
1217
- balances: _data.balances
1218
- };
1476
+ return JsonDecode(_data, 'GetChainsResponse');
1219
1477
  });
1220
1478
  }, error => {
1221
1479
  throw WebrpcRequestFailedError.new({
1222
- cause: `fetch(): ${error.message || ''}`
1480
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1223
1481
  });
1224
1482
  });
1225
1483
  };
1226
- this.getTokenBalancesSummary = (args, headers, signal) => {
1227
- return this.fetch(this.url('GetTokenBalancesSummary'), createHTTPRequest(args, headers, signal)).then(res => {
1484
+ this.getNativeTokenBalance = (req, headers, signal) => {
1485
+ return this.fetch(this.url('GetNativeTokenBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1228
1486
  return buildResponse(res).then(_data => {
1229
- return {
1230
- page: _data.page,
1231
- nativeBalances: _data.nativeBalances,
1232
- balances: _data.balances
1233
- };
1487
+ return JsonDecode(_data, 'GetNativeTokenBalanceResponse');
1234
1488
  });
1235
1489
  }, error => {
1236
1490
  throw WebrpcRequestFailedError.new({
1237
- cause: `fetch(): ${error.message || ''}`
1491
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1238
1492
  });
1239
1493
  });
1240
1494
  };
1241
- this.getTokenBalancesDetails = (args, headers, signal) => {
1242
- return this.fetch(this.url('GetTokenBalancesDetails'), createHTTPRequest(args, headers, signal)).then(res => {
1495
+ this.getTokenBalances = (req, headers, signal) => {
1496
+ return this.fetch(this.url('GetTokenBalances'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1243
1497
  return buildResponse(res).then(_data => {
1244
- return {
1245
- page: _data.page,
1246
- nativeBalances: _data.nativeBalances,
1247
- balances: _data.balances
1248
- };
1498
+ return JsonDecode(_data, 'GetTokenBalancesResponse');
1249
1499
  });
1250
1500
  }, error => {
1251
1501
  throw WebrpcRequestFailedError.new({
1252
- cause: `fetch(): ${error.message || ''}`
1502
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1253
1503
  });
1254
1504
  });
1255
1505
  };
1256
- this.getTokenBalancesByContract = (args, headers, signal) => {
1257
- return this.fetch(this.url('GetTokenBalancesByContract'), createHTTPRequest(args, headers, signal)).then(res => {
1506
+ this.getTokenBalancesByContract = (req, headers, signal) => {
1507
+ return this.fetch(this.url('GetTokenBalancesByContract'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1258
1508
  return buildResponse(res).then(_data => {
1259
- return {
1260
- page: _data.page,
1261
- balances: _data.balances
1262
- };
1509
+ return JsonDecode(_data, 'GetTokenBalancesByContractResponse');
1263
1510
  });
1264
1511
  }, error => {
1265
1512
  throw WebrpcRequestFailedError.new({
1266
- cause: `fetch(): ${error.message || ''}`
1513
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1267
1514
  });
1268
1515
  });
1269
1516
  };
1270
- this.getBalanceUpdates = (args, headers, signal) => {
1271
- return this.fetch(this.url('GetBalanceUpdates'), createHTTPRequest(args, headers, signal)).then(res => {
1517
+ this.getTokenBalancesDetails = (req, headers, signal) => {
1518
+ return this.fetch(this.url('GetTokenBalancesDetails'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1272
1519
  return buildResponse(res).then(_data => {
1273
- return {
1274
- page: _data.page,
1275
- balances: _data.balances
1276
- };
1520
+ return JsonDecode(_data, 'GetTokenBalancesDetailsResponse');
1277
1521
  });
1278
1522
  }, error => {
1279
1523
  throw WebrpcRequestFailedError.new({
1280
- cause: `fetch(): ${error.message || ''}`
1524
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1281
1525
  });
1282
1526
  });
1283
1527
  };
1284
- this.getChains = (args, headers, signal) => {
1285
- return this.fetch(this.url('GetChains'), createHTTPRequest(args, headers, signal)).then(res => {
1528
+ this.getTokenBalancesSummary = (req, headers, signal) => {
1529
+ return this.fetch(this.url('GetTokenBalancesSummary'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1286
1530
  return buildResponse(res).then(_data => {
1287
- return {
1288
- chains: _data.chains
1289
- };
1531
+ return JsonDecode(_data, 'GetTokenBalancesSummaryResponse');
1290
1532
  });
1291
1533
  }, error => {
1292
1534
  throw WebrpcRequestFailedError.new({
1293
- cause: `fetch(): ${error.message || ''}`
1535
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1294
1536
  });
1295
1537
  });
1296
1538
  };
1297
- this.ping = (headers, signal) => {
1298
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
1539
+ this.getTokenPrice = (req, headers, signal) => {
1540
+ return this.fetch(this.url('GetTokenPrice'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1299
1541
  return buildResponse(res).then(_data => {
1300
- return {
1301
- status: _data.status
1302
- };
1542
+ return JsonDecode(_data, 'GetTokenPriceResponse');
1303
1543
  });
1304
1544
  }, error => {
1305
1545
  throw WebrpcRequestFailedError.new({
1306
- cause: `fetch(): ${error.message || ''}`
1546
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1307
1547
  });
1308
1548
  });
1309
1549
  };
1310
- this.version = (headers, signal) => {
1311
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
1550
+ this.getTokenPrices = (req, headers, signal) => {
1551
+ return this.fetch(this.url('GetTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1312
1552
  return buildResponse(res).then(_data => {
1313
- return {
1314
- version: _data.version
1315
- };
1553
+ return JsonDecode(_data, 'GetTokenPricesResponse');
1316
1554
  });
1317
1555
  }, error => {
1318
1556
  throw WebrpcRequestFailedError.new({
1319
- cause: `fetch(): ${error.message || ''}`
1557
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1558
+ });
1559
+ });
1560
+ };
1561
+ this.getTransactionHistory = (req, headers, signal) => {
1562
+ return this.fetch(this.url('GetTransactionHistory'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
1563
+ return buildResponse(res).then(_data => {
1564
+ return JsonDecode(_data, 'GetTransactionHistoryResponse');
1565
+ });
1566
+ }, error => {
1567
+ throw WebrpcRequestFailedError.new({
1568
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1569
+ });
1570
+ });
1571
+ };
1572
+ this.ping = (headers, signal) => {
1573
+ return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(res => {
1574
+ return buildResponse(res).then(_data => {
1575
+ return JsonDecode(_data, 'PingResponse');
1576
+ });
1577
+ }, error => {
1578
+ throw WebrpcRequestFailedError.new({
1579
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1320
1580
  });
1321
1581
  });
1322
1582
  };
1323
1583
  this.runtimeStatus = (headers, signal) => {
1324
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
1584
+ return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(res => {
1585
+ return buildResponse(res).then(_data => {
1586
+ return JsonDecode(_data, 'RuntimeStatusResponse');
1587
+ });
1588
+ }, error => {
1589
+ throw WebrpcRequestFailedError.new({
1590
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1591
+ });
1592
+ });
1593
+ };
1594
+ this.version = (headers, signal) => {
1595
+ return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then(res => {
1325
1596
  return buildResponse(res).then(_data => {
1326
- return {
1327
- status: _data.status
1328
- };
1597
+ return JsonDecode(_data, 'VersionResponse');
1329
1598
  });
1330
1599
  }, error => {
1331
1600
  throw WebrpcRequestFailedError.new({
1332
- cause: `fetch(): ${error.message || ''}`
1601
+ cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`
1333
1602
  });
1334
1603
  });
1335
1604
  };
@@ -1340,15 +1609,15 @@ class IndexerGateway {
1340
1609
  return this.hostname + this.path + name;
1341
1610
  }
1342
1611
  }
1343
- const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
1612
+ const createHttpRequest = (body = '{}', headers = {}, signal = null) => {
1344
1613
  const reqHeaders = _extends({}, headers, {
1345
- 'Content-Type': 'application/json'
1614
+ 'Content-Type': 'application/json',
1615
+ [WebrpcHeader]: WebrpcHeaderValue
1346
1616
  });
1347
- reqHeaders[WebrpcHeader] = WebrpcHeaderValue;
1348
1617
  return {
1349
1618
  method: 'POST',
1350
1619
  headers: reqHeaders,
1351
- body: JSON.stringify(body || {}),
1620
+ body,
1352
1621
  signal
1353
1622
  };
1354
1623
  };
@@ -1358,13 +1627,9 @@ const buildResponse = res => {
1358
1627
  try {
1359
1628
  data = JSON.parse(text);
1360
1629
  } catch (error) {
1361
- let message = '';
1362
- if (error instanceof Error) {
1363
- message = error.message;
1364
- }
1365
1630
  throw WebrpcBadResponseError.new({
1366
1631
  status: res.status,
1367
- cause: `JSON.parse(): ${message}: response text: ${text}`
1632
+ cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`
1368
1633
  });
1369
1634
  }
1370
1635
  if (!res.ok) {
@@ -1374,259 +1639,458 @@ const buildResponse = res => {
1374
1639
  return data;
1375
1640
  });
1376
1641
  };
1642
+ const JsonEncode = obj => {
1643
+ return JSON.stringify(obj);
1644
+ };
1645
+ const JsonDecode = (data, _typ = '') => {
1646
+ let parsed = data;
1647
+ if (typeof data === 'string') {
1648
+ try {
1649
+ parsed = JSON.parse(data);
1650
+ } catch (err) {
1651
+ throw WebrpcBadResponseError.new({
1652
+ cause: `JsonDecode: JSON.parse failed: ${err.message}`
1653
+ });
1654
+ }
1655
+ }
1656
+ return parsed;
1657
+ };
1377
1658
 
1378
1659
  //
1379
1660
  // Errors
1380
1661
  //
1381
1662
 
1382
1663
  class WebrpcError extends Error {
1383
- constructor(name, code, message, status, cause) {
1384
- super(message);
1385
- this.name = void 0;
1664
+ constructor(error = {}) {
1665
+ super(error.message);
1386
1666
  this.code = void 0;
1387
- this.message = void 0;
1388
1667
  this.status = void 0;
1389
- this.cause = void 0;
1390
- /** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
1391
- this.msg = void 0;
1392
- this.name = name || 'WebrpcError';
1393
- this.code = typeof code === 'number' ? code : 0;
1394
- this.message = message || `endpoint error ${this.code}`;
1395
- this.msg = this.message;
1396
- this.status = typeof status === 'number' ? status : 0;
1397
- this.cause = cause;
1668
+ this.name = error.name || 'WebrpcEndpointError';
1669
+ this.code = typeof error.code === 'number' ? error.code : 0;
1670
+ this.message = error.message || `endpoint error`;
1671
+ this.status = typeof error.status === 'number' ? error.status : 400;
1672
+ if (error.cause !== undefined) this.cause = error.cause;
1398
1673
  Object.setPrototypeOf(this, WebrpcError.prototype);
1399
1674
  }
1400
1675
  static new(payload) {
1401
- return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
1676
+ return new this({
1677
+ message: payload.message,
1678
+ code: payload.code,
1679
+ status: payload.status,
1680
+ cause: payload.cause
1681
+ });
1402
1682
  }
1403
1683
  }
1404
-
1405
- // Webrpc errors
1406
-
1407
1684
  class WebrpcEndpointError extends WebrpcError {
1408
- constructor(name = 'WebrpcEndpoint', code = 0, message = 'endpoint error', status = 0, cause) {
1409
- super(name, code, message, status, cause);
1685
+ constructor(error = {}) {
1686
+ super(error);
1687
+ this.name = error.name || 'WebrpcEndpoint';
1688
+ this.code = typeof error.code === 'number' ? error.code : 0;
1689
+ this.message = error.message || `endpoint error`;
1690
+ this.status = typeof error.status === 'number' ? error.status : 400;
1691
+ if (error.cause !== undefined) this.cause = error.cause;
1410
1692
  Object.setPrototypeOf(this, WebrpcEndpointError.prototype);
1411
1693
  }
1412
1694
  }
1413
1695
  class WebrpcRequestFailedError extends WebrpcError {
1414
- constructor(name = 'WebrpcRequestFailed', code = -1, message = 'request failed', status = 0, cause) {
1415
- super(name, code, message, status, cause);
1696
+ constructor(error = {}) {
1697
+ super(error);
1698
+ this.name = error.name || 'WebrpcRequestFailed';
1699
+ this.code = typeof error.code === 'number' ? error.code : -1;
1700
+ this.message = error.message || `request failed`;
1701
+ this.status = typeof error.status === 'number' ? error.status : 400;
1702
+ if (error.cause !== undefined) this.cause = error.cause;
1416
1703
  Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype);
1417
1704
  }
1418
1705
  }
1419
1706
  class WebrpcBadRouteError extends WebrpcError {
1420
- constructor(name = 'WebrpcBadRoute', code = -2, message = 'bad route', status = 0, cause) {
1421
- super(name, code, message, status, cause);
1707
+ constructor(error = {}) {
1708
+ super(error);
1709
+ this.name = error.name || 'WebrpcBadRoute';
1710
+ this.code = typeof error.code === 'number' ? error.code : -2;
1711
+ this.message = error.message || `bad route`;
1712
+ this.status = typeof error.status === 'number' ? error.status : 404;
1713
+ if (error.cause !== undefined) this.cause = error.cause;
1422
1714
  Object.setPrototypeOf(this, WebrpcBadRouteError.prototype);
1423
1715
  }
1424
1716
  }
1425
1717
  class WebrpcBadMethodError extends WebrpcError {
1426
- constructor(name = 'WebrpcBadMethod', code = -3, message = 'bad method', status = 0, cause) {
1427
- super(name, code, message, status, cause);
1718
+ constructor(error = {}) {
1719
+ super(error);
1720
+ this.name = error.name || 'WebrpcBadMethod';
1721
+ this.code = typeof error.code === 'number' ? error.code : -3;
1722
+ this.message = error.message || `bad method`;
1723
+ this.status = typeof error.status === 'number' ? error.status : 405;
1724
+ if (error.cause !== undefined) this.cause = error.cause;
1428
1725
  Object.setPrototypeOf(this, WebrpcBadMethodError.prototype);
1429
1726
  }
1430
1727
  }
1431
1728
  class WebrpcBadRequestError extends WebrpcError {
1432
- constructor(name = 'WebrpcBadRequest', code = -4, message = 'bad request', status = 0, cause) {
1433
- super(name, code, message, status, cause);
1729
+ constructor(error = {}) {
1730
+ super(error);
1731
+ this.name = error.name || 'WebrpcBadRequest';
1732
+ this.code = typeof error.code === 'number' ? error.code : -4;
1733
+ this.message = error.message || `bad request`;
1734
+ this.status = typeof error.status === 'number' ? error.status : 400;
1735
+ if (error.cause !== undefined) this.cause = error.cause;
1434
1736
  Object.setPrototypeOf(this, WebrpcBadRequestError.prototype);
1435
1737
  }
1436
1738
  }
1437
1739
  class WebrpcBadResponseError extends WebrpcError {
1438
- constructor(name = 'WebrpcBadResponse', code = -5, message = 'bad response', status = 0, cause) {
1439
- super(name, code, message, status, cause);
1740
+ constructor(error = {}) {
1741
+ super(error);
1742
+ this.name = error.name || 'WebrpcBadResponse';
1743
+ this.code = typeof error.code === 'number' ? error.code : -5;
1744
+ this.message = error.message || `bad response`;
1745
+ this.status = typeof error.status === 'number' ? error.status : 500;
1746
+ if (error.cause !== undefined) this.cause = error.cause;
1440
1747
  Object.setPrototypeOf(this, WebrpcBadResponseError.prototype);
1441
1748
  }
1442
1749
  }
1443
1750
  class WebrpcServerPanicError extends WebrpcError {
1444
- constructor(name = 'WebrpcServerPanic', code = -6, message = 'server panic', status = 0, cause) {
1445
- super(name, code, message, status, cause);
1751
+ constructor(error = {}) {
1752
+ super(error);
1753
+ this.name = error.name || 'WebrpcServerPanic';
1754
+ this.code = typeof error.code === 'number' ? error.code : -6;
1755
+ this.message = error.message || `server panic`;
1756
+ this.status = typeof error.status === 'number' ? error.status : 500;
1757
+ if (error.cause !== undefined) this.cause = error.cause;
1446
1758
  Object.setPrototypeOf(this, WebrpcServerPanicError.prototype);
1447
1759
  }
1448
1760
  }
1449
1761
  class WebrpcInternalErrorError extends WebrpcError {
1450
- constructor(name = 'WebrpcInternalError', code = -7, message = 'internal error', status = 0, cause) {
1451
- super(name, code, message, status, cause);
1762
+ constructor(error = {}) {
1763
+ super(error);
1764
+ this.name = error.name || 'WebrpcInternalError';
1765
+ this.code = typeof error.code === 'number' ? error.code : -7;
1766
+ this.message = error.message || `internal error`;
1767
+ this.status = typeof error.status === 'number' ? error.status : 500;
1768
+ if (error.cause !== undefined) this.cause = error.cause;
1452
1769
  Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype);
1453
1770
  }
1454
1771
  }
1455
- class WebrpcClientDisconnectedError extends WebrpcError {
1456
- constructor(name = 'WebrpcClientDisconnected', code = -8, message = 'client disconnected', status = 0, cause) {
1457
- super(name, code, message, status, cause);
1458
- Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype);
1772
+ class WebrpcClientAbortedError extends WebrpcError {
1773
+ constructor(error = {}) {
1774
+ super(error);
1775
+ this.name = error.name || 'WebrpcClientAborted';
1776
+ this.code = typeof error.code === 'number' ? error.code : -8;
1777
+ this.message = error.message || `request aborted by client`;
1778
+ this.status = typeof error.status === 'number' ? error.status : 400;
1779
+ if (error.cause !== undefined) this.cause = error.cause;
1780
+ Object.setPrototypeOf(this, WebrpcClientAbortedError.prototype);
1459
1781
  }
1460
1782
  }
1461
1783
  class WebrpcStreamLostError extends WebrpcError {
1462
- constructor(name = 'WebrpcStreamLost', code = -9, message = 'stream lost', status = 0, cause) {
1463
- super(name, code, message, status, cause);
1784
+ constructor(error = {}) {
1785
+ super(error);
1786
+ this.name = error.name || 'WebrpcStreamLost';
1787
+ this.code = typeof error.code === 'number' ? error.code : -9;
1788
+ this.message = error.message || `stream lost`;
1789
+ this.status = typeof error.status === 'number' ? error.status : 400;
1790
+ if (error.cause !== undefined) this.cause = error.cause;
1464
1791
  Object.setPrototypeOf(this, WebrpcStreamLostError.prototype);
1465
1792
  }
1466
1793
  }
1467
1794
  class WebrpcStreamFinishedError extends WebrpcError {
1468
- constructor(name = 'WebrpcStreamFinished', code = -10, message = 'stream finished', status = 0, cause) {
1469
- super(name, code, message, status, cause);
1795
+ constructor(error = {}) {
1796
+ super(error);
1797
+ this.name = error.name || 'WebrpcStreamFinished';
1798
+ this.code = typeof error.code === 'number' ? error.code : -10;
1799
+ this.message = error.message || `stream finished`;
1800
+ this.status = typeof error.status === 'number' ? error.status : 200;
1801
+ if (error.cause !== undefined) this.cause = error.cause;
1470
1802
  Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype);
1471
1803
  }
1472
1804
  }
1473
1805
 
1806
+ //
1474
1807
  // Schema errors
1808
+ //
1475
1809
 
1476
- class UnauthorizedError extends WebrpcError {
1477
- constructor(name = 'Unauthorized', code = 1000, message = 'Unauthorized access', status = 0, cause) {
1478
- super(name, code, message, status, cause);
1479
- Object.setPrototypeOf(this, UnauthorizedError.prototype);
1480
- }
1481
- }
1482
- class PermissionDeniedError extends WebrpcError {
1483
- constructor(name = 'PermissionDenied', code = 1001, message = 'Permission denied', status = 0, cause) {
1484
- super(name, code, message, status, cause);
1485
- Object.setPrototypeOf(this, PermissionDeniedError.prototype);
1486
- }
1487
- }
1488
- class SessionExpiredError extends WebrpcError {
1489
- constructor(name = 'SessionExpired', code = 1002, message = 'Session expired', status = 0, cause) {
1490
- super(name, code, message, status, cause);
1491
- Object.setPrototypeOf(this, SessionExpiredError.prototype);
1492
- }
1493
- }
1494
- class MethodNotFoundError extends WebrpcError {
1495
- constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) {
1496
- super(name, code, message, status, cause);
1497
- Object.setPrototypeOf(this, MethodNotFoundError.prototype);
1498
- }
1499
- }
1500
- class RequestConflictError extends WebrpcError {
1501
- constructor(name = 'RequestConflict', code = 1004, message = 'Conflict with target resource', status = 0, cause) {
1502
- super(name, code, message, status, cause);
1503
- Object.setPrototypeOf(this, RequestConflictError.prototype);
1504
- }
1505
- }
1506
1810
  class AbortedError extends WebrpcError {
1507
- constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) {
1508
- super(name, code, message, status, cause);
1811
+ constructor(error = {}) {
1812
+ super(error);
1813
+ this.name = error.name || 'Aborted';
1814
+ this.code = typeof error.code === 'number' ? error.code : 1005;
1815
+ this.message = error.message || `Request aborted`;
1816
+ this.status = typeof error.status === 'number' ? error.status : 400;
1817
+ if (error.cause !== undefined) this.cause = error.cause;
1509
1818
  Object.setPrototypeOf(this, AbortedError.prototype);
1510
1819
  }
1511
1820
  }
1512
- class GeoblockedError extends WebrpcError {
1513
- constructor(name = 'Geoblocked', code = 1006, message = 'Geoblocked region', status = 0, cause) {
1514
- super(name, code, message, status, cause);
1515
- Object.setPrototypeOf(this, GeoblockedError.prototype);
1821
+ class AccessKeyMismatchError extends WebrpcError {
1822
+ constructor(error = {}) {
1823
+ super(error);
1824
+ this.name = error.name || 'AccessKeyMismatch';
1825
+ this.code = typeof error.code === 'number' ? error.code : 1102;
1826
+ this.message = error.message || `Access key mismatch`;
1827
+ this.status = typeof error.status === 'number' ? error.status : 409;
1828
+ if (error.cause !== undefined) this.cause = error.cause;
1829
+ Object.setPrototypeOf(this, AccessKeyMismatchError.prototype);
1516
1830
  }
1517
1831
  }
1518
- class RateLimitedError extends WebrpcError {
1519
- constructor(name = 'RateLimited', code = 1007, message = 'Rate-limited. Please slow down.', status = 0, cause) {
1520
- super(name, code, message, status, cause);
1521
- Object.setPrototypeOf(this, RateLimitedError.prototype);
1832
+ class AccessKeyNotFoundError extends WebrpcError {
1833
+ constructor(error = {}) {
1834
+ super(error);
1835
+ this.name = error.name || 'AccessKeyNotFound';
1836
+ this.code = typeof error.code === 'number' ? error.code : 1101;
1837
+ this.message = error.message || `Access key not found`;
1838
+ this.status = typeof error.status === 'number' ? error.status : 401;
1839
+ if (error.cause !== undefined) this.cause = error.cause;
1840
+ Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype);
1522
1841
  }
1523
1842
  }
1524
- class ProjectNotFoundError extends WebrpcError {
1525
- constructor(name = 'ProjectNotFound', code = 1100, message = 'Project not found', status = 0, cause) {
1526
- super(name, code, message, status, cause);
1527
- Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
1843
+ class AtLeastOneKeyError extends WebrpcError {
1844
+ constructor(error = {}) {
1845
+ super(error);
1846
+ this.name = error.name || 'AtLeastOneKey';
1847
+ this.code = typeof error.code === 'number' ? error.code : 1302;
1848
+ this.message = error.message || `You need at least one Access Key`;
1849
+ this.status = typeof error.status === 'number' ? error.status : 403;
1850
+ if (error.cause !== undefined) this.cause = error.cause;
1851
+ Object.setPrototypeOf(this, AtLeastOneKeyError.prototype);
1528
1852
  }
1529
1853
  }
1530
- class AccessKeyNotFoundError extends WebrpcError {
1531
- constructor(name = 'AccessKeyNotFound', code = 1101, message = 'Access key not found', status = 0, cause) {
1532
- super(name, code, message, status, cause);
1533
- Object.setPrototypeOf(this, AccessKeyNotFoundError.prototype);
1854
+ class GeoblockedError extends WebrpcError {
1855
+ constructor(error = {}) {
1856
+ super(error);
1857
+ this.name = error.name || 'Geoblocked';
1858
+ this.code = typeof error.code === 'number' ? error.code : 1006;
1859
+ this.message = error.message || `Geoblocked region`;
1860
+ this.status = typeof error.status === 'number' ? error.status : 451;
1861
+ if (error.cause !== undefined) this.cause = error.cause;
1862
+ Object.setPrototypeOf(this, GeoblockedError.prototype);
1534
1863
  }
1535
1864
  }
1536
- class AccessKeyMismatchError extends WebrpcError {
1537
- constructor(name = 'AccessKeyMismatch', code = 1102, message = 'Access key mismatch', status = 0, cause) {
1538
- super(name, code, message, status, cause);
1539
- Object.setPrototypeOf(this, AccessKeyMismatchError.prototype);
1865
+ class InvalidArgumentError extends WebrpcError {
1866
+ constructor(error = {}) {
1867
+ super(error);
1868
+ this.name = error.name || 'InvalidArgument';
1869
+ this.code = typeof error.code === 'number' ? error.code : 2001;
1870
+ this.message = error.message || `Invalid argument`;
1871
+ this.status = typeof error.status === 'number' ? error.status : 400;
1872
+ if (error.cause !== undefined) this.cause = error.cause;
1873
+ Object.setPrototypeOf(this, InvalidArgumentError.prototype);
1540
1874
  }
1541
1875
  }
1542
1876
  class InvalidOriginError extends WebrpcError {
1543
- constructor(name = 'InvalidOrigin', code = 1103, message = 'Invalid origin for Access Key', status = 0, cause) {
1544
- super(name, code, message, status, cause);
1877
+ constructor(error = {}) {
1878
+ super(error);
1879
+ this.name = error.name || 'InvalidOrigin';
1880
+ this.code = typeof error.code === 'number' ? error.code : 1103;
1881
+ this.message = error.message || `Invalid origin for Access Key`;
1882
+ this.status = typeof error.status === 'number' ? error.status : 403;
1883
+ if (error.cause !== undefined) this.cause = error.cause;
1545
1884
  Object.setPrototypeOf(this, InvalidOriginError.prototype);
1546
1885
  }
1547
1886
  }
1548
1887
  class InvalidServiceError extends WebrpcError {
1549
- constructor(name = 'InvalidService', code = 1104, message = 'Service not enabled for Access key', status = 0, cause) {
1550
- super(name, code, message, status, cause);
1888
+ constructor(error = {}) {
1889
+ super(error);
1890
+ this.name = error.name || 'InvalidService';
1891
+ this.code = typeof error.code === 'number' ? error.code : 1104;
1892
+ this.message = error.message || `Service not enabled for Access key`;
1893
+ this.status = typeof error.status === 'number' ? error.status : 403;
1894
+ if (error.cause !== undefined) this.cause = error.cause;
1551
1895
  Object.setPrototypeOf(this, InvalidServiceError.prototype);
1552
1896
  }
1553
1897
  }
1554
- class UnauthorizedUserError extends WebrpcError {
1555
- constructor(name = 'UnauthorizedUser', code = 1105, message = 'Unauthorized user', status = 0, cause) {
1556
- super(name, code, message, status, cause);
1557
- Object.setPrototypeOf(this, UnauthorizedUserError.prototype);
1898
+ class MaxAccessKeysError extends WebrpcError {
1899
+ constructor(error = {}) {
1900
+ super(error);
1901
+ this.name = error.name || 'MaxAccessKeys';
1902
+ this.code = typeof error.code === 'number' ? error.code : 1301;
1903
+ this.message = error.message || `Access keys limit reached`;
1904
+ this.status = typeof error.status === 'number' ? error.status : 403;
1905
+ if (error.cause !== undefined) this.cause = error.cause;
1906
+ Object.setPrototypeOf(this, MaxAccessKeysError.prototype);
1558
1907
  }
1559
1908
  }
1560
- class QuotaExceededError extends WebrpcError {
1561
- constructor(name = 'QuotaExceeded', code = 1200, message = 'Quota exceeded', status = 0, cause) {
1562
- super(name, code, message, status, cause);
1563
- Object.setPrototypeOf(this, QuotaExceededError.prototype);
1909
+ class MetadataCallFailedError extends WebrpcError {
1910
+ constructor(error = {}) {
1911
+ super(error);
1912
+ this.name = error.name || 'MetadataCallFailed';
1913
+ this.code = typeof error.code === 'number' ? error.code : 3003;
1914
+ this.message = error.message || `Metadata service call failed`;
1915
+ this.status = typeof error.status === 'number' ? error.status : 400;
1916
+ if (error.cause !== undefined) this.cause = error.cause;
1917
+ Object.setPrototypeOf(this, MetadataCallFailedError.prototype);
1564
1918
  }
1565
1919
  }
1566
- class RateLimitError extends WebrpcError {
1567
- constructor(name = 'RateLimit', code = 1201, message = 'Rate limit exceeded', status = 0, cause) {
1568
- super(name, code, message, status, cause);
1569
- Object.setPrototypeOf(this, RateLimitError.prototype);
1920
+ class MethodNotFoundError extends WebrpcError {
1921
+ constructor(error = {}) {
1922
+ super(error);
1923
+ this.name = error.name || 'MethodNotFound';
1924
+ this.code = typeof error.code === 'number' ? error.code : 1003;
1925
+ this.message = error.message || `Method not found`;
1926
+ this.status = typeof error.status === 'number' ? error.status : 404;
1927
+ if (error.cause !== undefined) this.cause = error.cause;
1928
+ Object.setPrototypeOf(this, MethodNotFoundError.prototype);
1570
1929
  }
1571
1930
  }
1572
1931
  class NoDefaultKeyError extends WebrpcError {
1573
- constructor(name = 'NoDefaultKey', code = 1300, message = 'No default access key found', status = 0, cause) {
1574
- super(name, code, message, status, cause);
1932
+ constructor(error = {}) {
1933
+ super(error);
1934
+ this.name = error.name || 'NoDefaultKey';
1935
+ this.code = typeof error.code === 'number' ? error.code : 1300;
1936
+ this.message = error.message || `No default access key found`;
1937
+ this.status = typeof error.status === 'number' ? error.status : 403;
1938
+ if (error.cause !== undefined) this.cause = error.cause;
1575
1939
  Object.setPrototypeOf(this, NoDefaultKeyError.prototype);
1576
1940
  }
1577
1941
  }
1578
- class MaxAccessKeysError extends WebrpcError {
1579
- constructor(name = 'MaxAccessKeys', code = 1301, message = 'Access keys limit reached', status = 0, cause) {
1580
- super(name, code, message, status, cause);
1581
- Object.setPrototypeOf(this, MaxAccessKeysError.prototype);
1942
+ class NotFoundError extends WebrpcError {
1943
+ constructor(error = {}) {
1944
+ super(error);
1945
+ this.name = error.name || 'NotFound';
1946
+ this.code = typeof error.code === 'number' ? error.code : 3000;
1947
+ this.message = error.message || `Resource not found`;
1948
+ this.status = typeof error.status === 'number' ? error.status : 400;
1949
+ if (error.cause !== undefined) this.cause = error.cause;
1950
+ Object.setPrototypeOf(this, NotFoundError.prototype);
1582
1951
  }
1583
1952
  }
1584
- class AtLeastOneKeyError extends WebrpcError {
1585
- constructor(name = 'AtLeastOneKey', code = 1302, message = 'You need at least one Access Key', status = 0, cause) {
1586
- super(name, code, message, status, cause);
1587
- Object.setPrototypeOf(this, AtLeastOneKeyError.prototype);
1953
+ class PermissionDeniedError extends WebrpcError {
1954
+ constructor(error = {}) {
1955
+ super(error);
1956
+ this.name = error.name || 'PermissionDenied';
1957
+ this.code = typeof error.code === 'number' ? error.code : 1001;
1958
+ this.message = error.message || `Permission denied`;
1959
+ this.status = typeof error.status === 'number' ? error.status : 403;
1960
+ if (error.cause !== undefined) this.cause = error.cause;
1961
+ Object.setPrototypeOf(this, PermissionDeniedError.prototype);
1588
1962
  }
1589
1963
  }
1590
- class TimeoutError extends WebrpcError {
1591
- constructor(name = 'Timeout', code = 1900, message = 'Request timed out', status = 0, cause) {
1592
- super(name, code, message, status, cause);
1593
- Object.setPrototypeOf(this, TimeoutError.prototype);
1964
+ class ProjectNotFoundError extends WebrpcError {
1965
+ constructor(error = {}) {
1966
+ super(error);
1967
+ this.name = error.name || 'ProjectNotFound';
1968
+ this.code = typeof error.code === 'number' ? error.code : 1100;
1969
+ this.message = error.message || `Project not found`;
1970
+ this.status = typeof error.status === 'number' ? error.status : 401;
1971
+ if (error.cause !== undefined) this.cause = error.cause;
1972
+ Object.setPrototypeOf(this, ProjectNotFoundError.prototype);
1594
1973
  }
1595
1974
  }
1596
- class InvalidArgumentError extends WebrpcError {
1597
- constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) {
1598
- super(name, code, message, status, cause);
1599
- Object.setPrototypeOf(this, InvalidArgumentError.prototype);
1975
+ class QueryFailedError extends WebrpcError {
1976
+ constructor(error = {}) {
1977
+ super(error);
1978
+ this.name = error.name || 'QueryFailed';
1979
+ this.code = typeof error.code === 'number' ? error.code : 2003;
1980
+ this.message = error.message || `Query failed`;
1981
+ this.status = typeof error.status === 'number' ? error.status : 400;
1982
+ if (error.cause !== undefined) this.cause = error.cause;
1983
+ Object.setPrototypeOf(this, QueryFailedError.prototype);
1600
1984
  }
1601
1985
  }
1602
- class UnavailableError extends WebrpcError {
1603
- constructor(name = 'Unavailable', code = 2002, message = 'Unavailable resource', status = 0, cause) {
1604
- super(name, code, message, status, cause);
1605
- Object.setPrototypeOf(this, UnavailableError.prototype);
1986
+ class QuotaExceededError extends WebrpcError {
1987
+ constructor(error = {}) {
1988
+ super(error);
1989
+ this.name = error.name || 'QuotaExceeded';
1990
+ this.code = typeof error.code === 'number' ? error.code : 1200;
1991
+ this.message = error.message || `Quota exceeded`;
1992
+ this.status = typeof error.status === 'number' ? error.status : 429;
1993
+ if (error.cause !== undefined) this.cause = error.cause;
1994
+ Object.setPrototypeOf(this, QuotaExceededError.prototype);
1606
1995
  }
1607
1996
  }
1608
- class QueryFailedError extends WebrpcError {
1609
- constructor(name = 'QueryFailed', code = 2003, message = 'Query failed', status = 0, cause) {
1610
- super(name, code, message, status, cause);
1611
- Object.setPrototypeOf(this, QueryFailedError.prototype);
1997
+ class RateLimitError extends WebrpcError {
1998
+ constructor(error = {}) {
1999
+ super(error);
2000
+ this.name = error.name || 'RateLimit';
2001
+ this.code = typeof error.code === 'number' ? error.code : 1201;
2002
+ this.message = error.message || `Rate limit exceeded`;
2003
+ this.status = typeof error.status === 'number' ? error.status : 429;
2004
+ if (error.cause !== undefined) this.cause = error.cause;
2005
+ Object.setPrototypeOf(this, RateLimitError.prototype);
2006
+ }
2007
+ }
2008
+ class RateLimitedError extends WebrpcError {
2009
+ constructor(error = {}) {
2010
+ super(error);
2011
+ this.name = error.name || 'RateLimited';
2012
+ this.code = typeof error.code === 'number' ? error.code : 1007;
2013
+ this.message = error.message || `Rate-limited. Please slow down.`;
2014
+ this.status = typeof error.status === 'number' ? error.status : 429;
2015
+ if (error.cause !== undefined) this.cause = error.cause;
2016
+ Object.setPrototypeOf(this, RateLimitedError.prototype);
2017
+ }
2018
+ }
2019
+ class RequestConflictError extends WebrpcError {
2020
+ constructor(error = {}) {
2021
+ super(error);
2022
+ this.name = error.name || 'RequestConflict';
2023
+ this.code = typeof error.code === 'number' ? error.code : 1004;
2024
+ this.message = error.message || `Conflict with target resource`;
2025
+ this.status = typeof error.status === 'number' ? error.status : 409;
2026
+ if (error.cause !== undefined) this.cause = error.cause;
2027
+ Object.setPrototypeOf(this, RequestConflictError.prototype);
1612
2028
  }
1613
2029
  }
1614
2030
  class ResourceExhaustedError extends WebrpcError {
1615
- constructor(name = 'ResourceExhausted', code = 2004, message = 'Resource exhausted', status = 0, cause) {
1616
- super(name, code, message, status, cause);
2031
+ constructor(error = {}) {
2032
+ super(error);
2033
+ this.name = error.name || 'ResourceExhausted';
2034
+ this.code = typeof error.code === 'number' ? error.code : 2004;
2035
+ this.message = error.message || `Resource exhausted`;
2036
+ this.status = typeof error.status === 'number' ? error.status : 400;
2037
+ if (error.cause !== undefined) this.cause = error.cause;
1617
2038
  Object.setPrototypeOf(this, ResourceExhaustedError.prototype);
1618
2039
  }
1619
2040
  }
1620
- class NotFoundError extends WebrpcError {
1621
- constructor(name = 'NotFound', code = 3000, message = 'Resource not found', status = 0, cause) {
1622
- super(name, code, message, status, cause);
1623
- Object.setPrototypeOf(this, NotFoundError.prototype);
2041
+ class SessionExpiredError extends WebrpcError {
2042
+ constructor(error = {}) {
2043
+ super(error);
2044
+ this.name = error.name || 'SessionExpired';
2045
+ this.code = typeof error.code === 'number' ? error.code : 1002;
2046
+ this.message = error.message || `Session expired`;
2047
+ this.status = typeof error.status === 'number' ? error.status : 403;
2048
+ if (error.cause !== undefined) this.cause = error.cause;
2049
+ Object.setPrototypeOf(this, SessionExpiredError.prototype);
1624
2050
  }
1625
2051
  }
1626
- class MetadataCallFailedError extends WebrpcError {
1627
- constructor(name = 'MetadataCallFailed', code = 3003, message = 'Metadata service call failed', status = 0, cause) {
1628
- super(name, code, message, status, cause);
1629
- Object.setPrototypeOf(this, MetadataCallFailedError.prototype);
2052
+ class TimeoutError extends WebrpcError {
2053
+ constructor(error = {}) {
2054
+ super(error);
2055
+ this.name = error.name || 'Timeout';
2056
+ this.code = typeof error.code === 'number' ? error.code : 1900;
2057
+ this.message = error.message || `Request timed out`;
2058
+ this.status = typeof error.status === 'number' ? error.status : 408;
2059
+ if (error.cause !== undefined) this.cause = error.cause;
2060
+ Object.setPrototypeOf(this, TimeoutError.prototype);
2061
+ }
2062
+ }
2063
+ class UnauthorizedError extends WebrpcError {
2064
+ constructor(error = {}) {
2065
+ super(error);
2066
+ this.name = error.name || 'Unauthorized';
2067
+ this.code = typeof error.code === 'number' ? error.code : 1000;
2068
+ this.message = error.message || `Unauthorized access`;
2069
+ this.status = typeof error.status === 'number' ? error.status : 401;
2070
+ if (error.cause !== undefined) this.cause = error.cause;
2071
+ Object.setPrototypeOf(this, UnauthorizedError.prototype);
2072
+ }
2073
+ }
2074
+ class UnauthorizedUserError extends WebrpcError {
2075
+ constructor(error = {}) {
2076
+ super(error);
2077
+ this.name = error.name || 'UnauthorizedUser';
2078
+ this.code = typeof error.code === 'number' ? error.code : 1105;
2079
+ this.message = error.message || `Unauthorized user`;
2080
+ this.status = typeof error.status === 'number' ? error.status : 403;
2081
+ if (error.cause !== undefined) this.cause = error.cause;
2082
+ Object.setPrototypeOf(this, UnauthorizedUserError.prototype);
2083
+ }
2084
+ }
2085
+ class UnavailableError extends WebrpcError {
2086
+ constructor(error = {}) {
2087
+ super(error);
2088
+ this.name = error.name || 'Unavailable';
2089
+ this.code = typeof error.code === 'number' ? error.code : 2002;
2090
+ this.message = error.message || `Unavailable resource`;
2091
+ this.status = typeof error.status === 'number' ? error.status : 400;
2092
+ if (error.cause !== undefined) this.cause = error.cause;
2093
+ Object.setPrototypeOf(this, UnavailableError.prototype);
1630
2094
  }
1631
2095
  }
1632
2096
  let errors = /*#__PURE__*/function (errors) {
@@ -1638,37 +2102,77 @@ let errors = /*#__PURE__*/function (errors) {
1638
2102
  errors["WebrpcBadResponse"] = "WebrpcBadResponse";
1639
2103
  errors["WebrpcServerPanic"] = "WebrpcServerPanic";
1640
2104
  errors["WebrpcInternalError"] = "WebrpcInternalError";
1641
- errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
2105
+ errors["WebrpcClientAborted"] = "WebrpcClientAborted";
1642
2106
  errors["WebrpcStreamLost"] = "WebrpcStreamLost";
1643
2107
  errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
1644
- errors["Unauthorized"] = "Unauthorized";
1645
- errors["PermissionDenied"] = "PermissionDenied";
1646
- errors["SessionExpired"] = "SessionExpired";
1647
- errors["MethodNotFound"] = "MethodNotFound";
1648
- errors["RequestConflict"] = "RequestConflict";
1649
2108
  errors["Aborted"] = "Aborted";
1650
- errors["Geoblocked"] = "Geoblocked";
1651
- errors["RateLimited"] = "RateLimited";
1652
- errors["ProjectNotFound"] = "ProjectNotFound";
1653
- errors["AccessKeyNotFound"] = "AccessKeyNotFound";
1654
2109
  errors["AccessKeyMismatch"] = "AccessKeyMismatch";
2110
+ errors["AccessKeyNotFound"] = "AccessKeyNotFound";
2111
+ errors["AtLeastOneKey"] = "AtLeastOneKey";
2112
+ errors["Geoblocked"] = "Geoblocked";
2113
+ errors["InvalidArgument"] = "InvalidArgument";
1655
2114
  errors["InvalidOrigin"] = "InvalidOrigin";
1656
2115
  errors["InvalidService"] = "InvalidService";
1657
- errors["UnauthorizedUser"] = "UnauthorizedUser";
2116
+ errors["MaxAccessKeys"] = "MaxAccessKeys";
2117
+ errors["MetadataCallFailed"] = "MetadataCallFailed";
2118
+ errors["MethodNotFound"] = "MethodNotFound";
2119
+ errors["NoDefaultKey"] = "NoDefaultKey";
2120
+ errors["NotFound"] = "NotFound";
2121
+ errors["PermissionDenied"] = "PermissionDenied";
2122
+ errors["ProjectNotFound"] = "ProjectNotFound";
2123
+ errors["QueryFailed"] = "QueryFailed";
1658
2124
  errors["QuotaExceeded"] = "QuotaExceeded";
1659
2125
  errors["RateLimit"] = "RateLimit";
1660
- errors["NoDefaultKey"] = "NoDefaultKey";
1661
- errors["MaxAccessKeys"] = "MaxAccessKeys";
1662
- errors["AtLeastOneKey"] = "AtLeastOneKey";
2126
+ errors["RateLimited"] = "RateLimited";
2127
+ errors["RequestConflict"] = "RequestConflict";
2128
+ errors["ResourceExhausted"] = "ResourceExhausted";
2129
+ errors["SessionExpired"] = "SessionExpired";
1663
2130
  errors["Timeout"] = "Timeout";
1664
- errors["InvalidArgument"] = "InvalidArgument";
2131
+ errors["Unauthorized"] = "Unauthorized";
2132
+ errors["UnauthorizedUser"] = "UnauthorizedUser";
1665
2133
  errors["Unavailable"] = "Unavailable";
1666
- errors["QueryFailed"] = "QueryFailed";
1667
- errors["ResourceExhausted"] = "ResourceExhausted";
1668
- errors["NotFound"] = "NotFound";
1669
- errors["MetadataCallFailed"] = "MetadataCallFailed";
1670
2134
  return errors;
1671
2135
  }({});
2136
+ let WebrpcErrorCodes = /*#__PURE__*/function (WebrpcErrorCodes) {
2137
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcEndpoint"] = 0] = "WebrpcEndpoint";
2138
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcRequestFailed"] = -1] = "WebrpcRequestFailed";
2139
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRoute"] = -2] = "WebrpcBadRoute";
2140
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadMethod"] = -3] = "WebrpcBadMethod";
2141
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadRequest"] = -4] = "WebrpcBadRequest";
2142
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcBadResponse"] = -5] = "WebrpcBadResponse";
2143
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcServerPanic"] = -6] = "WebrpcServerPanic";
2144
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcInternalError"] = -7] = "WebrpcInternalError";
2145
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcClientAborted"] = -8] = "WebrpcClientAborted";
2146
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamLost"] = -9] = "WebrpcStreamLost";
2147
+ WebrpcErrorCodes[WebrpcErrorCodes["WebrpcStreamFinished"] = -10] = "WebrpcStreamFinished";
2148
+ WebrpcErrorCodes[WebrpcErrorCodes["Aborted"] = 1005] = "Aborted";
2149
+ WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyMismatch"] = 1102] = "AccessKeyMismatch";
2150
+ WebrpcErrorCodes[WebrpcErrorCodes["AccessKeyNotFound"] = 1101] = "AccessKeyNotFound";
2151
+ WebrpcErrorCodes[WebrpcErrorCodes["AtLeastOneKey"] = 1302] = "AtLeastOneKey";
2152
+ WebrpcErrorCodes[WebrpcErrorCodes["Geoblocked"] = 1006] = "Geoblocked";
2153
+ WebrpcErrorCodes[WebrpcErrorCodes["InvalidArgument"] = 2001] = "InvalidArgument";
2154
+ WebrpcErrorCodes[WebrpcErrorCodes["InvalidOrigin"] = 1103] = "InvalidOrigin";
2155
+ WebrpcErrorCodes[WebrpcErrorCodes["InvalidService"] = 1104] = "InvalidService";
2156
+ WebrpcErrorCodes[WebrpcErrorCodes["MaxAccessKeys"] = 1301] = "MaxAccessKeys";
2157
+ WebrpcErrorCodes[WebrpcErrorCodes["MetadataCallFailed"] = 3003] = "MetadataCallFailed";
2158
+ WebrpcErrorCodes[WebrpcErrorCodes["MethodNotFound"] = 1003] = "MethodNotFound";
2159
+ WebrpcErrorCodes[WebrpcErrorCodes["NoDefaultKey"] = 1300] = "NoDefaultKey";
2160
+ WebrpcErrorCodes[WebrpcErrorCodes["NotFound"] = 3000] = "NotFound";
2161
+ WebrpcErrorCodes[WebrpcErrorCodes["PermissionDenied"] = 1001] = "PermissionDenied";
2162
+ WebrpcErrorCodes[WebrpcErrorCodes["ProjectNotFound"] = 1100] = "ProjectNotFound";
2163
+ WebrpcErrorCodes[WebrpcErrorCodes["QueryFailed"] = 2003] = "QueryFailed";
2164
+ WebrpcErrorCodes[WebrpcErrorCodes["QuotaExceeded"] = 1200] = "QuotaExceeded";
2165
+ WebrpcErrorCodes[WebrpcErrorCodes["RateLimit"] = 1201] = "RateLimit";
2166
+ WebrpcErrorCodes[WebrpcErrorCodes["RateLimited"] = 1007] = "RateLimited";
2167
+ WebrpcErrorCodes[WebrpcErrorCodes["RequestConflict"] = 1004] = "RequestConflict";
2168
+ WebrpcErrorCodes[WebrpcErrorCodes["ResourceExhausted"] = 2004] = "ResourceExhausted";
2169
+ WebrpcErrorCodes[WebrpcErrorCodes["SessionExpired"] = 1002] = "SessionExpired";
2170
+ WebrpcErrorCodes[WebrpcErrorCodes["Timeout"] = 1900] = "Timeout";
2171
+ WebrpcErrorCodes[WebrpcErrorCodes["Unauthorized"] = 1000] = "Unauthorized";
2172
+ WebrpcErrorCodes[WebrpcErrorCodes["UnauthorizedUser"] = 1105] = "UnauthorizedUser";
2173
+ WebrpcErrorCodes[WebrpcErrorCodes["Unavailable"] = 2002] = "Unavailable";
2174
+ return WebrpcErrorCodes;
2175
+ }({});
1672
2176
  const webrpcErrorByCode = {
1673
2177
  [0]: WebrpcEndpointError,
1674
2178
  [-1]: WebrpcRequestFailedError,
@@ -1678,57 +2182,98 @@ const webrpcErrorByCode = {
1678
2182
  [-5]: WebrpcBadResponseError,
1679
2183
  [-6]: WebrpcServerPanicError,
1680
2184
  [-7]: WebrpcInternalErrorError,
1681
- [-8]: WebrpcClientDisconnectedError,
2185
+ [-8]: WebrpcClientAbortedError,
1682
2186
  [-9]: WebrpcStreamLostError,
1683
2187
  [-10]: WebrpcStreamFinishedError,
1684
- [1000]: UnauthorizedError,
1685
- [1001]: PermissionDeniedError,
1686
- [1002]: SessionExpiredError,
1687
- [1003]: MethodNotFoundError,
1688
- [1004]: RequestConflictError,
1689
2188
  [1005]: AbortedError,
1690
- [1006]: GeoblockedError,
1691
- [1007]: RateLimitedError,
1692
- [1100]: ProjectNotFoundError,
1693
- [1101]: AccessKeyNotFoundError,
1694
2189
  [1102]: AccessKeyMismatchError,
2190
+ [1101]: AccessKeyNotFoundError,
2191
+ [1302]: AtLeastOneKeyError,
2192
+ [1006]: GeoblockedError,
2193
+ [2001]: InvalidArgumentError,
1695
2194
  [1103]: InvalidOriginError,
1696
2195
  [1104]: InvalidServiceError,
1697
- [1105]: UnauthorizedUserError,
1698
- [1200]: QuotaExceededError,
1699
- [1201]: RateLimitError,
1700
- [1300]: NoDefaultKeyError,
1701
2196
  [1301]: MaxAccessKeysError,
1702
- [1302]: AtLeastOneKeyError,
1703
- [1900]: TimeoutError,
1704
- [2001]: InvalidArgumentError,
1705
- [2002]: UnavailableError,
2197
+ [3003]: MetadataCallFailedError,
2198
+ [1003]: MethodNotFoundError,
2199
+ [1300]: NoDefaultKeyError,
2200
+ [3000]: NotFoundError,
2201
+ [1001]: PermissionDeniedError,
2202
+ [1100]: ProjectNotFoundError,
1706
2203
  [2003]: QueryFailedError,
2204
+ [1200]: QuotaExceededError,
2205
+ [1201]: RateLimitError,
2206
+ [1007]: RateLimitedError,
2207
+ [1004]: RequestConflictError,
1707
2208
  [2004]: ResourceExhaustedError,
1708
- [3000]: NotFoundError,
1709
- [3003]: MetadataCallFailedError
2209
+ [1002]: SessionExpiredError,
2210
+ [1900]: TimeoutError,
2211
+ [1000]: UnauthorizedError,
2212
+ [1105]: UnauthorizedUserError,
2213
+ [2002]: UnavailableError
1710
2214
  };
1711
2215
 
2216
+ //
2217
+ // Webrpc
2218
+ //
2219
+
2220
+ const WebrpcHeader = "Webrpc";
2221
+ const WebrpcHeaderValue = "webrpc@v0.31.2;gen-typescript@v0.23.1;sequence-indexer@v0.4.0";
2222
+ function VersionFromHeader(headers) {
2223
+ const headerValue = headers.get(WebrpcHeader);
2224
+ if (!headerValue) {
2225
+ return {
2226
+ WebrpcGenVersion: "",
2227
+ codeGenName: "",
2228
+ codeGenVersion: "",
2229
+ schemaName: "",
2230
+ schemaVersion: ""
2231
+ };
2232
+ }
2233
+ return parseWebrpcGenVersions(headerValue);
2234
+ }
2235
+ function parseWebrpcGenVersions(header) {
2236
+ const versions = header.split(";");
2237
+ if (versions.length < 3) {
2238
+ return {
2239
+ WebrpcGenVersion: "",
2240
+ codeGenName: "",
2241
+ codeGenVersion: "",
2242
+ schemaName: "",
2243
+ schemaVersion: ""
2244
+ };
2245
+ }
2246
+ const [_, WebrpcGenVersion] = versions[0].split("@");
2247
+ const [codeGenName, codeGenVersion] = versions[1].split("@");
2248
+ const [schemaName, schemaVersion] = versions[2].split("@");
2249
+ return {
2250
+ WebrpcGenVersion: WebrpcGenVersion != null ? WebrpcGenVersion : "",
2251
+ codeGenName: codeGenName != null ? codeGenName : "",
2252
+ codeGenVersion: codeGenVersion != null ? codeGenVersion : "",
2253
+ schemaName: schemaName != null ? schemaName : "",
2254
+ schemaVersion: schemaVersion != null ? schemaVersion : ""
2255
+ };
2256
+ }
2257
+
1712
2258
  var indexergw_gen = /*#__PURE__*/Object.freeze({
1713
2259
  __proto__: null,
1714
- WebrpcHeader: WebrpcHeader,
1715
- WebrpcHeaderValue: WebrpcHeaderValue,
1716
- WebRPCVersion: WebRPCVersion,
1717
- WebRPCSchemaVersion: WebRPCSchemaVersion,
1718
- WebRPCSchemaHash: WebRPCSchemaHash,
1719
- VersionFromHeader: VersionFromHeader,
1720
- ResourceStatus: ResourceStatus,
2260
+ WebrpcVersion: WebrpcVersion,
2261
+ WebrpcSchemaVersion: WebrpcSchemaVersion,
2262
+ WebrpcSchemaHash: WebrpcSchemaHash,
1721
2263
  ContractType: ContractType,
1722
- EventLogType: EventLogType,
2264
+ ContractVerificationStatus: ContractVerificationStatus,
1723
2265
  EventLogDataType: EventLogDataType,
2266
+ EventLogType: EventLogType,
2267
+ NetworkType: NetworkType,
1724
2268
  OrderStatus: OrderStatus,
1725
- TxnTransferType: TxnTransferType,
2269
+ ResourceStatus: ResourceStatus,
2270
+ SortOrder: SortOrder,
1726
2271
  TransactionStatus: TransactionStatus,
1727
2272
  TransactionType: TransactionType,
1728
- SortOrder: SortOrder,
1729
- ContractVerificationStatus: ContractVerificationStatus,
1730
- NetworkType: NetworkType,
2273
+ TxnTransferType: TxnTransferType,
1731
2274
  IndexerGateway: IndexerGateway,
2275
+ JsonEncode: JsonEncode,
2276
+ JsonDecode: JsonDecode,
1732
2277
  WebrpcError: WebrpcError,
1733
2278
  WebrpcEndpointError: WebrpcEndpointError,
1734
2279
  WebrpcRequestFailedError: WebrpcRequestFailedError,
@@ -1738,36 +2283,41 @@ var indexergw_gen = /*#__PURE__*/Object.freeze({
1738
2283
  WebrpcBadResponseError: WebrpcBadResponseError,
1739
2284
  WebrpcServerPanicError: WebrpcServerPanicError,
1740
2285
  WebrpcInternalErrorError: WebrpcInternalErrorError,
1741
- WebrpcClientDisconnectedError: WebrpcClientDisconnectedError,
2286
+ WebrpcClientAbortedError: WebrpcClientAbortedError,
1742
2287
  WebrpcStreamLostError: WebrpcStreamLostError,
1743
2288
  WebrpcStreamFinishedError: WebrpcStreamFinishedError,
1744
- UnauthorizedError: UnauthorizedError,
1745
- PermissionDeniedError: PermissionDeniedError,
1746
- SessionExpiredError: SessionExpiredError,
1747
- MethodNotFoundError: MethodNotFoundError,
1748
- RequestConflictError: RequestConflictError,
1749
2289
  AbortedError: AbortedError,
1750
- GeoblockedError: GeoblockedError,
1751
- RateLimitedError: RateLimitedError,
1752
- ProjectNotFoundError: ProjectNotFoundError,
1753
- AccessKeyNotFoundError: AccessKeyNotFoundError,
1754
2290
  AccessKeyMismatchError: AccessKeyMismatchError,
2291
+ AccessKeyNotFoundError: AccessKeyNotFoundError,
2292
+ AtLeastOneKeyError: AtLeastOneKeyError,
2293
+ GeoblockedError: GeoblockedError,
2294
+ InvalidArgumentError: InvalidArgumentError,
1755
2295
  InvalidOriginError: InvalidOriginError,
1756
2296
  InvalidServiceError: InvalidServiceError,
1757
- UnauthorizedUserError: UnauthorizedUserError,
2297
+ MaxAccessKeysError: MaxAccessKeysError,
2298
+ MetadataCallFailedError: MetadataCallFailedError,
2299
+ MethodNotFoundError: MethodNotFoundError,
2300
+ NoDefaultKeyError: NoDefaultKeyError,
2301
+ NotFoundError: NotFoundError,
2302
+ PermissionDeniedError: PermissionDeniedError,
2303
+ ProjectNotFoundError: ProjectNotFoundError,
2304
+ QueryFailedError: QueryFailedError,
1758
2305
  QuotaExceededError: QuotaExceededError,
1759
2306
  RateLimitError: RateLimitError,
1760
- NoDefaultKeyError: NoDefaultKeyError,
1761
- MaxAccessKeysError: MaxAccessKeysError,
1762
- AtLeastOneKeyError: AtLeastOneKeyError,
2307
+ RateLimitedError: RateLimitedError,
2308
+ RequestConflictError: RequestConflictError,
2309
+ ResourceExhaustedError: ResourceExhaustedError,
2310
+ SessionExpiredError: SessionExpiredError,
1763
2311
  TimeoutError: TimeoutError,
1764
- InvalidArgumentError: InvalidArgumentError,
2312
+ UnauthorizedError: UnauthorizedError,
2313
+ UnauthorizedUserError: UnauthorizedUserError,
1765
2314
  UnavailableError: UnavailableError,
1766
- QueryFailedError: QueryFailedError,
1767
- ResourceExhaustedError: ResourceExhaustedError,
1768
- NotFoundError: NotFoundError,
1769
- MetadataCallFailedError: MetadataCallFailedError,
1770
- errors: errors
2315
+ errors: errors,
2316
+ WebrpcErrorCodes: WebrpcErrorCodes,
2317
+ webrpcErrorByCode: webrpcErrorByCode,
2318
+ WebrpcHeader: WebrpcHeader,
2319
+ WebrpcHeaderValue: WebrpcHeaderValue,
2320
+ VersionFromHeader: VersionFromHeader
1771
2321
  });
1772
2322
 
1773
2323
  class SequenceIndexer extends Indexer {
@@ -1835,6 +2385,8 @@ exports.IndexerGateway = indexergw_gen;
1835
2385
  exports.InvalidArgumentError = InvalidArgumentError$1;
1836
2386
  exports.InvalidOriginError = InvalidOriginError$1;
1837
2387
  exports.InvalidServiceError = InvalidServiceError$1;
2388
+ exports.JsonDecode = JsonDecode$1;
2389
+ exports.JsonEncode = JsonEncode$1;
1838
2390
  exports.MaxAccessKeysError = MaxAccessKeysError$1;
1839
2391
  exports.MetadataCallFailedError = MetadataCallFailedError$1;
1840
2392
  exports.MethodNotFoundError = MethodNotFoundError$1;
@@ -1863,21 +2415,23 @@ exports.UnauthorizedError = UnauthorizedError$1;
1863
2415
  exports.UnauthorizedUserError = UnauthorizedUserError$1;
1864
2416
  exports.UnavailableError = UnavailableError$1;
1865
2417
  exports.VersionFromHeader = VersionFromHeader$1;
1866
- exports.WebRPCSchemaHash = WebRPCSchemaHash$1;
1867
- exports.WebRPCSchemaVersion = WebRPCSchemaVersion$1;
1868
- exports.WebRPCVersion = WebRPCVersion$1;
1869
2418
  exports.WebrpcBadMethodError = WebrpcBadMethodError$1;
1870
2419
  exports.WebrpcBadRequestError = WebrpcBadRequestError$1;
1871
2420
  exports.WebrpcBadResponseError = WebrpcBadResponseError$1;
1872
2421
  exports.WebrpcBadRouteError = WebrpcBadRouteError$1;
1873
- exports.WebrpcClientDisconnectedError = WebrpcClientDisconnectedError$1;
2422
+ exports.WebrpcClientAbortedError = WebrpcClientAbortedError$1;
1874
2423
  exports.WebrpcEndpointError = WebrpcEndpointError$1;
1875
2424
  exports.WebrpcError = WebrpcError$1;
2425
+ exports.WebrpcErrorCodes = WebrpcErrorCodes$1;
1876
2426
  exports.WebrpcHeader = WebrpcHeader$1;
1877
2427
  exports.WebrpcHeaderValue = WebrpcHeaderValue$1;
1878
2428
  exports.WebrpcInternalErrorError = WebrpcInternalErrorError$1;
1879
2429
  exports.WebrpcRequestFailedError = WebrpcRequestFailedError$1;
2430
+ exports.WebrpcSchemaHash = WebrpcSchemaHash$1;
2431
+ exports.WebrpcSchemaVersion = WebrpcSchemaVersion$1;
1880
2432
  exports.WebrpcServerPanicError = WebrpcServerPanicError$1;
1881
2433
  exports.WebrpcStreamFinishedError = WebrpcStreamFinishedError$1;
1882
2434
  exports.WebrpcStreamLostError = WebrpcStreamLostError$1;
2435
+ exports.WebrpcVersion = WebrpcVersion$1;
1883
2436
  exports.errors = errors$1;
2437
+ exports.webrpcErrorByCode = webrpcErrorByCode$1;