@0xsequence/indexer 2.3.40 → 2.3.41

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