@sentio/sdk 2.40.0-rc.12 → 2.40.0-rc.14

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 (34) hide show
  1. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  2. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +230 -69
  3. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  4. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  5. package/lib/eth/builtin/internal/erc1155-processor.js +80 -24
  6. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  7. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  8. package/lib/eth/builtin/internal/erc20-processor.js +180 -54
  9. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  10. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  11. package/lib/eth/builtin/internal/erc20bytes-processor.js +90 -27
  12. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  13. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  14. package/lib/eth/builtin/internal/erc721-processor.js +140 -42
  15. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  16. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  17. package/lib/eth/builtin/internal/weth9-processor.js +110 -33
  18. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  19. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  20. package/lib/eth/codegen/function-calls.js +7 -2
  21. package/lib/eth/codegen/function-calls.js.map +1 -1
  22. package/lib/eth/context.d.ts +4 -0
  23. package/lib/eth/context.d.ts.map +1 -1
  24. package/lib/eth/context.js +4 -0
  25. package/lib/eth/context.js.map +1 -1
  26. package/package.json +3 -3
  27. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +230 -92
  28. package/src/eth/builtin/internal/erc1155-processor.ts +80 -32
  29. package/src/eth/builtin/internal/erc20-processor.ts +180 -72
  30. package/src/eth/builtin/internal/erc20bytes-processor.ts +90 -36
  31. package/src/eth/builtin/internal/erc721-processor.ts +140 -56
  32. package/src/eth/builtin/internal/weth9-processor.ts +110 -44
  33. package/src/eth/codegen/function-calls.ts +7 -2
  34. package/src/eth/context.ts +7 -0
@@ -118,8 +118,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
118
118
  context: ethCallContext,
119
119
  calldata,
120
120
  });
121
+ console.debug("looking up eth call key:", key);
121
122
  const ret = preparedData.ethCallResults[key];
122
123
  if (ret) {
124
+ console.debug("prepared eth call found:", key);
123
125
  const result = iface.decodeFunctionResult("name", ret).toArray();
124
126
  return result.length == 1 ? result[0] : result;
125
127
  }
@@ -146,8 +148,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
146
148
  context: ethCallContext,
147
149
  calldata,
148
150
  });
151
+ console.debug("looking up eth call key:", key);
149
152
  const ret = preparedData.ethCallResults[key];
150
153
  if (ret) {
154
+ console.debug("prepared eth call found:", key);
151
155
  const result = iface
152
156
  .decodeFunctionResult("totalSupply", ret)
153
157
  .toArray();
@@ -176,8 +180,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
176
180
  context: ethCallContext,
177
181
  calldata,
178
182
  });
183
+ console.debug("looking up eth call key:", key);
179
184
  const ret = preparedData.ethCallResults[key];
180
185
  if (ret) {
186
+ console.debug("prepared eth call found:", key);
181
187
  const result = iface.decodeFunctionResult("decimals", ret).toArray();
182
188
  return result.length == 1 ? result[0] : result;
183
189
  }
@@ -205,8 +211,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
205
211
  context: ethCallContext,
206
212
  calldata,
207
213
  });
214
+ console.debug("looking up eth call key:", key);
208
215
  const ret = preparedData.ethCallResults[key];
209
216
  if (ret) {
217
+ console.debug("prepared eth call found:", key);
210
218
  const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
211
219
  return result.length == 1 ? result[0] : result;
212
220
  }
@@ -236,8 +244,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
236
244
  context: ethCallContext,
237
245
  calldata,
238
246
  });
247
+ console.debug("looking up eth call key:", key);
239
248
  const ret = preparedData.ethCallResults[key];
240
249
  if (ret) {
250
+ console.debug("prepared eth call found:", key);
241
251
  const result = iface.decodeFunctionResult("symbol", ret).toArray();
242
252
  return result.length == 1 ? result[0] : result;
243
253
  }
