@sentio/sdk 2.40.0 → 2.40.1-rc.10

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 (56) hide show
  1. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  2. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +71 -115
  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 +26 -40
  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 +56 -88
  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 +29 -43
  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 +44 -68
  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 +35 -53
  18. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  19. package/lib/eth/codegen/file.d.ts.map +1 -1
  20. package/lib/eth/codegen/file.js +5 -1
  21. package/lib/eth/codegen/file.js.map +1 -1
  22. package/lib/eth/codegen/function-calls.d.ts +1 -0
  23. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  24. package/lib/eth/codegen/function-calls.js +5 -3
  25. package/lib/eth/codegen/function-calls.js.map +1 -1
  26. package/lib/eth/codegen/types.d.ts.map +1 -1
  27. package/lib/eth/codegen/types.js +23 -6
  28. package/lib/eth/codegen/types.js.map +1 -1
  29. package/lib/store/cache.d.ts +0 -3
  30. package/lib/store/cache.d.ts.map +1 -1
  31. package/lib/store/cache.js.map +1 -1
  32. package/lib/store/codegen.d.ts.map +1 -1
  33. package/lib/store/codegen.js +51 -34
  34. package/lib/store/codegen.js.map +1 -1
  35. package/lib/store/store.d.ts +3 -3
  36. package/lib/store/store.d.ts.map +1 -1
  37. package/lib/store/store.js +2 -2
  38. package/lib/store/store.js.map +1 -1
  39. package/lib/store/types.d.ts +6 -0
  40. package/lib/store/types.d.ts.map +1 -1
  41. package/lib/store/types.js +49 -1
  42. package/lib/store/types.js.map +1 -1
  43. package/package.json +5 -8
  44. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +72 -115
  45. package/src/eth/builtin/internal/erc1155-processor.ts +27 -40
  46. package/src/eth/builtin/internal/erc20-processor.ts +57 -88
  47. package/src/eth/builtin/internal/erc20bytes-processor.ts +30 -43
  48. package/src/eth/builtin/internal/erc721-processor.ts +45 -68
  49. package/src/eth/builtin/internal/weth9-processor.ts +36 -53
  50. package/src/eth/codegen/file.ts +5 -0
  51. package/src/eth/codegen/function-calls.ts +6 -3
  52. package/src/eth/codegen/types.ts +32 -7
  53. package/src/store/cache.ts +0 -4
  54. package/src/store/codegen.ts +53 -34
  55. package/src/store/store.ts +5 -5
  56. package/src/store/types.ts +57 -0
@@ -193,6 +193,32 @@ const templateContract = EACAggregatorProxy__factory.connect(
193
193
  DummyProvider
194
194
  );
195
195
 
