@0xsequence/relayer 0.42.10 → 0.43.0

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.
@@ -1,17 +1,18 @@
1
1
  /* eslint-disable */
2
- // sequence-relayer v0.4.0 e7d1a1c505a5bcc9189296c17a160c72e1f6ef8a
2
+ // sequence-relayer v0.4.0 dd44f90f38fc726a1f1430cfece544c3316f6b4f
3
3
  // --
4
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
5
- // Do not edit by hand. Update your webrpc schema and re-generate.
4
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
5
+ //
6
+ // webrpc-gen -schema=relayer.ridl -target=typescript -client -out=./clients/relayer.gen.ts
6
7
 
7
8
  // WebRPC description and code-gen version
8
- export const WebRPCVersion = 'v1'
9
+ export const WebRPCVersion = "v1"
9
10
 
10
11
  // Schema version of your RIDL schema
11
- export const WebRPCSchemaVersion = 'v0.4.0'
12
+ export const WebRPCSchemaVersion = "v0.4.0"
12
13
 
13
14
  // Schema hash generated from your RIDL schema
14
- export const WebRPCSchemaHash = 'e7d1a1c505a5bcc9189296c17a160c72e1f6ef8a'
15
+ export const WebRPCSchemaHash = "dd44f90f38fc726a1f1430cfece544c3316f6b4f"
15
16
 
16
17
  //
17
18
  // Types
@@ -70,7 +71,8 @@ export interface SenderStatus {
70
71
  active: boolean
71
72
  }
72
73
 
73
- export interface RuntimeChecks {}
74
+ export interface RuntimeChecks {
75
+ }
74
76
 
