@sentio/sdk 2.45.3-rc.1 → 2.45.3-rc.2

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.
Files changed (49) hide show
  1. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +23 -23
  2. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  3. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +93 -659
  4. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  5. package/lib/eth/builtin/internal/erc1155-processor.d.ts +8 -8
  6. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  7. package/lib/eth/builtin/internal/erc1155-processor.js +33 -264
  8. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  9. package/lib/eth/builtin/internal/erc20-processor.d.ts +18 -18
  10. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  11. package/lib/eth/builtin/internal/erc20-processor.js +75 -538
  12. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  13. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +9 -9
  14. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  15. package/lib/eth/builtin/internal/erc20bytes-processor.js +37 -268
  16. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  17. package/lib/eth/builtin/internal/erc721-processor.d.ts +14 -14
  18. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  19. package/lib/eth/builtin/internal/erc721-processor.js +57 -430
  20. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  21. package/lib/eth/builtin/internal/weth9-processor.d.ts +11 -11
  22. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  23. package/lib/eth/builtin/internal/weth9-processor.js +45 -321
  24. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  25. package/lib/eth/codegen/file.d.ts.map +1 -1
  26. package/lib/eth/codegen/file.js +3 -6
  27. package/lib/eth/codegen/file.js.map +1 -1
  28. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  29. package/lib/eth/codegen/function-calls.js +5 -27
  30. package/lib/eth/codegen/function-calls.js.map +1 -1
  31. package/lib/eth/context.d.ts +4 -2
  32. package/lib/eth/context.d.ts.map +1 -1
  33. package/lib/eth/context.js +15 -0
  34. package/lib/eth/context.js.map +1 -1
  35. package/lib/eth/eth.d.ts +2 -0
  36. package/lib/eth/eth.d.ts.map +1 -1
  37. package/lib/eth/eth.js +15 -1
  38. package/lib/eth/eth.js.map +1 -1
  39. package/package.json +3 -3
  40. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +189 -662
  41. package/src/eth/builtin/internal/erc1155-processor.ts +69 -261
  42. package/src/eth/builtin/internal/erc20-processor.ts +136 -535
  43. package/src/eth/builtin/internal/erc20bytes-processor.ts +68 -265
  44. package/src/eth/builtin/internal/erc721-processor.ts +118 -433
  45. package/src/eth/builtin/internal/weth9-processor.ts +81 -318
  46. package/src/eth/codegen/file.ts +2 -6
  47. package/src/eth/codegen/function-calls.ts +7 -29
  48. package/src/eth/context.ts +19 -2
  49. package/src/eth/eth.ts +21 -1
@@ -1,7 +1,7 @@
1
1
  /* Autogenerated file. Do not edit manually. */
2
2
  /* tslint:disable */
3
3
  /* eslint-disable */