@@ -269,8 +279,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
269
279
  context: ethCallContext,
270
280
  calldata,
271
281
  });
282
+ console.debug("looking up eth call key:", key);
272
283
  const ret = preparedData.ethCallResults[key];
273
284
  if (ret) {
285
+ console.debug("prepared eth call found:", key);
274
286
  const result = iface.decodeFunctionResult("allowance", ret).toArray();
275
287
  return result.length == 1 ? result[0] : result;
276
288
  }
@@ -309,8 +321,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
309
321
  context: ethCallContext,
310
322
  calldata,
311
323
  });
324
+ console.debug("looking up eth call key:", key);
312
325
  const ret = preparedData.ethCallResults[key];
313
326
  if (ret) {
327
+ console.debug("prepared eth call found:", key);
314
328
  const result = iface.decodeFunctionResult("approve", ret).toArray();
315
329
  return result.length == 1 ? result[0] : result;
316
330
  }
@@ -345,8 +359,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
345
359
  context: ethCallContext,
346
360
  calldata,
347
361
  });
362
+ console.debug("looking up eth call key:", key);
348
363
  const ret = preparedData.ethCallResults[key];
349
364
  if (ret) {
365
+ console.debug("prepared eth call found:", key);
350
366
  const result = iface
351
367
  .decodeFunctionResult("transferFrom", ret)
352
368
  .toArray();
@@ -378,8 +394,10 @@ export class ERC20BytesContractView extends ContractView<ERC20Bytes> {
378
394
  context: ethCallContext,
379
395
  calldata,
380
396
  });
397
+ console.debug("looking up eth call key:", key);
381
398
  const ret = preparedData.ethCallResults[key];
