@sentio/sdk 2.40.0-rc.5 → 2.40.0-rc.6

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 (79) hide show
  1. package/lib/aptos/builtin/0x1.js +10 -10
  2. package/lib/aptos/builtin/0x3.js +11 -11
  3. package/lib/aptos/builtin/index.js +11 -11
  4. package/lib/aptos/codegen/index.js +3 -3
  5. package/lib/aptos/ext/index.js +10 -10
  6. package/lib/aptos/index.js +10 -10
  7. package/lib/chunk-2QEQTKQY.js +1050 -0
  8. package/lib/{chunk-Z7QWETBQ.js → chunk-3LE323R2.js} +2 -2
  9. package/lib/{chunk-QHHXY7LO.js → chunk-5XM56ENY.js} +5 -5
  10. package/lib/{chunk-RX5G4RN2.js → chunk-7NFMED3E.js} +2 -2
  11. package/lib/{chunk-KA5CLZU6.js → chunk-7NWX3CH7.js} +90 -53
  12. package/lib/{chunk-F2IZC2B6.js → chunk-EMF4HXFG.js} +5 -5
  13. package/lib/{chunk-VP6Y633M.js → chunk-GOWJIAB2.js} +2 -2
  14. package/lib/chunk-K5OSTLHI.js +916 -0
  15. package/lib/{chunk-WLLDVQFE.js → chunk-KO4GSZCM.js} +3 -3
  16. package/lib/chunk-KTAUVRJN.js +1910 -0
  17. package/lib/{chunk-2QVJGMW4.js → chunk-KVB555XD.js} +2 -2
  18. package/lib/{chunk-TDPQO2SX.js → chunk-LICAL3XW.js} +2 -2
  19. package/lib/{chunk-NBZRHB5V.js → chunk-O6QXDRGG.js} +5 -5
  20. package/lib/{chunk-6DDG76PU.js → chunk-P6T5WFAZ.js} +4 -4
  21. package/lib/chunk-QKJ5SWA2.js +861 -0
  22. package/lib/{chunk-VJTNBZMU.js → chunk-QTWMU7GQ.js} +1 -1
  23. package/lib/{chunk-OAIP7J4S.js → chunk-RXO7SOTL.js} +2757 -1157
  24. package/lib/{chunk-S727P6WP.js → chunk-SYEQKTIU.js} +1 -1
  25. package/lib/{chunk-7OBRGY7G.js → chunk-YNJXNOVA.js} +2 -2
  26. package/lib/{chunk-N4OQDWM2.js → chunk-YOLIZKGZ.js} +1 -1
  27. package/lib/{chunk-USETTWR7.js → chunk-Z5PQR6UE.js} +100 -54
  28. package/lib/core/index.js +3 -3
  29. package/lib/{eacaggregatorproxy-aed46d4a.d.ts → eacaggregatorproxy-cb8e39be.d.ts} +76 -24
  30. package/lib/{erc1155-80a76eb5.d.ts → erc1155-fb097c50.d.ts} +31 -9
  31. package/lib/{erc20-39aae019.d.ts → erc20-95ba7721.d.ts} +61 -19
  32. package/lib/{erc721-0a429bd4.d.ts → erc721-13bf7a61.d.ts} +49 -15
  33. package/lib/eth/builtin/eacaggregatorproxy.d.ts +1 -1
  34. package/lib/eth/builtin/eacaggregatorproxy.js +5 -5
  35. package/lib/eth/builtin/erc1155.d.ts +1 -1
  36. package/lib/eth/builtin/erc1155.js +5 -5
  37. package/lib/eth/builtin/erc20.d.ts +1 -1
  38. package/lib/eth/builtin/erc20.js +4 -4
  39. package/lib/eth/builtin/erc721.d.ts +1 -1
  40. package/lib/eth/builtin/erc721.js +4 -4
  41. package/lib/eth/builtin/index.d.ts +39 -15
  42. package/lib/eth/builtin/index.js +8 -8
  43. package/lib/eth/builtin/weth9.d.ts +1 -1
  44. package/lib/eth/builtin/weth9.js +5 -5
  45. package/lib/eth/codegen/index.js +130 -39
  46. package/lib/eth/index.d.ts +1 -0
  47. package/lib/eth/index.js +7 -4
  48. package/lib/fuel/index.js +4 -4
  49. package/lib/index.js +5 -3
  50. package/lib/move/index.js +4 -4
  51. package/lib/solana/builtin/index.js +4 -4
  52. package/lib/solana/index.js +4 -4
  53. package/lib/store/index.js +3 -3
  54. package/lib/sui/builtin/0x1.js +12 -12
  55. package/lib/sui/builtin/0x2.js +13 -13
  56. package/lib/sui/builtin/0x3.js +14 -14
  57. package/lib/sui/builtin/index.js +14 -14
  58. package/lib/sui/codegen/index.js +2 -2
  59. package/lib/sui/ext/index.js +10 -10
  60. package/lib/sui/index.js +11 -11
  61. package/lib/testing/index.js +14 -14
  62. package/lib/utils/index.js +7 -7
  63. package/lib/{weth9-08664cb7.d.ts → weth9-2b52cb06.d.ts} +40 -12
  64. package/package.json +1 -1
  65. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1446 -115
  66. package/src/eth/builtin/internal/erc1155-processor.ts +611 -34
  67. package/src/eth/builtin/internal/erc20-processor.ts +1182 -84
  68. package/src/eth/builtin/internal/erc20bytes-processor.ts +595 -45
  69. package/src/eth/builtin/internal/erc721-processor.ts +967 -64
  70. package/src/eth/builtin/internal/weth9-processor.ts +698 -55
  71. package/src/eth/codegen/file.ts +26 -3
  72. package/src/eth/codegen/function-calls.ts +93 -8
  73. package/src/eth/codegen/types.ts +22 -1
  74. package/src/eth/eth-plugin.ts +4 -4
  75. package/src/eth/index.ts +2 -0
  76. package/lib/chunk-76HTCT5F.js +0 -469
  77. package/lib/chunk-ERTIHPSD.js +0 -528
  78. package/lib/chunk-LWKILLQ6.js +0 -820
  79. package/lib/chunk-S36AAZOU.js +0 -417