4
- import { BigNumberish, Overrides, BytesLike, Interface } from "ethers";
4
+ import { BigNumberish, Overrides, BytesLike } from "ethers";
5
5
  import {
6
6
  addContractByABI,
7
7
  getContractByABI,
@@ -21,6 +21,7 @@ import {
21
21
  EthContext,
22
22
  EthFetchConfig,
23
23
  PreprocessResult,
24
+ encodeCallData,
24
25
  } from "@sentio/sdk/eth";
25
26
  import { EthCallParam, EthCallContext, PreparedData } from "@sentio/protos";
26
27
 
@@ -150,23 +151,6 @@ export type TransferFromCallTrace = TypedCallTrace<
150
151
 
151
152
  const templateContract = ERC721__factory.connect("0x0", DummyProvider);
152
153
 
153
- const iface = new Interface([
154
- "function approve(address to, uint256 tokenId) returns ()",
155
- "function totalSupply() view returns (uint256)",
156
- "function balanceOf(address owner) view returns (uint256 balance)",
157
- "function getApproved(uint256 tokenId) view returns (address operator)",
158
- "function isApprovedForAll(address owner, address operator) view returns (bool)",
159
- "function name() view returns (string)",
160
- "function ownerOf(uint256 tokenId) view returns (address owner)",
161
- "function safeTransferFrom(address from, address to, uint256 tokenId) returns ()",
162
- "function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) returns ()",
163
- "function setApprovalForAll(address operator, bool _approved) returns ()",
164
- "function supportsInterface(bytes4 interfaceId) view returns (bool)",
165
- "function symbol() view returns (string)",
166
- "function tokenURI(uint256 tokenId) view returns (string)",
167
- "function transferFrom(address from, address to, uint256 tokenId) returns ()",
168
- ]);
169
-
170
154
  export class ERC721ContractView extends ContractView<ERC721> {
171
155
  constructor(contract: ERC721) {
172
156
  super(contract);
@@ -407,255 +391,138 @@ export class ERC721ContractView extends ContractView<ERC721> {
407
391
  approve(
408
392
  to: string,
409
393
  tokenId: BigNumberish,
410
- ethCallContext: EthCallContext,
394
+ callContext: EthCallContext,
411
395
  ): EthCallParam {
412
- try {
413
- const iface = new Interface(["function approve(address,uint256)"]);
414
- const calldata = iface.encodeFunctionData("approve", [to, tokenId]);
415
- return {
416
- context: ethCallContext,
417
- calldata,
418
- };
419
- } catch (e) {
420
- const stack = new Error().stack;
421
- throw transformEtherError(e, undefined, stack);
422
- }
396
+ return encodeCallData(
397
+ callContext,
398
+ "approve",
399
+ "function approve(address,uint256)",
400
+ [to, tokenId],
401
+ );
423
402
  },
424
- totalSupply(ethCallContext: EthCallContext): EthCallParam {
425
- try {
426
- const iface = new Interface(["function totalSupply()"]);
427
- const calldata = iface.encodeFunctionData("totalSupply", []);
428
- return {
429
- context: ethCallContext,
430
- calldata,
431
- };
432
- } catch (e) {
433
- const stack = new Error().stack;
434
- throw transformEtherError(e, undefined, stack);
435
- }
403
+ totalSupply(callContext: EthCallContext): EthCallParam {
404
+ return encodeCallData(
405
+ callContext,
406
+ "totalSupply",
407
+ "function totalSupply()",
408
+ [],
409
+ );
436
410
  },
437
- balanceOf(owner: string, ethCallContext: EthCallContext): EthCallParam {
438
- try {
439
- const iface = new Interface(["function balanceOf(address)"]);
440
- const calldata = iface.encodeFunctionData("balanceOf", [owner]);
441
- return {
442
- context: ethCallContext,
443
- calldata,
444
- };
445
- } catch (e) {
446
- const stack = new Error().stack;
447
- throw transformEtherError(e, undefined, stack);
448
- }
411
+ balanceOf(owner: string, callContext: EthCallContext): EthCallParam {
412
+ return encodeCallData(
413
+ callContext,
414
+ "balanceOf",
415
+ "function balanceOf(address)",
416
+ [owner],
417
+ );
449
418
  },
450
419
  getApproved(
451
420
  tokenId: BigNumberish,
452
- ethCallContext: EthCallContext,
421
+ callContext: EthCallContext,
453
422
  ): EthCallParam {
454
- try {
455
- const iface = new Interface(["function getApproved(uint256)"]);
456
- const calldata = iface.encodeFunctionData("getApproved", [tokenId]);
457
- return {
458
- context: ethCallContext,
459
- calldata,
460
- };
461
- } catch (e) {
462
- const stack = new Error().stack;
463
- throw transformEtherError(e, undefined, stack);
464
- }
423
+ return encodeCallData(
424
+ callContext,
425
+ "getApproved",
426
+ "function getApproved(uint256)",
427
+ [tokenId],
428
+ );
465
429
  },
466
430
  isApprovedForAll(
467
431
  owner: string,
468
432
  operator: string,
469
- ethCallContext: EthCallContext,
433
+ callContext: EthCallContext,
470
434
  ): EthCallParam {
471
- try {
472
- const iface = new Interface([
473
- "function isApprovedForAll(address,address)",
474
- ]);
475
- const calldata = iface.encodeFunctionData("isApprovedForAll", [
476
- owner,
477
- operator,
478
- ]);
479
- return {
480
- context: ethCallContext,
481
- calldata,
482
- };
483
- } catch (e) {
484
- const stack = new Error().stack;
485
- throw transformEtherError(e, undefined, stack);
486
- }
435
+ return encodeCallData(
436
+ callContext,
437
+ "isApprovedForAll",
438
+ "function isApprovedForAll(address,address)",
439
+ [owner, operator],
440
+ );
487
441
  },
488
- name(ethCallContext: EthCallContext): EthCallParam {
489
- try {
490
- const iface = new Interface(["function name()"]);
491
- const calldata = iface.encodeFunctionData("name", []);
492
- return {
493
- context: ethCallContext,
494
- calldata,
495
- };
496
- } catch (e) {
497
- const stack = new Error().stack;
498
- throw transformEtherError(e, undefined, stack);
499
- }
442
+ name(callContext: EthCallContext): EthCallParam {
443
+ return encodeCallData(callContext, "name", "function name()", []);
500
444
  },
501
- ownerOf(
502
- tokenId: BigNumberish,
503
- ethCallContext: EthCallContext,
504
- ): EthCallParam {
505
- try {
506
- const iface = new Interface(["function ownerOf(uint256)"]);
507
- const calldata = iface.encodeFunctionData("ownerOf", [tokenId]);
508
- return {
509
- context: ethCallContext,
510
- calldata,
511
- };
512
- } catch (e) {
513
- const stack = new Error().stack;
514
- throw transformEtherError(e, undefined, stack);
515
- }
445
+ ownerOf(tokenId: BigNumberish, callContext: EthCallContext): EthCallParam {
446
+ return encodeCallData(
447
+ callContext,
448
+ "ownerOf",
449
+ "function ownerOf(uint256)",
450
+ [tokenId],
451
+ );
516
452
  },
517
453
  safeTransferFrom_address_address_uint256(
518
454
  from: string,
519
455
  to: string,
520
456
  tokenId: BigNumberish,
521
- ethCallContext: EthCallContext,
457
+ callContext: EthCallContext,
522
458
  ): EthCallParam {
523
- try {
524
- const iface = new Interface([
525
- "function safeTransferFrom(address,address,uint256)",
526
- ]);
527
- const calldata = iface.encodeFunctionData("safeTransferFrom", [
528
- from,
529
- to,
530
- tokenId,
531
- ]);
532
- return {
533
- context: ethCallContext,
534
- calldata,
535
- };
536
- } catch (e) {
537
- const stack = new Error().stack;
538
- throw transformEtherError(e, undefined, stack);
539
- }
459
+ return encodeCallData(
460
+ callContext,
461
+ "safeTransferFrom",
462
+ "function safeTransferFrom(address,address,uint256)",
463
+ [from, to, tokenId],
464
+ );
540
465
  },
541
466
  safeTransferFrom_address_address_uint256_bytes(
542
467
  from: string,
543
468
  to: string,
544
469
  tokenId: BigNumberish,
545
470
  data: BytesLike,
546
- ethCallContext: EthCallContext,
471
+ callContext: EthCallContext,
547
472
  ): EthCallParam {
548
- try {
549
- const iface = new Interface([
550
- "function safeTransferFrom(address,address,uint256,bytes)",
551
- ]);
552
- const calldata = iface.encodeFunctionData("safeTransferFrom", [
553
- from,
554
- to,
555
- tokenId,
556
- data,
557
- ]);
558
- return {
559
- context: ethCallContext,
560
- calldata,
561
- };
562
- } catch (e) {
563
- const stack = new Error().stack;
564
- throw transformEtherError(e, undefined, stack);
565
- }
473
+ return encodeCallData(
474
+ callContext,
475
+ "safeTransferFrom",
476
+ "function safeTransferFrom(address,address,uint256,bytes)",
477
+ [from, to, tokenId, data],
478
+ );
566
479
  },
567
480
  setApprovalForAll(
568
481
  operator: string,
569
482
  _approved: boolean,
570
- ethCallContext: EthCallContext,
483
+ callContext: EthCallContext,
571
484
  ): EthCallParam {
572
- try {
573
- const iface = new Interface([
574
- "function setApprovalForAll(address,bool)",
575
- ]);
576
- const calldata = iface.encodeFunctionData("setApprovalForAll", [
577
- operator,
578
- _approved,
579
- ]);
580
- return {
581
- context: ethCallContext,
582
- calldata,
583
- };
584
- } catch (e) {
585
- const stack = new Error().stack;
586
- throw transformEtherError(e, undefined, stack);
587
- }
485
+ return encodeCallData(
486
+ callContext,
487
+ "setApprovalForAll",
488
+ "function setApprovalForAll(address,bool)",
489
+ [operator, _approved],
490
+ );
588
491
  },
589
492
  supportsInterface(
590
493
  interfaceId: BytesLike,
591
- ethCallContext: EthCallContext,
494
+ callContext: EthCallContext,
592
495
  ): EthCallParam {
593
- try {
594
- const iface = new Interface(["function supportsInterface(bytes4)"]);
595
- const calldata = iface.encodeFunctionData("supportsInterface", [
596
- interfaceId,
597
- ]);
598
- return {
599
- context: ethCallContext,
600
- calldata,
601
- };
602
- } catch (e) {
603
- const stack = new Error().stack;
604
- throw transformEtherError(e, undefined, stack);
605
- }
496
+ return encodeCallData(
497
+ callContext,
498
+ "supportsInterface",
499
+ "function supportsInterface(bytes4)",
500
+ [interfaceId],
501
+ );
606
502
  },
607
- symbol(ethCallContext: EthCallContext): EthCallParam {
608
- try {
609
- const iface = new Interface(["function symbol()"]);
610
- const calldata = iface.encodeFunctionData("symbol", []);
611
- return {
612
- context: ethCallContext,
613
- calldata,
614
- };
615
- } catch (e) {
616
- const stack = new Error().stack;
617
- throw transformEtherError(e, undefined, stack);
618
- }
503
+ symbol(callContext: EthCallContext): EthCallParam {
504
+ return encodeCallData(callContext, "symbol", "function symbol()", []);
619
505
  },
620
- tokenURI(
621
- tokenId: BigNumberish,
622
- ethCallContext: EthCallContext,
623
- ): EthCallParam {
624
- try {
625
- const iface = new Interface(["function tokenURI(uint256)"]);
626
- const calldata = iface.encodeFunctionData("tokenURI", [tokenId]);
627
- return {
628
- context: ethCallContext,
629
- calldata,
630
- };
631
- } catch (e) {
632
- const stack = new Error().stack;
633
- throw transformEtherError(e, undefined, stack);
634
- }
506
+ tokenURI(tokenId: BigNumberish, callContext: EthCallContext): EthCallParam {
507
+ return encodeCallData(
508
+ callContext,
509
+ "tokenURI",
510
+ "function tokenURI(uint256)",
511
+ [tokenId],
512
+ );
635
513
  },
636
514
  transferFrom(
637
515
  from: string,
638
516
  to: string,
639
517
  tokenId: BigNumberish,
640
- ethCallContext: EthCallContext,
518
+ callContext: EthCallContext,
641
519
  ): EthCallParam {
642
- try {
643
- const iface = new Interface([
644
- "function transferFrom(address,address,uint256)",
645
- ]);
646
- const calldata = iface.encodeFunctionData("transferFrom", [
647
- from,
648
- to,
649
- tokenId,
650
- ]);
651
- return {
652
- context: ethCallContext,
653
- calldata,
654
- };
655
- } catch (e) {
656
- const stack = new Error().stack;
657
- throw transformEtherError(e, undefined, stack);
658
- }
520
+ return encodeCallData(
521
+ callContext,
522
+ "transferFrom",
523
+ "function transferFrom(address,address,uint256)",
524
+ [from, to, tokenId],
525
+ );
659
526
  },
660
527
  };
661
528
  }
@@ -665,27 +532,17 @@ export class ERC721BoundContractView extends BoundContractView<
665
532
  ERC721ContractView
666
533
  > {
667
534
  async totalSupply(overrides?: Overrides): Promise<bigint> {
668
- const ethCallContext = {
669
- chainId: this.context.chainId,
670
- blockTag: "0x" + this.context.blockNumber.toString(16),
671
- address: this.context.address,
672
- };
673
535
  return await this.view.totalSupply(
674
536
  {
675
537
  blockTag: this.context.blockNumber,
676
538
  ...overrides,
677
539
  },
678
540
  this.context.preparedData,
679
- ethCallContext,
541
+ this.context.getEthCallContext(),
680
542
  );
681
543
  }
682
544
 
683
545
  async balanceOf(owner: string, overrides?: Overrides): Promise<bigint> {
684
- const ethCallContext = {
685
- chainId: this.context.chainId,
686
- blockTag: "0x" + this.context.blockNumber.toString(16),
687
- address: this.context.address,
688
- };
689
546
  return await this.view.balanceOf(
690
547
  owner,
691
548
  {
@@ -693,7 +550,7 @@ export class ERC721BoundContractView extends BoundContractView<
693
550
  ...overrides,
694
551
  },
695
552
  this.context.preparedData,
696
- ethCallContext,
553
+ this.context.getEthCallContext(),
697
554
  );
698
555
  }
699
556
 
@@ -701,11 +558,6 @@ export class ERC721BoundContractView extends BoundContractView<
701
558
  tokenId: BigNumberish,
702
559
  overrides?: Overrides,
703
560
  ): Promise<string> {
704
- const ethCallContext = {
705
- chainId: this.context.chainId,
706
- blockTag: "0x" + this.context.blockNumber.toString(16),
707
- address: this.context.address,
708
- };
709
561
  return await this.view.getApproved(
710
562
  tokenId,
711
563
  {
@@ -713,7 +565,7 @@ export class ERC721BoundContractView extends BoundContractView<
713
565
  ...overrides,
714
566
  },
715
567
  this.context.preparedData,
716
- ethCallContext,
568
+ this.context.getEthCallContext(),
717
569
  );
718
570
  }
719
571
 
@@ -722,11 +574,6 @@ export class ERC721BoundContractView extends BoundContractView<
722
574
  operator: string,
723
575
  overrides?: Overrides,
724
576
  ): Promise<boolean> {
725
- const ethCallContext = {
726
- chainId: this.context.chainId,
727
- blockTag: "0x" + this.context.blockNumber.toString(16),
728
- address: this.context.address,
729
- };
730
577
  return await this.view.isApprovedForAll(
731
578
  owner,
732
579
  operator,
@@ -735,32 +582,22 @@ export class ERC721BoundContractView extends BoundContractView<
735
582
  ...overrides,
736
583
  },
737
584
  this.context.preparedData,
738
- ethCallContext,
585
+ this.context.getEthCallContext(),
739
586
  );
740
587
  }
741
588
 
742
589
  async name(overrides?: Overrides): Promise<string> {
743
- const ethCallContext = {
744
- chainId: this.context.chainId,
745
- blockTag: "0x" + this.context.blockNumber.toString(16),
746
- address: this.context.address,
747
- };
748
590
  return await this.view.name(
749
591
  {
750
592
  blockTag: this.context.blockNumber,
751
593
  ...overrides,
752
594
  },
753
595
  this.context.preparedData,
754
- ethCallContext,
596
+ this.context.getEthCallContext(),
755
597
  );
756
598
  }
757
599
 
758
600
  async ownerOf(tokenId: BigNumberish, overrides?: Overrides): Promise<string> {
759
- const ethCallContext = {
760
- chainId: this.context.chainId,
761
- blockTag: "0x" + this.context.blockNumber.toString(16),
762
- address: this.context.address,
763
- };
764
601
  return await this.view.ownerOf(
765
602
  tokenId,
766
603
  {
@@ -768,7 +605,7 @@ export class ERC721BoundContractView extends BoundContractView<
768
605
  ...overrides,
769
606
  },
770
607
  this.context.preparedData,
771
- ethCallContext,
608
+ this.context.getEthCallContext(),
772
609
  );
773
610
  }
774
611
 
@@ -776,11 +613,6 @@ export class ERC721BoundContractView extends BoundContractView<
776
613
  interfaceId: BytesLike,
777
614
  overrides?: Overrides,
778
615
  ): Promise<boolean> {
779
- const ethCallContext = {
780
- chainId: this.context.chainId,
781
- blockTag: "0x" + this.context.blockNumber.toString(16),
782
- address: this.context.address,
783
- };
784
616
  return await this.view.supportsInterface(
785
617
  interfaceId,
786
618
  {
@@ -788,23 +620,18 @@ export class ERC721BoundContractView extends BoundContractView<
788
620
  ...overrides,
789
621
  },
790
622
  this.context.preparedData,
791
- ethCallContext,
623
+ this.context.getEthCallContext(),
792
624
  );
793
625
  }
794
626
 
795
627
  async symbol(overrides?: Overrides): Promise<string> {
796
- const ethCallContext = {
797
- chainId: this.context.chainId,
798
- blockTag: "0x" + this.context.blockNumber.toString(16),
799
- address: this.context.address,
800
- };
801
628
  return await this.view.symbol(
802
629
  {
803
630
  blockTag: this.context.blockNumber,
804
631
  ...overrides,
805
632
  },
806
633
  this.context.preparedData,
807
- ethCallContext,
634
+ this.context.getEthCallContext(),
808
635
  );
809
636
  }
810
637
 
@@ -812,11 +639,6 @@ export class ERC721BoundContractView extends BoundContractView<
812
639
  tokenId: BigNumberish,
813
640
  overrides?: Overrides,
814
641
  ): Promise<string> {
815
- const ethCallContext = {
816
- chainId: this.context.chainId,
817
- blockTag: "0x" + this.context.blockNumber.toString(16),
818
- address: this.context.address,
819
- };
820
642
  return await this.view.tokenURI(
821
643
  tokenId,
822
644
  {
@@ -824,7 +646,7 @@ export class ERC721BoundContractView extends BoundContractView<
824
646
  ...overrides,
825
647
  },
826
648
  this.context.preparedData,
827
- ethCallContext,
649
+ this.context.getEthCallContext(),
828
650
  );
829
651
  }
830
652
 
@@ -837,11 +659,6 @@ export class ERC721BoundContractView extends BoundContractView<
837
659
  tokenId: BigNumberish,
838
660
  overrides?: Overrides,
839
661
  ): Promise<void> {
840
- const ethCallContext = {
841
- chainId: this.context.chainId,
842
- blockTag: "0x" + this.context.blockNumber.toString(16),
843
- address: this.context.address,
844
- };
845
662
  return await this.view.callStatic.approve(
846
663
  to,
847
664
  tokenId,
@@ -850,7 +667,7 @@ export class ERC721BoundContractView extends BoundContractView<
850
667
  ...overrides,
851
668
  },
852
669
  this.context.preparedData,
853
- ethCallContext,
670
+ this.context.getEthCallContext(),
854
671
  );
855
672
  },
856
673
  async safeTransferFrom_address_address_uint256(
@@ -859,11 +676,6 @@ export class ERC721BoundContractView extends BoundContractView<
859
676
  tokenId: BigNumberish,
860
677
  overrides?: Overrides,
861
678
  ): Promise<void> {
862
- const ethCallContext = {
863
- chainId: this.context.chainId,
864
- blockTag: "0x" + this.context.blockNumber.toString(16),
865
- address: this.context.address,
866
- };
867
679
  return await this.view.callStatic.safeTransferFrom_address_address_uint256(
868
680
  from,
869
681
  to,
@@ -873,7 +685,7 @@ export class ERC721BoundContractView extends BoundContractView<
873
685
  ...overrides,
874
686
  },
875
687
  this.context.preparedData,
876
- ethCallContext,
688
+ this.context.getEthCallContext(),
877
689
  );
878
690
  },
879
691
  async safeTransferFrom_address_address_uint256_bytes(
@@ -883,11 +695,6 @@ export class ERC721BoundContractView extends BoundContractView<
883
695
  data: BytesLike,
884
696
  overrides?: Overrides,
885
697
  ): Promise<void> {
886
- const ethCallContext = {
887
- chainId: this.context.chainId,
888
- blockTag: "0x" + this.context.blockNumber.toString(16),
889
- address: this.context.address,
890
- };
891
698
  return await this.view.callStatic.safeTransferFrom_address_address_uint256_bytes(
892
699
  from,
893
700
  to,
@@ -898,7 +705,7 @@ export class ERC721BoundContractView extends BoundContractView<
898
705
  ...overrides,
899
706
  },
900
707
  this.context.preparedData,
901
- ethCallContext,
708
+ this.context.getEthCallContext(),
902
709
  );
903
710
  },