196
+ const iface = new Interface([
197
+ "function acceptOwnership() returns ()",
198
+ "function accessController() view returns (address)",
199
+ "function aggregator() view returns (address)",
200
+ "function confirmAggregator(address _aggregator) returns ()",
201
+ "function decimals() view returns (uint8)",
202
+ "function description() view returns (string)",
203
+ "function getAnswer(uint256 _roundId) view returns (int256)",
204
+ "function getRoundData(uint80 _roundId) view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)",
205
+ "function getTimestamp(uint256 _roundId) view returns (uint256)",
206
+ "function latestAnswer() view returns (int256)",
207
+ "function latestRound() view returns (uint256)",
208
+ "function latestRoundData() view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)",
209
+ "function latestTimestamp() view returns (uint256)",
210
+ "function owner() view returns (address)",
211
+ "function phaseAggregators(uint16) view returns (address)",
212
+ "function phaseId() view returns (uint16)",
213
+ "function proposeAggregator(address _aggregator) returns ()",
214
+ "function proposedAggregator() view returns (address)",
215
+ "function proposedGetRoundData(uint80 _roundId) view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)",
216
+ "function proposedLatestRoundData() view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)",
217
+ "function setController(address _accessController) returns ()",
218
+ "function transferOwnership(address _to) returns ()",
219
+ "function version() view returns (uint256)",
220
+ ]);
221
+
196
222
  export class EACAggregatorProxyContractView extends ContractView<EACAggregatorProxy> {
197
223
  constructor(contract: EACAggregatorProxy) {
198
224
  super(contract);
@@ -206,15 +232,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
206
232
  ): Promise<string> {
207
233
  try {
208
234
  if (preparedData?.ethCallResults && ethCallContext) {
209
- const iface = new Interface([
210
- "function accessController() view returns (address)",
211
- ]);
212
235
  const calldata = iface.encodeFunctionData("accessController", []);
213
- const key = makeEthCallKey({
236
+ const ethCallKey = makeEthCallKey({
214
237
  context: ethCallContext,
215
238
  calldata,
216
239
  });
217
- const ret = preparedData.ethCallResults[key];
240
+ const ret = preparedData.ethCallResults[ethCallKey];
218
241
  if (ret) {
219
242
  const result = iface
220
243
  .decodeFunctionResult("accessController", ret)
@@ -238,15 +261,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
238
261
  ): Promise<string> {
239
262
  try {
240
263
  if (preparedData?.ethCallResults && ethCallContext) {
241
- const iface = new Interface([
242
- "function aggregator() view returns (address)",
243
- ]);
244
264
  const calldata = iface.encodeFunctionData("aggregator", []);
245
- const key = makeEthCallKey({
265
+ const ethCallKey = makeEthCallKey({
246
266
  context: ethCallContext,
247
267
  calldata,
248
268
  });
249
- const ret = preparedData.ethCallResults[key];
269
+ const ret = preparedData.ethCallResults[ethCallKey];
250
270
  if (ret) {
251
271
  const result = iface
252
272
  .decodeFunctionResult("aggregator", ret)
@@ -268,15 +288,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
268
288
  ): Promise<bigint> {
269
289
  try {
270
290
  if (preparedData?.ethCallResults && ethCallContext) {
271
- const iface = new Interface([
272
- "function decimals() view returns (uint8)",
273
- ]);
274
291
  const calldata = iface.encodeFunctionData("decimals", []);
275
- const key = makeEthCallKey({
292
+ const ethCallKey = makeEthCallKey({
276
293
  context: ethCallContext,
277
294
  calldata,
278
295
  });
279
- const ret = preparedData.ethCallResults[key];
296
+ const ret = preparedData.ethCallResults[ethCallKey];
280
297
  if (ret) {
281
298
  const result = iface.decodeFunctionResult("decimals", ret).toArray();
282
299
  return result.length == 1 ? result[0] : result;
@@ -296,15 +313,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
296
313
  ): Promise<string> {
297
314
  try {
298
315
  if (preparedData?.ethCallResults && ethCallContext) {
299
- const iface = new Interface([
300
- "function description() view returns (string)",
301
- ]);
302
316
  const calldata = iface.encodeFunctionData("description", []);
303
- const key = makeEthCallKey({
317
+ const ethCallKey = makeEthCallKey({
304
318
  context: ethCallContext,
305
319
  calldata,
306
320
  });
307
- const ret = preparedData.ethCallResults[key];
321
+ const ret = preparedData.ethCallResults[ethCallKey];
308
322
  if (ret) {
309
323
  const result = iface
310
324
  .decodeFunctionResult("description", ret)
@@ -327,15 +341,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
327
341
  ): Promise<bigint> {
328
342
  try {
329
343
  if (preparedData?.ethCallResults && ethCallContext) {
330
- const iface = new Interface([
331
- "function getAnswer(uint256) view returns (int256)",
332
- ]);
333
344
  const calldata = iface.encodeFunctionData("getAnswer", [_roundId]);
334
- const key = makeEthCallKey({
345
+ const ethCallKey = makeEthCallKey({
335
346
  context: ethCallContext,
336
347
  calldata,
337
348
  });
338
- const ret = preparedData.ethCallResults[key];
349
+ const ret = preparedData.ethCallResults[ethCallKey];
339
350
  if (ret) {
340
351
  const result = iface.decodeFunctionResult("getAnswer", ret).toArray();
341
352
  return result.length == 1 ? result[0] : result;
@@ -367,15 +378,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
367
378
  > {
368
379
  try {
369
380
  if (preparedData?.ethCallResults && ethCallContext) {
370
- const iface = new Interface([
371
- "function getRoundData(uint80) view returns (uint80,int256,uint256,uint256,uint80)",
372
- ]);
373
381
  const calldata = iface.encodeFunctionData("getRoundData", [_roundId]);
374
- const key = makeEthCallKey({
382
+ const ethCallKey = makeEthCallKey({
375
383
  context: ethCallContext,
376
384
  calldata,
377
385
  });
378
- const ret = preparedData.ethCallResults[key];
386
+ const ret = preparedData.ethCallResults[ethCallKey];
379
387
  if (ret) {
380
388
  const result = iface
381
389
  .decodeFunctionResult("getRoundData", ret)
@@ -401,15 +409,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
401
409
  ): Promise<bigint> {
402
410
  try {
403
411
  if (preparedData?.ethCallResults && ethCallContext) {
404
- const iface = new Interface([
405
- "function getTimestamp(uint256) view returns (uint256)",
406
- ]);
407
412
  const calldata = iface.encodeFunctionData("getTimestamp", [_roundId]);
408
- const key = makeEthCallKey({
413
+ const ethCallKey = makeEthCallKey({
409
414
  context: ethCallContext,
410
415
  calldata,
411
416
  });
412
- const ret = preparedData.ethCallResults[key];
417
+ const ret = preparedData.ethCallResults[ethCallKey];
413
418
  if (ret) {
414
419
  const result = iface
415
420
  .decodeFunctionResult("getTimestamp", ret)
@@ -434,15 +439,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
434
439
  ): Promise<bigint> {
435
440
  try {
436
441
  if (preparedData?.ethCallResults && ethCallContext) {
437
- const iface = new Interface([
438
- "function latestAnswer() view returns (int256)",
439
- ]);
440
442
  const calldata = iface.encodeFunctionData("latestAnswer", []);
441
- const key = makeEthCallKey({
443
+ const ethCallKey = makeEthCallKey({
442
444
  context: ethCallContext,
443
445
  calldata,
444
446
  });
445
- const ret = preparedData.ethCallResults[key];
447
+ const ret = preparedData.ethCallResults[ethCallKey];
446
448
  if (ret) {
447
449
  const result = iface
448
450
  .decodeFunctionResult("latestAnswer", ret)
@@ -464,15 +466,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
464
466
  ): Promise<bigint> {
465
467
  try {
466
468
  if (preparedData?.ethCallResults && ethCallContext) {
467
- const iface = new Interface([
468
- "function latestRound() view returns (uint256)",
469
- ]);
470
469
  const calldata = iface.encodeFunctionData("latestRound", []);
471
- const key = makeEthCallKey({
470
+ const ethCallKey = makeEthCallKey({
472
471
  context: ethCallContext,
473
472
  calldata,
474
473
  });
475
- const ret = preparedData.ethCallResults[key];
474
+ const ret = preparedData.ethCallResults[ethCallKey];
476
475
  if (ret) {
477
476
  const result = iface
478
477
  .decodeFunctionResult("latestRound", ret)
@@ -502,15 +501,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
502
501
  > {
503
502
  try {
504
503
  if (preparedData?.ethCallResults && ethCallContext) {
505
- const iface = new Interface([
506
- "function latestRoundData() view returns (uint80,int256,uint256,uint256,uint80)",
507
- ]);
508
504
  const calldata = iface.encodeFunctionData("latestRoundData", []);
509
- const key = makeEthCallKey({
505
+ const ethCallKey = makeEthCallKey({
510
506
  context: ethCallContext,
511
507
  calldata,
512
508
  });
513
- const ret = preparedData.ethCallResults[key];
509
+ const ret = preparedData.ethCallResults[ethCallKey];
514
510
  if (ret) {
515
511
  const result = iface
516
512
  .decodeFunctionResult("latestRoundData", ret)
@@ -534,15 +530,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
534
530
  ): Promise<bigint> {
535
531
  try {
536
532
  if (preparedData?.ethCallResults && ethCallContext) {
537
- const iface = new Interface([
538
- "function latestTimestamp() view returns (uint256)",
539
- ]);
540
533
  const calldata = iface.encodeFunctionData("latestTimestamp", []);
541
- const key = makeEthCallKey({
534
+ const ethCallKey = makeEthCallKey({
542
535
  context: ethCallContext,
543
536
  calldata,
544
537
  });
545
- const ret = preparedData.ethCallResults[key];
538
+ const ret = preparedData.ethCallResults[ethCallKey];
546
539
  if (ret) {
547
540
  const result = iface
548
541
  .decodeFunctionResult("latestTimestamp", ret)
@@ -566,15 +559,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
566
559
  ): Promise<string> {
567
560
  try {
568
561
  if (preparedData?.ethCallResults && ethCallContext) {
569
- const iface = new Interface([
570
- "function owner() view returns (address)",
571
- ]);
572
562
  const calldata = iface.encodeFunctionData("owner", []);
573
- const key = makeEthCallKey({
563
+ const ethCallKey = makeEthCallKey({
574
564
  context: ethCallContext,
575
565
  calldata,
576
566
  });
577
- const ret = preparedData.ethCallResults[key];
567
+ const ret = preparedData.ethCallResults[ethCallKey];
578
568
  if (ret) {
579
569
  const result = iface.decodeFunctionResult("owner", ret).toArray();
580
570
  return result.length == 1 ? result[0] : result;
@@ -595,15 +585,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
595
585
  ): Promise<string> {
596
586
  try {
597
587
  if (preparedData?.ethCallResults && ethCallContext) {
598
- const iface = new Interface([
599
- "function phaseAggregators(uint16) view returns (address)",
600
- ]);
601
588
  const calldata = iface.encodeFunctionData("phaseAggregators", [arg0]);
602
- const key = makeEthCallKey({
589
+ const ethCallKey = makeEthCallKey({
603
590
  context: ethCallContext,
604
591
  calldata,
605
592
  });
606
- const ret = preparedData.ethCallResults[key];
593
+ const ret = preparedData.ethCallResults[ethCallKey];
607
594
  if (ret) {
608
595
  const result = iface
609
596
  .decodeFunctionResult("phaseAggregators", ret)
@@ -628,15 +615,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
628
615
  ): Promise<bigint> {
629
616
  try {
630
617
  if (preparedData?.ethCallResults && ethCallContext) {
631
- const iface = new Interface([
632
- "function phaseId() view returns (uint16)",
633
- ]);
634
618
  const calldata = iface.encodeFunctionData("phaseId", []);
635
- const key = makeEthCallKey({
619
+ const ethCallKey = makeEthCallKey({
636
620
  context: ethCallContext,
637
621
  calldata,
638
622
  });
639
- const ret = preparedData.ethCallResults[key];
623
+ const ret = preparedData.ethCallResults[ethCallKey];
640
624
  if (ret) {
641
625
  const result = iface.decodeFunctionResult("phaseId", ret).toArray();
642
626
  return result.length == 1 ? result[0] : result;
@@ -656,15 +640,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
656
640
  ): Promise<string> {
657
641
  try {
658
642
  if (preparedData?.ethCallResults && ethCallContext) {
659
- const iface = new Interface([
660
- "function proposedAggregator() view returns (address)",
661
- ]);
662
643
  const calldata = iface.encodeFunctionData("proposedAggregator", []);
663
- const key = makeEthCallKey({
644
+ const ethCallKey = makeEthCallKey({
664
645
  context: ethCallContext,
665
646
  calldata,
666
647
  });
667
- const ret = preparedData.ethCallResults[key];
648
+ const ret = preparedData.ethCallResults[ethCallKey];
668
649
  if (ret) {
669
650
  const result = iface
670
651
  .decodeFunctionResult("proposedAggregator", ret)
@@ -697,17 +678,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
697
678
  > {
698
679
  try {
699
680
  if (preparedData?.ethCallResults && ethCallContext) {
700
- const iface = new Interface([
701
- "function proposedGetRoundData(uint80) view returns (uint80,int256,uint256,uint256,uint80)",
702
- ]);
703
681
  const calldata = iface.encodeFunctionData("proposedGetRoundData", [
704
682
  _roundId,
705
683
  ]);
706
- const key = makeEthCallKey({
684
+ const ethCallKey = makeEthCallKey({
707
685
  context: ethCallContext,
708
686
  calldata,
709
687
  });
710
- const ret = preparedData.ethCallResults[key];
688
+ const ret = preparedData.ethCallResults[ethCallKey];
711
689
  if (ret) {
712
690
  const result = iface
713
691
  .decodeFunctionResult("proposedGetRoundData", ret)
@@ -740,18 +718,15 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
740
718
  > {
741
719
  try {
742
720
  if (preparedData?.ethCallResults && ethCallContext) {
743
- const iface = new Interface([
744
- "function proposedLatestRoundData() view returns (uint80,int256,uint256,uint256,uint80)",
745
- ]);
746
721
  const calldata = iface.encodeFunctionData(
747
722
  "proposedLatestRoundData",
748
723
  []
749
724
  );
750
- const key = makeEthCallKey({
725
+ const ethCallKey = makeEthCallKey({
751
726
  context: ethCallContext,
752
727
  calldata,
753
728
  });
754
- const ret = preparedData.ethCallResults[key];
729
+ const ret = preparedData.ethCallResults[ethCallKey];
755
730
  if (ret) {
756
731
  const result = iface
757
732
  .decodeFunctionResult("proposedLatestRoundData", ret)
@@ -775,15 +750,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
775
750
  ): Promise<bigint> {
776
751
  try {
777
752
  if (preparedData?.ethCallResults && ethCallContext) {
778
- const iface = new Interface([
779
- "function version() view returns (uint256)",
780
- ]);
781
753
  const calldata = iface.encodeFunctionData("version", []);
782
- const key = makeEthCallKey({
754
+ const ethCallKey = makeEthCallKey({
783
755
  context: ethCallContext,
784
756
  calldata,
785
757
  });
786
- const ret = preparedData.ethCallResults[key];
758
+ const ret = preparedData.ethCallResults[ethCallKey];
787
759
  if (ret) {
788
760
  const result = iface.decodeFunctionResult("version", ret).toArray();
789
761
  return result.length == 1 ? result[0] : result;
@@ -806,15 +778,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
806
778
  ): Promise<void> {
807
779
  try {
808
780
  if (preparedData?.ethCallResults && ethCallContext) {
809
- const iface = new Interface([
810
- "function acceptOwnership() nonpayable returns ()",
811
- ]);
812
781
  const calldata = iface.encodeFunctionData("acceptOwnership", []);
813
- const key = makeEthCallKey({
782
+ const ethCallKey = makeEthCallKey({
814
783
  context: ethCallContext,
815
784
  calldata,
816
785
  });
817
- const ret = preparedData.ethCallResults[key];
786
+ const ret = preparedData.ethCallResults[ethCallKey];
818
787
  if (ret) {
819
788
  const result = iface
820
789
  .decodeFunctionResult("acceptOwnership", ret)
@@ -838,17 +807,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
838
807
  ): Promise<void> {
839
808
  try {
840
809
  if (preparedData?.ethCallResults && ethCallContext) {
841
- const iface = new Interface([
842
- "function confirmAggregator(address) nonpayable returns ()",
843
- ]);
844
810
  const calldata = iface.encodeFunctionData("confirmAggregator", [
845
811
  _aggregator,
846
812
  ]);
847
- const key = makeEthCallKey({
813
+ const ethCallKey = makeEthCallKey({
848
814
  context: ethCallContext,
849
815
  calldata,
850
816
  });
851
- const ret = preparedData.ethCallResults[key];
817
+ const ret = preparedData.ethCallResults[ethCallKey];
852
818
  if (ret) {
853
819
  const result = iface
854
820
  .decodeFunctionResult("confirmAggregator", ret)
@@ -872,17 +838,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
872
838
  ): Promise<void> {
873
839
  try {
874
840
  if (preparedData?.ethCallResults && ethCallContext) {
875
- const iface = new Interface([
876
- "function proposeAggregator(address) nonpayable returns ()",
877
- ]);
878
841
  const calldata = iface.encodeFunctionData("proposeAggregator", [
879
842
  _aggregator,
880
843
  ]);
881
- const key = makeEthCallKey({
844
+ const ethCallKey = makeEthCallKey({
882
845
  context: ethCallContext,
883
846
  calldata,
884
847
  });
885
- const ret = preparedData.ethCallResults[key];
848
+ const ret = preparedData.ethCallResults[ethCallKey];
886
849
  if (ret) {
887
850
  const result = iface
888
851
  .decodeFunctionResult("proposeAggregator", ret)
@@ -906,17 +869,14 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
906
869
  ): Promise<void> {
907
870
  try {
908
871
  if (preparedData?.ethCallResults && ethCallContext) {
909
- const iface = new Interface([
910
- "function setController(address) nonpayable returns ()",
911
- ]);
912
872
  const calldata = iface.encodeFunctionData("setController", [
913
873
  _accessController,
914
874
  ]);
915
- const key = makeEthCallKey({
875
+ const ethCallKey = makeEthCallKey({
916
876
  context: ethCallContext,
917
877
  calldata,
918
878
  });
919
- const ret = preparedData.ethCallResults[key];
879
+ const ret = preparedData.ethCallResults[ethCallKey];
920
880
  if (ret) {
921
881
  const result = iface
922
882
  .decodeFunctionResult("setController", ret)
@@ -940,15 +900,12 @@ export class EACAggregatorProxyContractView extends ContractView<EACAggregatorPr
940
900
  ): Promise<void> {
941
901
  try {
942
902
  if (preparedData?.ethCallResults && ethCallContext) {
943
- const iface = new Interface([
944
- "function transferOwnership(address) nonpayable returns ()",
945
- ]);
946
903
  const calldata = iface.encodeFunctionData("transferOwnership", [_to]);
947
- const key = makeEthCallKey({
904
+ const ethCallKey = makeEthCallKey({
948
905
  context: ethCallContext,
949
906
  calldata,
950
907
  });
951
- const ret = preparedData.ethCallResults[key];
908
+ const ret = preparedData.ethCallResults[ethCallKey];
952
909
  if (ret) {
953
910
  const result = iface
954
911
  .decodeFunctionResult("transferOwnership", ret)
@@ -121,6 +121,17 @@ export type UriCallTrace = TypedCallTrace<[bigint], UriCallObject>;
121
121
 
122
122
  const templateContract = ERC1155__factory.connect("0x0", DummyProvider);
123
123
 
124
+ const iface = new Interface([
125
+ "function balanceOf(address account, uint256 id) view returns (uint256)",
126
+ "function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])",
127
+ "function isApprovedForAll(address account, address operator) view returns (bool)",
128
+ "function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) returns ()",
129
+ "function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data) returns ()",
130
+ "function setApprovalForAll(address operator, bool approved) returns ()",
131
+ "function supportsInterface(bytes4 interfaceId) view returns (bool)",
132
+ "function uri(uint256 id) view returns (string)",
133
+ ]);
134
+
124
135
  export class ERC1155ContractView extends ContractView<ERC1155> {
125
136
  constructor(contract: ERC1155) {
126
137
  super(contract);
@@ -136,15 +147,12 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
136
147
  ): Promise<bigint> {
137
148
  try {
138
149
  if (preparedData?.ethCallResults && ethCallContext) {
139
- const iface = new Interface([
140
- "function balanceOf(address,uint256) view returns (uint256)",
141
- ]);
142
150
  const calldata = iface.encodeFunctionData("balanceOf", [account, id]);
143
- const key = makeEthCallKey({
151
+ const ethCallKey = makeEthCallKey({
144
152
  context: ethCallContext,
145
153
  calldata,
146
154
  });
147
- const ret = preparedData.ethCallResults[key];
155
+ const ret = preparedData.ethCallResults[ethCallKey];
148
156
  if (ret) {
149
157
  const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
150
158
  return result.length == 1 ? result[0] : result;
@@ -170,18 +178,15 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
170
178
  ): Promise<bigint[]> {
171
179
  try {
172
180
  if (preparedData?.ethCallResults && ethCallContext) {
173
- const iface = new Interface([
174
- "function balanceOfBatch(address[],uint256[]) view returns (uint256[])",
175
- ]);
176
181
  const calldata = iface.encodeFunctionData("balanceOfBatch", [
177
182
  accounts,
178
183
  ids,
179
184
  ]);
180
- const key = makeEthCallKey({
185
+ const ethCallKey = makeEthCallKey({
181
186
  context: ethCallContext,
182
187
  calldata,
183
188
  });
184
- const ret = preparedData.ethCallResults[key];
189
+ const ret = preparedData.ethCallResults[ethCallKey];
185
190
  if (ret) {
186
191
  const result = iface
187
192
  .decodeFunctionResult("balanceOfBatch", ret)
@@ -207,18 +212,15 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
207
212
  ): Promise<boolean> {
208
213
  try {
209
214
  if (preparedData?.ethCallResults && ethCallContext) {
210
- const iface = new Interface([
211
- "function isApprovedForAll(address,address) view returns (bool)",
212
- ]);
213
215
  const calldata = iface.encodeFunctionData("isApprovedForAll", [
214
216
  account,
215
217
  operator,
216
218
  ]);
217
- const key = makeEthCallKey({
219
+ const ethCallKey = makeEthCallKey({
218
220
  context: ethCallContext,
219
221
  calldata,
220
222
  });
221
- const ret = preparedData.ethCallResults[key];
223
+ const ret = preparedData.ethCallResults[ethCallKey];
222
224
  if (ret) {
223
225
  const result = iface
224
226
  .decodeFunctionResult("isApprovedForAll", ret)
@@ -243,17 +245,14 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
243
245
  ): Promise<boolean> {
244
246
  try {
245
247
  if (preparedData?.ethCallResults && ethCallContext) {
246
- const iface = new Interface([
247
- "function supportsInterface(bytes4) view returns (bool)",
248
- ]);
249
248
  const calldata = iface.encodeFunctionData("supportsInterface", [
250
249
  interfaceId,
251
250
  ]);
252
- const key = makeEthCallKey({
251
+ const ethCallKey = makeEthCallKey({
253
252
  context: ethCallContext,
254
253
  calldata,
255
254
  });
256
- const ret = preparedData.ethCallResults[key];
255
+ const ret = preparedData.ethCallResults[ethCallKey];
257
256
  if (ret) {
258
257
  const result = iface
259
258
  .decodeFunctionResult("supportsInterface", ret)
@@ -279,15 +278,12 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
279
278
  ): Promise<string> {
280
279
  try {
281
280
  if (preparedData?.ethCallResults && ethCallContext) {
282
- const iface = new Interface([
283
- "function uri(uint256) view returns (string)",
284
- ]);
285
281
  const calldata = iface.encodeFunctionData("uri", [id]);
286
- const key = makeEthCallKey({
282
+ const ethCallKey = makeEthCallKey({
287
283
  context: ethCallContext,
288
284
  calldata,
289
285
  });
290
- const ret = preparedData.ethCallResults[key];
286
+ const ret = preparedData.ethCallResults[ethCallKey];
291
287
  if (ret) {
292
288
  const result = iface.decodeFunctionResult("uri", ret).toArray();
293
289
  return result.length == 1 ? result[0] : result;
@@ -318,9 +314,6 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
318
314
  ): Promise<void> {
319
315
  try {
320
316
  if (preparedData?.ethCallResults && ethCallContext) {
321
- const iface = new Interface([
322
- "function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes) nonpayable returns ()",
323
- ]);
324
317
  const calldata = iface.encodeFunctionData("safeBatchTransferFrom", [
325
318
  from,
326
319
  to,
@@ -328,11 +321,11 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
328
321
  amounts,
329
322
  data,
330
323
  ]);
331
- const key = makeEthCallKey({
324
+ const ethCallKey = makeEthCallKey({
332
325
  context: ethCallContext,
333
326
  calldata,
334
327
  });
335
- const ret = preparedData.ethCallResults[key];
328
+ const ret = preparedData.ethCallResults[ethCallKey];
336
329
  if (ret) {
337
330
  const result = iface
338
331
  .decodeFunctionResult("safeBatchTransferFrom", ret)
@@ -362,9 +355,6 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
362
355
  ): Promise<void> {
363
356
  try {
364
357
  if (preparedData?.ethCallResults && ethCallContext) {
365
- const iface = new Interface([
366
- "function safeTransferFrom(address,address,uint256,uint256,bytes) nonpayable returns ()",
367
- ]);
368
358
  const calldata = iface.encodeFunctionData("safeTransferFrom", [
369
359
  from,
370
360
  to,
@@ -372,11 +362,11 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
372
362
  amount,
373
363
  data,
374
364
  ]);
375
- const key = makeEthCallKey({
365
+ const ethCallKey = makeEthCallKey({
376
366
  context: ethCallContext,
377
367
  calldata,
378
368
  });
379
- const ret = preparedData.ethCallResults[key];
369
+ const ret = preparedData.ethCallResults[ethCallKey];
380
370
  if (ret) {
381
371
  const result = iface
382
372
  .decodeFunctionResult("safeTransferFrom", ret)
@@ -403,18 +393,15 @@ export class ERC1155ContractView extends ContractView<ERC1155> {
403
393
  ): Promise<void> {
404
394
  try {
405
395
  if (preparedData?.ethCallResults && ethCallContext) {
406
- const iface = new Interface([
407
- "function setApprovalForAll(address,bool) nonpayable returns ()",
408
- ]);
409
396
  const calldata = iface.encodeFunctionData("setApprovalForAll", [
410
397
  operator,
411
398
  approved,
412
399
  ]);
413
- const key = makeEthCallKey({
400
+ const ethCallKey = makeEthCallKey({
414
401
  context: ethCallContext,
415
402
  calldata,
416
403
  });
417
- const ret = preparedData.ethCallResults[key];
404
+ const ret = preparedData.ethCallResults[ethCallKey];
418
405
  if (ret) {
419
406
  const result = iface
420
407
  .decodeFunctionResult("setApprovalForAll", ret)