75
77
  export interface SequenceContext {
76
78
  factory: string
@@ -131,8 +133,8 @@ export interface MetaTxnLog {
131
133
  minedAt: string
132
134
  target: string
133
135
  input: string
134
- txnArgs: { [key: string]: any }
135
- txnReceipt?: { [key: string]: any }
136
+ txnArgs: {[key: string]: any}
137
+ txnReceipt?: {[key: string]: any}
136
138
  walletAddress: string
137
139
  metaTxnNonce: string
138
140
  gasLimit: number
@@ -177,7 +179,7 @@ export interface Transaction {
177
179
  chainId: number
178
180
  metaTxnID?: string
179
181
  transfers?: Array<TxnLogTransfer>
180
- users?: { [key: string]: TxnLogUser }
182
+ users?: {[key: string]: TxnLogUser}
181
183
  timestamp: string
182
184
  }
183
185
 
@@ -252,8 +254,10 @@ export interface Relayer {
252
254
  getMetaTxnNonce(args: GetMetaTxnNonceArgs, headers?: object): Promise<GetMetaTxnNonceReturn>
253
255
  getMetaTxnReceipt(args: GetMetaTxnReceiptArgs, headers?: object): Promise<GetMetaTxnReceiptReturn>
254
256
  simulate(args: SimulateArgs, headers?: object): Promise<SimulateReturn>
257
+ updateMetaTxnGasLimits(args: UpdateMetaTxnGasLimitsArgs, headers?: object): Promise<UpdateMetaTxnGasLimitsReturn>
255
258
  feeTokens(headers?: object): Promise<FeeTokensReturn>
256
259
  feeOptions(args: FeeOptionsArgs, headers?: object): Promise<FeeOptionsReturn>
260
+ getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn>
257
261
  sentTransactions(args: SentTransactionsArgs, headers?: object): Promise<SentTransactionsReturn>
258
262
  pendingTransactions(args: PendingTransactionsArgs, headers?: object): Promise<PendingTransactionsReturn>
259
263
  listGasSponsors(args: ListGasSponsorsArgs, headers?: object): Promise<ListGasSponsorsReturn>
@@ -262,30 +266,35 @@ export interface Relayer {
262
266
  reportGasSponsorUsage(args: ReportGasSponsorUsageArgs, headers?: object): Promise<ReportGasSponsorUsageReturn>
263
267
  }
264
268
 
265
- export interface PingArgs {}
269
+ export interface PingArgs {
270
+ }
266
271
 
267
272
  export interface PingReturn {
268
- status: boolean
273
+ status: boolean
274
+ }
275
+ export interface VersionArgs {
269
276
  }
270
- export interface VersionArgs {}
271
277
 
272
278
  export interface VersionReturn {
273
- version: Version
279
+ version: Version
280
+ }
281
+ export interface RuntimeStatusArgs {
274
282
  }
275
- export interface RuntimeStatusArgs {}
276
283
 
277
284
  export interface RuntimeStatusReturn {
278
- status: RuntimeStatus
285
+ status: RuntimeStatus
286
+ }
287
+ export interface GetSequenceContextArgs {
279
288
  }
280
- export interface GetSequenceContextArgs {}
281
289
 
282
290
  export interface GetSequenceContextReturn {
283
- data: SequenceContext
291
+ data: SequenceContext
292
+ }
293
+ export interface GetChainIDArgs {
284
294
  }
285
- export interface GetChainIDArgs {}
286
295
 
287
296
  export interface GetChainIDReturn {
288
- chainID: number
297
+ chainID: number
289
298
  }
290
299
  export interface SendMetaTxnArgs {
291
300
  call: MetaTxn
@@ -294,7 +303,7 @@ export interface SendMetaTxnArgs {
294
303
 
295
304
  export interface SendMetaTxnReturn {
296
305
  status: boolean
297
- txnHash: string
306
+ txnHash: string
298
307
  }
299
308
  export interface GetMetaTxnNonceArgs {
300
309
  walletContractAddress: string
@@ -302,14 +311,14 @@ export interface GetMetaTxnNonceArgs {
302
311
  }
303
312
 
304
313
  export interface GetMetaTxnNonceReturn {
305
- nonce: string
314
+ nonce: string
306
315
  }
307
316
  export interface GetMetaTxnReceiptArgs {
308
317
  metaTxID: string
309
318
  }
310
319
 
311
320
  export interface GetMetaTxnReceiptReturn {
312
- receipt: MetaTxnReceipt
321
+ receipt: MetaTxnReceipt
313
322
  }
314
323
  export interface SimulateArgs {
315
324
  wallet: string
@@ -317,13 +326,23 @@ export interface SimulateArgs {
317
326
  }
318
327
 
319
328
  export interface SimulateReturn {
320
- results: Array<SimulateResult>
329
+ results: Array<SimulateResult>
330
+ }
331
+ export interface UpdateMetaTxnGasLimitsArgs {
332
+ walletAddress: string
333
+ walletConfig: WalletConfig
334
+ payload: string
335
+ }
336
+
337
+ export interface UpdateMetaTxnGasLimitsReturn {
338
+ payload: string
339
+ }
340
+ export interface FeeTokensArgs {
321
341
  }
322
- export interface FeeTokensArgs {}
323
342
 
324
343
  export interface FeeTokensReturn {
325
344
  isFeeRequired: boolean
326
- tokens: Array<FeeToken>
345
+ tokens: Array<FeeToken>
327
346
  }
328
347
  export interface FeeOptionsArgs {
329
348
  wallet: string
@@ -333,7 +352,15 @@ export interface FeeOptionsArgs {
333
352
 
334
353
  export interface FeeOptionsReturn {
335
354
  options: Array<FeeOption>
336
- quote?: string
355
+ quote?: string
356
+ }
357
+ export interface GetMetaTxnNetworkFeeOptionsArgs {
358
+ walletConfig: WalletConfig
359
+ payload: string
360
+ }
361
+
362
+ export interface GetMetaTxnNetworkFeeOptionsReturn {
363
+ options: Array<FeeOption>
337
364
  }
338
365
  export interface SentTransactionsArgs {
339
366
  filter?: SentTransactionsFilter
@@ -342,7 +369,7 @@ export interface SentTransactionsArgs {
342
369
 
343
370
  export interface SentTransactionsReturn {
344
371
  page: Page
345
- transactions: Array<Transaction>
372
+ transactions: Array<Transaction>
346
373
  }
347
374
  export interface PendingTransactionsArgs {
348
375
  page?: Page
@@ -350,7 +377,7 @@ export interface PendingTransactionsArgs {
350
377
 
351
378
  export interface PendingTransactionsReturn {
352
379
  page: Page
353
- transactions: Array<Transaction>
380
+ transactions: Array<Transaction>
354
381
  }
355
382
  export interface ListGasSponsorsArgs {
356
383
  page?: Page
@@ -358,7 +385,7 @@ export interface ListGasSponsorsArgs {
358
385
 
359
386
  export interface ListGasSponsorsReturn {
360
387
  page: Page
361
- gasSponsors: Array<GasSponsor>
388
+ gasSponsors: Array<GasSponsor>
362
389
  }
363
390
  export interface AddGasSponsorArgs {
364
391
  address: string
@@ -368,7 +395,7 @@ export interface AddGasSponsorArgs {
368
395
 
369
396
  export interface AddGasSponsorReturn {
370
397
  status: boolean
371
- gasSponsor: GasSponsor
398
+ gasSponsor: GasSponsor
372
399
  }
373
400
  export interface UpdateGasSponsorArgs {
374
401
  address: string
@@ -378,7 +405,7 @@ export interface UpdateGasSponsorArgs {
378
405
 
379
406
  export interface UpdateGasSponsorReturn {
380
407
  status: boolean
381
- gasSponsor: GasSponsor
408
+ gasSponsor: GasSponsor
382
409
  }
383
410
  export interface ReportGasSponsorUsageArgs {
384
411
  startTime?: string
@@ -386,9 +413,11 @@ export interface ReportGasSponsorUsageArgs {
386
413
  }
387
414
 
388
415
  export interface ReportGasSponsorUsageReturn {
389
- gasSponsorUsage: Array<GasSponsorUsage>
416
+ gasSponsorUsage: Array<GasSponsorUsage>
390
417
  }
391
418
 
419
+
420
+
392
421
  //
393
422
  // Client
394
423
  //
@@ -399,196 +428,262 @@ export class Relayer implements Relayer {
399
428
 
400
429
  constructor(hostname: string, fetch: Fetch) {
401
430
  this.hostname = hostname
402
- this.fetch = fetch
431
+ this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init)
403
432
  }
404
433
 
405
434
  private url(name: string): string {
406
435
  return this.hostname + this.path + name
407
436
  }
408
-
437
+
409
438
  ping = (headers?: object): Promise<PingReturn> => {
410
- return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
439
+ return this.fetch(
440
+ this.url('Ping'),
441
+ createHTTPRequest({}, headers)
442
+ ).then((res) => {
411
443
  return buildResponse(res).then(_data => {
412
444
  return {
413
- status: <boolean>_data.status
445
+ status: <boolean>(_data.status)
414
446
  }
415
447
  })
416
448
  })
417
449
  }
418
-
450
+
419
451
  version = (headers?: object): Promise<VersionReturn> => {
420
- return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
452
+ return this.fetch(
453
+ this.url('Version'),
454
+ createHTTPRequest({}, headers)
455
+ ).then((res) => {
421
456
  return buildResponse(res).then(_data => {
422
457
  return {
423
- version: <Version>_data.version
458
+ version: <Version>(_data.version)
424
459
  }
425
460
  })
426
461
  })
427
462
  }
428
-
463
+
429
464
  runtimeStatus = (headers?: object): Promise<RuntimeStatusReturn> => {
430
- return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
465
+ return this.fetch(
466
+ this.url('RuntimeStatus'),
467
+ createHTTPRequest({}, headers)
468
+ ).then((res) => {
431
469
  return buildResponse(res).then(_data => {
432
470
  return {
433
- status: <RuntimeStatus>_data.status
471
+ status: <RuntimeStatus>(_data.status)
434
472
  }
435
473
  })
436
474
  })
437
475
  }
438
-
476
+
439
477
  getSequenceContext = (headers?: object): Promise<GetSequenceContextReturn> => {
440
- return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
478
+ return this.fetch(
479
+ this.url('GetSequenceContext'),
480
+ createHTTPRequest({}, headers)
481
+ ).then((res) => {
441
482
  return buildResponse(res).then(_data => {
442
483
  return {
443
- data: <SequenceContext>_data.data
484
+ data: <SequenceContext>(_data.data)
444
485
  }
445
486
  })
446
487
  })
447
488
  }
448
-
489
+
449
490
  getChainID = (headers?: object): Promise<GetChainIDReturn> => {
450
- return this.fetch(this.url('GetChainID'), createHTTPRequest({}, headers)).then(res => {
491
+ return this.fetch(
492
+ this.url('GetChainID'),
493
+ createHTTPRequest({}, headers)
494
+ ).then((res) => {
451
495
  return buildResponse(res).then(_data => {
452
496
  return {
453
- chainID: <number>_data.chainID
497
+ chainID: <number>(_data.chainID)
454
498
  }
455
499
  })
456
500
  })
457
501
  }
458
-
502
+
459
503
  sendMetaTxn = (args: SendMetaTxnArgs, headers?: object): Promise<SendMetaTxnReturn> => {
460
- return this.fetch(this.url('SendMetaTxn'), createHTTPRequest(args, headers)).then(res => {
504
+ return this.fetch(
505
+ this.url('SendMetaTxn'),
506
+ createHTTPRequest(args, headers)).then((res) => {
461
507
  return buildResponse(res).then(_data => {
462
508
  return {
463
- status: <boolean>_data.status,
464
- txnHash: <string>_data.txnHash
509
+ status: <boolean>(_data.status),
510
+ txnHash: <string>(_data.txnHash)
465
511
  }
466
512
  })
467
513
  })
468
514
  }
469
-
515
+
470
516
  getMetaTxnNonce = (args: GetMetaTxnNonceArgs, headers?: object): Promise<GetMetaTxnNonceReturn> => {
471
- return this.fetch(this.url('GetMetaTxnNonce'), createHTTPRequest(args, headers)).then(res => {
517
+ return this.fetch(
518
+ this.url('GetMetaTxnNonce'),
519
+ createHTTPRequest(args, headers)).then((res) => {
472
520
  return buildResponse(res).then(_data => {
473
521
  return {
474
- nonce: <string>_data.nonce
522
+ nonce: <string>(_data.nonce)
475
523
  }
476
524
  })
477
525
  })
478
526
  }
479
-
527
+
480
528
  getMetaTxnReceipt = (args: GetMetaTxnReceiptArgs, headers?: object): Promise<GetMetaTxnReceiptReturn> => {
481
- return this.fetch(this.url('GetMetaTxnReceipt'), createHTTPRequest(args, headers)).then(res => {
529
+ return this.fetch(
530
+ this.url('GetMetaTxnReceipt'),
531
+ createHTTPRequest(args, headers)).then((res) => {
482
532
  return buildResponse(res).then(_data => {
483
533
  return {
484
- receipt: <MetaTxnReceipt>_data.receipt
534
+ receipt: <MetaTxnReceipt>(_data.receipt)
485
535
  }
486
536
  })
487
537
  })
488
538
  }
489
-
539
+
490
540
  simulate = (args: SimulateArgs, headers?: object): Promise<SimulateReturn> => {
491
- return this.fetch(this.url('Simulate'), createHTTPRequest(args, headers)).then(res => {
541
+ return this.fetch(
542
+ this.url('Simulate'),
543
+ createHTTPRequest(args, headers)).then((res) => {
492
544
  return buildResponse(res).then(_data => {
493
545
  return {
494
- results: <Array<SimulateResult>>_data.results
546
+ results: <Array<SimulateResult>>(_data.results)
495
547
  }
496
548
  })
497
549
  })
498
550
  }
499
-
551
+
552
+ updateMetaTxnGasLimits = (args: UpdateMetaTxnGasLimitsArgs, headers?: object): Promise<UpdateMetaTxnGasLimitsReturn> => {
553
+ return this.fetch(
554
+ this.url('UpdateMetaTxnGasLimits'),
555
+ createHTTPRequest(args, headers)).then((res) => {
556
+ return buildResponse(res).then(_data => {
557
+ return {
558
+ payload: <string>(_data.payload)
559
+ }
560
+ })
561
+ })
562
+ }
563
+
500
564
  feeTokens = (headers?: object): Promise<FeeTokensReturn> => {
501
- return this.fetch(this.url('FeeTokens'), createHTTPRequest({}, headers)).then(res => {
565
+ return this.fetch(
566
+ this.url('FeeTokens'),
567
+ createHTTPRequest({}, headers)
568
+ ).then((res) => {
502
569
  return buildResponse(res).then(_data => {
503
570
  return {
504
- isFeeRequired: <boolean>_data.isFeeRequired,
505
- tokens: <Array<FeeToken>>_data.tokens
571
+ isFeeRequired: <boolean>(_data.isFeeRequired),
572
+ tokens: <Array<FeeToken>>(_data.tokens)
506
573
  }
507
574
  })
508
575
  })
509
576
  }
510
-
577
+
511
578
  feeOptions = (args: FeeOptionsArgs, headers?: object): Promise<FeeOptionsReturn> => {
512
- return this.fetch(this.url('FeeOptions'), createHTTPRequest(args, headers)).then(res => {
579
+ return this.fetch(
580
+ this.url('FeeOptions'),
581
+ createHTTPRequest(args, headers)).then((res) => {
513
582
  return buildResponse(res).then(_data => {
514
583
  return {
515
- options: <Array<FeeOption>>_data.options,
516
- quote: <string>_data.quote
584
+ options: <Array<FeeOption>>(_data.options),
585
+ quote: <string>(_data.quote)
517
586
  }
518
587
  })
519
588
  })
520
589
  }
521
-
590
+
591
+ getMetaTxnNetworkFeeOptions = (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn> => {
592
+ return this.fetch(
593
+ this.url('GetMetaTxnNetworkFeeOptions'),
594
+ createHTTPRequest(args, headers)).then((res) => {
595
+ return buildResponse(res).then(_data => {
596
+ return {
597
+ options: <Array<FeeOption>>(_data.options)
598
+ }
599
+ })
600
+ })
601
+ }
602
+
522
603
  sentTransactions = (args: SentTransactionsArgs, headers?: object): Promise<SentTransactionsReturn> => {
523
- return this.fetch(this.url('SentTransactions'), createHTTPRequest(args, headers)).then(res => {
604
+ return this.fetch(
605
+ this.url('SentTransactions'),
606
+ createHTTPRequest(args, headers)).then((res) => {
524
607
  return buildResponse(res).then(_data => {
525
608
  return {
526
- page: <Page>_data.page,
527
- transactions: <Array<Transaction>>_data.transactions
609
+ page: <Page>(_data.page),
610
+ transactions: <Array<Transaction>>(_data.transactions)
528
611
  }
529
612
  })
530
613
  })
531
614
  }
532
-
615
+
533
616
  pendingTransactions = (args: PendingTransactionsArgs, headers?: object): Promise<PendingTransactionsReturn> => {
534
- return this.fetch(this.url('PendingTransactions'), createHTTPRequest(args, headers)).then(res => {
617
+ return this.fetch(
618
+ this.url('PendingTransactions'),
619
+ createHTTPRequest(args, headers)).then((res) => {
535
620
  return buildResponse(res).then(_data => {
536
621
  return {
537
- page: <Page>_data.page,
538
- transactions: <Array<Transaction>>_data.transactions
622
+ page: <Page>(_data.page),
623
+ transactions: <Array<Transaction>>(_data.transactions)
539
624
  }
540
625
  })
541
626
  })
542
627
  }
543
-
628
+
544
629
  listGasSponsors = (args: ListGasSponsorsArgs, headers?: object): Promise<ListGasSponsorsReturn> => {
545
- return this.fetch(this.url('ListGasSponsors'), createHTTPRequest(args, headers)).then(res => {
630
+ return this.fetch(
631
+ this.url('ListGasSponsors'),
632
+ createHTTPRequest(args, headers)).then((res) => {
546
633
  return buildResponse(res).then(_data => {
547
634
  return {
548
- page: <Page>_data.page,
549
- gasSponsors: <Array<GasSponsor>>_data.gasSponsors
635
+ page: <Page>(_data.page),
636
+ gasSponsors: <Array<GasSponsor>>(_data.gasSponsors)
550
637
  }
551
638
  })
552
639
  })
553
640
  }
554
-
641
+
555
642
  addGasSponsor = (args: AddGasSponsorArgs, headers?: object): Promise<AddGasSponsorReturn> => {
556
- return this.fetch(this.url('AddGasSponsor'), createHTTPRequest(args, headers)).then(res => {
643
+ return this.fetch(
644
+ this.url('AddGasSponsor'),
645
+ createHTTPRequest(args, headers)).then((res) => {
557
646
  return buildResponse(res).then(_data => {
558
647
  return {
559
- status: <boolean>_data.status,
560
- gasSponsor: <GasSponsor>_data.gasSponsor
648
+ status: <boolean>(_data.status),
649
+ gasSponsor: <GasSponsor>(_data.gasSponsor)
561
650
  }
562
651
  })
563
652
  })
564
653
  }
565
-
654
+
566
655
  updateGasSponsor = (args: UpdateGasSponsorArgs, headers?: object): Promise<UpdateGasSponsorReturn> => {
567
- return this.fetch(this.url('UpdateGasSponsor'), createHTTPRequest(args, headers)).then(res => {
656
+ return this.fetch(
657
+ this.url('UpdateGasSponsor'),
658
+ createHTTPRequest(args, headers)).then((res) => {
568
659
  return buildResponse(res).then(_data => {
569
660
  return {
570
- status: <boolean>_data.status,
571
- gasSponsor: <GasSponsor>_data.gasSponsor
661
+ status: <boolean>(_data.status),
662
+ gasSponsor: <GasSponsor>(_data.gasSponsor)
572
663
  }
573
664
  })
574
665
  })
575
666
  }
576
-
667
+
577
668
  reportGasSponsorUsage = (args: ReportGasSponsorUsageArgs, headers?: object): Promise<ReportGasSponsorUsageReturn> => {
578
- return this.fetch(this.url('ReportGasSponsorUsage'), createHTTPRequest(args, headers)).then(res => {
669
+ return this.fetch(
670
+ this.url('ReportGasSponsorUsage'),
671
+ createHTTPRequest(args, headers)).then((res) => {
579
672
  return buildResponse(res).then(_data => {
580
673
  return {
581
- gasSponsorUsage: <Array<GasSponsorUsage>>_data.gasSponsorUsage
674
+ gasSponsorUsage: <Array<GasSponsorUsage>>(_data.gasSponsorUsage)
582
675
  }
583
676
  })
584
677
  })
585
678
  }
679
+
586
680
  }
587
681
 
682
+
588
683
  export interface WebRPCError extends Error {
589
684
  code: string
590
685
  msg: string
591
- status: number
686
+ status: number
592
687
  }
593
688
 
594
689
  const createHTTPRequest = (body: object = {}, headers: object = {}): object => {
@@ -604,7 +699,7 @@ const buildResponse = (res: Response): Promise<any> => {
604
699
  let data
605
700
  try {
606
701
  data = JSON.parse(text)
607
- } catch (err) {
702
+ } catch(err) {
608
703
  throw { code: 'unknown', msg: `expecting JSON, got: ${text}`, status: res.status } as WebRPCError
609
704
  }
610
705
  if (!res.ok) {