904
711
  async setApprovalForAll(
@@ -906,11 +713,6 @@ export class ERC721BoundContractView extends BoundContractView<
906
713
  _approved: boolean,
907
714
  overrides?: Overrides,
908
715
  ): Promise<void> {
909
- const ethCallContext = {
910
- chainId: this.context.chainId,
911
- blockTag: "0x" + this.context.blockNumber.toString(16),
912
- address: this.context.address,
913
- };
914
716
  return await this.view.callStatic.setApprovalForAll(
915
717
  operator,
916
718
  _approved,
@@ -919,7 +721,7 @@ export class ERC721BoundContractView extends BoundContractView<
919
721
  ...overrides,
920
722
  },
921
723
  this.context.preparedData,
922
- ethCallContext,
724
+ this.context.getEthCallContext(),
923
725
  );
924
726
  },
925
727
  async transferFrom(
@@ -928,11 +730,6 @@ export class ERC721BoundContractView extends BoundContractView<
928
730
  tokenId: BigNumberish,
929
731
  overrides?: Overrides,
930
732
  ): Promise<void> {
931
- const ethCallContext = {
932
- chainId: this.context.chainId,
933
- blockTag: "0x" + this.context.blockNumber.toString(16),
934
- address: this.context.address,
935
- };
936
733
  return await this.view.callStatic.transferFrom(
937
734
  from,
938
735
  to,
@@ -942,7 +739,7 @@ export class ERC721BoundContractView extends BoundContractView<
942
739
  ...overrides,
943
740
  },
944
741
  this.context.preparedData,
945
- ethCallContext,
742
+ this.context.getEthCallContext(),
946
743
  );