@@ -0,0 +1,1050 @@
1
+ import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
+ import {
3
+ BaseProcessor,
4
+ BaseProcessorTemplate,
5
+ BoundContractView,
6
+ ContractView,
7
+ DummyProvider,
8
+ Interface,
9
+ WETH9__factory,
10
+ addContractByABI,
11
+ addProcessor,
12
+ getContractByABI,
13
+ getProcessor,
14
+ getProvider,
15
+ import_chain,
16
+ transformEtherError
17
+ } from "./chunk-RXO7SOTL.js";
18
+ import {
19
+ makeEthCallKey
20
+ } from "./chunk-Z5PQR6UE.js";
21
+ import {
22
+ __export,
23
+ __publicField
24
+ } from "./chunk-AXRHIURD.js";
25
+
26
+ // src/eth/builtin/weth9.ts
27
+ var weth9_exports = {};
28
+ __export(weth9_exports, {
29
+ WETH9BoundContractView: () => WETH9BoundContractView,
30
+ WETH9ContractView: () => WETH9ContractView,
31
+ WETH9Processor: () => WETH9Processor,
32
+ WETH9ProcessorTemplate: () => WETH9ProcessorTemplate,
33
+ WETH9__factory: () => WETH9__factory,
34
+ getWETH9Contract: () => getWETH9Contract,
35
+ getWETH9ContractOnContext: () => getWETH9ContractOnContext,
36
+ mockApprovalLog: () => mockApprovalLog,
37
+ mockDepositLog: () => mockDepositLog,
38
+ mockTransferLog: () => mockTransferLog,
39
+ mockWithdrawalLog: () => mockWithdrawalLog
40
+ });
41
+
42
+ // src/eth/builtin/internal/weth9-processor.ts
43
+ var templateContract = WETH9__factory.connect("0x0", DummyProvider);
44
+ var WETH9ContractView = class extends ContractView {
45
+ constructor(contract) {
46
+ super(contract);
47
+ this.callStatic.contract = contract;
48
+ }
49
+ async name(overrides, preparedData, ethCallContext) {
50
+ try {
51
+ if (preparedData?.ethCallResults && ethCallContext) {
52
+ const iface = new Interface(["function name() view returns (string)"]);
53
+ const calldata = iface.encodeFunctionData("name", []);
54
+ const key = makeEthCallKey({
55
+ context: ethCallContext,
56
+ calldata
57
+ });
58
+ const ret = preparedData.ethCallResults[key];
59
+ if (ret) {
60
+ const result = iface.decodeFunctionResult("name", ret).toArray();
61
+ return result.length == 1 ? result[0] : result;
62
+ }
63
+ }
64
+ return await this.contract.getFunction("name()")(overrides || {});
65
+ } catch (e) {
66
+ const stack = new Error().stack;
67
+ throw transformEtherError(e, void 0, stack);
68
+ }
69
+ }
70
+ async totalSupply(overrides, preparedData, ethCallContext) {
71
+ try {
72
+ if (preparedData?.ethCallResults && ethCallContext) {
73
+ const iface = new Interface([
74
+ "function totalSupply() view returns (uint256)"
75
+ ]);
76
+ const calldata = iface.encodeFunctionData("totalSupply", []);
77
+ const key = makeEthCallKey({
78
+ context: ethCallContext,
79
+ calldata
80
+ });
81
+ const ret = preparedData.ethCallResults[key];
82
+ if (ret) {
83
+ const result = iface.decodeFunctionResult("totalSupply", ret).toArray();
84
+ return result.length == 1 ? result[0] : result;
85
+ }
86
+ }
87
+ return await this.contract.getFunction("totalSupply()")(overrides || {});
88
+ } catch (e) {
89
+ const stack = new Error().stack;
90
+ throw transformEtherError(e, void 0, stack);
91
+ }
92
+ }
93
+ async decimals(overrides, preparedData, ethCallContext) {
94
+ try {
95
+ if (preparedData?.ethCallResults && ethCallContext) {
96
+ const iface = new Interface([
97
+ "function decimals() view returns (uint8)"
98
+ ]);
99
+ const calldata = iface.encodeFunctionData("decimals", []);
100
+ const key = makeEthCallKey({
101
+ context: ethCallContext,
102
+ calldata
103
+ });
104
+ const ret = preparedData.ethCallResults[key];
105
+ if (ret) {
106
+ const result = iface.decodeFunctionResult("decimals", ret).toArray();
107
+ return result.length == 1 ? result[0] : result;
108
+ }
109
+ }
110
+ return await this.contract.getFunction("decimals()")(overrides || {});
111
+ } catch (e) {
112
+ const stack = new Error().stack;
113
+ throw transformEtherError(e, void 0, stack);
114
+ }
115
+ }
116
+ async balanceOf(arg0, overrides, preparedData, ethCallContext) {
117
+ try {
118
+ if (preparedData?.ethCallResults && ethCallContext) {
119
+ const iface = new Interface([
120
+ "function balanceOf(address) view returns (uint256)"
121
+ ]);
122
+ const calldata = iface.encodeFunctionData("balanceOf", [arg0]);
123
+ const key = makeEthCallKey({
124
+ context: ethCallContext,
125
+ calldata
126
+ });
127
+ const ret = preparedData.ethCallResults[key];
128
+ if (ret) {
129
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
130
+ return result.length == 1 ? result[0] : result;
131
+ }
132
+ }
133
+ return await this.contract.getFunction("balanceOf(address)")(
134
+ arg0,
135
+ overrides || {}
136
+ );
137
+ } catch (e) {
138
+ const stack = new Error().stack;
139
+ throw transformEtherError(e, void 0, stack);
140
+ }
141
+ }
142
+ async symbol(overrides, preparedData, ethCallContext) {
143
+ try {
144
+ if (preparedData?.ethCallResults && ethCallContext) {
145
+ const iface = new Interface([
146
+ "function symbol() view returns (string)"
147
+ ]);
148
+ const calldata = iface.encodeFunctionData("symbol", []);
149
+ const key = makeEthCallKey({
150
+ context: ethCallContext,
151
+ calldata
152
+ });
153
+ const ret = preparedData.ethCallResults[key];
154
+ if (ret) {
155
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
156
+ return result.length == 1 ? result[0] : result;
157
+ }
158
+ }
159
+ return await this.contract.getFunction("symbol()")(overrides || {});
160
+ } catch (e) {
161
+ const stack = new Error().stack;
162
+ throw transformEtherError(e, void 0, stack);
163
+ }
164
+ }
165
+ async allowance(arg0, arg1, overrides, preparedData, ethCallContext) {
166
+ try {
167
+ if (preparedData?.ethCallResults && ethCallContext) {
168
+ const iface = new Interface([
169
+ "function allowance(address,address) view returns (uint256)"
170
+ ]);
171
+ const calldata = iface.encodeFunctionData("allowance", [arg0, arg1]);
172
+ const key = makeEthCallKey({
173
+ context: ethCallContext,
174
+ calldata
175
+ });
176
+ const ret = preparedData.ethCallResults[key];
177
+ if (ret) {
178
+ const result = iface.decodeFunctionResult("allowance", ret).toArray();
179
+ return result.length == 1 ? result[0] : result;
180
+ }
181
+ }
182
+ return await this.contract.getFunction("allowance(address,address)")(
183
+ arg0,
184
+ arg1,
185
+ overrides || {}
186
+ );
187
+ } catch (e) {
188
+ const stack = new Error().stack;
189
+ throw transformEtherError(e, void 0, stack);
190
+ }
191
+ }
192
+ callStatic = {
193
+ contract: this.contract,
194
+ async approve(guy, wad, overrides, preparedData, ethCallContext) {
195
+ try {
196
+ if (preparedData?.ethCallResults && ethCallContext) {
197
+ const iface = new Interface([
198
+ "function approve(address,uint256) nonpayable returns (bool)"
199
+ ]);
200
+ const calldata = iface.encodeFunctionData("approve", [guy, wad]);
201
+ const key = makeEthCallKey({
202
+ context: ethCallContext,
203
+ calldata
204
+ });
205
+ const ret = preparedData.ethCallResults[key];
206
+ if (ret) {
207
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
208
+ return result.length == 1 ? result[0] : result;
209
+ }
210
+ }
211
+ return await this.contract.getFunction("approve(address,uint256)").staticCall(guy, wad, overrides || {});
212
+ } catch (e) {
213
+ const stack = new Error().stack;
214
+ throw transformEtherError(e, void 0, stack);
215
+ }
216
+ },
217
+ async transferFrom(src, dst, wad, overrides, preparedData, ethCallContext) {
218
+ try {
219
+ if (preparedData?.ethCallResults && ethCallContext) {
220
+ const iface = new Interface([
221
+ "function transferFrom(address,address,uint256) nonpayable returns (bool)"
222
+ ]);
223
+ const calldata = iface.encodeFunctionData("transferFrom", [
224
+ src,
225
+ dst,
226
+ wad
227
+ ]);
228
+ const key = makeEthCallKey({
229
+ context: ethCallContext,
230
+ calldata
231
+ });
232
+ const ret = preparedData.ethCallResults[key];
233
+ if (ret) {
234
+ const result = iface.decodeFunctionResult("transferFrom", ret).toArray();
235
+ return result.length == 1 ? result[0] : result;
236
+ }
237
+ }
238
+ return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(src, dst, wad, overrides || {});
239
+ } catch (e) {
240
+ const stack = new Error().stack;
241
+ throw transformEtherError(e, void 0, stack);
242
+ }
243
+ },
244
+ async withdraw(wad, overrides, preparedData, ethCallContext) {
245
+ try {
246
+ if (preparedData?.ethCallResults && ethCallContext) {
247
+ const iface = new Interface([
248
+ "function withdraw(uint256) nonpayable returns ()"
249
+ ]);
250
+ const calldata = iface.encodeFunctionData("withdraw", [wad]);
251
+ const key = makeEthCallKey({
252
+ context: ethCallContext,
253
+ calldata
254
+ });
255
+ const ret = preparedData.ethCallResults[key];
256
+ if (ret) {
257
+ const result = iface.decodeFunctionResult("withdraw", ret).toArray();
258
+ return result.length == 1 ? result[0] : result;
259
+ }
260
+ }
261
+ return await this.contract.getFunction("withdraw(uint256)").staticCall(wad, overrides || {});
262
+ } catch (e) {
263
+ const stack = new Error().stack;
264
+ throw transformEtherError(e, void 0, stack);
265
+ }
266
+ },
267
+ async transfer(dst, wad, overrides, preparedData, ethCallContext) {
268
+ try {
269
+ if (preparedData?.ethCallResults && ethCallContext) {
270
+ const iface = new Interface([
271
+ "function transfer(address,uint256) nonpayable returns (bool)"
272
+ ]);
273
+ const calldata = iface.encodeFunctionData("transfer", [dst, wad]);
274
+ const key = makeEthCallKey({
275
+ context: ethCallContext,
276
+ calldata
277
+ });
278
+ const ret = preparedData.ethCallResults[key];
279
+ if (ret) {
280
+ const result = iface.decodeFunctionResult("transfer", ret).toArray();
281
+ return result.length == 1 ? result[0] : result;
282
+ }
283
+ }
284
+ return await this.contract.getFunction("transfer(address,uint256)").staticCall(dst, wad, overrides || {});
285
+ } catch (e) {
286
+ const stack = new Error().stack;
287
+ throw transformEtherError(e, void 0, stack);
288
+ }
289
+ },
290
+ async deposit(overrides, preparedData, ethCallContext) {
291
+ try {
292
+ if (preparedData?.ethCallResults && ethCallContext) {
293
+ const iface = new Interface([
294
+ "function deposit() payable returns ()"
295
+ ]);
296
+ const calldata = iface.encodeFunctionData("deposit", []);
297
+ const key = makeEthCallKey({
298
+ context: ethCallContext,
299
+ calldata
300
+ });
301
+ const ret = preparedData.ethCallResults[key];
302
+ if (ret) {
303
+ const result = iface.decodeFunctionResult("deposit", ret).toArray();
304
+ return result.length == 1 ? result[0] : result;
305
+ }
306
+ }
307
+ return await this.contract.getFunction("deposit()").staticCall(overrides || {});
308
+ } catch (e) {
309
+ const stack = new Error().stack;
310
+ throw transformEtherError(e, void 0, stack);
311
+ }
312
+ }
313
+ };
314
+ encodeCall = {
315
+ name(ethCallContext) {
316
+ try {
317
+ const iface = new Interface(["function name()"]);
318
+ const calldata = iface.encodeFunctionData("name", []);
319
+ return {
320
+ context: ethCallContext,
321
+ calldata
322
+ };
323
+ } catch (e) {
324
+ const stack = new Error().stack;
325
+ throw transformEtherError(e, void 0, stack);
326
+ }
327
+ },
328
+ approve(guy, wad, ethCallContext) {
329
+ try {
330
+ const iface = new Interface(["function approve(address,uint256)"]);
331
+ const calldata = iface.encodeFunctionData("approve", [guy, wad]);
332
+ return {
333
+ context: ethCallContext,
334
+ calldata
335
+ };
336
+ } catch (e) {
337
+ const stack = new Error().stack;
338
+ throw transformEtherError(e, void 0, stack);
339
+ }
340
+ },
341
+ totalSupply(ethCallContext) {
342
+ try {
343
+ const iface = new Interface(["function totalSupply()"]);
344
+ const calldata = iface.encodeFunctionData("totalSupply", []);
345
+ return {
346
+ context: ethCallContext,
347
+ calldata
348
+ };
349
+ } catch (e) {
350
+ const stack = new Error().stack;
351
+ throw transformEtherError(e, void 0, stack);
352
+ }
353
+ },
354
+ transferFrom(src, dst, wad, ethCallContext) {
355
+ try {
356
+ const iface = new Interface([
357
+ "function transferFrom(address,address,uint256)"
358
+ ]);
359
+ const calldata = iface.encodeFunctionData("transferFrom", [
360
+ src,
361
+ dst,
362
+ wad
363
+ ]);
364
+ return {
365
+ context: ethCallContext,
366
+ calldata
367
+ };
368
+ } catch (e) {
369
+ const stack = new Error().stack;
370
+ throw transformEtherError(e, void 0, stack);
371
+ }
372
+ },
373
+ withdraw(wad, ethCallContext) {
374
+ try {
375
+ const iface = new Interface(["function withdraw(uint256)"]);
376
+ const calldata = iface.encodeFunctionData("withdraw", [wad]);
377
+ return {
378
+ context: ethCallContext,
379
+ calldata
380
+ };
381
+ } catch (e) {
382
+ const stack = new Error().stack;
383
+ throw transformEtherError(e, void 0, stack);
384
+ }
385
+ },
386
+ decimals(ethCallContext) {
387
+ try {
388
+ const iface = new Interface(["function decimals()"]);
389
+ const calldata = iface.encodeFunctionData("decimals", []);
390
+ return {
391
+ context: ethCallContext,
392
+ calldata
393
+ };
394
+ } catch (e) {
395
+ const stack = new Error().stack;
396
+ throw transformEtherError(e, void 0, stack);
397
+ }
398
+ },
399
+ balanceOf(arg0, ethCallContext) {
400
+ try {
401
+ const iface = new Interface(["function balanceOf(address)"]);
402
+ const calldata = iface.encodeFunctionData("balanceOf", [arg0]);
403
+ return {
404
+ context: ethCallContext,
405
+ calldata
406
+ };
407
+ } catch (e) {
408
+ const stack = new Error().stack;
409
+ throw transformEtherError(e, void 0, stack);
410
+ }
411
+ },
412
+ symbol(ethCallContext) {
413
+ try {
414
+ const iface = new Interface(["function symbol()"]);
415
+ const calldata = iface.encodeFunctionData("symbol", []);
416
+ return {
417
+ context: ethCallContext,
418
+ calldata
419
+ };
420
+ } catch (e) {
421
+ const stack = new Error().stack;
422
+ throw transformEtherError(e, void 0, stack);
423
+ }
424
+ },
425
+ transfer(dst, wad, ethCallContext) {
426
+ try {
427
+ const iface = new Interface(["function transfer(address,uint256)"]);
428
+ const calldata = iface.encodeFunctionData("transfer", [dst, wad]);
429
+ return {
430
+ context: ethCallContext,
431
+ calldata
432
+ };
433
+ } catch (e) {
434
+ const stack = new Error().stack;
435
+ throw transformEtherError(e, void 0, stack);
436
+ }
437
+ },
438
+ deposit(ethCallContext) {
439
+ try {
440
+ const iface = new Interface(["function deposit()"]);
441
+ const calldata = iface.encodeFunctionData("deposit", []);
442
+ return {
443
+ context: ethCallContext,
444
+ calldata
445
+ };
446
+ } catch (e) {
447
+ const stack = new Error().stack;
448
+ throw transformEtherError(e, void 0, stack);
449
+ }
450
+ },
451
+ allowance(arg0, arg1, ethCallContext) {
452
+ try {
453
+ const iface = new Interface(["function allowance(address,address)"]);
454
+ const calldata = iface.encodeFunctionData("allowance", [arg0, arg1]);
455
+ return {
456
+ context: ethCallContext,
457
+ calldata
458
+ };
459
+ } catch (e) {
460
+ const stack = new Error().stack;
461
+ throw transformEtherError(e, void 0, stack);
462
+ }
463
+ }
464
+ };
465
+ };
466
+ var WETH9BoundContractView = class extends BoundContractView {
467
+ async name(overrides) {
468
+ const ethCallContext = {
469
+ chainId: this.context.chainId,
470
+ blockTag: this.context.blockNumber.toString(16),
471
+ address: this.context.address
472
+ };
473
+ return await this.view.name(
474
+ {
475
+ blockTag: this.context.blockNumber,
476
+ ...overrides
477
+ },
478
+ this.context.preparedData,
479
+ ethCallContext
480
+ );
481
+ }
482
+ async totalSupply(overrides) {
483
+ const ethCallContext = {
484
+ chainId: this.context.chainId,
485
+ blockTag: this.context.blockNumber.toString(16),
486
+ address: this.context.address
487
+ };
488
+ return await this.view.totalSupply(
489
+ {
490
+ blockTag: this.context.blockNumber,
491
+ ...overrides
492
+ },
493
+ this.context.preparedData,
494
+ ethCallContext
495
+ );
496
+ }
497
+ async decimals(overrides) {
498
+ const ethCallContext = {
499
+ chainId: this.context.chainId,
500
+ blockTag: this.context.blockNumber.toString(16),
501
+ address: this.context.address
502
+ };
503
+ return await this.view.decimals(
504
+ {
505
+ blockTag: this.context.blockNumber,
506
+ ...overrides
507
+ },
508
+ this.context.preparedData,
509
+ ethCallContext
510
+ );
511
+ }
512
+ async balanceOf(arg0, overrides) {
513
+ const ethCallContext = {
514
+ chainId: this.context.chainId,
515
+ blockTag: this.context.blockNumber.toString(16),
516
+ address: this.context.address
517
+ };
518
+ return await this.view.balanceOf(
519
+ arg0,
520
+ {
521
+ blockTag: this.context.blockNumber,
522
+ ...overrides
523
+ },
524
+ this.context.preparedData,
525
+ ethCallContext
526
+ );
527
+ }
528
+ async symbol(overrides) {
529
+ const ethCallContext = {
530
+ chainId: this.context.chainId,
531
+ blockTag: this.context.blockNumber.toString(16),
532
+ address: this.context.address
533
+ };
534
+ return await this.view.symbol(
535
+ {
536
+ blockTag: this.context.blockNumber,
537
+ ...overrides
538
+ },
539
+ this.context.preparedData,
540
+ ethCallContext
541
+ );
542
+ }
543
+ async allowance(arg0, arg1, overrides) {
544
+ const ethCallContext = {
545
+ chainId: this.context.chainId,
546
+ blockTag: this.context.blockNumber.toString(16),
547
+ address: this.context.address
548
+ };
549
+ return await this.view.allowance(
550
+ arg0,
551
+ arg1,
552
+ {
553
+ blockTag: this.context.blockNumber,
554
+ ...overrides
555
+ },
556
+ this.context.preparedData,
557
+ ethCallContext
558
+ );
559
+ }
560
+ callStatic = {
561
+ view: this.view,
562
+ context: this.context,
563
+ async approve(guy, wad, overrides) {
564
+ const ethCallContext = {
565
+ chainId: this.context.chainId,
566
+ blockTag: this.context.blockNumber.toString(16),
567
+ address: this.context.address
568
+ };
569
+ return await this.view.callStatic.approve(
570
+ guy,
571
+ wad,
572
+ {
573
+ blockTag: this.context.blockNumber,
574
+ ...overrides
575
+ },
576
+ this.context.preparedData,
577
+ ethCallContext
578
+ );
579
+ },
580
+ async transferFrom(src, dst, wad, overrides) {
581
+ const ethCallContext = {
582
+ chainId: this.context.chainId,
583
+ blockTag: this.context.blockNumber.toString(16),
584
+ address: this.context.address
585
+ };
586
+ return await this.view.callStatic.transferFrom(
587
+ src,
588
+ dst,
589
+ wad,
590
+ {
591
+ blockTag: this.context.blockNumber,
592
+ ...overrides
593
+ },
594
+ this.context.preparedData,
595
+ ethCallContext
596
+ );
597
+ },
598
+ async withdraw(wad, overrides) {
599
+ const ethCallContext = {
600
+ chainId: this.context.chainId,
601
+ blockTag: this.context.blockNumber.toString(16),
602
+ address: this.context.address
603
+ };
604
+ return await this.view.callStatic.withdraw(
605
+ wad,
606
+ {
607
+ blockTag: this.context.blockNumber,
608
+ ...overrides
609
+ },
610
+ this.context.preparedData,
611
+ ethCallContext
612
+ );
613
+ },
614
+ async transfer(dst, wad, overrides) {
615
+ const ethCallContext = {
616
+ chainId: this.context.chainId,
617
+ blockTag: this.context.blockNumber.toString(16),
618
+ address: this.context.address
619
+ };
620
+ return await this.view.callStatic.transfer(
621
+ dst,
622
+ wad,
623
+ {
624
+ blockTag: this.context.blockNumber,
625
+ ...overrides
626
+ },
627
+ this.context.preparedData,
628
+ ethCallContext
629
+ );
630
+ },
631
+ async deposit(overrides) {
632
+ const ethCallContext = {
633
+ chainId: this.context.chainId,
634
+ blockTag: this.context.blockNumber.toString(16),
635
+ address: this.context.address
636
+ };
637
+ return await this.view.callStatic.deposit(
638
+ {
639
+ blockTag: this.context.blockNumber,
640
+ ...overrides
641
+ },
642
+ this.context.preparedData,
643
+ ethCallContext
644
+ );
645
+ }
646
+ };
647
+ encodeCall = {
648
+ view: this.view,
649
+ context: this.context,
650
+ name(overrides) {
651
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
652
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
653
+ const address = this.context.address;
654
+ return this.view.encodeCall.name({ chainId, address, blockTag });
655
+ },
656
+ approve(guy, wad, overrides) {
657
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
658
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
659
+ const address = this.context.address;
660
+ return this.view.encodeCall.approve(guy, wad, {
661
+ chainId,
662
+ address,
663
+ blockTag
664
+ });
665
+ },
666
+ totalSupply(overrides) {
667
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
668
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
669
+ const address = this.context.address;
670
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
671
+ },
672
+ transferFrom(src, dst, wad, overrides) {
673
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
674
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
675
+ const address = this.context.address;
676
+ return this.view.encodeCall.transferFrom(src, dst, wad, {
677
+ chainId,
678
+ address,
679
+ blockTag
680
+ });
681
+ },
682
+ withdraw(wad, overrides) {
683
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
684
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
685
+ const address = this.context.address;
686
+ return this.view.encodeCall.withdraw(wad, { chainId, address, blockTag });
687
+ },
688
+ decimals(overrides) {
689
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
690
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
691
+ const address = this.context.address;
692
+ return this.view.encodeCall.decimals({ chainId, address, blockTag });
693
+ },
694
+ balanceOf(arg0, overrides) {
695
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
696
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
697
+ const address = this.context.address;
698
+ return this.view.encodeCall.balanceOf(arg0, {
699
+ chainId,
700
+ address,
701
+ blockTag
702
+ });
703
+ },
704
+ symbol(overrides) {
705
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
706
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
707
+ const address = this.context.address;
708
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
709
+ },
710
+ transfer(dst, wad, overrides) {
711
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
712
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
713
+ const address = this.context.address;
714
+ return this.view.encodeCall.transfer(dst, wad, {
715
+ chainId,
716
+ address,
717
+ blockTag
718
+ });
719
+ },
720
+ deposit(overrides) {
721
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
722
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
723
+ const address = this.context.address;
724
+ return this.view.encodeCall.deposit({ chainId, address, blockTag });
725
+ },
726
+ allowance(arg0, arg1, overrides) {
727
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
728
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
729
+ const address = this.context.address;
730
+ return this.view.encodeCall.allowance(arg0, arg1, {
731
+ chainId,
732
+ address,
733
+ blockTag
734
+ });
735
+ }
736
+ };
737
+ };
738
+ var _WETH9Processor = class extends BaseProcessor {
739
+ onEventApproval(handler, filter, fetchConfig, preprocessHandler) {
740
+ if (!filter) {
741
+ filter = templateContract.filters["Approval(address,address,uint256)"](
742
+ null,
743
+ null,
744
+ null
745
+ );
746
+ }
747
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
748
+ }
749
+ onEventTransfer(handler, filter, fetchConfig, preprocessHandler) {
750
+ if (!filter) {
751
+ filter = templateContract.filters["Transfer(address,address,uint256)"](
752
+ null,
753
+ null,
754
+ null
755
+ );
756
+ }
757
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
758
+ }
759
+ onEventDeposit(handler, filter, fetchConfig, preprocessHandler) {
760
+ if (!filter) {
761
+ filter = templateContract.filters["Deposit(address,uint256)"](null, null);
762
+ }
763
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
764
+ }
765
+ onEventWithdrawal(handler, filter, fetchConfig, preprocessHandler) {
766
+ if (!filter) {
767
+ filter = templateContract.filters["Withdrawal(address,uint256)"](
768
+ null,
769
+ null
770
+ );
771
+ }
772
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
773
+ }
774
+ onCallName(handler, fetchConfig, preprocessHandler) {
775
+ return super.onEthTrace(
776
+ "0x06fdde03",
777
+ handler,
778
+ fetchConfig,
779
+ preprocessHandler
780
+ );
781
+ }
782
+ onCallApprove(handler, fetchConfig, preprocessHandler) {
783
+ return super.onEthTrace(
784
+ "0x095ea7b3",
785
+ handler,
786
+ fetchConfig,
787
+ preprocessHandler
788
+ );
789
+ }
790
+ onCallTotalSupply(handler, fetchConfig, preprocessHandler) {
791
+ return super.onEthTrace(
792
+ "0x18160ddd",
793
+ handler,
794
+ fetchConfig,
795
+ preprocessHandler
796
+ );
797
+ }
798
+ onCallTransferFrom(handler, fetchConfig, preprocessHandler) {
799
+ return super.onEthTrace(
800
+ "0x23b872dd",
801
+ handler,
802
+ fetchConfig,
803
+ preprocessHandler
804
+ );
805
+ }
806
+ onCallWithdraw(handler, fetchConfig, preprocessHandler) {
807
+ return super.onEthTrace(
808
+ "0x2e1a7d4d",
809
+ handler,
810
+ fetchConfig,
811
+ preprocessHandler
812
+ );
813
+ }
814
+ onCallDecimals(handler, fetchConfig, preprocessHandler) {
815
+ return super.onEthTrace(
816
+ "0x313ce567",
817
+ handler,
818
+ fetchConfig,
819
+ preprocessHandler
820
+ );
821
+ }
822
+ onCallBalanceOf(handler, fetchConfig, preprocessHandler) {
823
+ return super.onEthTrace(
824
+ "0x70a08231",
825
+ handler,
826
+ fetchConfig,
827
+ preprocessHandler
828
+ );
829
+ }
830
+ onCallSymbol(handler, fetchConfig, preprocessHandler) {
831
+ return super.onEthTrace(
832
+ "0x95d89b41",
833
+ handler,
834
+ fetchConfig,
835
+ preprocessHandler
836
+ );
837
+ }
838
+ onCallTransfer(handler, fetchConfig, preprocessHandler) {
839
+ return super.onEthTrace(
840
+ "0xa9059cbb",
841
+ handler,
842
+ fetchConfig,
843
+ preprocessHandler
844
+ );
845
+ }
846
+ onCallDeposit(handler, fetchConfig, preprocessHandler) {
847
+ return super.onEthTrace(
848
+ "0xd0e30db0",
849
+ handler,
850
+ fetchConfig,
851
+ preprocessHandler
852
+ );
853
+ }
854
+ onCallAllowance(handler, fetchConfig, preprocessHandler) {
855
+ return super.onEthTrace(
856
+ "0xdd62ed3e",
857
+ handler,
858
+ fetchConfig,
859
+ preprocessHandler
860
+ );
861
+ }
862
+ CreateBoundContractView() {
863
+ const view = getWETH9Contract(this.config.network, this.config.address);
864
+ return new WETH9BoundContractView(this.config.address, view);
865
+ }
866
+ static bind(options) {
867
+ if (!options.name) {
868
+ options.name = "WETH9";
869
+ }
870
+ let processor = getProcessor(options);
871
+ if (!processor) {
872
+ processor = new _WETH9Processor(options);
873
+ addProcessor(options, processor);
874
+ }
875
+ return processor;
876
+ }
877
+ };
878
+ var WETH9Processor = _WETH9Processor;
879
+ __publicField(WETH9Processor, "filters", {
880
+ Approval(src, guy, wad) {
881
+ return templateContract.filters["Approval(address,address,uint256)"](
882
+ src,
883
+ guy,
884
+ wad
885
+ );
886
+ },
887
+ Transfer(src, dst, wad) {
888
+ return templateContract.filters["Transfer(address,address,uint256)"](
889
+ src,
890
+ dst,
891
+ wad
892
+ );
893
+ },
894
+ Deposit(dst, wad) {
895
+ return templateContract.filters["Deposit(address,uint256)"](dst, wad);
896
+ },
897
+ Withdrawal(src, wad) {
898
+ return templateContract.filters["Withdrawal(address,uint256)"](src, wad);
899
+ }
900
+ });
901
+ var WETH9ProcessorTemplate = class extends BaseProcessorTemplate {
902
+ bindInternal(options) {
903
+ if (!options.name) {
904
+ options.name = "WETH9";
905
+ }
906
+ let processor = getProcessor(options);
907
+ if (!processor) {
908
+ processor = new WETH9Processor(options);
909
+ addProcessor(options, processor);
910
+ }
911
+ return processor;
912
+ }
913
+ onEventApproval(handler, filter, fetchConfig, preprocessHandler) {
914
+ if (!filter) {
915
+ filter = templateContract.filters["Approval(address,address,uint256)"](
916
+ null,
917
+ null,
918
+ null
919
+ );
920
+ }
921
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
922
+ }
923
+ onEventTransfer(handler, filter, fetchConfig, preprocessHandler) {
924
+ if (!filter) {
925
+ filter = templateContract.filters["Transfer(address,address,uint256)"](
926
+ null,
927
+ null,
928
+ null
929
+ );
930
+ }
931
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
932
+ }
933
+ onEventDeposit(handler, filter, fetchConfig, preprocessHandler) {
934
+ if (!filter) {
935
+ filter = templateContract.filters["Deposit(address,uint256)"](null, null);
936
+ }
937
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
938
+ }
939
+ onEventWithdrawal(handler, filter, fetchConfig, preprocessHandler) {
940
+ if (!filter) {
941
+ filter = templateContract.filters["Withdrawal(address,uint256)"](
942
+ null,
943
+ null
944
+ );
945
+ }
946
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
947
+ }
948
+ };
949
+ function getWETH9Contract(chainId, address) {
950
+ let contract = getContractByABI(
951
+ "WETH9",
952
+ address,
953
+ chainId
954
+ );
955
+ if (!contract) {
956
+ const rawContract = WETH9__factory.connect(address, getProvider(chainId));
957
+ contract = new WETH9ContractView(rawContract);
958
+ addContractByABI("WETH9", address, chainId, contract);
959
+ }
960
+ return contract;
961
+ }
962
+ function getWETH9ContractOnContext(context, address) {
963
+ const view = getWETH9Contract(context.getChainId(), address);
964
+ const boundView = new WETH9BoundContractView(address, view);
965
+ boundView.context = context;
966
+ if (boundView.callStatic) {
967
+ boundView.callStatic.context = context;
968
+ }
969
+ return boundView;
970
+ }
971
+
972
+ // src/eth/builtin/internal/weth9-test-utils.ts
973
+ var mockField = {
974
+ blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
975
+ blockNumber: 0,
976
+ logIndex: 0,
977
+ removed: false,
978
+ transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
979
+ transactionIndex: 0
980
+ };
981
+ function mockApprovalLog(contractAddress, event) {
982
+ const contract = getWETH9Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
983
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
984
+ "Approval(address,address,uint256)",
985
+ [event.src, event.guy, event.wad]
986
+ );
987
+ return {
988
+ ...mockField,
989
+ index: 0,
990
+ address: contractAddress,
991
+ data: encodedLog.data,
992
+ topics: encodedLog.topics
993
+ };
994
+ }
995
+ function mockTransferLog(contractAddress, event) {
996
+ const contract = getWETH9Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
997
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
998
+ "Transfer(address,address,uint256)",
999
+ [event.src, event.dst, event.wad]
1000
+ );
1001
+ return {
1002
+ ...mockField,
1003
+ index: 0,
1004
+ address: contractAddress,
1005
+ data: encodedLog.data,
1006
+ topics: encodedLog.topics
1007
+ };
1008
+ }
1009
+ function mockDepositLog(contractAddress, event) {
1010
+ const contract = getWETH9Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
1011
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
1012
+ "Deposit(address,uint256)",
1013
+ [event.dst, event.wad]
1014
+ );
1015
+ return {
1016
+ ...mockField,
1017
+ index: 0,
1018
+ address: contractAddress,
1019
+ data: encodedLog.data,
1020
+ topics: encodedLog.topics
1021
+ };
1022
+ }
1023
+ function mockWithdrawalLog(contractAddress, event) {
1024
+ const contract = getWETH9Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
1025
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
1026
+ "Withdrawal(address,uint256)",
1027
+ [event.src, event.wad]
1028
+ );
1029
+ return {
1030
+ ...mockField,
1031
+ index: 0,
1032
+ address: contractAddress,
1033
+ data: encodedLog.data,
1034
+ topics: encodedLog.topics
1035
+ };
1036
+ }
1037
+
1038
+ export {
1039
+ WETH9ContractView,
1040
+ WETH9BoundContractView,
1041
+ WETH9Processor,
1042
+ WETH9ProcessorTemplate,
1043
+ getWETH9Contract,
1044
+ getWETH9ContractOnContext,
1045
+ mockApprovalLog,
1046
+ mockTransferLog,
1047
+ mockDepositLog,
1048
+ mockWithdrawalLog,
1049
+ weth9_exports
1050
+ };