@0xsequence/relayer 1.9.24 → 1.9.26
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.
|
@@ -234,11 +234,11 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/* eslint-disable */
|
|
237
|
-
// sequence-relayer v0.4.1
|
|
237
|
+
// sequence-relayer v0.4.1 1e27d0fd295aa5897878939595ef0c6adc54b1a3
|
|
238
238
|
// --
|
|
239
|
-
// Code generated by webrpc-gen@v0.
|
|
239
|
+
// Code generated by webrpc-gen@v0.18.6 with typescript generator. DO NOT EDIT.
|
|
240
240
|
//
|
|
241
|
-
// webrpc-gen -schema=relayer.ridl -target=typescript
|
|
241
|
+
// webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts
|
|
242
242
|
|
|
243
243
|
// WebRPC description and code-gen version
|
|
244
244
|
const WebRPCVersion = 'v1';
|
|
@@ -247,7 +247,7 @@ const WebRPCVersion = 'v1';
|
|
|
247
247
|
const WebRPCSchemaVersion = 'v0.4.1';
|
|
248
248
|
|
|
249
249
|
// Schema hash generated from your RIDL schema
|
|
250
|
-
const WebRPCSchemaHash = '
|
|
250
|
+
const WebRPCSchemaHash = '1e27d0fd295aa5897878939595ef0c6adc54b1a3';
|
|
251
251
|
|
|
252
252
|
//
|
|
253
253
|
// Types
|
|
@@ -291,109 +291,153 @@ class Relayer {
|
|
|
291
291
|
this.hostname = void 0;
|
|
292
292
|
this.fetch = void 0;
|
|
293
293
|
this.path = '/rpc/Relayer/';
|
|
294
|
-
this.ping = headers => {
|
|
295
|
-
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
294
|
+
this.ping = (headers, signal) => {
|
|
295
|
+
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
296
296
|
return buildResponse(res).then(_data => {
|
|
297
297
|
return {
|
|
298
298
|
status: _data.status
|
|
299
299
|
};
|
|
300
300
|
});
|
|
301
|
+
}, error => {
|
|
302
|
+
throw WebrpcRequestFailedError.new({
|
|
303
|
+
cause: `fetch(): ${error.message || ''}`
|
|
304
|
+
});
|
|
301
305
|
});
|
|
302
306
|
};
|
|
303
|
-
this.version = headers => {
|
|
304
|
-
return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
|
|
307
|
+
this.version = (headers, signal) => {
|
|
308
|
+
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
305
309
|
return buildResponse(res).then(_data => {
|
|
306
310
|
return {
|
|
307
311
|
version: _data.version
|
|
308
312
|
};
|
|
309
313
|
});
|
|
314
|
+
}, error => {
|
|
315
|
+
throw WebrpcRequestFailedError.new({
|
|
316
|
+
cause: `fetch(): ${error.message || ''}`
|
|
317
|
+
});
|
|
310
318
|
});
|
|
311
319
|
};
|
|
312
|
-
this.runtimeStatus = headers => {
|
|
313
|
-
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
|
|
320
|
+
this.runtimeStatus = (headers, signal) => {
|
|
321
|
+
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
314
322
|
return buildResponse(res).then(_data => {
|
|
315
323
|
return {
|
|
316
324
|
status: _data.status
|
|
317
325
|
};
|
|
318
326
|
});
|
|
327
|
+
}, error => {
|
|
328
|
+
throw WebrpcRequestFailedError.new({
|
|
329
|
+
cause: `fetch(): ${error.message || ''}`
|
|
330
|
+
});
|
|
319
331
|
});
|
|
320
332
|
};
|
|
321
|
-
this.getSequenceContext = headers => {
|
|
322
|
-
return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
|
|
333
|
+
this.getSequenceContext = (headers, signal) => {
|
|
334
|
+
return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
323
335
|
return buildResponse(res).then(_data => {
|
|
324
336
|
return {
|
|
325
337
|
data: _data.data
|
|
326
338
|
};
|
|
327
339
|
});
|
|
340
|
+
}, error => {
|
|
341
|
+
throw WebrpcRequestFailedError.new({
|
|
342
|
+
cause: `fetch(): ${error.message || ''}`
|
|
343
|
+
});
|
|
328
344
|
});
|
|
329
345
|
};
|
|
330
|
-
this.getChainID = headers => {
|
|
331
|
-
return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers)).then(res => {
|
|
346
|
+
this.getChainID = (headers, signal) => {
|
|
347
|
+
return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
332
348
|
return buildResponse(res).then(_data => {
|
|
333
349
|
return {
|
|
334
350
|
chainID: _data.chainID
|
|
335
351
|
};
|
|
336
352
|
});
|
|
353
|
+
}, error => {
|
|
354
|
+
throw WebrpcRequestFailedError.new({
|
|
355
|
+
cause: `fetch(): ${error.message || ''}`
|
|
356
|
+
});
|
|
337
357
|
});
|
|
338
358
|
};
|
|
339
|
-
this.sendMetaTxn = (args, headers) => {
|
|
340
|
-
return this.fetch(this.url('SendMetaTxn'), createHTTPRequest(args, headers)).then(res => {
|
|
359
|
+
this.sendMetaTxn = (args, headers, signal) => {
|
|
360
|
+
return this.fetch(this.url('SendMetaTxn'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
341
361
|
return buildResponse(res).then(_data => {
|
|
342
362
|
return {
|
|
343
363
|
status: _data.status,
|
|
344
364
|
txnHash: _data.txnHash
|
|
345
365
|
};
|
|
346
366
|
});
|
|
367
|
+
}, error => {
|
|
368
|
+
throw WebrpcRequestFailedError.new({
|
|
369
|
+
cause: `fetch(): ${error.message || ''}`
|
|
370
|
+
});
|
|
347
371
|
});
|
|
348
372
|
};
|
|
349
|
-
this.getMetaTxnNonce = (args, headers) => {
|
|
350
|
-
return this.fetch(this.url('GetMetaTxnNonce'), createHTTPRequest(args, headers)).then(res => {
|
|
373
|
+
this.getMetaTxnNonce = (args, headers, signal) => {
|
|
374
|
+
return this.fetch(this.url('GetMetaTxnNonce'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
351
375
|
return buildResponse(res).then(_data => {
|
|
352
376
|
return {
|
|
353
377
|
nonce: _data.nonce
|
|
354
378
|
};
|
|
355
379
|
});
|
|
380
|
+
}, error => {
|
|
381
|
+
throw WebrpcRequestFailedError.new({
|
|
382
|
+
cause: `fetch(): ${error.message || ''}`
|
|
383
|
+
});
|
|
356
384
|
});
|
|
357
385
|
};
|
|
358
|
-
this.getMetaTxnReceipt = (args, headers) => {
|
|
359
|
-
return this.fetch(this.url('GetMetaTxnReceipt'), createHTTPRequest(args, headers)).then(res => {
|
|
386
|
+
this.getMetaTxnReceipt = (args, headers, signal) => {
|
|
387
|
+
return this.fetch(this.url('GetMetaTxnReceipt'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
360
388
|
return buildResponse(res).then(_data => {
|
|
361
389
|
return {
|
|
362
390
|
receipt: _data.receipt
|
|
363
391
|
};
|
|
364
392
|
});
|
|
393
|
+
}, error => {
|
|
394
|
+
throw WebrpcRequestFailedError.new({
|
|
395
|
+
cause: `fetch(): ${error.message || ''}`
|
|
396
|
+
});
|
|
365
397
|
});
|
|
366
398
|
};
|
|
367
|
-
this.simulate = (args, headers) => {
|
|
368
|
-
return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers)).then(res => {
|
|
399
|
+
this.simulate = (args, headers, signal) => {
|
|
400
|
+
return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
369
401
|
return buildResponse(res).then(_data => {
|
|
370
402
|
return {
|
|
371
403
|
results: _data.results
|
|
372
404
|
};
|
|
373
405
|
});
|
|
406
|
+
}, error => {
|
|
407
|
+
throw WebrpcRequestFailedError.new({
|
|
408
|
+
cause: `fetch(): ${error.message || ''}`
|
|
409
|
+
});
|
|
374
410
|
});
|
|
375
411
|
};
|
|
376
|
-
this.updateMetaTxnGasLimits = (args, headers) => {
|
|
377
|
-
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHTTPRequest(args, headers)).then(res => {
|
|
412
|
+
this.updateMetaTxnGasLimits = (args, headers, signal) => {
|
|
413
|
+
return this.fetch(this.url('UpdateMetaTxnGasLimits'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
378
414
|
return buildResponse(res).then(_data => {
|
|
379
415
|
return {
|
|
380
416
|
payload: _data.payload
|
|
381
417
|
};
|
|
382
418
|
});
|
|
419
|
+
}, error => {
|
|
420
|
+
throw WebrpcRequestFailedError.new({
|
|
421
|
+
cause: `fetch(): ${error.message || ''}`
|
|
422
|
+
});
|
|
383
423
|
});
|
|
384
424
|
};
|
|
385
|
-
this.feeTokens = headers => {
|
|
386
|
-
return this.fetch(this.url('FeeTokens'), createHTTPRequest({}, headers)).then(res => {
|
|
425
|
+
this.feeTokens = (headers, signal) => {
|
|
426
|
+
return this.fetch(this.url('FeeTokens'), createHTTPRequest({}, headers, signal)).then(res => {
|
|
387
427
|
return buildResponse(res).then(_data => {
|
|
388
428
|
return {
|
|
389
429
|
isFeeRequired: _data.isFeeRequired,
|
|
390
430
|
tokens: _data.tokens
|
|
391
431
|
};
|
|
392
432
|
});
|
|
433
|
+
}, error => {
|
|
434
|
+
throw WebrpcRequestFailedError.new({
|
|
435
|
+
cause: `fetch(): ${error.message || ''}`
|
|
436
|
+
});
|
|
393
437
|
});
|
|
394
438
|
};
|
|
395
|
-
this.feeOptions = (args, headers) => {
|
|
396
|
-
return this.fetch(this.url('FeeOptions'), createHTTPRequest(args, headers)).then(res => {
|
|
439
|
+
this.feeOptions = (args, headers, signal) => {
|
|
440
|
+
return this.fetch(this.url('FeeOptions'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
397
441
|
return buildResponse(res).then(_data => {
|
|
398
442
|
return {
|
|
399
443
|
options: _data.options,
|
|
@@ -401,169 +445,255 @@ class Relayer {
|
|
|
401
445
|
quote: _data.quote
|
|
402
446
|
};
|
|
403
447
|
});
|
|
448
|
+
}, error => {
|
|
449
|
+
throw WebrpcRequestFailedError.new({
|
|
450
|
+
cause: `fetch(): ${error.message || ''}`
|
|
451
|
+
});
|
|
404
452
|
});
|
|
405
453
|
};
|
|
406
|
-
this.getMetaTxnNetworkFeeOptions = (args, headers) => {
|
|
407
|
-
return this.fetch(this.url('GetMetaTxnNetworkFeeOptions'), createHTTPRequest(args, headers)).then(res => {
|
|
454
|
+
this.getMetaTxnNetworkFeeOptions = (args, headers, signal) => {
|
|
455
|
+
return this.fetch(this.url('GetMetaTxnNetworkFeeOptions'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
408
456
|
return buildResponse(res).then(_data => {
|
|
409
457
|
return {
|
|
410
458
|
options: _data.options
|
|
411
459
|
};
|
|
412
460
|
});
|
|
461
|
+
}, error => {
|
|
462
|
+
throw WebrpcRequestFailedError.new({
|
|
463
|
+
cause: `fetch(): ${error.message || ''}`
|
|
464
|
+
});
|
|
413
465
|
});
|
|
414
466
|
};
|
|
415
|
-
this.getMetaTransactions = (args, headers) => {
|
|
416
|
-
return this.fetch(this.url('GetMetaTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
467
|
+
this.getMetaTransactions = (args, headers, signal) => {
|
|
468
|
+
return this.fetch(this.url('GetMetaTransactions'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
417
469
|
return buildResponse(res).then(_data => {
|
|
418
470
|
return {
|
|
419
471
|
page: _data.page,
|
|
420
472
|
transactions: _data.transactions
|
|
421
473
|
};
|
|
422
474
|
});
|
|
475
|
+
}, error => {
|
|
476
|
+
throw WebrpcRequestFailedError.new({
|
|
477
|
+
cause: `fetch(): ${error.message || ''}`
|
|
478
|
+
});
|
|
423
479
|
});
|
|
424
480
|
};
|
|
425
|
-
this.sentTransactions = (args, headers) => {
|
|
426
|
-
return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
481
|
+
this.sentTransactions = (args, headers, signal) => {
|
|
482
|
+
return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
427
483
|
return buildResponse(res).then(_data => {
|
|
428
484
|
return {
|
|
429
485
|
page: _data.page,
|
|
430
486
|
transactions: _data.transactions
|
|
431
487
|
};
|
|
432
488
|
});
|
|
489
|
+
}, error => {
|
|
490
|
+
throw WebrpcRequestFailedError.new({
|
|
491
|
+
cause: `fetch(): ${error.message || ''}`
|
|
492
|
+
});
|
|
433
493
|
});
|
|
434
494
|
};
|
|
435
|
-
this.pendingTransactions = (args, headers) => {
|
|
436
|
-
return this.fetch(this.url('PendingTransactions'), createHTTPRequest(args, headers)).then(res => {
|
|
495
|
+
this.pendingTransactions = (args, headers, signal) => {
|
|
496
|
+
return this.fetch(this.url('PendingTransactions'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
437
497
|
return buildResponse(res).then(_data => {
|
|
438
498
|
return {
|
|
439
499
|
page: _data.page,
|
|
440
500
|
transactions: _data.transactions
|
|
441
501
|
};
|
|
442
502
|
});
|
|
503
|
+
}, error => {
|
|
504
|
+
throw WebrpcRequestFailedError.new({
|
|
505
|
+
cause: `fetch(): ${error.message || ''}`
|
|
506
|
+
});
|
|
443
507
|
});
|
|
444
508
|
};
|
|
445
|
-
this.getGasTank = (args, headers) => {
|
|
446
|
-
return this.fetch(this.url('GetGasTank'), createHTTPRequest(args, headers)).then(res => {
|
|
509
|
+
this.getGasTank = (args, headers, signal) => {
|
|
510
|
+
return this.fetch(this.url('GetGasTank'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
447
511
|
return buildResponse(res).then(_data => {
|
|
448
512
|
return {
|
|
449
513
|
gasTank: _data.gasTank
|
|
450
514
|
};
|
|
451
515
|
});
|
|
516
|
+
}, error => {
|
|
517
|
+
throw WebrpcRequestFailedError.new({
|
|
518
|
+
cause: `fetch(): ${error.message || ''}`
|
|
519
|
+
});
|
|
452
520
|
});
|
|
453
521
|
};
|
|
454
|
-
this.addGasTank = (args, headers) => {
|
|
455
|
-
return this.fetch(this.url('AddGasTank'), createHTTPRequest(args, headers)).then(res => {
|
|
522
|
+
this.addGasTank = (args, headers, signal) => {
|
|
523
|
+
return this.fetch(this.url('AddGasTank'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
456
524
|
return buildResponse(res).then(_data => {
|
|
457
525
|
return {
|
|
458
526
|
status: _data.status,
|
|
459
527
|
gasTank: _data.gasTank
|
|
460
528
|
};
|
|
461
529
|
});
|
|
530
|
+
}, error => {
|
|
531
|
+
throw WebrpcRequestFailedError.new({
|
|
532
|
+
cause: `fetch(): ${error.message || ''}`
|
|
533
|
+
});
|
|
462
534
|
});
|
|
463
535
|
};
|
|
464
|
-
this.updateGasTank = (args, headers) => {
|
|
465
|
-
return this.fetch(this.url('UpdateGasTank'), createHTTPRequest(args, headers)).then(res => {
|
|
536
|
+
this.updateGasTank = (args, headers, signal) => {
|
|
537
|
+
return this.fetch(this.url('UpdateGasTank'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
466
538
|
return buildResponse(res).then(_data => {
|
|
467
539
|
return {
|
|
468
540
|
status: _data.status,
|
|
469
541
|
gasTank: _data.gasTank
|
|
470
542
|
};
|
|
471
543
|
});
|
|
544
|
+
}, error => {
|
|
545
|
+
throw WebrpcRequestFailedError.new({
|
|
546
|
+
cause: `fetch(): ${error.message || ''}`
|
|
547
|
+
});
|
|
472
548
|
});
|
|
473
549
|
};
|
|
474
|
-
this.getGasSponsor = (args, headers) => {
|
|
475
|
-
return this.fetch(this.url('GetGasSponsor'), createHTTPRequest(args, headers)).then(res => {
|
|
550
|
+
this.getGasSponsor = (args, headers, signal) => {
|
|
551
|
+
return this.fetch(this.url('GetGasSponsor'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
476
552
|
return buildResponse(res).then(_data => {
|
|
477
553
|
return {
|
|
478
554
|
gasSponsor: _data.gasSponsor
|
|
479
555
|
};
|
|
480
556
|
});
|
|
557
|
+
}, error => {
|
|
558
|
+
throw WebrpcRequestFailedError.new({
|
|
559
|
+
cause: `fetch(): ${error.message || ''}`
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
};
|
|
563
|
+
this.addressGasSponsors = (args, headers, signal) => {
|
|
564
|
+
return this.fetch(this.url('AddressGasSponsors'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
565
|
+
return buildResponse(res).then(_data => {
|
|
566
|
+
return {
|
|
567
|
+
page: _data.page,
|
|
568
|
+
gasSponsors: _data.gasSponsors
|
|
569
|
+
};
|
|
570
|
+
});
|
|
571
|
+
}, error => {
|
|
572
|
+
throw WebrpcRequestFailedError.new({
|
|
573
|
+
cause: `fetch(): ${error.message || ''}`
|
|
574
|
+
});
|
|
481
575
|
});
|
|
482
576
|
};
|
|
483
|
-
this.listGasSponsors = (args, headers) => {
|
|
484
|
-
return this.fetch(this.url('ListGasSponsors'), createHTTPRequest(args, headers)).then(res => {
|
|
577
|
+
this.listGasSponsors = (args, headers, signal) => {
|
|
578
|
+
return this.fetch(this.url('ListGasSponsors'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
485
579
|
return buildResponse(res).then(_data => {
|
|
486
580
|
return {
|
|
487
581
|
page: _data.page,
|
|
488
582
|
gasSponsors: _data.gasSponsors
|
|
489
583
|
};
|
|
490
584
|
});
|
|
585
|
+
}, error => {
|
|
586
|
+
throw WebrpcRequestFailedError.new({
|
|
587
|
+
cause: `fetch(): ${error.message || ''}`
|
|
588
|
+
});
|
|
491
589
|
});
|
|
492
590
|
};
|
|
493
|
-
this.addGasSponsor = (args, headers) => {
|
|
494
|
-
return this.fetch(this.url('AddGasSponsor'), createHTTPRequest(args, headers)).then(res => {
|
|
591
|
+
this.addGasSponsor = (args, headers, signal) => {
|
|
592
|
+
return this.fetch(this.url('AddGasSponsor'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
495
593
|
return buildResponse(res).then(_data => {
|
|
496
594
|
return {
|
|
497
595
|
status: _data.status,
|
|
498
596
|
gasSponsor: _data.gasSponsor
|
|
499
597
|
};
|
|
500
598
|
});
|
|
599
|
+
}, error => {
|
|
600
|
+
throw WebrpcRequestFailedError.new({
|
|
601
|
+
cause: `fetch(): ${error.message || ''}`
|
|
602
|
+
});
|
|
501
603
|
});
|
|
502
604
|
};
|
|
503
|
-
this.updateGasSponsor = (args, headers) => {
|
|
504
|
-
return this.fetch(this.url('UpdateGasSponsor'), createHTTPRequest(args, headers)).then(res => {
|
|
605
|
+
this.updateGasSponsor = (args, headers, signal) => {
|
|
606
|
+
return this.fetch(this.url('UpdateGasSponsor'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
505
607
|
return buildResponse(res).then(_data => {
|
|
506
608
|
return {
|
|
507
609
|
status: _data.status,
|
|
508
610
|
gasSponsor: _data.gasSponsor
|
|
509
611
|
};
|
|
510
612
|
});
|
|
613
|
+
}, error => {
|
|
614
|
+
throw WebrpcRequestFailedError.new({
|
|
615
|
+
cause: `fetch(): ${error.message || ''}`
|
|
616
|
+
});
|
|
511
617
|
});
|
|
512
618
|
};
|
|
513
|
-
this.removeGasSponsor = (args, headers) => {
|
|
514
|
-
return this.fetch(this.url('RemoveGasSponsor'), createHTTPRequest(args, headers)).then(res => {
|
|
619
|
+
this.removeGasSponsor = (args, headers, signal) => {
|
|
620
|
+
return this.fetch(this.url('RemoveGasSponsor'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
515
621
|
return buildResponse(res).then(_data => {
|
|
516
622
|
return {
|
|
517
623
|
status: _data.status
|
|
518
624
|
};
|
|
519
625
|
});
|
|
626
|
+
}, error => {
|
|
627
|
+
throw WebrpcRequestFailedError.new({
|
|
628
|
+
cause: `fetch(): ${error.message || ''}`
|
|
629
|
+
});
|
|
520
630
|
});
|
|
521
631
|
};
|
|
522
|
-
this.reportGasSponsorUsage = (args, headers) => {
|
|
523
|
-
return this.fetch(this.url('ReportGasSponsorUsage'), createHTTPRequest(args, headers)).then(res => {
|
|
632
|
+
this.reportGasSponsorUsage = (args, headers, signal) => {
|
|
633
|
+
return this.fetch(this.url('ReportGasSponsorUsage'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
524
634
|
return buildResponse(res).then(_data => {
|
|
525
635
|
return {
|
|
526
636
|
gasSponsorUsage: _data.gasSponsorUsage
|
|
527
637
|
};
|
|
528
638
|
});
|
|
639
|
+
}, error => {
|
|
640
|
+
throw WebrpcRequestFailedError.new({
|
|
641
|
+
cause: `fetch(): ${error.message || ''}`
|
|
642
|
+
});
|
|
529
643
|
});
|
|
530
644
|
};
|
|
531
|
-
this.nextGasTankBalanceAdjustmentNonce = (args, headers) => {
|
|
532
|
-
return this.fetch(this.url('NextGasTankBalanceAdjustmentNonce'), createHTTPRequest(args, headers)).then(res => {
|
|
645
|
+
this.nextGasTankBalanceAdjustmentNonce = (args, headers, signal) => {
|
|
646
|
+
return this.fetch(this.url('NextGasTankBalanceAdjustmentNonce'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
533
647
|
return buildResponse(res).then(_data => {
|
|
534
648
|
return {
|
|
535
649
|
nonce: _data.nonce
|
|
536
650
|
};
|
|
537
651
|
});
|
|
652
|
+
}, error => {
|
|
653
|
+
throw WebrpcRequestFailedError.new({
|
|
654
|
+
cause: `fetch(): ${error.message || ''}`
|
|
655
|
+
});
|
|
538
656
|
});
|
|
539
657
|
};
|
|
540
|
-
this.adjustGasTankBalance = (args, headers) => {
|
|
541
|
-
return this.fetch(this.url('AdjustGasTankBalance'), createHTTPRequest(args, headers)).then(res => {
|
|
658
|
+
this.adjustGasTankBalance = (args, headers, signal) => {
|
|
659
|
+
return this.fetch(this.url('AdjustGasTankBalance'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
542
660
|
return buildResponse(res).then(_data => {
|
|
543
661
|
return {
|
|
544
662
|
status: _data.status,
|
|
545
663
|
adjustment: _data.adjustment
|
|
546
664
|
};
|
|
547
665
|
});
|
|
666
|
+
}, error => {
|
|
667
|
+
throw WebrpcRequestFailedError.new({
|
|
668
|
+
cause: `fetch(): ${error.message || ''}`
|
|
669
|
+
});
|
|
548
670
|
});
|
|
549
671
|
};
|
|
550
|
-
this.getGasTankBalanceAdjustment = (args, headers) => {
|
|
551
|
-
return this.fetch(this.url('GetGasTankBalanceAdjustment'), createHTTPRequest(args, headers)).then(res => {
|
|
672
|
+
this.getGasTankBalanceAdjustment = (args, headers, signal) => {
|
|
673
|
+
return this.fetch(this.url('GetGasTankBalanceAdjustment'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
552
674
|
return buildResponse(res).then(_data => {
|
|
553
675
|
return {
|
|
554
676
|
adjustment: _data.adjustment
|
|
555
677
|
};
|
|
556
678
|
});
|
|
679
|
+
}, error => {
|
|
680
|
+
throw WebrpcRequestFailedError.new({
|
|
681
|
+
cause: `fetch(): ${error.message || ''}`
|
|
682
|
+
});
|
|
557
683
|
});
|
|
558
684
|
};
|
|
559
|
-
this.listGasTankBalanceAdjustments = (args, headers) => {
|
|
560
|
-
return this.fetch(this.url('ListGasTankBalanceAdjustments'), createHTTPRequest(args, headers)).then(res => {
|
|
685
|
+
this.listGasTankBalanceAdjustments = (args, headers, signal) => {
|
|
686
|
+
return this.fetch(this.url('ListGasTankBalanceAdjustments'), createHTTPRequest(args, headers, signal)).then(res => {
|
|
561
687
|
return buildResponse(res).then(_data => {
|
|
562
688
|
return {
|
|
563
689
|
page: _data.page,
|
|
564
690
|
adjustments: _data.adjustments
|
|
565
691
|
};
|
|
566
692
|
});
|
|
693
|
+
}, error => {
|
|
694
|
+
throw WebrpcRequestFailedError.new({
|
|
695
|
+
cause: `fetch(): ${error.message || ''}`
|
|
696
|
+
});
|
|
567
697
|
});
|
|
568
698
|
};
|
|
569
699
|
this.hostname = hostname;
|
|
@@ -573,13 +703,14 @@ class Relayer {
|
|
|
573
703
|
return this.hostname + this.path + name;
|
|
574
704
|
}
|
|
575
705
|
}
|
|
576
|
-
const createHTTPRequest = (body = {}, headers = {}) => {
|
|
706
|
+
const createHTTPRequest = (body = {}, headers = {}, signal = null) => {
|
|
577
707
|
return {
|
|
578
708
|
method: 'POST',
|
|
579
709
|
headers: _extends({}, headers, {
|
|
580
710
|
'Content-Type': 'application/json'
|
|
581
711
|
}),
|
|
582
|
-
body: JSON.stringify(body || {})
|
|
712
|
+
body: JSON.stringify(body || {}),
|
|
713
|
+
signal
|
|
583
714
|
};
|
|
584
715
|
};
|
|
585
716
|
const buildResponse = res => {
|
|
@@ -587,20 +718,214 @@ const buildResponse = res => {
|
|
|
587
718
|
let data;
|
|
588
719
|
try {
|
|
589
720
|
data = JSON.parse(text);
|
|
590
|
-
} catch (
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
721
|
+
} catch (error) {
|
|
722
|
+
let message = '';
|
|
723
|
+
if (error instanceof Error) {
|
|
724
|
+
message = error.message;
|
|
725
|
+
}
|
|
726
|
+
throw WebrpcBadResponseError.new({
|
|
727
|
+
status: res.status,
|
|
728
|
+
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
729
|
+
});
|
|
596
730
|
}
|
|
597
731
|
if (!res.ok) {
|
|
598
|
-
|
|
732
|
+
const code = typeof data.code === 'number' ? data.code : 0;
|
|
733
|
+
throw (webrpcErrorByCode[code] || WebrpcError).new(data);
|
|
599
734
|
}
|
|
600
735
|
return data;
|
|
601
736
|
});
|
|
602
737
|
};
|
|
603
738
|
|
|
739
|
+
//
|
|
740
|
+
// Errors
|
|
741
|
+
//
|
|
742
|
+
|
|
743
|
+
class WebrpcError extends Error {
|
|
744
|
+
constructor(name, code, message, status, cause) {
|
|
745
|
+
super(message);
|
|
746
|
+
this.name = void 0;
|
|
747
|
+
this.code = void 0;
|
|
748
|
+
this.message = void 0;
|
|
749
|
+
this.status = void 0;
|
|
750
|
+
this.cause = void 0;
|
|
751
|
+
/** @deprecated Use message instead of msg. Deprecated in webrpc v0.11.0. */
|
|
752
|
+
this.msg = void 0;
|
|
753
|
+
this.name = name || 'WebrpcError';
|
|
754
|
+
this.code = typeof code === 'number' ? code : 0;
|
|
755
|
+
this.message = message || `endpoint error ${this.code}`;
|
|
756
|
+
this.msg = this.message;
|
|
757
|
+
this.status = typeof status === 'number' ? status : 0;
|
|
758
|
+
this.cause = cause;
|
|
759
|
+
Object.setPrototypeOf(this, WebrpcError.prototype);
|
|
760
|
+
}
|
|
761
|
+
static new(payload) {
|
|
762
|
+
return new this(payload.error, payload.code, payload.message || payload.msg, payload.status, payload.cause);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// Webrpc errors
|
|
767
|
+
|
|
768
|
+
class WebrpcEndpointError extends WebrpcError {
|
|
769
|
+
constructor(name = 'WebrpcEndpoint', code = 0, message = 'endpoint error', status = 0, cause) {
|
|
770
|
+
super(name, code, message, status, cause);
|
|
771
|
+
Object.setPrototypeOf(this, WebrpcEndpointError.prototype);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
class WebrpcRequestFailedError extends WebrpcError {
|
|
775
|
+
constructor(name = 'WebrpcRequestFailed', code = -1, message = 'request failed', status = 0, cause) {
|
|
776
|
+
super(name, code, message, status, cause);
|
|
777
|
+
Object.setPrototypeOf(this, WebrpcRequestFailedError.prototype);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
class WebrpcBadRouteError extends WebrpcError {
|
|
781
|
+
constructor(name = 'WebrpcBadRoute', code = -2, message = 'bad route', status = 0, cause) {
|
|
782
|
+
super(name, code, message, status, cause);
|
|
783
|
+
Object.setPrototypeOf(this, WebrpcBadRouteError.prototype);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
class WebrpcBadMethodError extends WebrpcError {
|
|
787
|
+
constructor(name = 'WebrpcBadMethod', code = -3, message = 'bad method', status = 0, cause) {
|
|
788
|
+
super(name, code, message, status, cause);
|
|
789
|
+
Object.setPrototypeOf(this, WebrpcBadMethodError.prototype);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
class WebrpcBadRequestError extends WebrpcError {
|
|
793
|
+
constructor(name = 'WebrpcBadRequest', code = -4, message = 'bad request', status = 0, cause) {
|
|
794
|
+
super(name, code, message, status, cause);
|
|
795
|
+
Object.setPrototypeOf(this, WebrpcBadRequestError.prototype);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
class WebrpcBadResponseError extends WebrpcError {
|
|
799
|
+
constructor(name = 'WebrpcBadResponse', code = -5, message = 'bad response', status = 0, cause) {
|
|
800
|
+
super(name, code, message, status, cause);
|
|
801
|
+
Object.setPrototypeOf(this, WebrpcBadResponseError.prototype);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
class WebrpcServerPanicError extends WebrpcError {
|
|
805
|
+
constructor(name = 'WebrpcServerPanic', code = -6, message = 'server panic', status = 0, cause) {
|
|
806
|
+
super(name, code, message, status, cause);
|
|
807
|
+
Object.setPrototypeOf(this, WebrpcServerPanicError.prototype);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
class WebrpcInternalErrorError extends WebrpcError {
|
|
811
|
+
constructor(name = 'WebrpcInternalError', code = -7, message = 'internal error', status = 0, cause) {
|
|
812
|
+
super(name, code, message, status, cause);
|
|
813
|
+
Object.setPrototypeOf(this, WebrpcInternalErrorError.prototype);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
class WebrpcClientDisconnectedError extends WebrpcError {
|
|
817
|
+
constructor(name = 'WebrpcClientDisconnected', code = -8, message = 'client disconnected', status = 0, cause) {
|
|
818
|
+
super(name, code, message, status, cause);
|
|
819
|
+
Object.setPrototypeOf(this, WebrpcClientDisconnectedError.prototype);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
class WebrpcStreamLostError extends WebrpcError {
|
|
823
|
+
constructor(name = 'WebrpcStreamLost', code = -9, message = 'stream lost', status = 0, cause) {
|
|
824
|
+
super(name, code, message, status, cause);
|
|
825
|
+
Object.setPrototypeOf(this, WebrpcStreamLostError.prototype);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
class WebrpcStreamFinishedError extends WebrpcError {
|
|
829
|
+
constructor(name = 'WebrpcStreamFinished', code = -10, message = 'stream finished', status = 0, cause) {
|
|
830
|
+
super(name, code, message, status, cause);
|
|
831
|
+
Object.setPrototypeOf(this, WebrpcStreamFinishedError.prototype);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// Schema errors
|
|
836
|
+
|
|
837
|
+
class UnauthorizedError extends WebrpcError {
|
|
838
|
+
constructor(name = 'Unauthorized', code = 1000, message = 'Unauthorized access', status = 0, cause) {
|
|
839
|
+
super(name, code, message, status, cause);
|
|
840
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
class PermissionDeniedError extends WebrpcError {
|
|
844
|
+
constructor(name = 'PermissionDenied', code = 1001, message = 'Permission denied', status = 0, cause) {
|
|
845
|
+
super(name, code, message, status, cause);
|
|
846
|
+
Object.setPrototypeOf(this, PermissionDeniedError.prototype);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
class MethodNotFoundError extends WebrpcError {
|
|
850
|
+
constructor(name = 'MethodNotFound', code = 1003, message = 'Method not found', status = 0, cause) {
|
|
851
|
+
super(name, code, message, status, cause);
|
|
852
|
+
Object.setPrototypeOf(this, MethodNotFoundError.prototype);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
class AbortedError extends WebrpcError {
|
|
856
|
+
constructor(name = 'Aborted', code = 1005, message = 'Request aborted', status = 0, cause) {
|
|
857
|
+
super(name, code, message, status, cause);
|
|
858
|
+
Object.setPrototypeOf(this, AbortedError.prototype);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
class InvalidArgumentError extends WebrpcError {
|
|
862
|
+
constructor(name = 'InvalidArgument', code = 2001, message = 'Invalid argument', status = 0, cause) {
|
|
863
|
+
super(name, code, message, status, cause);
|
|
864
|
+
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
class UnavailableError extends WebrpcError {
|
|
868
|
+
constructor(name = 'Unavailable', code = 2002, message = 'Unavailable resource', status = 0, cause) {
|
|
869
|
+
super(name, code, message, status, cause);
|
|
870
|
+
Object.setPrototypeOf(this, UnavailableError.prototype);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
class QueryFailedError extends WebrpcError {
|
|
874
|
+
constructor(name = 'QueryFailed', code = 2003, message = 'Query failed', status = 0, cause) {
|
|
875
|
+
super(name, code, message, status, cause);
|
|
876
|
+
Object.setPrototypeOf(this, QueryFailedError.prototype);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
class NotFoundError extends WebrpcError {
|
|
880
|
+
constructor(name = 'NotFound', code = 3000, message = 'Resource not found', status = 0, cause) {
|
|
881
|
+
super(name, code, message, status, cause);
|
|
882
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
let errors = /*#__PURE__*/function (errors) {
|
|
886
|
+
errors["WebrpcEndpoint"] = "WebrpcEndpoint";
|
|
887
|
+
errors["WebrpcRequestFailed"] = "WebrpcRequestFailed";
|
|
888
|
+
errors["WebrpcBadRoute"] = "WebrpcBadRoute";
|
|
889
|
+
errors["WebrpcBadMethod"] = "WebrpcBadMethod";
|
|
890
|
+
errors["WebrpcBadRequest"] = "WebrpcBadRequest";
|
|
891
|
+
errors["WebrpcBadResponse"] = "WebrpcBadResponse";
|
|
892
|
+
errors["WebrpcServerPanic"] = "WebrpcServerPanic";
|
|
893
|
+
errors["WebrpcInternalError"] = "WebrpcInternalError";
|
|
894
|
+
errors["WebrpcClientDisconnected"] = "WebrpcClientDisconnected";
|
|
895
|
+
errors["WebrpcStreamLost"] = "WebrpcStreamLost";
|
|
896
|
+
errors["WebrpcStreamFinished"] = "WebrpcStreamFinished";
|
|
897
|
+
errors["Unauthorized"] = "Unauthorized";
|
|
898
|
+
errors["PermissionDenied"] = "PermissionDenied";
|
|
899
|
+
errors["MethodNotFound"] = "MethodNotFound";
|
|
900
|
+
errors["Aborted"] = "Aborted";
|
|
901
|
+
errors["InvalidArgument"] = "InvalidArgument";
|
|
902
|
+
errors["Unavailable"] = "Unavailable";
|
|
903
|
+
errors["QueryFailed"] = "QueryFailed";
|
|
904
|
+
errors["NotFound"] = "NotFound";
|
|
905
|
+
return errors;
|
|
906
|
+
}({});
|
|
907
|
+
const webrpcErrorByCode = {
|
|
908
|
+
[0]: WebrpcEndpointError,
|
|
909
|
+
[-1]: WebrpcRequestFailedError,
|
|
910
|
+
[-2]: WebrpcBadRouteError,
|
|
911
|
+
[-3]: WebrpcBadMethodError,
|
|
912
|
+
[-4]: WebrpcBadRequestError,
|
|
913
|
+
[-5]: WebrpcBadResponseError,
|
|
914
|
+
[-6]: WebrpcServerPanicError,
|
|
915
|
+
[-7]: WebrpcInternalErrorError,
|
|
916
|
+
[-8]: WebrpcClientDisconnectedError,
|
|
917
|
+
[-9]: WebrpcStreamLostError,
|
|
918
|
+
[-10]: WebrpcStreamFinishedError,
|
|
919
|
+
[1000]: UnauthorizedError,
|
|
920
|
+
[1001]: PermissionDeniedError,
|
|
921
|
+
[1003]: MethodNotFoundError,
|
|
922
|
+
[1005]: AbortedError,
|
|
923
|
+
[2001]: InvalidArgumentError,
|
|
924
|
+
[2002]: UnavailableError,
|
|
925
|
+
[2003]: QueryFailedError,
|
|
926
|
+
[3000]: NotFoundError
|
|
927
|
+
};
|
|
928
|
+
|
|
604
929
|
var relayer_gen = /*#__PURE__*/Object.freeze({
|
|
605
930
|
__proto__: null,
|
|
606
931
|
WebRPCVersion: WebRPCVersion,
|
|
@@ -610,7 +935,28 @@ var relayer_gen = /*#__PURE__*/Object.freeze({
|
|
|
610
935
|
TransferType: TransferType,
|
|
611
936
|
FeeTokenType: FeeTokenType,
|
|
612
937
|
SortOrder: SortOrder,
|
|
613
|
-
Relayer: Relayer
|
|
938
|
+
Relayer: Relayer,
|
|
939
|
+
WebrpcError: WebrpcError,
|
|
940
|
+
WebrpcEndpointError: WebrpcEndpointError,
|
|
941
|
+
WebrpcRequestFailedError: WebrpcRequestFailedError,
|
|
942
|
+
WebrpcBadRouteError: WebrpcBadRouteError,
|
|
943
|
+
WebrpcBadMethodError: WebrpcBadMethodError,
|
|
944
|
+
WebrpcBadRequestError: WebrpcBadRequestError,
|
|
945
|
+
WebrpcBadResponseError: WebrpcBadResponseError,
|
|
946
|
+
WebrpcServerPanicError: WebrpcServerPanicError,
|
|
947
|
+
WebrpcInternalErrorError: WebrpcInternalErrorError,
|
|
948
|
+
WebrpcClientDisconnectedError: WebrpcClientDisconnectedError,
|
|
949
|
+
WebrpcStreamLostError: WebrpcStreamLostError,
|
|
950
|
+
WebrpcStreamFinishedError: WebrpcStreamFinishedError,
|
|
951
|
+
UnauthorizedError: UnauthorizedError,
|
|
952
|
+
PermissionDeniedError: PermissionDeniedError,
|
|
953
|
+
MethodNotFoundError: MethodNotFoundError,
|
|
954
|
+
AbortedError: AbortedError,
|
|
955
|
+
InvalidArgumentError: InvalidArgumentError,
|
|
956
|
+
UnavailableError: UnavailableError,
|
|
957
|
+
QueryFailedError: QueryFailedError,
|
|
958
|
+
NotFoundError: NotFoundError,
|
|
959
|
+
errors: errors
|
|
614
960
|
});
|
|
615
961
|
|
|
616
962
|
const FINAL_STATUSES = [ETHTxnStatus.DROPPED, ETHTxnStatus.SUCCEEDED, ETHTxnStatus.PARTIALLY_FAILED, ETHTxnStatus.FAILED];
|