947
744
  },
948
745
  };
@@ -956,63 +753,31 @@ export class ERC721BoundContractView extends BoundContractView<
956
753
  tokenId: BigNumberish,
957
754
  overrides?: Overrides,
958
755
  ): EthCallParam {
959
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
960
- if (overrides?.blockTag) {
961
- blockTagWithOverride =
962
- typeof overrides.blockTag == "string"
963
- ? overrides.blockTag
964
- : "0x" + overrides.blockTag.toString(16);
965
- }
966
-
967
756
  return this.view.encodeCall.approve(to, tokenId, {
968
757
  chainId: this.context.chainId.toString(),
969
758
  address: this.context.address,
970
- blockTag: blockTagWithOverride,
759
+ blockTag: this.context.getBlockTag(overrides),
971
760
  });
972
761
  },
973
762
  totalSupply(overrides?: Overrides): EthCallParam {
974
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
975
- if (overrides?.blockTag) {
976
- blockTagWithOverride =
977
- typeof overrides.blockTag == "string"
978
- ? overrides.blockTag
979
- : "0x" + overrides.blockTag.toString(16);
980
- }
981
-
982
763
  return this.view.encodeCall.totalSupply({
983
764
  chainId: this.context.chainId.toString(),
984
765
  address: this.context.address,
985
- blockTag: blockTagWithOverride,
766
+ blockTag: this.context.getBlockTag(overrides),
986
767
  });
987
768
  },
