@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.
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +230 -69
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +80 -24
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +180 -54
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +90 -27
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +140 -42
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +110 -33
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/function-calls.d.ts.map +1 -1
- package/lib/eth/codegen/function-calls.js +7 -2
- package/lib/eth/codegen/function-calls.js.map +1 -1
- package/lib/eth/context.d.ts +4 -0
- package/lib/eth/context.d.ts.map +1 -1
- package/lib/eth/context.js +4 -0
- package/lib/eth/context.js.map +1 -1
- package/package.json +3 -3
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +230 -92
- package/src/eth/builtin/internal/erc1155-processor.ts +80 -32
- package/src/eth/builtin/internal/erc20-processor.ts +180 -72
- package/src/eth/builtin/internal/erc20bytes-processor.ts +90 -36
- package/src/eth/builtin/internal/erc721-processor.ts +140 -56
- package/src/eth/builtin/internal/weth9-processor.ts +110 -44
- package/src/eth/codegen/function-calls.ts +7 -2
- package/src/eth/context.ts +7 -0
@@ -127,8 +127,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
127
127
|
context: ethCallContext,
|
128
128
|
calldata,
|
129
129
|
});
|
130
|
+
console.debug("looking up eth call key:", key);
|
130
131
|
const ret = preparedData.ethCallResults[key];
|
131
132
|
if (ret) {
|
133
|
+
console.debug("prepared eth call found:", key);
|
132
134
|
const result = iface.decodeFunctionResult("name", ret).toArray();
|
133
135
|
return result.length == 1 ? result[0] : result;
|
134
136
|
}
|
@@ -155,8 +157,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
155
157
|
context: ethCallContext,
|
156
158
|
calldata,
|
157
159
|
});
|
160
|
+
console.debug("looking up eth call key:", key);
|
158
161
|
const ret = preparedData.ethCallResults[key];
|
159
162
|
if (ret) {
|
163
|
+
console.debug("prepared eth call found:", key);
|
160
164
|
const result = iface
|
161
165
|
.decodeFunctionResult("totalSupply", ret)
|
162
166
|
.toArray();
|
@@ -185,8 +189,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
185
189
|
context: ethCallContext,
|
186
190
|
calldata,
|
187
191
|
});
|
192
|
+
console.debug("looking up eth call key:", key);
|
188
193
|
const ret = preparedData.ethCallResults[key];
|
189
194
|
if (ret) {
|
195
|
+
console.debug("prepared eth call found:", key);
|
190
196
|
const result = iface.decodeFunctionResult("decimals", ret).toArray();
|
191
197
|
return result.length == 1 ? result[0] : result;
|
192
198
|
}
|
@@ -214,8 +220,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
214
220
|
context: ethCallContext,
|
215
221
|
calldata,
|
216
222
|
});
|
223
|
+
console.debug("looking up eth call key:", key);
|
217
224
|
const ret = preparedData.ethCallResults[key];
|
218
225
|
if (ret) {
|
226
|
+
console.debug("prepared eth call found:", key);
|
219
227
|
const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
|
220
228
|
return result.length == 1 ? result[0] : result;
|
221
229
|
}
|
@@ -245,8 +253,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
245
253
|
context: ethCallContext,
|
246
254
|
calldata,
|
247
255
|
});
|
256
|
+
console.debug("looking up eth call key:", key);
|
248
257
|
const ret = preparedData.ethCallResults[key];
|
249
258
|
if (ret) {
|
259
|
+
console.debug("prepared eth call found:", key);
|
250
260
|
const result = iface.decodeFunctionResult("symbol", ret).toArray();
|
251
261
|
return result.length == 1 ? result[0] : result;
|
252
262
|
}
|
@@ -275,8 +285,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
275
285
|
context: ethCallContext,
|
276
286
|
calldata,
|
277
287
|
});
|
288
|
+
console.debug("looking up eth call key:", key);
|
278
289
|
const ret = preparedData.ethCallResults[key];
|
279
290
|
if (ret) {
|
291
|
+
console.debug("prepared eth call found:", key);
|
280
292
|
const result = iface.decodeFunctionResult("allowance", ret).toArray();
|
281
293
|
return result.length == 1 ? result[0] : result;
|
282
294
|
}
|
@@ -312,8 +324,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
312
324
|
context: ethCallContext,
|
313
325
|
calldata,
|
314
326
|
});
|
327
|
+
console.debug("looking up eth call key:", key);
|
315
328
|
const ret = preparedData.ethCallResults[key];
|
316
329
|
if (ret) {
|
330
|
+
console.debug("prepared eth call found:", key);
|
317
331
|
const result = iface.decodeFunctionResult("approve", ret).toArray();
|
318
332
|
return result.length == 1 ? result[0] : result;
|
319
333
|
}
|
@@ -348,8 +362,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
348
362
|
context: ethCallContext,
|
349
363
|
calldata,
|
350
364
|
});
|
365
|
+
console.debug("looking up eth call key:", key);
|
351
366
|
const ret = preparedData.ethCallResults[key];
|
352
367
|
if (ret) {
|
368
|
+
console.debug("prepared eth call found:", key);
|
353
369
|
const result = iface
|
354
370
|
.decodeFunctionResult("transferFrom", ret)
|
355
371
|
.toArray();
|
@@ -380,8 +396,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
380
396
|
context: ethCallContext,
|
381
397
|
calldata,
|
382
398
|
});
|
399
|
+
console.debug("looking up eth call key:", key);
|
383
400
|
const ret = preparedData.ethCallResults[key];
|
384
401
|
if (ret) {
|
402
|
+
console.debug("prepared eth call found:", key);
|
385
403
|
const result = iface
|
386
404
|
.decodeFunctionResult("withdraw", ret)
|
387
405
|
.toArray();
|
@@ -413,8 +431,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
413
431
|
context: ethCallContext,
|
414
432
|
calldata,
|
415
433
|
});
|
434
|
+
console.debug("looking up eth call key:", key);
|
416
435
|
const ret = preparedData.ethCallResults[key];
|
417
436
|
if (ret) {
|
437
|
+
console.debug("prepared eth call found:", key);
|
418
438
|
const result = iface
|
419
439
|
.decodeFunctionResult("transfer", ret)
|
420
440
|
.toArray();
|
@@ -444,8 +464,10 @@ export class WETH9ContractView extends ContractView<WETH9> {
|
|
444
464
|
context: ethCallContext,
|
445
465
|
calldata,
|
446
466
|
});
|
467
|
+
console.debug("looking up eth call key:", key);
|
447
468
|
const ret = preparedData.ethCallResults[key];
|
448
469
|
if (ret) {
|
470
|
+
console.debug("prepared eth call found:", key);
|
449
471
|
const result = iface.decodeFunctionResult("deposit", ret).toArray();
|
450
472
|
return result.length == 1 ? result[0] : result;
|
451
473
|
}
|
@@ -637,7 +659,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
637
659
|
async name(overrides?: Overrides): Promise<string> {
|
638
660
|
const ethCallContext = {
|
639
661
|
chainId: this.context.chainId,
|
640
|
-
blockTag: this.context.blockNumber.toString(16),
|
662
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
641
663
|
address: this.context.address,
|
642
664
|
};
|
643
665
|
return await this.view.name(
|
@@ -653,7 +675,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
653
675
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
654
676
|
const ethCallContext = {
|
655
677
|
chainId: this.context.chainId,
|
656
|
-
blockTag: this.context.blockNumber.toString(16),
|
678
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
657
679
|
address: this.context.address,
|
658
680
|
};
|
659
681
|
return await this.view.totalSupply(
|
@@ -669,7 +691,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
669
691
|
async decimals(overrides?: Overrides): Promise<bigint> {
|
670
692
|
const ethCallContext = {
|
671
693
|
chainId: this.context.chainId,
|
672
|
-
blockTag: this.context.blockNumber.toString(16),
|
694
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
673
695
|
address: this.context.address,
|
674
696
|
};
|
675
697
|
return await this.view.decimals(
|
@@ -685,7 +707,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
685
707
|
async balanceOf(arg0: string, overrides?: Overrides): Promise<bigint> {
|
686
708
|
const ethCallContext = {
|
687
709
|
chainId: this.context.chainId,
|
688
|
-
blockTag: this.context.blockNumber.toString(16),
|
710
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
689
711
|
address: this.context.address,
|
690
712
|
};
|
691
713
|
return await this.view.balanceOf(
|
@@ -702,7 +724,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
702
724
|
async symbol(overrides?: Overrides): Promise<string> {
|
703
725
|
const ethCallContext = {
|
704
726
|
chainId: this.context.chainId,
|
705
|
-
blockTag: this.context.blockNumber.toString(16),
|
727
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
706
728
|
address: this.context.address,
|
707
729
|
};
|
708
730
|
return await this.view.symbol(
|
@@ -722,7 +744,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
722
744
|
): Promise<bigint> {
|
723
745
|
const ethCallContext = {
|
724
746
|
chainId: this.context.chainId,
|
725
|
-
blockTag: this.context.blockNumber.toString(16),
|
747
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
726
748
|
address: this.context.address,
|
727
749
|
};
|
728
750
|
return await this.view.allowance(
|
@@ -748,7 +770,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
748
770
|
): Promise<boolean> {
|
749
771
|
const ethCallContext = {
|
750
772
|
chainId: this.context.chainId,
|
751
|
-
blockTag: this.context.blockNumber.toString(16),
|
773
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
752
774
|
address: this.context.address,
|
753
775
|
};
|
754
776
|
return await this.view.callStatic.approve(
|
@@ -770,7 +792,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
770
792
|
): Promise<boolean> {
|
771
793
|
const ethCallContext = {
|
772
794
|
chainId: this.context.chainId,
|
773
|
-
blockTag: this.context.blockNumber.toString(16),
|
795
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
774
796
|
address: this.context.address,
|
775
797
|
};
|
776
798
|
return await this.view.callStatic.transferFrom(
|
@@ -788,7 +810,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
788
810
|
async withdraw(wad: BigNumberish, overrides?: Overrides): Promise<void> {
|
789
811
|
const ethCallContext = {
|
790
812
|
chainId: this.context.chainId,
|
791
|
-
blockTag: this.context.blockNumber.toString(16),
|
813
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
792
814
|
address: this.context.address,
|
793
815
|
};
|
794
816
|
return await this.view.callStatic.withdraw(
|
@@ -808,7 +830,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
808
830
|
): Promise<boolean> {
|
809
831
|
const ethCallContext = {
|
810
832
|
chainId: this.context.chainId,
|
811
|
-
blockTag: this.context.blockNumber.toString(16),
|
833
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
812
834
|
address: this.context.address,
|
813
835
|
};
|
814
836
|
return await this.view.callStatic.transfer(
|
@@ -825,7 +847,7 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
825
847
|
async deposit(overrides?: Overrides): Promise<void> {
|
826
848
|
const ethCallContext = {
|
827
849
|
chainId: this.context.chainId,
|
828
|
-
blockTag: this.context.blockNumber.toString(16),
|
850
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
829
851
|
address: this.context.address,
|
830
852
|
};
|
831
853
|
return await this.view.callStatic.deposit(
|
@@ -846,10 +868,14 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
846
868
|
name(overrides?: Overrides): EthCallParam {
|
847
869
|
const chainId =
|
848
870
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
849
|
-
const blockTag =
|
850
|
-
overrides?.blockTag?.toString() ??
|
851
|
-
this.context.blockNumber.toString(16);
|
852
871
|
const address = this.context.address;
|
872
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
873
|
+
if (overrides?.blockTag) {
|
874
|
+
blockTag =
|
875
|
+
typeof overrides.blockTag == "string"
|
876
|
+
? overrides.blockTag
|
877
|
+
: "0x" + overrides.blockTag.toString(16);
|
878
|
+
}
|
853
879
|
|
854
880
|
return this.view.encodeCall.name({ chainId, address, blockTag });
|
855
881
|
},
|
@@ -860,10 +886,14 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
860
886
|
): EthCallParam {
|
861
887
|
const chainId =
|
862
888
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
863
|
-
const blockTag =
|
864
|
-
overrides?.blockTag?.toString() ??
|
865
|
-
this.context.blockNumber.toString(16);
|
866
889
|
const address = this.context.address;
|
890
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
891
|
+
if (overrides?.blockTag) {
|
892
|
+
blockTag =
|
893
|
+
typeof overrides.blockTag == "string"
|
894
|
+
? overrides.blockTag
|
895
|
+
: "0x" + overrides.blockTag.toString(16);
|
896
|
+
}
|
867
897
|
|
868
898
|
return this.view.encodeCall.approve(guy, wad, {
|
869
899
|
chainId,
|
@@ -874,10 +904,14 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
874
904
|
totalSupply(overrides?: Overrides): EthCallParam {
|
875
905
|
const chainId =
|
876
906
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
877
|
-
const blockTag =
|
878
|
-
overrides?.blockTag?.toString() ??
|
879
|
-
this.context.blockNumber.toString(16);
|
880
907
|
const address = this.context.address;
|
908
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
909
|
+
if (overrides?.blockTag) {
|
910
|
+
blockTag =
|
911
|
+
typeof overrides.blockTag == "string"
|
912
|
+
? overrides.blockTag
|
913
|
+
: "0x" + overrides.blockTag.toString(16);
|
914
|
+
}
|
881
915
|
|
882
916
|
return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
|
883
917
|
},
|
@@ -889,10 +923,14 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
889
923
|
): EthCallParam {
|
890
924
|
const chainId =
|
891
925
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
892
|
-
const blockTag =
|
893
|
-
overrides?.blockTag?.toString() ??
|
894
|
-
this.context.blockNumber.toString(16);
|
895
926
|
const address = this.context.address;
|
927
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
928
|
+
if (overrides?.blockTag) {
|
929
|
+
blockTag =
|
930
|
+
typeof overrides.blockTag == "string"
|
931
|
+
? overrides.blockTag
|
932
|
+
: "0x" + overrides.blockTag.toString(16);
|
933
|
+
}
|
896
934
|
|
897
935
|
return this.view.encodeCall.transferFrom(src, dst, wad, {
|
898
936
|
chainId,
|
@@ -903,30 +941,42 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
903
941
|
withdraw(wad: BigNumberish, overrides?: Overrides): EthCallParam {
|
904
942
|
const chainId =
|
905
943
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
906
|
-
const blockTag =
|
907
|
-
overrides?.blockTag?.toString() ??
|
908
|
-
this.context.blockNumber.toString(16);
|
909
944
|
const address = this.context.address;
|
945
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
946
|
+
if (overrides?.blockTag) {
|
947
|
+
blockTag =
|
948
|
+
typeof overrides.blockTag == "string"
|
949
|
+
? overrides.blockTag
|
950
|
+
: "0x" + overrides.blockTag.toString(16);
|
951
|
+
}
|
910
952
|
|
911
953
|
return this.view.encodeCall.withdraw(wad, { chainId, address, blockTag });
|
912
954
|
},
|
913
955
|
decimals(overrides?: Overrides): EthCallParam {
|
914
956
|
const chainId =
|
915
957
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
916
|
-
const blockTag =
|
917
|
-
overrides?.blockTag?.toString() ??
|
918
|
-
this.context.blockNumber.toString(16);
|
919
958
|
const address = this.context.address;
|
959
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
960
|
+
if (overrides?.blockTag) {
|
961
|
+
blockTag =
|
962
|
+
typeof overrides.blockTag == "string"
|
963
|
+
? overrides.blockTag
|
964
|
+
: "0x" + overrides.blockTag.toString(16);
|
965
|
+
}
|
920
966
|
|
921
967
|
return this.view.encodeCall.decimals({ chainId, address, blockTag });
|
922
968
|
},
|
923
969
|
balanceOf(arg0: string, overrides?: Overrides): EthCallParam {
|
924
970
|
const chainId =
|
925
971
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
926
|
-
const blockTag =
|
927
|
-
overrides?.blockTag?.toString() ??
|
928
|
-
this.context.blockNumber.toString(16);
|
929
972
|
const address = this.context.address;
|
973
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
974
|
+
if (overrides?.blockTag) {
|
975
|
+
blockTag =
|
976
|
+
typeof overrides.blockTag == "string"
|
977
|
+
? overrides.blockTag
|
978
|
+
: "0x" + overrides.blockTag.toString(16);
|
979
|
+
}
|
930
980
|
|
931
981
|
return this.view.encodeCall.balanceOf(arg0, {
|
932
982
|
chainId,
|
@@ -937,10 +987,14 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
937
987
|
symbol(overrides?: Overrides): EthCallParam {
|
938
988
|
const chainId =
|
939
989
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
940
|
-
const blockTag =
|
941
|
-
overrides?.blockTag?.toString() ??
|
942
|
-
this.context.blockNumber.toString(16);
|
943
990
|
const address = this.context.address;
|
991
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
992
|
+
if (overrides?.blockTag) {
|
993
|
+
blockTag =
|
994
|
+
typeof overrides.blockTag == "string"
|
995
|
+
? overrides.blockTag
|
996
|
+
: "0x" + overrides.blockTag.toString(16);
|
997
|
+
}
|
944
998
|
|
945
999
|
return this.view.encodeCall.symbol({ chainId, address, blockTag });
|
946
1000
|
},
|
@@ -951,10 +1005,14 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
951
1005
|
): EthCallParam {
|
952
1006
|
const chainId =
|
953
1007
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
954
|
-
const blockTag =
|
955
|
-
overrides?.blockTag?.toString() ??
|
956
|
-
this.context.blockNumber.toString(16);
|
957
1008
|
const address = this.context.address;
|
1009
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1010
|
+
if (overrides?.blockTag) {
|
1011
|
+
blockTag =
|
1012
|
+
typeof overrides.blockTag == "string"
|
1013
|
+
? overrides.blockTag
|
1014
|
+
: "0x" + overrides.blockTag.toString(16);
|
1015
|
+
}
|
958
1016
|
|
959
1017
|
return this.view.encodeCall.transfer(dst, wad, {
|
960
1018
|
chainId,
|
@@ -965,20 +1023,28 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
965
1023
|
deposit(overrides?: Overrides): EthCallParam {
|
966
1024
|
const chainId =
|
967
1025
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
968
|
-
const blockTag =
|
969
|
-
overrides?.blockTag?.toString() ??
|
970
|
-
this.context.blockNumber.toString(16);
|
971
1026
|
const address = this.context.address;
|
1027
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1028
|
+
if (overrides?.blockTag) {
|
1029
|
+
blockTag =
|
1030
|
+
typeof overrides.blockTag == "string"
|
1031
|
+
? overrides.blockTag
|
1032
|
+
: "0x" + overrides.blockTag.toString(16);
|
1033
|
+
}
|
972
1034
|
|
973
1035
|
return this.view.encodeCall.deposit({ chainId, address, blockTag });
|
974
1036
|
},
|
975
1037
|
allowance(arg0: string, arg1: string, overrides?: Overrides): EthCallParam {
|
976
1038
|
const chainId =
|
977
1039
|
overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
978
|
-
const blockTag =
|
979
|
-
overrides?.blockTag?.toString() ??
|
980
|
-
this.context.blockNumber.toString(16);
|
981
1040
|
const address = this.context.address;
|
1041
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16);
|
1042
|
+
if (overrides?.blockTag) {
|
1043
|
+
blockTag =
|
1044
|
+
typeof overrides.blockTag == "string"
|
1045
|
+
? overrides.blockTag
|
1046
|
+
: "0x" + overrides.blockTag.toString(16);
|
1047
|
+
}
|
982
1048
|
|
983
1049
|
return this.view.encodeCall.allowance(arg0, arg1, {
|
984
1050
|
chainId,
|
@@ -51,8 +51,10 @@ export function generateViewFunction(view: boolean, fn: FunctionDeclaration, inc
|
|
51
51
|
context: ethCallContext,
|
52
52
|
calldata
|
53
53
|
})
|
54
|
+
console.debug("looking up eth call key:", key)
|
54
55
|
const ret = preparedData.ethCallResults[key]
|
55
56
|
if (ret) {
|
57
|
+
console.debug("prepared eth call found:", key)
|
56
58
|
const result = iface.decodeFunctionResult("${fn.name}", ret).toArray()
|
57
59
|
return result.length == 1? result[0]: result
|
58
60
|
}
|
@@ -90,7 +92,7 @@ export function generateBoundViewFunction(view: boolean, fn: FunctionDeclaration
|
|
90
92
|
})}overrides?: Overrides): ${generateReturnTypes(fn)} {
|
91
93
|
const ethCallContext = {
|
92
94
|
chainId: this.context.chainId,
|
93
|
-
blockTag: this.context.blockNumber.toString(16),
|
95
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
94
96
|
address: this.context.address,
|
95
97
|
}
|
96
98
|
return await this.${qualifier}.${declName}(${
|
@@ -152,8 +154,11 @@ export function generateBoundFunctionCallEncoder(fn: FunctionDeclaration, includ
|
|
152
154
|
useStructs: true
|
153
155
|
})}overrides?: Overrides): EthCallParam {
|
154
156
|
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString()
|
155
|
-
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16)
|
156
157
|
const address = this.context.address
|
158
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16)
|
159
|
+
if (overrides?.blockTag) {
|
160
|
+
blockTag = typeof(overrides.blockTag) == 'string'? overrides.blockTag: "0x" + overrides.blockTag.toString(16)
|
161
|
+
}
|
157
162
|
|
158
163
|
return this.view.encodeCall.${declName}(${
|
159
164
|
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
package/src/eth/context.ts
CHANGED
@@ -188,6 +188,9 @@ export class ContractContext<
|
|
188
188
|
if (view.callStatic) {
|
189
189
|
view.callStatic.context = this
|
190
190
|
}
|
191
|
+
if (view.encodeCall) {
|
192
|
+
view.encodeCall.context = this
|
193
|
+
}
|
191
194
|
this.contractName = contractName
|
192
195
|
this.contract = view
|
193
196
|
}
|
@@ -226,6 +229,10 @@ export class BoundContractView<TContract extends BaseContract, TContractView ext
|
|
226
229
|
context: EthContext
|
227
230
|
view: TContractView
|
228
231
|
}
|
232
|
+
encodeCall: {
|
233
|
+
context: EthContext
|
234
|
+
view: TContractView
|
235
|
+
}
|
229
236
|
|
230
237
|
constructor(address: string, view: TContractView) {
|
231
238
|
this.address = address
|