@0xsequence/indexer 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/indexer.gen.d.ts.map +1 -1
- package/dist/indexer.gen.js +219 -153
- package/dist/indexergw.gen.d.ts.map +1 -1
- package/dist/indexergw.gen.js +86 -60
- package/package.json +3 -3
- package/src/indexer.gen.ts +403 -277
- package/src/indexergw.gen.ts +153 -107
package/dist/indexer.gen.js
CHANGED
|
@@ -138,267 +138,325 @@ export class Indexer {
|
|
|
138
138
|
syncBalance: (req) => ['Indexer', 'syncBalance', req],
|
|
139
139
|
toggleWebhookListener: (req) => ['Indexer', 'toggleWebhookListener', req],
|
|
140
140
|
updateWebhookListener: (req) => ['Indexer', 'updateWebhookListener', req],
|
|
141
|
-
version: () => ['Indexer', 'version']
|
|
141
|
+
version: () => ['Indexer', 'version'],
|
|
142
142
|
};
|
|
143
143
|
addWebhookListener = (req, headers, signal) => {
|
|
144
|
-
return this.fetch(this.url('AddWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
145
|
-
return buildResponse(res).then(_data => {
|
|
144
|
+
return this.fetch(this.url('AddWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
145
|
+
return buildResponse(res).then((_data) => {
|
|
146
146
|
return JsonDecode(_data, 'AddWebhookListenerResponse');
|
|
147
147
|
});
|
|
148
|
-
}, error => {
|
|
149
|
-
throw WebrpcRequestFailedError.new({
|
|
148
|
+
}, (error) => {
|
|
149
|
+
throw WebrpcRequestFailedError.new({
|
|
150
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
151
|
+
});
|
|
150
152
|
});
|
|
151
153
|
};
|
|
152
154
|
fetchTransactionReceipt = (req, headers, signal) => {
|
|
153
|
-
return this.fetch(this.url('FetchTransactionReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
154
|
-
return buildResponse(res).then(_data => {
|
|
155
|
+
return this.fetch(this.url('FetchTransactionReceipt'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
156
|
+
return buildResponse(res).then((_data) => {
|
|
155
157
|
return JsonDecode(_data, 'FetchTransactionReceiptResponse');
|
|
156
158
|
});
|
|
157
|
-
}, error => {
|
|
158
|
-
throw WebrpcRequestFailedError.new({
|
|
159
|
+
}, (error) => {
|
|
160
|
+
throw WebrpcRequestFailedError.new({
|
|
161
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
162
|
+
});
|
|
159
163
|
});
|
|
160
164
|
};
|
|
161
165
|
fetchTransactionReceiptWithFilter = (req, headers, signal) => {
|
|
162
|
-
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
163
|
-
return buildResponse(res).then(_data => {
|
|
166
|
+
return this.fetch(this.url('FetchTransactionReceiptWithFilter'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
167
|
+
return buildResponse(res).then((_data) => {
|
|
164
168
|
return JsonDecode(_data, 'FetchTransactionReceiptWithFilterResponse');
|
|
165
169
|
});
|
|
166
|
-
}, error => {
|
|
167
|
-
throw WebrpcRequestFailedError.new({
|
|
170
|
+
}, (error) => {
|
|
171
|
+
throw WebrpcRequestFailedError.new({
|
|
172
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
173
|
+
});
|
|
168
174
|
});
|
|
169
175
|
};
|
|
170
176
|
getAllWebhookListeners = (req, headers, signal) => {
|
|
171
|
-
return this.fetch(this.url('GetAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
172
|
-
return buildResponse(res).then(_data => {
|
|
177
|
+
return this.fetch(this.url('GetAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
178
|
+
return buildResponse(res).then((_data) => {
|
|
173
179
|
return JsonDecode(_data, 'GetAllWebhookListenersResponse');
|
|
174
180
|
});
|
|
175
|
-
}, error => {
|
|
176
|
-
throw WebrpcRequestFailedError.new({
|
|
181
|
+
}, (error) => {
|
|
182
|
+
throw WebrpcRequestFailedError.new({
|
|
183
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
184
|
+
});
|
|
177
185
|
});
|
|
178
186
|
};
|
|
179
187
|
getBalanceUpdates = (req, headers, signal) => {
|
|
180
|
-
return this.fetch(this.url('GetBalanceUpdates'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
181
|
-
return buildResponse(res).then(_data => {
|
|
188
|
+
return this.fetch(this.url('GetBalanceUpdates'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
189
|
+
return buildResponse(res).then((_data) => {
|
|
182
190
|
return JsonDecode(_data, 'GetBalanceUpdatesResponse');
|
|
183
191
|
});
|
|
184
|
-
}, error => {
|
|
185
|
-
throw WebrpcRequestFailedError.new({
|
|
192
|
+
}, (error) => {
|
|
193
|
+
throw WebrpcRequestFailedError.new({
|
|
194
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
195
|
+
});
|
|
186
196
|
});
|
|
187
197
|
};
|
|
188
198
|
getChainID = (headers, signal) => {
|
|
189
|
-
return this.fetch(this.url('GetChainID'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
190
|
-
return buildResponse(res).then(_data => {
|
|
199
|
+
return this.fetch(this.url('GetChainID'), createHttpRequest('{}', headers, signal)).then((res) => {
|
|
200
|
+
return buildResponse(res).then((_data) => {
|
|
191
201
|
return JsonDecode(_data, 'GetChainIDResponse');
|
|
192
202
|
});
|
|
193
|
-
}, error => {
|
|
194
|
-
throw WebrpcRequestFailedError.new({
|
|
203
|
+
}, (error) => {
|
|
204
|
+
throw WebrpcRequestFailedError.new({
|
|
205
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
206
|
+
});
|
|
195
207
|
});
|
|
196
208
|
};
|
|
197
209
|
getEtherBalance = (req, headers, signal) => {
|
|
198
|
-
return this.fetch(this.url('GetEtherBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
199
|
-
return buildResponse(res).then(_data => {
|
|
210
|
+
return this.fetch(this.url('GetEtherBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
211
|
+
return buildResponse(res).then((_data) => {
|
|
200
212
|
return JsonDecode(_data, 'GetEtherBalanceResponse');
|
|
201
213
|
});
|
|
202
|
-
}, error => {
|
|
203
|
-
throw WebrpcRequestFailedError.new({
|
|
214
|
+
}, (error) => {
|
|
215
|
+
throw WebrpcRequestFailedError.new({
|
|
216
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
217
|
+
});
|
|
204
218
|
});
|
|
205
219
|
};
|
|
206
220
|
getMarketplaceOrders = (req, headers, signal) => {
|
|
207
|
-
return this.fetch(this.url('GetMarketplaceOrders'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
208
|
-
return buildResponse(res).then(_data => {
|
|
221
|
+
return this.fetch(this.url('GetMarketplaceOrders'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
222
|
+
return buildResponse(res).then((_data) => {
|
|
209
223
|
return JsonDecode(_data, 'GetMarketplaceOrdersResponse');
|
|
210
224
|
});
|
|
211
|
-
}, error => {
|
|
212
|
-
throw WebrpcRequestFailedError.new({
|
|
225
|
+
}, (error) => {
|
|
226
|
+
throw WebrpcRequestFailedError.new({
|
|
227
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
228
|
+
});
|
|
213
229
|
});
|
|
214
230
|
};
|
|
215
231
|
getMarketplaceTopOrders = (req, headers, signal) => {
|
|
216
|
-
return this.fetch(this.url('GetMarketplaceTopOrders'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
217
|
-
return buildResponse(res).then(_data => {
|
|
232
|
+
return this.fetch(this.url('GetMarketplaceTopOrders'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
233
|
+
return buildResponse(res).then((_data) => {
|
|
218
234
|
return JsonDecode(_data, 'GetMarketplaceTopOrdersResponse');
|
|
219
235
|
});
|
|
220
|
-
}, error => {
|
|
221
|
-
throw WebrpcRequestFailedError.new({
|
|
236
|
+
}, (error) => {
|
|
237
|
+
throw WebrpcRequestFailedError.new({
|
|
238
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
239
|
+
});
|
|
222
240
|
});
|
|
223
241
|
};
|
|
224
242
|
getNativeTokenBalance = (req, headers, signal) => {
|
|
225
|
-
return this.fetch(this.url('GetNativeTokenBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
226
|
-
return buildResponse(res).then(_data => {
|
|
243
|
+
return this.fetch(this.url('GetNativeTokenBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
244
|
+
return buildResponse(res).then((_data) => {
|
|
227
245
|
return JsonDecode(_data, 'GetNativeTokenBalanceResponse');
|
|
228
246
|
});
|
|
229
|
-
}, error => {
|
|
230
|
-
throw WebrpcRequestFailedError.new({
|
|
247
|
+
}, (error) => {
|
|
248
|
+
throw WebrpcRequestFailedError.new({
|
|
249
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
250
|
+
});
|
|
231
251
|
});
|
|
232
252
|
};
|
|
233
253
|
getTokenBalances = (req, headers, signal) => {
|
|
234
|
-
return this.fetch(this.url('GetTokenBalances'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
235
|
-
return buildResponse(res).then(_data => {
|
|
254
|
+
return this.fetch(this.url('GetTokenBalances'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
255
|
+
return buildResponse(res).then((_data) => {
|
|
236
256
|
return JsonDecode(_data, 'GetTokenBalancesResponse');
|
|
237
257
|
});
|
|
238
|
-
}, error => {
|
|
239
|
-
throw WebrpcRequestFailedError.new({
|
|
258
|
+
}, (error) => {
|
|
259
|
+
throw WebrpcRequestFailedError.new({
|
|
260
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
261
|
+
});
|
|
240
262
|
});
|
|
241
263
|
};
|
|
242
264
|
getTokenBalancesByContract = (req, headers, signal) => {
|
|
243
|
-
return this.fetch(this.url('GetTokenBalancesByContract'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
244
|
-
return buildResponse(res).then(_data => {
|
|
265
|
+
return this.fetch(this.url('GetTokenBalancesByContract'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
266
|
+
return buildResponse(res).then((_data) => {
|
|
245
267
|
return JsonDecode(_data, 'GetTokenBalancesByContractResponse');
|
|
246
268
|
});
|
|
247
|
-
}, error => {
|
|
248
|
-
throw WebrpcRequestFailedError.new({
|
|
269
|
+
}, (error) => {
|
|
270
|
+
throw WebrpcRequestFailedError.new({
|
|
271
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
272
|
+
});
|
|
249
273
|
});
|
|
250
274
|
};
|
|
251
275
|
getTokenBalancesDetails = (req, headers, signal) => {
|
|
252
|
-
return this.fetch(this.url('GetTokenBalancesDetails'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
253
|
-
return buildResponse(res).then(_data => {
|
|
276
|
+
return this.fetch(this.url('GetTokenBalancesDetails'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
277
|
+
return buildResponse(res).then((_data) => {
|
|
254
278
|
return JsonDecode(_data, 'GetTokenBalancesDetailsResponse');
|
|
255
279
|
});
|
|
256
|
-
}, error => {
|
|
257
|
-
throw WebrpcRequestFailedError.new({
|
|
280
|
+
}, (error) => {
|
|
281
|
+
throw WebrpcRequestFailedError.new({
|
|
282
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
283
|
+
});
|
|
258
284
|
});
|
|
259
285
|
};
|
|
260
286
|
getTokenBalancesSummary = (req, headers, signal) => {
|
|
261
|
-
return this.fetch(this.url('GetTokenBalancesSummary'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
262
|
-
return buildResponse(res).then(_data => {
|
|
287
|
+
return this.fetch(this.url('GetTokenBalancesSummary'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
288
|
+
return buildResponse(res).then((_data) => {
|
|
263
289
|
return JsonDecode(_data, 'GetTokenBalancesSummaryResponse');
|
|
264
290
|
});
|
|
265
|
-
}, error => {
|
|
266
|
-
throw WebrpcRequestFailedError.new({
|
|
291
|
+
}, (error) => {
|
|
292
|
+
throw WebrpcRequestFailedError.new({
|
|
293
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
294
|
+
});
|
|
267
295
|
});
|
|
268
296
|
};
|
|
269
297
|
getTokenIDRanges = (req, headers, signal) => {
|
|
270
|
-
return this.fetch(this.url('GetTokenIDRanges'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
271
|
-
return buildResponse(res).then(_data => {
|
|
298
|
+
return this.fetch(this.url('GetTokenIDRanges'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
299
|
+
return buildResponse(res).then((_data) => {
|
|
272
300
|
return JsonDecode(_data, 'GetTokenIDRangesResponse');
|
|
273
301
|
});
|
|
274
|
-
}, error => {
|
|
275
|
-
throw WebrpcRequestFailedError.new({
|
|
302
|
+
}, (error) => {
|
|
303
|
+
throw WebrpcRequestFailedError.new({
|
|
304
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
305
|
+
});
|
|
276
306
|
});
|
|
277
307
|
};
|
|
278
308
|
getTokenIDs = (req, headers, signal) => {
|
|
279
|
-
return this.fetch(this.url('GetTokenIDs'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
280
|
-
return buildResponse(res).then(_data => {
|
|
309
|
+
return this.fetch(this.url('GetTokenIDs'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
310
|
+
return buildResponse(res).then((_data) => {
|
|
281
311
|
return JsonDecode(_data, 'GetTokenIDsResponse');
|
|
282
312
|
});
|
|
283
|
-
}, error => {
|
|
284
|
-
throw WebrpcRequestFailedError.new({
|
|
313
|
+
}, (error) => {
|
|
314
|
+
throw WebrpcRequestFailedError.new({
|
|
315
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
316
|
+
});
|
|
285
317
|
});
|
|
286
318
|
};
|
|
287
319
|
getTokenPrice = (req, headers, signal) => {
|
|
288
|
-
return this.fetch(this.url('GetTokenPrice'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
289
|
-
return buildResponse(res).then(_data => {
|
|
320
|
+
return this.fetch(this.url('GetTokenPrice'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
321
|
+
return buildResponse(res).then((_data) => {
|
|
290
322
|
return JsonDecode(_data, 'GetTokenPriceResponse');
|
|
291
323
|
});
|
|
292
|
-
}, error => {
|
|
293
|
-
throw WebrpcRequestFailedError.new({
|
|
324
|
+
}, (error) => {
|
|
325
|
+
throw WebrpcRequestFailedError.new({
|
|
326
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
327
|
+
});
|
|
294
328
|
});
|
|
295
329
|
};
|
|
296
330
|
getTokenPrices = (req, headers, signal) => {
|
|
297
|
-
return this.fetch(this.url('GetTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
298
|
-
return buildResponse(res).then(_data => {
|
|
331
|
+
return this.fetch(this.url('GetTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
332
|
+
return buildResponse(res).then((_data) => {
|
|
299
333
|
return JsonDecode(_data, 'GetTokenPricesResponse');
|
|
300
334
|
});
|
|
301
|
-
}, error => {
|
|
302
|
-
throw WebrpcRequestFailedError.new({
|
|
335
|
+
}, (error) => {
|
|
336
|
+
throw WebrpcRequestFailedError.new({
|
|
337
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
338
|
+
});
|
|
303
339
|
});
|
|
304
340
|
};
|
|
305
341
|
getTokenSupplies = (req, headers, signal) => {
|
|
306
|
-
return this.fetch(this.url('GetTokenSupplies'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
307
|
-
return buildResponse(res).then(_data => {
|
|
342
|
+
return this.fetch(this.url('GetTokenSupplies'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
343
|
+
return buildResponse(res).then((_data) => {
|
|
308
344
|
return JsonDecode(_data, 'GetTokenSuppliesResponse');
|
|
309
345
|
});
|
|
310
|
-
}, error => {
|
|
311
|
-
throw WebrpcRequestFailedError.new({
|
|
346
|
+
}, (error) => {
|
|
347
|
+
throw WebrpcRequestFailedError.new({
|
|
348
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
349
|
+
});
|
|
312
350
|
});
|
|
313
351
|
};
|
|
314
352
|
getTokenSuppliesMap = (req, headers, signal) => {
|
|
315
|
-
return this.fetch(this.url('GetTokenSuppliesMap'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
316
|
-
return buildResponse(res).then(_data => {
|
|
353
|
+
return this.fetch(this.url('GetTokenSuppliesMap'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
354
|
+
return buildResponse(res).then((_data) => {
|
|
317
355
|
return JsonDecode(_data, 'GetTokenSuppliesMapResponse');
|
|
318
356
|
});
|
|
319
|
-
}, error => {
|
|
320
|
-
throw WebrpcRequestFailedError.new({
|
|
357
|
+
}, (error) => {
|
|
358
|
+
throw WebrpcRequestFailedError.new({
|
|
359
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
360
|
+
});
|
|
321
361
|
});
|
|
322
362
|
};
|
|
323
363
|
getTransactionHistory = (req, headers, signal) => {
|
|
324
|
-
return this.fetch(this.url('GetTransactionHistory'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
325
|
-
return buildResponse(res).then(_data => {
|
|
364
|
+
return this.fetch(this.url('GetTransactionHistory'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
365
|
+
return buildResponse(res).then((_data) => {
|
|
326
366
|
return JsonDecode(_data, 'GetTransactionHistoryResponse');
|
|
327
367
|
});
|
|
328
|
-
}, error => {
|
|
329
|
-
throw WebrpcRequestFailedError.new({
|
|
368
|
+
}, (error) => {
|
|
369
|
+
throw WebrpcRequestFailedError.new({
|
|
370
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
371
|
+
});
|
|
330
372
|
});
|
|
331
373
|
};
|
|
332
374
|
getWebhookListener = (req, headers, signal) => {
|
|
333
|
-
return this.fetch(this.url('GetWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
334
|
-
return buildResponse(res).then(_data => {
|
|
375
|
+
return this.fetch(this.url('GetWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
376
|
+
return buildResponse(res).then((_data) => {
|
|
335
377
|
return JsonDecode(_data, 'GetWebhookListenerResponse');
|
|
336
378
|
});
|
|
337
|
-
}, error => {
|
|
338
|
-
throw WebrpcRequestFailedError.new({
|
|
379
|
+
}, (error) => {
|
|
380
|
+
throw WebrpcRequestFailedError.new({
|
|
381
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
382
|
+
});
|
|
339
383
|
});
|
|
340
384
|
};
|
|
341
385
|
listTokenPrices = (req, headers, signal) => {
|
|
342
|
-
return this.fetch(this.url('ListTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
343
|
-
return buildResponse(res).then(_data => {
|
|
386
|
+
return this.fetch(this.url('ListTokenPrices'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
387
|
+
return buildResponse(res).then((_data) => {
|
|
344
388
|
return JsonDecode(_data, 'ListTokenPricesResponse');
|
|
345
389
|
});
|
|
346
|
-
}, error => {
|
|
347
|
-
throw WebrpcRequestFailedError.new({
|
|
390
|
+
}, (error) => {
|
|
391
|
+
throw WebrpcRequestFailedError.new({
|
|
392
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
393
|
+
});
|
|
348
394
|
});
|
|
349
395
|
};
|
|
350
396
|
pauseAllWebhookListeners = (req, headers, signal) => {
|
|
351
|
-
return this.fetch(this.url('PauseAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
352
|
-
return buildResponse(res).then(_data => {
|
|
397
|
+
return this.fetch(this.url('PauseAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
398
|
+
return buildResponse(res).then((_data) => {
|
|
353
399
|
return JsonDecode(_data, 'PauseAllWebhookListenersResponse');
|
|
354
400
|
});
|
|
355
|
-
}, error => {
|
|
356
|
-
throw WebrpcRequestFailedError.new({
|
|
401
|
+
}, (error) => {
|
|
402
|
+
throw WebrpcRequestFailedError.new({
|
|
403
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
404
|
+
});
|
|
357
405
|
});
|
|
358
406
|
};
|
|
359
407
|
ping = (headers, signal) => {
|
|
360
|
-
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
361
|
-
return buildResponse(res).then(_data => {
|
|
408
|
+
return this.fetch(this.url('Ping'), createHttpRequest('{}', headers, signal)).then((res) => {
|
|
409
|
+
return buildResponse(res).then((_data) => {
|
|
362
410
|
return JsonDecode(_data, 'PingResponse');
|
|
363
411
|
});
|
|
364
|
-
}, error => {
|
|
365
|
-
throw WebrpcRequestFailedError.new({
|
|
412
|
+
}, (error) => {
|
|
413
|
+
throw WebrpcRequestFailedError.new({
|
|
414
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
415
|
+
});
|
|
366
416
|
});
|
|
367
417
|
};
|
|
368
418
|
removeAllWebhookListeners = (req, headers, signal) => {
|
|
369
|
-
return this.fetch(this.url('RemoveAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
370
|
-
return buildResponse(res).then(_data => {
|
|
419
|
+
return this.fetch(this.url('RemoveAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
420
|
+
return buildResponse(res).then((_data) => {
|
|
371
421
|
return JsonDecode(_data, 'RemoveAllWebhookListenersResponse');
|
|
372
422
|
});
|
|
373
|
-
}, error => {
|
|
374
|
-
throw WebrpcRequestFailedError.new({
|
|
423
|
+
}, (error) => {
|
|
424
|
+
throw WebrpcRequestFailedError.new({
|
|
425
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
426
|
+
});
|
|
375
427
|
});
|
|
376
428
|
};
|
|
377
429
|
removeWebhookListener = (req, headers, signal) => {
|
|
378
|
-
return this.fetch(this.url('RemoveWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
379
|
-
return buildResponse(res).then(_data => {
|
|
430
|
+
return this.fetch(this.url('RemoveWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
431
|
+
return buildResponse(res).then((_data) => {
|
|
380
432
|
return JsonDecode(_data, 'RemoveWebhookListenerResponse');
|
|
381
433
|
});
|
|
382
|
-
}, error => {
|
|
383
|
-
throw WebrpcRequestFailedError.new({
|
|
434
|
+
}, (error) => {
|
|
435
|
+
throw WebrpcRequestFailedError.new({
|
|
436
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
437
|
+
});
|
|
384
438
|
});
|
|
385
439
|
};
|
|
386
440
|
resumeAllWebhookListeners = (req, headers, signal) => {
|
|
387
|
-
return this.fetch(this.url('ResumeAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
388
|
-
return buildResponse(res).then(_data => {
|
|
441
|
+
return this.fetch(this.url('ResumeAllWebhookListeners'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
442
|
+
return buildResponse(res).then((_data) => {
|
|
389
443
|
return JsonDecode(_data, 'ResumeAllWebhookListenersResponse');
|
|
390
444
|
});
|
|
391
|
-
}, error => {
|
|
392
|
-
throw WebrpcRequestFailedError.new({
|
|
445
|
+
}, (error) => {
|
|
446
|
+
throw WebrpcRequestFailedError.new({
|
|
447
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
448
|
+
});
|
|
393
449
|
});
|
|
394
450
|
};
|
|
395
451
|
runtimeStatus = (headers, signal) => {
|
|
396
|
-
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
397
|
-
return buildResponse(res).then(_data => {
|
|
452
|
+
return this.fetch(this.url('RuntimeStatus'), createHttpRequest('{}', headers, signal)).then((res) => {
|
|
453
|
+
return buildResponse(res).then((_data) => {
|
|
398
454
|
return JsonDecode(_data, 'RuntimeStatusResponse');
|
|
399
455
|
});
|
|
400
|
-
}, error => {
|
|
401
|
-
throw WebrpcRequestFailedError.new({
|
|
456
|
+
}, (error) => {
|
|
457
|
+
throw WebrpcRequestFailedError.new({
|
|
458
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
459
|
+
});
|
|
402
460
|
});
|
|
403
461
|
};
|
|
404
462
|
subscribeBalanceUpdates = (req, options) => {
|
|
@@ -406,18 +464,18 @@ export class Indexer {
|
|
|
406
464
|
const abortSignal = abortController.signal;
|
|
407
465
|
if (options.signal) {
|
|
408
466
|
abortSignal.addEventListener('abort', () => abortController.abort(options.signal?.reason), {
|
|
409
|
-
signal: options.signal
|
|
467
|
+
signal: options.signal,
|
|
410
468
|
});
|
|
411
469
|
}
|
|
412
470
|
const _fetch = () => this.fetch(this.url('SubscribeBalanceUpdates'), createHttpRequest(JsonEncode(req), options.headers, abortSignal)).then(async (res) => {
|
|
413
471
|
await sseResponse(res, options, _fetch);
|
|
414
|
-
}, error => {
|
|
472
|
+
}, (error) => {
|
|
415
473
|
options.onError(error, _fetch);
|
|
416
474
|
});
|
|
417
475
|
const resp = _fetch();
|
|
418
476
|
return {
|
|
419
477
|
abort: abortController.abort.bind(abortController),
|
|
420
|
-
closed: resp
|
|
478
|
+
closed: resp,
|
|
421
479
|
};
|
|
422
480
|
};
|
|
423
481
|
subscribeEvents = (req, options) => {
|
|
@@ -425,18 +483,18 @@ export class Indexer {
|
|
|
425
483
|
const abortSignal = abortController.signal;
|
|
426
484
|
if (options.signal) {
|
|
427
485
|
abortSignal.addEventListener('abort', () => abortController.abort(options.signal?.reason), {
|
|
428
|
-
signal: options.signal
|
|
486
|
+
signal: options.signal,
|
|
429
487
|
});
|
|
430
488
|
}
|
|
431
489
|
const _fetch = () => this.fetch(this.url('SubscribeEvents'), createHttpRequest(JsonEncode(req), options.headers, abortSignal)).then(async (res) => {
|
|
432
490
|
await sseResponse(res, options, _fetch);
|
|
433
|
-
}, error => {
|
|
491
|
+
}, (error) => {
|
|
434
492
|
options.onError(error, _fetch);
|
|
435
493
|
});
|
|
436
494
|
const resp = _fetch();
|
|
437
495
|
return {
|
|
438
496
|
abort: abortController.abort.bind(abortController),
|
|
439
|
-
closed: resp
|
|
497
|
+
closed: resp,
|
|
440
498
|
};
|
|
441
499
|
};
|
|
442
500
|
subscribeReceipts = (req, options) => {
|
|
@@ -444,54 +502,62 @@ export class Indexer {
|
|
|
444
502
|
const abortSignal = abortController.signal;
|
|
445
503
|
if (options.signal) {
|
|
446
504
|
abortSignal.addEventListener('abort', () => abortController.abort(options.signal?.reason), {
|
|
447
|
-
signal: options.signal
|
|
505
|
+
signal: options.signal,
|
|
448
506
|
});
|
|
449
507
|
}
|
|
450
508
|
const _fetch = () => this.fetch(this.url('SubscribeReceipts'), createHttpRequest(JsonEncode(req), options.headers, abortSignal)).then(async (res) => {
|
|
451
509
|
await sseResponse(res, options, _fetch);
|
|
452
|
-
}, error => {
|
|
510
|
+
}, (error) => {
|
|
453
511
|
options.onError(error, _fetch);
|
|
454
512
|
});
|
|
455
513
|
const resp = _fetch();
|
|
456
514
|
return {
|
|
457
515
|
abort: abortController.abort.bind(abortController),
|
|
458
|
-
closed: resp
|
|
516
|
+
closed: resp,
|
|
459
517
|
};
|
|
460
518
|
};
|
|
461
519
|
syncBalance = (req, headers, signal) => {
|
|
462
|
-
return this.fetch(this.url('SyncBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
463
|
-
return buildResponse(res).then(_data => {
|
|
520
|
+
return this.fetch(this.url('SyncBalance'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
521
|
+
return buildResponse(res).then((_data) => {
|
|
464
522
|
return JsonDecode(_data, 'SyncBalanceResponse');
|
|
465
523
|
});
|
|
466
|
-
}, error => {
|
|
467
|
-
throw WebrpcRequestFailedError.new({
|
|
524
|
+
}, (error) => {
|
|
525
|
+
throw WebrpcRequestFailedError.new({
|
|
526
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
527
|
+
});
|
|
468
528
|
});
|
|
469
529
|
};
|
|
470
530
|
toggleWebhookListener = (req, headers, signal) => {
|
|
471
|
-
return this.fetch(this.url('ToggleWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
472
|
-
return buildResponse(res).then(_data => {
|
|
531
|
+
return this.fetch(this.url('ToggleWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
532
|
+
return buildResponse(res).then((_data) => {
|
|
473
533
|
return JsonDecode(_data, 'ToggleWebhookListenerResponse');
|
|
474
534
|
});
|
|
475
|
-
}, error => {
|
|
476
|
-
throw WebrpcRequestFailedError.new({
|
|
535
|
+
}, (error) => {
|
|
536
|
+
throw WebrpcRequestFailedError.new({
|
|
537
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
538
|
+
});
|
|
477
539
|
});
|
|
478
540
|
};
|
|
479
541
|
updateWebhookListener = (req, headers, signal) => {
|
|
480
|
-
return this.fetch(this.url('UpdateWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then(res => {
|
|
481
|
-
return buildResponse(res).then(_data => {
|
|
542
|
+
return this.fetch(this.url('UpdateWebhookListener'), createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
|
|
543
|
+
return buildResponse(res).then((_data) => {
|
|
482
544
|
return JsonDecode(_data, 'UpdateWebhookListenerResponse');
|
|
483
545
|
});
|
|
484
|
-
}, error => {
|
|
485
|
-
throw WebrpcRequestFailedError.new({
|
|
546
|
+
}, (error) => {
|
|
547
|
+
throw WebrpcRequestFailedError.new({
|
|
548
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
549
|
+
});
|
|
486
550
|
});
|
|
487
551
|
};
|
|
488
552
|
version = (headers, signal) => {
|
|
489
|
-
return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then(res => {
|
|
490
|
-
return buildResponse(res).then(_data => {
|
|
553
|
+
return this.fetch(this.url('Version'), createHttpRequest('{}', headers, signal)).then((res) => {
|
|
554
|
+
return buildResponse(res).then((_data) => {
|
|
491
555
|
return JsonDecode(_data, 'VersionResponse');
|
|
492
556
|
});
|
|
493
|
-
}, error => {
|
|
494
|
-
throw WebrpcRequestFailedError.new({
|
|
557
|
+
}, (error) => {
|
|
558
|
+
throw WebrpcRequestFailedError.new({
|
|
559
|
+
cause: `fetch(): ${error instanceof Error ? error.message : String(error)}`,
|
|
560
|
+
});
|
|
495
561
|
});
|
|
496
562
|
};
|
|
497
563
|
}
|
|
@@ -510,7 +576,7 @@ const sseResponse = async (res, options, retryFetch) => {
|
|
|
510
576
|
if (!res.body) {
|
|
511
577
|
onError(WebrpcBadResponseError.new({
|
|
512
578
|
status: res.status,
|
|
513
|
-
cause: 'Invalid response, missing body'
|
|
579
|
+
cause: 'Invalid response, missing body',
|
|
514
580
|
}), retryFetch);
|
|
515
581
|
return;
|
|
516
582
|
}
|
|
@@ -543,14 +609,14 @@ const sseResponse = async (res, options, retryFetch) => {
|
|
|
543
609
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
544
610
|
onError(WebrpcClientAbortedError.new({
|
|
545
611
|
message: 'AbortError',
|
|
546
|
-
cause: `AbortError: ${error instanceof Error ? error.message : String(error)}
|
|
612
|
+
cause: `AbortError: ${error instanceof Error ? error.message : String(error)}`,
|
|
547
613
|
}), () => {
|
|
548
614
|
throw new Error('Abort signal cannot be used to reconnect');
|
|
549
615
|
});
|
|
550
616
|
}
|
|
551
617
|
else {
|
|
552
618
|
onError(WebrpcStreamLostError.new({
|
|
553
|
-
cause: `reader.read(): ${error instanceof Error ? error.message : String(error)}
|
|
619
|
+
cause: `reader.read(): ${error instanceof Error ? error.message : String(error)}`,
|
|
554
620
|
}), retryFetch);
|
|
555
621
|
}
|
|
556
622
|
return;
|
|
@@ -577,7 +643,7 @@ const sseResponse = async (res, options, retryFetch) => {
|
|
|
577
643
|
}
|
|
578
644
|
onError(WebrpcBadResponseError.new({
|
|
579
645
|
status: res.status,
|
|
580
|
-
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}
|
|
646
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}`,
|
|
581
647
|
}), retryFetch);
|
|
582
648
|
}
|
|
583
649
|
onMessage(data);
|
|
@@ -595,12 +661,12 @@ const createHttpRequest = (body = '{}', headers = {}, signal = null) => {
|
|
|
595
661
|
const reqHeaders = {
|
|
596
662
|
...headers,
|
|
597
663
|
'Content-Type': 'application/json',
|
|
598
|
-
[WebrpcHeader]: WebrpcHeaderValue
|
|
664
|
+
[WebrpcHeader]: WebrpcHeaderValue,
|
|
599
665
|
};
|
|
600
666
|
return { method: 'POST', headers: reqHeaders, body, signal };
|
|
601
667
|
};
|
|
602
668
|
const buildResponse = (res) => {
|
|
603
|
-
return res.text().then(text => {
|
|
669
|
+
return res.text().then((text) => {
|
|
604
670
|
let data;
|
|
605
671
|
try {
|
|
606
672
|
data = JSON.parse(text);
|
|
@@ -608,7 +674,7 @@ const buildResponse = (res) => {
|
|
|
608
674
|
catch (error) {
|
|
609
675
|
throw WebrpcBadResponseError.new({
|
|
610
676
|
status: res.status,
|
|
611
|
-
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}
|
|
677
|
+
cause: `JSON.parse(): ${error instanceof Error ? error.message : String(error)}: response text: ${text}`,
|
|
612
678
|
});
|
|
613
679
|
}
|
|
614
680
|
if (!res.ok) {
|
|
@@ -1214,7 +1280,7 @@ export const webrpcErrorByCode = {
|
|
|
1214
1280
|
[1900]: TimeoutError,
|
|
1215
1281
|
[1000]: UnauthorizedError,
|
|
1216
1282
|
[1105]: UnauthorizedUserError,
|
|
1217
|
-
[2002]: UnavailableError
|
|
1283
|
+
[2002]: UnavailableError,
|
|
1218
1284
|
};
|
|
1219
1285
|
//
|
|
1220
1286
|
// Webrpc
|
|
@@ -1229,7 +1295,7 @@ export function VersionFromHeader(headers) {
|
|
|
1229
1295
|
codeGenName: '',
|
|
1230
1296
|
codeGenVersion: '',
|
|
1231
1297
|
schemaName: '',
|
|
1232
|
-
schemaVersion: ''
|
|
1298
|
+
schemaVersion: '',
|
|
1233
1299
|
};
|
|
1234
1300
|
}
|
|
1235
1301
|
return parseWebrpcGenVersions(headerValue);
|
|
@@ -1242,7 +1308,7 @@ function parseWebrpcGenVersions(header) {
|
|
|
1242
1308
|
codeGenName: '',
|
|
1243
1309
|
codeGenVersion: '',
|
|
1244
1310
|
schemaName: '',
|
|
1245
|
-
schemaVersion: ''
|
|
1311
|
+
schemaVersion: '',
|
|
1246
1312
|
};
|
|
1247
1313
|
}
|
|
1248
1314
|
const [_, WebrpcGenVersion] = versions[0].split('@');
|
|
@@ -1253,6 +1319,6 @@ function parseWebrpcGenVersions(header) {
|
|
|
1253
1319
|
codeGenName: codeGenName ?? '',
|
|
1254
1320
|
codeGenVersion: codeGenVersion ?? '',
|
|
1255
1321
|
schemaName: schemaName ?? '',
|
|
1256
|
-
schemaVersion: schemaVersion ?? ''
|
|
1322
|
+
schemaVersion: schemaVersion ?? '',
|
|
1257
1323
|
};
|
|
1258
1324
|
}
|