988
769
  balanceOf(owner: string, overrides?: Overrides): EthCallParam {
989
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
990
- if (overrides?.blockTag) {
991
- blockTagWithOverride =
992
- typeof overrides.blockTag == "string"
993
- ? overrides.blockTag
994
- : "0x" + overrides.blockTag.toString(16);
995
- }
996
-
997
770
  return this.view.encodeCall.balanceOf(owner, {
998
771
  chainId: this.context.chainId.toString(),
999
772
  address: this.context.address,
1000
- blockTag: blockTagWithOverride,
773
+ blockTag: this.context.getBlockTag(overrides),
1001
774
  });
1002
775
  },
1003
776
  getApproved(tokenId: BigNumberish, overrides?: Overrides): EthCallParam {
1004
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1005
- if (overrides?.blockTag) {
1006
- blockTagWithOverride =
1007
- typeof overrides.blockTag == "string"
1008
- ? overrides.blockTag
1009
- : "0x" + overrides.blockTag.toString(16);
1010
- }
1011
-
1012
777
  return this.view.encodeCall.getApproved(tokenId, {
1013
778
  chainId: this.context.chainId.toString(),
1014
779
  address: this.context.address,
1015
- blockTag: blockTagWithOverride,
780
+ blockTag: this.context.getBlockTag(overrides),
1016
781
  });
1017
782
  },
