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