@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,861 @@
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
+ ERC20Bytes__factory,
9
+ Interface,
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/internal/erc20bytes-processor.ts
27
+ var templateContract = ERC20Bytes__factory.connect("0x0", DummyProvider);
28
+ var ERC20BytesContractView = class extends ContractView {
29
+ constructor(contract) {
30
+ super(contract);
31
+ this.callStatic.contract = contract;
32
+ }
33
+ async name(overrides, preparedData, ethCallContext) {
34
+ try {
35
+ if (preparedData?.ethCallResults && ethCallContext) {
36
+ const iface = new Interface(["function name() view returns (bytes32)"]);
37
+ const calldata = iface.encodeFunctionData("name", []);
38
+ const key = makeEthCallKey({
39
+ context: ethCallContext,
40
+ calldata
41
+ });
42
+ const ret = preparedData.ethCallResults[key];
43
+ if (ret) {
44
+ const result = iface.decodeFunctionResult("name", ret).toArray();
45
+ return result.length == 1 ? result[0] : result;
46
+ }
47
+ }
48
+ return await this.contract.getFunction("name()")(overrides || {});
49
+ } catch (e) {
50
+ const stack = new Error().stack;
51
+ throw transformEtherError(e, void 0, stack);
52
+ }
53
+ }
54
+ async totalSupply(overrides, preparedData, ethCallContext) {
55
+ try {
56
+ if (preparedData?.ethCallResults && ethCallContext) {
57
+ const iface = new Interface([
58
+ "function totalSupply() view returns (uint256)"
59
+ ]);
60
+ const calldata = iface.encodeFunctionData("totalSupply", []);
61
+ const key = makeEthCallKey({
62
+ context: ethCallContext,
63
+ calldata
64
+ });
65
+ const ret = preparedData.ethCallResults[key];
66
+ if (ret) {
67
+ const result = iface.decodeFunctionResult("totalSupply", ret).toArray();
68
+ return result.length == 1 ? result[0] : result;
69
+ }
70
+ }
71
+ return await this.contract.getFunction("totalSupply()")(overrides || {});
72
+ } catch (e) {
73
+ const stack = new Error().stack;
74
+ throw transformEtherError(e, void 0, stack);
75
+ }
76
+ }
77
+ async decimals(overrides, preparedData, ethCallContext) {
78
+ try {
79
+ if (preparedData?.ethCallResults && ethCallContext) {
80
+ const iface = new Interface([
81
+ "function decimals() view returns (uint8)"
82
+ ]);
83
+ const calldata = iface.encodeFunctionData("decimals", []);
84
+ const key = makeEthCallKey({
85
+ context: ethCallContext,
86
+ calldata
87
+ });
88
+ const ret = preparedData.ethCallResults[key];
89
+ if (ret) {
90
+ const result = iface.decodeFunctionResult("decimals", ret).toArray();
91
+ return result.length == 1 ? result[0] : result;
92
+ }
93
+ }
94
+ return await this.contract.getFunction("decimals()")(overrides || {});
95
+ } catch (e) {
96
+ const stack = new Error().stack;
97
+ throw transformEtherError(e, void 0, stack);
98
+ }
99
+ }
100
+ async balanceOf(who, overrides, preparedData, ethCallContext) {
101
+ try {
102
+ if (preparedData?.ethCallResults && ethCallContext) {
103
+ const iface = new Interface([
104
+ "function balanceOf(address) view returns (uint256)"
105
+ ]);
106
+ const calldata = iface.encodeFunctionData("balanceOf", [who]);
107
+ const key = makeEthCallKey({
108
+ context: ethCallContext,
109
+ calldata
110
+ });
111
+ const ret = preparedData.ethCallResults[key];
112
+ if (ret) {
113
+ const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
114
+ return result.length == 1 ? result[0] : result;
115
+ }
116
+ }
117
+ return await this.contract.getFunction("balanceOf(address)")(
118
+ who,
119
+ overrides || {}
120
+ );
121
+ } catch (e) {
122
+ const stack = new Error().stack;
123
+ throw transformEtherError(e, void 0, stack);
124
+ }
125
+ }
126
+ async symbol(overrides, preparedData, ethCallContext) {
127
+ try {
128
+ if (preparedData?.ethCallResults && ethCallContext) {
129
+ const iface = new Interface([
130
+ "function symbol() view returns (bytes32)"
131
+ ]);
132
+ const calldata = iface.encodeFunctionData("symbol", []);
133
+ const key = makeEthCallKey({
134
+ context: ethCallContext,
135
+ calldata
136
+ });
137
+ const ret = preparedData.ethCallResults[key];
138
+ if (ret) {
139
+ const result = iface.decodeFunctionResult("symbol", ret).toArray();
140
+ return result.length == 1 ? result[0] : result;
141
+ }
142
+ }
143
+ return await this.contract.getFunction("symbol()")(overrides || {});
144
+ } catch (e) {
145
+ const stack = new Error().stack;
146
+ throw transformEtherError(e, void 0, stack);
147
+ }
148
+ }
149
+ async allowance(owner, spender, overrides, preparedData, ethCallContext) {
150
+ try {
151
+ if (preparedData?.ethCallResults && ethCallContext) {
152
+ const iface = new Interface([
153
+ "function allowance(address,address) view returns (uint256)"
154
+ ]);
155
+ const calldata = iface.encodeFunctionData("allowance", [
156
+ owner,
157
+ spender
158
+ ]);
159
+ const key = makeEthCallKey({
160
+ context: ethCallContext,
161
+ calldata
162
+ });
163
+ const ret = preparedData.ethCallResults[key];
164
+ if (ret) {
165
+ const result = iface.decodeFunctionResult("allowance", ret).toArray();
166
+ return result.length == 1 ? result[0] : result;
167
+ }
168
+ }
169
+ return await this.contract.getFunction("allowance(address,address)")(
170
+ owner,
171
+ spender,
172
+ overrides || {}
173
+ );
174
+ } catch (e) {
175
+ const stack = new Error().stack;
176
+ throw transformEtherError(e, void 0, stack);
177
+ }
178
+ }
179
+ callStatic = {
180
+ contract: this.contract,
181
+ async approve(spender, value, overrides, preparedData, ethCallContext) {
182
+ try {
183
+ if (preparedData?.ethCallResults && ethCallContext) {
184
+ const iface = new Interface([
185
+ "function approve(address,uint256) nonpayable returns (bool)"
186
+ ]);
187
+ const calldata = iface.encodeFunctionData("approve", [
188
+ spender,
189
+ value
190
+ ]);
191
+ const key = makeEthCallKey({
192
+ context: ethCallContext,
193
+ calldata
194
+ });
195
+ const ret = preparedData.ethCallResults[key];
196
+ if (ret) {
197
+ const result = iface.decodeFunctionResult("approve", ret).toArray();
198
+ return result.length == 1 ? result[0] : result;
199
+ }
200
+ }
201
+ return await this.contract.getFunction("approve(address,uint256)").staticCall(spender, value, overrides || {});
202
+ } catch (e) {
203
+ const stack = new Error().stack;
204
+ throw transformEtherError(e, void 0, stack);
205
+ }
206
+ },
207
+ async transferFrom(from, to, value, overrides, preparedData, ethCallContext) {
208
+ try {
209
+ if (preparedData?.ethCallResults && ethCallContext) {
210
+ const iface = new Interface([
211
+ "function transferFrom(address,address,uint256) nonpayable returns (bool)"
212
+ ]);
213
+ const calldata = iface.encodeFunctionData("transferFrom", [
214
+ from,
215
+ to,
216
+ value
217
+ ]);
218
+ const key = makeEthCallKey({
219
+ context: ethCallContext,
220
+ calldata
221
+ });
222
+ const ret = preparedData.ethCallResults[key];
223
+ if (ret) {
224
+ const result = iface.decodeFunctionResult("transferFrom", ret).toArray();
225
+ return result.length == 1 ? result[0] : result;
226
+ }
227
+ }
228
+ return await this.contract.getFunction("transferFrom(address,address,uint256)").staticCall(from, to, value, overrides || {});
229
+ } catch (e) {
230
+ const stack = new Error().stack;
231
+ throw transformEtherError(e, void 0, stack);
232
+ }
233
+ },
234
+ async transfer(to, value, overrides, preparedData, ethCallContext) {
235
+ try {
236
+ if (preparedData?.ethCallResults && ethCallContext) {
237
+ const iface = new Interface([
238
+ "function transfer(address,uint256) nonpayable returns (bool)"
239
+ ]);
240
+ const calldata = iface.encodeFunctionData("transfer", [to, value]);
241
+ const key = makeEthCallKey({
242
+ context: ethCallContext,
243
+ calldata
244
+ });
245
+ const ret = preparedData.ethCallResults[key];
246
+ if (ret) {
247
+ const result = iface.decodeFunctionResult("transfer", ret).toArray();
248
+ return result.length == 1 ? result[0] : result;
249
+ }
250
+ }
251
+ return await this.contract.getFunction("transfer(address,uint256)").staticCall(to, value, overrides || {});
252
+ } catch (e) {
253
+ const stack = new Error().stack;
254
+ throw transformEtherError(e, void 0, stack);
255
+ }
256
+ }
257
+ };
258
+ encodeCall = {
259
+ name(ethCallContext) {
260
+ try {
261
+ const iface = new Interface(["function name()"]);
262
+ const calldata = iface.encodeFunctionData("name", []);
263
+ return {
264
+ context: ethCallContext,
265
+ calldata
266
+ };
267
+ } catch (e) {
268
+ const stack = new Error().stack;
269
+ throw transformEtherError(e, void 0, stack);
270
+ }
271
+ },
272
+ approve(spender, value, ethCallContext) {
273
+ try {
274
+ const iface = new Interface(["function approve(address,uint256)"]);
275
+ const calldata = iface.encodeFunctionData("approve", [spender, value]);
276
+ return {
277
+ context: ethCallContext,
278
+ calldata
279
+ };
280
+ } catch (e) {
281
+ const stack = new Error().stack;
282
+ throw transformEtherError(e, void 0, stack);
283
+ }
284
+ },
285
+ totalSupply(ethCallContext) {
286
+ try {
287
+ const iface = new Interface(["function totalSupply()"]);
288
+ const calldata = iface.encodeFunctionData("totalSupply", []);
289
+ return {
290
+ context: ethCallContext,
291
+ calldata
292
+ };
293
+ } catch (e) {
294
+ const stack = new Error().stack;
295
+ throw transformEtherError(e, void 0, stack);
296
+ }
297
+ },
298
+ transferFrom(from, to, value, ethCallContext) {
299
+ try {
300
+ const iface = new Interface([
301
+ "function transferFrom(address,address,uint256)"
302
+ ]);
303
+ const calldata = iface.encodeFunctionData("transferFrom", [
304
+ from,
305
+ to,
306
+ value
307
+ ]);
308
+ return {
309
+ context: ethCallContext,
310
+ calldata
311
+ };
312
+ } catch (e) {
313
+ const stack = new Error().stack;
314
+ throw transformEtherError(e, void 0, stack);
315
+ }
316
+ },
317
+ decimals(ethCallContext) {
318
+ try {
319
+ const iface = new Interface(["function decimals()"]);
320
+ const calldata = iface.encodeFunctionData("decimals", []);
321
+ return {
322
+ context: ethCallContext,
323
+ calldata
324
+ };
325
+ } catch (e) {
326
+ const stack = new Error().stack;
327
+ throw transformEtherError(e, void 0, stack);
328
+ }
329
+ },
330
+ balanceOf(who, ethCallContext) {
331
+ try {
332
+ const iface = new Interface(["function balanceOf(address)"]);
333
+ const calldata = iface.encodeFunctionData("balanceOf", [who]);
334
+ return {
335
+ context: ethCallContext,
336
+ calldata
337
+ };
338
+ } catch (e) {
339
+ const stack = new Error().stack;
340
+ throw transformEtherError(e, void 0, stack);
341
+ }
342
+ },
343
+ symbol(ethCallContext) {
344
+ try {
345
+ const iface = new Interface(["function symbol()"]);
346
+ const calldata = iface.encodeFunctionData("symbol", []);
347
+ return {
348
+ context: ethCallContext,
349
+ calldata
350
+ };
351
+ } catch (e) {
352
+ const stack = new Error().stack;
353
+ throw transformEtherError(e, void 0, stack);
354
+ }
355
+ },
356
+ transfer(to, value, ethCallContext) {
357
+ try {
358
+ const iface = new Interface(["function transfer(address,uint256)"]);
359
+ const calldata = iface.encodeFunctionData("transfer", [to, value]);
360
+ return {
361
+ context: ethCallContext,
362
+ calldata
363
+ };
364
+ } catch (e) {
365
+ const stack = new Error().stack;
366
+ throw transformEtherError(e, void 0, stack);
367
+ }
368
+ },
369
+ allowance(owner, spender, ethCallContext) {
370
+ try {
371
+ const iface = new Interface(["function allowance(address,address)"]);
372
+ const calldata = iface.encodeFunctionData("allowance", [
373
+ owner,
374
+ spender
375
+ ]);
376
+ return {
377
+ context: ethCallContext,
378
+ calldata
379
+ };
380
+ } catch (e) {
381
+ const stack = new Error().stack;
382
+ throw transformEtherError(e, void 0, stack);
383
+ }
384
+ }
385
+ };
386
+ };
387
+ var ERC20BytesBoundContractView = class extends BoundContractView {
388
+ async name(overrides) {
389
+ const ethCallContext = {
390
+ chainId: this.context.chainId,
391
+ blockTag: this.context.blockNumber.toString(16),
392
+ address: this.context.address
393
+ };
394
+ return await this.view.name(
395
+ {
396
+ blockTag: this.context.blockNumber,
397
+ ...overrides
398
+ },
399
+ this.context.preparedData,
400
+ ethCallContext
401
+ );
402
+ }
403
+ async totalSupply(overrides) {
404
+ const ethCallContext = {
405
+ chainId: this.context.chainId,
406
+ blockTag: this.context.blockNumber.toString(16),
407
+ address: this.context.address
408
+ };
409
+ return await this.view.totalSupply(
410
+ {
411
+ blockTag: this.context.blockNumber,
412
+ ...overrides
413
+ },
414
+ this.context.preparedData,
415
+ ethCallContext
416
+ );
417
+ }
418
+ async decimals(overrides) {
419
+ const ethCallContext = {
420
+ chainId: this.context.chainId,
421
+ blockTag: this.context.blockNumber.toString(16),
422
+ address: this.context.address
423
+ };
424
+ return await this.view.decimals(
425
+ {
426
+ blockTag: this.context.blockNumber,
427
+ ...overrides
428
+ },
429
+ this.context.preparedData,
430
+ ethCallContext
431
+ );
432
+ }
433
+ async balanceOf(who, overrides) {
434
+ const ethCallContext = {
435
+ chainId: this.context.chainId,
436
+ blockTag: this.context.blockNumber.toString(16),
437
+ address: this.context.address
438
+ };
439
+ return await this.view.balanceOf(
440
+ who,
441
+ {
442
+ blockTag: this.context.blockNumber,
443
+ ...overrides
444
+ },
445
+ this.context.preparedData,
446
+ ethCallContext
447
+ );
448
+ }
449
+ async symbol(overrides) {
450
+ const ethCallContext = {
451
+ chainId: this.context.chainId,
452
+ blockTag: this.context.blockNumber.toString(16),
453
+ address: this.context.address
454
+ };
455
+ return await this.view.symbol(
456
+ {
457
+ blockTag: this.context.blockNumber,
458
+ ...overrides
459
+ },
460
+ this.context.preparedData,
461
+ ethCallContext
462
+ );
463
+ }
464
+ async allowance(owner, spender, overrides) {
465
+ const ethCallContext = {
466
+ chainId: this.context.chainId,
467
+ blockTag: this.context.blockNumber.toString(16),
468
+ address: this.context.address
469
+ };
470
+ return await this.view.allowance(
471
+ owner,
472
+ spender,
473
+ {
474
+ blockTag: this.context.blockNumber,
475
+ ...overrides
476
+ },
477
+ this.context.preparedData,
478
+ ethCallContext
479
+ );
480
+ }
481
+ callStatic = {
482
+ view: this.view,
483
+ context: this.context,
484
+ async approve(spender, value, overrides) {
485
+ const ethCallContext = {
486
+ chainId: this.context.chainId,
487
+ blockTag: this.context.blockNumber.toString(16),
488
+ address: this.context.address
489
+ };
490
+ return await this.view.callStatic.approve(
491
+ spender,
492
+ value,
493
+ {
494
+ blockTag: this.context.blockNumber,
495
+ ...overrides
496
+ },
497
+ this.context.preparedData,
498
+ ethCallContext
499
+ );
500
+ },
501
+ async transferFrom(from, to, value, overrides) {
502
+ const ethCallContext = {
503
+ chainId: this.context.chainId,
504
+ blockTag: this.context.blockNumber.toString(16),
505
+ address: this.context.address
506
+ };
507
+ return await this.view.callStatic.transferFrom(
508
+ from,
509
+ to,
510
+ value,
511
+ {
512
+ blockTag: this.context.blockNumber,
513
+ ...overrides
514
+ },
515
+ this.context.preparedData,
516
+ ethCallContext
517
+ );
518
+ },
519
+ async transfer(to, value, overrides) {
520
+ const ethCallContext = {
521
+ chainId: this.context.chainId,
522
+ blockTag: this.context.blockNumber.toString(16),
523
+ address: this.context.address
524
+ };
525
+ return await this.view.callStatic.transfer(
526
+ to,
527
+ value,
528
+ {
529
+ blockTag: this.context.blockNumber,
530
+ ...overrides
531
+ },
532
+ this.context.preparedData,
533
+ ethCallContext
534
+ );
535
+ }
536
+ };
537
+ encodeCall = {
538
+ view: this.view,
539
+ context: this.context,
540
+ name(overrides) {
541
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
542
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
543
+ const address = this.context.address;
544
+ return this.view.encodeCall.name({ chainId, address, blockTag });
545
+ },
546
+ approve(spender, value, overrides) {
547
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
548
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
549
+ const address = this.context.address;
550
+ return this.view.encodeCall.approve(spender, value, {
551
+ chainId,
552
+ address,
553
+ blockTag
554
+ });
555
+ },
556
+ totalSupply(overrides) {
557
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
558
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
559
+ const address = this.context.address;
560
+ return this.view.encodeCall.totalSupply({ chainId, address, blockTag });
561
+ },
562
+ transferFrom(from, to, value, overrides) {
563
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
564
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
565
+ const address = this.context.address;
566
+ return this.view.encodeCall.transferFrom(from, to, value, {
567
+ chainId,
568
+ address,
569
+ blockTag
570
+ });
571
+ },
572
+ decimals(overrides) {
573
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
574
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
575
+ const address = this.context.address;
576
+ return this.view.encodeCall.decimals({ chainId, address, blockTag });
577
+ },
578
+ balanceOf(who, overrides) {
579
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
580
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
581
+ const address = this.context.address;
582
+ return this.view.encodeCall.balanceOf(who, {
583
+ chainId,
584
+ address,
585
+ blockTag
586
+ });
587
+ },
588
+ symbol(overrides) {
589
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
590
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
591
+ const address = this.context.address;
592
+ return this.view.encodeCall.symbol({ chainId, address, blockTag });
593
+ },
594
+ transfer(to, value, overrides) {
595
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
596
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
597
+ const address = this.context.address;
598
+ return this.view.encodeCall.transfer(to, value, {
599
+ chainId,
600
+ address,
601
+ blockTag
602
+ });
603
+ },
604
+ allowance(owner, spender, overrides) {
605
+ const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
606
+ const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
607
+ const address = this.context.address;
608
+ return this.view.encodeCall.allowance(owner, spender, {
609
+ chainId,
610
+ address,
611
+ blockTag
612
+ });
613
+ }
614
+ };
615
+ };
616
+ var _ERC20BytesProcessor = class extends BaseProcessor {
617
+ onEventApproval(handler, filter, fetchConfig, preprocessHandler) {
618
+ if (!filter) {
619
+ filter = templateContract.filters["Approval(address,address,uint256)"](
620
+ null,
621
+ null,
622
+ null
623
+ );
624
+ }
625
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
626
+ }
627
+ onEventTransfer(handler, filter, fetchConfig, preprocessHandler) {
628
+ if (!filter) {
629
+ filter = templateContract.filters["Transfer(address,address,uint256)"](
630
+ null,
631
+ null,
632
+ null
633
+ );
634
+ }
635
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
636
+ }
637
+ onCallName(handler, fetchConfig, preprocessHandler) {
638
+ return super.onEthTrace(
639
+ "0x06fdde03",
640
+ handler,
641
+ fetchConfig,
642
+ preprocessHandler
643
+ );
644
+ }
645
+ onCallApprove(handler, fetchConfig, preprocessHandler) {
646
+ return super.onEthTrace(
647
+ "0x095ea7b3",
648
+ handler,
649
+ fetchConfig,
650
+ preprocessHandler
651
+ );
652
+ }
653
+ onCallTotalSupply(handler, fetchConfig, preprocessHandler) {
654
+ return super.onEthTrace(
655
+ "0x18160ddd",
656
+ handler,
657
+ fetchConfig,
658
+ preprocessHandler
659
+ );
660
+ }
661
+ onCallTransferFrom(handler, fetchConfig, preprocessHandler) {
662
+ return super.onEthTrace(
663
+ "0x23b872dd",
664
+ handler,
665
+ fetchConfig,
666
+ preprocessHandler
667
+ );
668
+ }
669
+ onCallDecimals(handler, fetchConfig, preprocessHandler) {
670
+ return super.onEthTrace(
671
+ "0x313ce567",
672
+ handler,
673
+ fetchConfig,
674
+ preprocessHandler
675
+ );
676
+ }
677
+ onCallBalanceOf(handler, fetchConfig, preprocessHandler) {
678
+ return super.onEthTrace(
679
+ "0x70a08231",
680
+ handler,
681
+ fetchConfig,
682
+ preprocessHandler
683
+ );
684
+ }
685
+ onCallSymbol(handler, fetchConfig, preprocessHandler) {
686
+ return super.onEthTrace(
687
+ "0x95d89b41",
688
+ handler,
689
+ fetchConfig,
690
+ preprocessHandler
691
+ );
692
+ }
693
+ onCallTransfer(handler, fetchConfig, preprocessHandler) {
694
+ return super.onEthTrace(
695
+ "0xa9059cbb",
696
+ handler,
697
+ fetchConfig,
698
+ preprocessHandler
699
+ );
700
+ }
701
+ onCallAllowance(handler, fetchConfig, preprocessHandler) {
702
+ return super.onEthTrace(
703
+ "0xdd62ed3e",
704
+ handler,
705
+ fetchConfig,
706
+ preprocessHandler
707
+ );
708
+ }
709
+ CreateBoundContractView() {
710
+ const view = getERC20BytesContract(
711
+ this.config.network,
712
+ this.config.address
713
+ );
714
+ return new ERC20BytesBoundContractView(this.config.address, view);
715
+ }
716
+ static bind(options) {
717
+ if (!options.name) {
718
+ options.name = "ERC20Bytes";
719
+ }
720
+ let processor = getProcessor(options);
721
+ if (!processor) {
722
+ processor = new _ERC20BytesProcessor(options);
723
+ addProcessor(options, processor);
724
+ }
725
+ return processor;
726
+ }
727
+ };
728
+ var ERC20BytesProcessor = _ERC20BytesProcessor;
729
+ __publicField(ERC20BytesProcessor, "filters", {
730
+ Approval(owner, spender, value) {
731
+ return templateContract.filters["Approval(address,address,uint256)"](
732
+ owner,
733
+ spender,
734
+ value
735
+ );
736
+ },
737
+ Transfer(from, to, value) {
738
+ return templateContract.filters["Transfer(address,address,uint256)"](
739
+ from,
740
+ to,
741
+ value
742
+ );
743
+ }
744
+ });
745
+ var ERC20BytesProcessorTemplate = class extends BaseProcessorTemplate {
746
+ bindInternal(options) {
747
+ if (!options.name) {
748
+ options.name = "ERC20Bytes";
749
+ }
750
+ let processor = getProcessor(options);
751
+ if (!processor) {
752
+ processor = new ERC20BytesProcessor(options);
753
+ addProcessor(options, processor);
754
+ }
755
+ return processor;
756
+ }
757
+ onEventApproval(handler, filter, fetchConfig, preprocessHandler) {
758
+ if (!filter) {
759
+ filter = templateContract.filters["Approval(address,address,uint256)"](
760
+ null,
761
+ null,
762
+ null
763
+ );
764
+ }
765
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
766
+ }
767
+ onEventTransfer(handler, filter, fetchConfig, preprocessHandler) {
768
+ if (!filter) {
769
+ filter = templateContract.filters["Transfer(address,address,uint256)"](
770
+ null,
771
+ null,
772
+ null
773
+ );
774
+ }
775
+ return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
776
+ }
777
+ };
778
+ function getERC20BytesContract(chainId, address) {
779
+ let contract = getContractByABI(
780
+ "ERC20Bytes",
781
+ address,
782
+ chainId
783
+ );
784
+ if (!contract) {
785
+ const rawContract = ERC20Bytes__factory.connect(
786
+ address,
787
+ getProvider(chainId)
788
+ );
789
+ contract = new ERC20BytesContractView(rawContract);
790
+ addContractByABI("ERC20Bytes", address, chainId, contract);
791
+ }
792
+ return contract;
793
+ }
794
+ function getERC20BytesContractOnContext(context, address) {
795
+ const view = getERC20BytesContract(context.getChainId(), address);
796
+ const boundView = new ERC20BytesBoundContractView(address, view);
797
+ boundView.context = context;
798
+ if (boundView.callStatic) {
799
+ boundView.callStatic.context = context;
800
+ }
801
+ return boundView;
802
+ }
803
+
804
+ // src/eth/builtin/erc20bytes.ts
805
+ var erc20bytes_exports = {};
806
+ __export(erc20bytes_exports, {
807
+ ERC20BytesBoundContractView: () => ERC20BytesBoundContractView,
808
+ ERC20BytesContractView: () => ERC20BytesContractView,
809
+ ERC20BytesProcessor: () => ERC20BytesProcessor,
810
+ ERC20BytesProcessorTemplate: () => ERC20BytesProcessorTemplate,
811
+ ERC20Bytes__factory: () => ERC20Bytes__factory,
812
+ getERC20BytesContract: () => getERC20BytesContract,
813
+ getERC20BytesContractOnContext: () => getERC20BytesContractOnContext,
814
+ mockApprovalLog: () => mockApprovalLog,
815
+ mockTransferLog: () => mockTransferLog
816
+ });
817
+
818
+ // src/eth/builtin/internal/erc20bytes-test-utils.ts
819
+ var mockField = {
820
+ blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
821
+ blockNumber: 0,
822
+ logIndex: 0,
823
+ removed: false,
824
+ transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
825
+ transactionIndex: 0
826
+ };
827
+ function mockApprovalLog(contractAddress, event) {
828
+ const contract = getERC20BytesContract(import_chain.EthChainId.ETHEREUM, contractAddress);
829
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
830
+ "Approval(address,address,uint256)",
831
+ [event.owner, event.spender, event.value]
832
+ );
833
+ return {
834
+ ...mockField,
835
+ index: 0,
836
+ address: contractAddress,
837
+ data: encodedLog.data,
838
+ topics: encodedLog.topics
839
+ };
840
+ }
841
+ function mockTransferLog(contractAddress, event) {
842
+ const contract = getERC20BytesContract(import_chain.EthChainId.ETHEREUM, contractAddress);
843
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
844
+ "Transfer(address,address,uint256)",
845
+ [event.from, event.to, event.value]
846
+ );
847
+ return {
848
+ ...mockField,
849
+ index: 0,
850
+ address: contractAddress,
851
+ data: encodedLog.data,
852
+ topics: encodedLog.topics
853
+ };
854
+ }
855
+
856
+ export {
857
+ ERC20BytesProcessor,
858
+ ERC20BytesProcessorTemplate,
859
+ getERC20BytesContract,
860
+ erc20bytes_exports
861
+ };