1018
783
  isApprovedForAll(
@@ -1020,48 +785,24 @@ export class ERC721BoundContractView extends BoundContractView<
1020
785
  operator: string,
1021
786
  overrides?: Overrides,
1022
787
  ): EthCallParam {
1023
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1024
- if (overrides?.blockTag) {
1025
- blockTagWithOverride =
1026
- typeof overrides.blockTag == "string"
1027
- ? overrides.blockTag
1028
- : "0x" + overrides.blockTag.toString(16);
1029
- }
1030
-
1031
788
  return this.view.encodeCall.isApprovedForAll(owner, operator, {
1032
789
  chainId: this.context.chainId.toString(),
1033
790
  address: this.context.address,
1034
- blockTag: blockTagWithOverride,
791
+ blockTag: this.context.getBlockTag(overrides),
1035
792
  });
1036
793
  },
1037
794
  name(overrides?: Overrides): EthCallParam {
1038
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1039
- if (overrides?.blockTag) {
1040
- blockTagWithOverride =
1041
- typeof overrides.blockTag == "string"
1042
- ? overrides.blockTag
1043
- : "0x" + overrides.blockTag.toString(16);
1044
- }
1045
-
1046
795
  return this.view.encodeCall.name({
1047
796
  chainId: this.context.chainId.toString(),
1048
797
  address: this.context.address,
1049
- blockTag: blockTagWithOverride,
798
+ blockTag: this.context.getBlockTag(overrides),
1050
799
  });
1051
800
  },