382
399
  if (ret) {
400
+ console.debug("prepared eth call found:", key);
383
401
  const result = iface
384
402
  .decodeFunctionResult("transfer", ret)
385
403
  .toArray();
@@ -550,7 +568,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
550
568
  async name(overrides?: Overrides): Promise<string> {
551
569
  const ethCallContext = {
552
570
  chainId: this.context.chainId,
553
- blockTag: this.context.blockNumber.toString(16),
571
+ blockTag: "0x" + this.context.blockNumber.toString(16),
554
572
  address: this.context.address,
555
573
  };
556
574
  return await this.view.name(
@@ -566,7 +584,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
566
584
  async totalSupply(overrides?: Overrides): Promise<bigint> {
567
585
  const ethCallContext = {
568
586
  chainId: this.context.chainId,
569
- blockTag: this.context.blockNumber.toString(16),
587
+ blockTag: "0x" + this.context.blockNumber.toString(16),
570
588
  address: this.context.address,
571
589
  };
572
590
  return await this.view.totalSupply(
@@ -582,7 +600,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
582
600
  async decimals(overrides?: Overrides): Promise<bigint> {
583
601
  const ethCallContext = {
584
602
  chainId: this.context.chainId,
585
- blockTag: this.context.blockNumber.toString(16),
603
+ blockTag: "0x" + this.context.blockNumber.toString(16),
586
604
  address: this.context.address,
587
605
  };
588
606
  return await this.view.decimals(
@@ -598,7 +616,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
598
616
  async balanceOf(who: string, overrides?: Overrides): Promise<bigint> {
599
617
  const ethCallContext = {
600
618
  chainId: this.context.chainId,
601
- blockTag: this.context.blockNumber.toString(16),
619
+ blockTag: "0x" + this.context.blockNumber.toString(16),
602
620
  address: this.context.address,
603
621
  };
604
622
  return await this.view.balanceOf(
@@ -615,7 +633,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
615
633
  async symbol(overrides?: Overrides): Promise<string> {
616
634
  const ethCallContext = {
617
635
  chainId: this.context.chainId,
618
- blockTag: this.context.blockNumber.toString(16),
636
+ blockTag: "0x" + this.context.blockNumber.toString(16),
619
637
  address: this.context.address,
620
638
  };
621
639
  return await this.view.symbol(
@@ -635,7 +653,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
635
653
  ): Promise<bigint> {
636
654
  const ethCallContext = {
637
655
  chainId: this.context.chainId,
638
- blockTag: this.context.blockNumber.toString(16),
656
+ blockTag: "0x" + this.context.blockNumber.toString(16),
639
657
  address: this.context.address,
640
658
  };
641
659
  return await this.view.allowance(
@@ -661,7 +679,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
661
679
  ): Promise<boolean> {
662
680
  const ethCallContext = {
663
681
  chainId: this.context.chainId,
664
- blockTag: this.context.blockNumber.toString(16),
682
+ blockTag: "0x" + this.context.blockNumber.toString(16),
665
683
  address: this.context.address,
666
684
  };
667
685
  return await this.view.callStatic.approve(
@@ -683,7 +701,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
683
701
  ): Promise<boolean> {
684
702
  const ethCallContext = {
685
703
  chainId: this.context.chainId,
686
- blockTag: this.context.blockNumber.toString(16),
704
+ blockTag: "0x" + this.context.blockNumber.toString(16),
687
705
  address: this.context.address,
688
706
  };
689
707
  return await this.view.callStatic.transferFrom(
@@ -705,7 +723,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
705
723
  ): Promise<boolean> {
706
724
  const ethCallContext = {
707
725
  chainId: this.context.chainId,
708
- blockTag: this.context.blockNumber.toString(16),
726
+ blockTag: "0x" + this.context.blockNumber.toString(16),
709
727
  address: this.context.address,
710
728
  };
711
729
  return await this.view.callStatic.transfer(
@@ -728,10 +746,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
728
746
  name(overrides?: Overrides): EthCallParam {
729
747
  const chainId =
730
748
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
731
- const blockTag =
732
- overrides?.blockTag?.toString() ??
733
- this.context.blockNumber.toString(16);
734
749
  const address = this.context.address;
750
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
751
+ if (overrides?.blockTag) {
752
+ blockTag =
753
+ typeof overrides.blockTag == "string"
754
+ ? overrides.blockTag
755
+ : "0x" + overrides.blockTag.toString(16);
756
+ }
735
757
 
736
758
  return this.view.encodeCall.name({ chainId, address, blockTag });
737
759
  },
@@ -742,10 +764,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
742
764
  ): EthCallParam {
743
765
  const chainId =
744
766
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
745
- const blockTag =
746
- overrides?.blockTag?.toString() ??
747
- this.context.blockNumber.toString(16);
748
767
  const address = this.context.address;
768
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
769
+ if (overrides?.blockTag) {
770
+ blockTag =
771
+ typeof overrides.blockTag == "string"
772
+ ? overrides.blockTag
773
+ : "0x" + overrides.blockTag.toString(16);
774
+ }
749
775
 
750
776
  return this.view.encodeCall.approve(spender, value, {
751
777
  chainId,
@@ -756,10 +782,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
756
782
  totalSupply(overrides?: Overrides): EthCallParam {
757
783
  const chainId =
758
784
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
759
- const blockTag =
760
- overrides?.blockTag?.toString() ??
761
- this.context.blockNumber.toString(16);
762
785
  const address = this.context.address;
786
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
787
+ if (overrides?.blockTag) {
788
+ blockTag =
789
+ typeof overrides.blockTag == "string"
790
+ ? overrides.blockTag
791
+ : "0x" + overrides.blockTag.toString(16);
792
+ }
763
793
 
764
794
  return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
765
795
  },
@@ -771,10 +801,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
771
801
  ): EthCallParam {
772
802
  const chainId =
773
803
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
774
- const blockTag =
775
- overrides?.blockTag?.toString() ??
776
- this.context.blockNumber.toString(16);
777
804
  const address = this.context.address;
805
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
806
+ if (overrides?.blockTag) {
807
+ blockTag =
808
+ typeof overrides.blockTag == "string"
809
+ ? overrides.blockTag
810
+ : "0x" + overrides.blockTag.toString(16);
811
+ }
778
812
 
779
813
  return this.view.encodeCall.transferFrom(from, to, value, {
780
814
  chainId,
@@ -785,20 +819,28 @@ export class ERC20BytesBoundContractView extends BoundContractView<
785
819
  decimals(overrides?: Overrides): EthCallParam {
786
820
  const chainId =
787
821
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
788
- const blockTag =
789
- overrides?.blockTag?.toString() ??
790
- this.context.blockNumber.toString(16);
791
822
  const address = this.context.address;
823
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
824
+ if (overrides?.blockTag) {
825
+ blockTag =
826
+ typeof overrides.blockTag == "string"
827
+ ? overrides.blockTag
828
+ : "0x" + overrides.blockTag.toString(16);
829
+ }
792
830
 
793
831
  return this.view.encodeCall.decimals({ chainId, address, blockTag });
794
832
  },
795
833
  balanceOf(who: string, overrides?: Overrides): EthCallParam {
796
834
  const chainId =
797
835
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
798
- const blockTag =
799
- overrides?.blockTag?.toString() ??
800
- this.context.blockNumber.toString(16);
801
836
  const address = this.context.address;
837
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
838
+ if (overrides?.blockTag) {
839
+ blockTag =
840
+ typeof overrides.blockTag == "string"
841
+ ? overrides.blockTag
842
+ : "0x" + overrides.blockTag.toString(16);
843
+ }
802
844
 
803
845
  return this.view.encodeCall.balanceOf(who, {
804
846
  chainId,
@@ -809,10 +851,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
809
851
  symbol(overrides?: Overrides): EthCallParam {
810
852
  const chainId =
811
853
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
812
- const blockTag =
813
- overrides?.blockTag?.toString() ??
814
- this.context.blockNumber.toString(16);
815
854
  const address = this.context.address;
855
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
856
+ if (overrides?.blockTag) {
857
+ blockTag =
858
+ typeof overrides.blockTag == "string"
859
+ ? overrides.blockTag
860
+ : "0x" + overrides.blockTag.toString(16);
861
+ }
816
862
 
817
863
  return this.view.encodeCall.symbol({ chainId, address, blockTag });
818
864
  },
@@ -823,10 +869,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
823
869
  ): EthCallParam {
824
870
  const chainId =
825
871
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
826
- const blockTag =
827
- overrides?.blockTag?.toString() ??
828
- this.context.blockNumber.toString(16);
829
872
  const address = this.context.address;
873
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
874
+ if (overrides?.blockTag) {
875
+ blockTag =
876
+ typeof overrides.blockTag == "string"
877
+ ? overrides.blockTag
878
+ : "0x" + overrides.blockTag.toString(16);
879
+ }
830
880
 
831
881
  return this.view.encodeCall.transfer(to, value, {
832
882
  chainId,
@@ -841,10 +891,14 @@ export class ERC20BytesBoundContractView extends BoundContractView<
841
891
  ): EthCallParam {
842
892
  const chainId =
843
893
  overrides?.chainId?.toString() ?? this.context.chainId.toString();
844
- const blockTag =
845
- overrides?.blockTag?.toString() ??
846
- this.context.blockNumber.toString(16);
847
894
  const address = this.context.address;
895
+ let blockTag = "0x" + this.context.blockNumber.toString(16);
896
+ if (overrides?.blockTag) {
897
+ blockTag =
898
+ typeof overrides.blockTag == "string"
899
+ ? overrides.blockTag
900
+ : "0x" + overrides.blockTag.toString(16);
901
+ }
848
902
 
849
903
  return this.view.encodeCall.allowance(owner, spender, {
850
904
  chainId,