1052
801
  ownerOf(tokenId: BigNumberish, overrides?: Overrides): EthCallParam {
1053
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1054
- if (overrides?.blockTag) {
1055
- blockTagWithOverride =
1056
- typeof overrides.blockTag == "string"
1057
- ? overrides.blockTag
1058
- : "0x" + overrides.blockTag.toString(16);
1059
- }
1060
-
1061
802
  return this.view.encodeCall.ownerOf(tokenId, {
1062
803
  chainId: this.context.chainId.toString(),
1063
804
  address: this.context.address,
1064
- blockTag: blockTagWithOverride,
805
+ blockTag: this.context.getBlockTag(overrides),
1065
806
  });
1066
807
  },
1067
808
  safeTransferFrom_address_address_uint256(
@@ -1070,14 +811,6 @@ export class ERC721BoundContractView extends BoundContractView<
1070
811
  tokenId: BigNumberish,
1071
812
  overrides?: Overrides,
1072
813
  ): EthCallParam {
1073
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1074
- if (overrides?.blockTag) {
1075
- blockTagWithOverride =
1076
- typeof overrides.blockTag == "string"
1077
- ? overrides.blockTag
1078
- : "0x" + overrides.blockTag.toString(16);
1079
- }
1080
-
1081
814
  return this.view.encodeCall.safeTransferFrom_address_address_uint256(
1082
815
  from,
1083
816
  to,
@@ -1085,7 +818,7 @@ export class ERC721BoundContractView extends BoundContractView<
1085
818
  {
1086
819
  chainId: this.context.chainId.toString(),
1087
820
  address: this.context.address,
1088
- blockTag: blockTagWithOverride,
821
+ blockTag: this.context.getBlockTag(overrides),
1089
822
  },
1090
823
  );
1091
824
  },
@@ -1096,14 +829,6 @@ export class ERC721BoundContractView extends BoundContractView<
1096
829
  data: BytesLike,
1097
830
  overrides?: Overrides,
1098
831
  ): EthCallParam {
1099
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1100
- if (overrides?.blockTag) {
1101
- blockTagWithOverride =
1102
- typeof overrides.blockTag == "string"
1103
- ? overrides.blockTag
1104
- : "0x" + overrides.blockTag.toString(16);
1105
- }
1106
-
1107
832
  return this.view.encodeCall.safeTransferFrom_address_address_uint256_bytes(
1108
833
  from,
1109
834
  to,
@@ -1112,7 +837,7 @@ export class ERC721BoundContractView extends BoundContractView<
1112
837
  {
1113
838
  chainId: this.context.chainId.toString(),
1114
839
  address: this.context.address,
1115
- blockTag: blockTagWithOverride,
840
+ blockTag: this.context.getBlockTag(overrides),
1116
841
  },
1117
842
  );
1118
843
  },
@@ -1121,66 +846,34 @@ export class ERC721BoundContractView extends BoundContractView<
1121
846
  _approved: boolean,
1122
847
  overrides?: Overrides,
1123
848
  ): EthCallParam {
1124
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1125
- if (overrides?.blockTag) {
1126
- blockTagWithOverride =
1127
- typeof overrides.blockTag == "string"
1128
- ? overrides.blockTag
1129
- : "0x" + overrides.blockTag.toString(16);
1130
- }
1131
-
1132
849
  return this.view.encodeCall.setApprovalForAll(operator, _approved, {
1133
850
  chainId: this.context.chainId.toString(),
1134
851
  address: this.context.address,
1135
- blockTag: blockTagWithOverride,
852
+ blockTag: this.context.getBlockTag(overrides),
1136
853
  });
1137
854
  },
1138
855
  supportsInterface(
1139
856
  interfaceId: BytesLike,
1140
857
  overrides?: Overrides,
1141
858
  ): EthCallParam {
1142
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1143
- if (overrides?.blockTag) {
1144
- blockTagWithOverride =
1145
- typeof overrides.blockTag == "string"
1146
- ? overrides.blockTag
1147
- : "0x" + overrides.blockTag.toString(16);
1148
- }
1149
-
1150
859
  return this.view.encodeCall.supportsInterface(interfaceId, {
1151
860
  chainId: this.context.chainId.toString(),
1152
861
  address: this.context.address,
1153
- blockTag: blockTagWithOverride,
862
+ blockTag: this.context.getBlockTag(overrides),
1154
863
  });
1155
864
  },
1156
865
  symbol(overrides?: Overrides): EthCallParam {
1157
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1158
- if (overrides?.blockTag) {
1159
- blockTagWithOverride =
1160
- typeof overrides.blockTag == "string"
1161
- ? overrides.blockTag
1162
- : "0x" + overrides.blockTag.toString(16);
1163
- }
1164
-
1165
866
  return this.view.encodeCall.symbol({
1166
867
  chainId: this.context.chainId.toString(),
1167
868
  address: this.context.address,
1168
- blockTag: blockTagWithOverride,
869
+ blockTag: this.context.getBlockTag(overrides),
1169
870
  });
1170
871
  },
1171
872
  tokenURI(tokenId: BigNumberish, overrides?: Overrides): EthCallParam {
1172
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1173
- if (overrides?.blockTag) {
1174
- blockTagWithOverride =
1175
- typeof overrides.blockTag == "string"
1176
- ? overrides.blockTag
1177
- : "0x" + overrides.blockTag.toString(16);
1178
- }
1179
-
1180
873
  return this.view.encodeCall.tokenURI(tokenId, {
1181
874
  chainId: this.context.chainId.toString(),
1182
875
  address: this.context.address,
1183
- blockTag: blockTagWithOverride,
876
+ blockTag: this.context.getBlockTag(overrides),
1184
877
  });
1185
878
  },
1186
879
  transferFrom(
@@ -1189,18 +882,10 @@ export class ERC721BoundContractView extends BoundContractView<
1189
882
  tokenId: BigNumberish,
1190
883
  overrides?: Overrides,
1191
884
  ): EthCallParam {
1192
- let blockTagWithOverride = "0x" + this.context.blockNumber.toString(16);
1193
- if (overrides?.blockTag) {
1194
- blockTagWithOverride =
1195
- typeof overrides.blockTag == "string"
1196
- ? overrides.blockTag
1197
- : "0x" + overrides.blockTag.toString(16);
1198
- }
1199
-
1200
885
  return this.view.encodeCall.transferFrom(from, to, tokenId, {
1201
886
  chainId: this.context.chainId.toString(),
1202
887
  address: this.context.address,
1203
- blockTag: blockTagWithOverride,
888
+ blockTag: this.context.getBlockTag(overrides),
1204
889
  });
1205
890
  },
1206
891
  };