@gitmyabi-stg/wif 0.0.1

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.
@@ -0,0 +1,974 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERC20Token = exports.ERC20TokenAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * ERC20Token ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.ERC20TokenAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "string",
15
+ "name": "initialName",
16
+ "type": "string"
17
+ },
18
+ {
19
+ "internalType": "string",
20
+ "name": "initialSymbol",
21
+ "type": "string"
22
+ },
23
+ {
24
+ "internalType": "uint256",
25
+ "name": "initSupply",
26
+ "type": "uint256"
27
+ },
28
+ {
29
+ "internalType": "uint8",
30
+ "name": "initialDecimals",
31
+ "type": "uint8"
32
+ }
33
+ ],
34
+ "stateMutability": "nonpayable",
35
+ "type": "constructor"
36
+ },
37
+ {
38
+ "inputs": [
39
+ {
40
+ "internalType": "address",
41
+ "name": "spender",
42
+ "type": "address"
43
+ },
44
+ {
45
+ "internalType": "uint256",
46
+ "name": "allowance",
47
+ "type": "uint256"
48
+ },
49
+ {
50
+ "internalType": "uint256",
51
+ "name": "needed",
52
+ "type": "uint256"
53
+ }
54
+ ],
55
+ "name": "ERC20InsufficientAllowance",
56
+ "type": "error"
57
+ },
58
+ {
59
+ "inputs": [
60
+ {
61
+ "internalType": "address",
62
+ "name": "sender",
63
+ "type": "address"
64
+ },
65
+ {
66
+ "internalType": "uint256",
67
+ "name": "balance",
68
+ "type": "uint256"
69
+ },
70
+ {
71
+ "internalType": "uint256",
72
+ "name": "needed",
73
+ "type": "uint256"
74
+ }
75
+ ],
76
+ "name": "ERC20InsufficientBalance",
77
+ "type": "error"
78
+ },
79
+ {
80
+ "inputs": [
81
+ {
82
+ "internalType": "address",
83
+ "name": "approver",
84
+ "type": "address"
85
+ }
86
+ ],
87
+ "name": "ERC20InvalidApprover",
88
+ "type": "error"
89
+ },
90
+ {
91
+ "inputs": [
92
+ {
93
+ "internalType": "address",
94
+ "name": "receiver",
95
+ "type": "address"
96
+ }
97
+ ],
98
+ "name": "ERC20InvalidReceiver",
99
+ "type": "error"
100
+ },
101
+ {
102
+ "inputs": [
103
+ {
104
+ "internalType": "address",
105
+ "name": "sender",
106
+ "type": "address"
107
+ }
108
+ ],
109
+ "name": "ERC20InvalidSender",
110
+ "type": "error"
111
+ },
112
+ {
113
+ "inputs": [
114
+ {
115
+ "internalType": "address",
116
+ "name": "spender",
117
+ "type": "address"
118
+ }
119
+ ],
120
+ "name": "ERC20InvalidSpender",
121
+ "type": "error"
122
+ },
123
+ {
124
+ "inputs": [
125
+ {
126
+ "internalType": "address",
127
+ "name": "owner",
128
+ "type": "address"
129
+ }
130
+ ],
131
+ "name": "OwnableInvalidOwner",
132
+ "type": "error"
133
+ },
134
+ {
135
+ "inputs": [
136
+ {
137
+ "internalType": "address",
138
+ "name": "account",
139
+ "type": "address"
140
+ }
141
+ ],
142
+ "name": "OwnableUnauthorizedAccount",
143
+ "type": "error"
144
+ },
145
+ {
146
+ "anonymous": false,
147
+ "inputs": [
148
+ {
149
+ "indexed": true,
150
+ "internalType": "address",
151
+ "name": "owner",
152
+ "type": "address"
153
+ },
154
+ {
155
+ "indexed": true,
156
+ "internalType": "address",
157
+ "name": "spender",
158
+ "type": "address"
159
+ },
160
+ {
161
+ "indexed": false,
162
+ "internalType": "uint256",
163
+ "name": "value",
164
+ "type": "uint256"
165
+ }
166
+ ],
167
+ "name": "Approval",
168
+ "type": "event"
169
+ },
170
+ {
171
+ "anonymous": false,
172
+ "inputs": [
173
+ {
174
+ "indexed": true,
175
+ "internalType": "address",
176
+ "name": "previousOwner",
177
+ "type": "address"
178
+ },
179
+ {
180
+ "indexed": true,
181
+ "internalType": "address",
182
+ "name": "newOwner",
183
+ "type": "address"
184
+ }
185
+ ],
186
+ "name": "OwnershipTransferred",
187
+ "type": "event"
188
+ },
189
+ {
190
+ "anonymous": false,
191
+ "inputs": [
192
+ {
193
+ "indexed": false,
194
+ "internalType": "uint8",
195
+ "name": "precision",
196
+ "type": "uint8"
197
+ }
198
+ ],
199
+ "name": "SetDecimals",
200
+ "type": "event"
201
+ },
202
+ {
203
+ "anonymous": false,
204
+ "inputs": [
205
+ {
206
+ "indexed": false,
207
+ "internalType": "string",
208
+ "name": "name",
209
+ "type": "string"
210
+ }
211
+ ],
212
+ "name": "SetName",
213
+ "type": "event"
214
+ },
215
+ {
216
+ "anonymous": false,
217
+ "inputs": [
218
+ {
219
+ "indexed": false,
220
+ "internalType": "string",
221
+ "name": "symbol",
222
+ "type": "string"
223
+ }
224
+ ],
225
+ "name": "SetSymbol",
226
+ "type": "event"
227
+ },
228
+ {
229
+ "anonymous": false,
230
+ "inputs": [
231
+ {
232
+ "indexed": true,
233
+ "internalType": "address",
234
+ "name": "from",
235
+ "type": "address"
236
+ },
237
+ {
238
+ "indexed": true,
239
+ "internalType": "address",
240
+ "name": "to",
241
+ "type": "address"
242
+ },
243
+ {
244
+ "indexed": false,
245
+ "internalType": "uint256",
246
+ "name": "value",
247
+ "type": "uint256"
248
+ }
249
+ ],
250
+ "name": "Transfer",
251
+ "type": "event"
252
+ },
253
+ {
254
+ "inputs": [
255
+ {
256
+ "internalType": "address",
257
+ "name": "owner",
258
+ "type": "address"
259
+ },
260
+ {
261
+ "internalType": "address",
262
+ "name": "spender",
263
+ "type": "address"
264
+ }
265
+ ],
266
+ "name": "allowance",
267
+ "outputs": [
268
+ {
269
+ "internalType": "uint256",
270
+ "name": "",
271
+ "type": "uint256"
272
+ }
273
+ ],
274
+ "stateMutability": "view",
275
+ "type": "function"
276
+ },
277
+ {
278
+ "inputs": [
279
+ {
280
+ "internalType": "address",
281
+ "name": "spender",
282
+ "type": "address"
283
+ },
284
+ {
285
+ "internalType": "uint256",
286
+ "name": "value",
287
+ "type": "uint256"
288
+ }
289
+ ],
290
+ "name": "approve",
291
+ "outputs": [
292
+ {
293
+ "internalType": "bool",
294
+ "name": "",
295
+ "type": "bool"
296
+ }
297
+ ],
298
+ "stateMutability": "nonpayable",
299
+ "type": "function"
300
+ },
301
+ {
302
+ "inputs": [
303
+ {
304
+ "internalType": "address",
305
+ "name": "account",
306
+ "type": "address"
307
+ }
308
+ ],
309
+ "name": "balanceOf",
310
+ "outputs": [
311
+ {
312
+ "internalType": "uint256",
313
+ "name": "",
314
+ "type": "uint256"
315
+ }
316
+ ],
317
+ "stateMutability": "view",
318
+ "type": "function"
319
+ },
320
+ {
321
+ "inputs": [
322
+ {
323
+ "internalType": "address",
324
+ "name": "account",
325
+ "type": "address"
326
+ },
327
+ {
328
+ "internalType": "uint256",
329
+ "name": "amount",
330
+ "type": "uint256"
331
+ }
332
+ ],
333
+ "name": "burn",
334
+ "outputs": [],
335
+ "stateMutability": "nonpayable",
336
+ "type": "function"
337
+ },
338
+ {
339
+ "inputs": [],
340
+ "name": "decimals",
341
+ "outputs": [
342
+ {
343
+ "internalType": "uint8",
344
+ "name": "",
345
+ "type": "uint8"
346
+ }
347
+ ],
348
+ "stateMutability": "view",
349
+ "type": "function"
350
+ },
351
+ {
352
+ "inputs": [
353
+ {
354
+ "internalType": "address",
355
+ "name": "account",
356
+ "type": "address"
357
+ },
358
+ {
359
+ "internalType": "uint256",
360
+ "name": "amount",
361
+ "type": "uint256"
362
+ }
363
+ ],
364
+ "name": "mint",
365
+ "outputs": [],
366
+ "stateMutability": "nonpayable",
367
+ "type": "function"
368
+ },
369
+ {
370
+ "inputs": [],
371
+ "name": "name",
372
+ "outputs": [
373
+ {
374
+ "internalType": "string",
375
+ "name": "",
376
+ "type": "string"
377
+ }
378
+ ],
379
+ "stateMutability": "view",
380
+ "type": "function"
381
+ },
382
+ {
383
+ "inputs": [],
384
+ "name": "owner",
385
+ "outputs": [
386
+ {
387
+ "internalType": "address",
388
+ "name": "",
389
+ "type": "address"
390
+ }
391
+ ],
392
+ "stateMutability": "view",
393
+ "type": "function"
394
+ },
395
+ {
396
+ "inputs": [],
397
+ "name": "renounceOwnership",
398
+ "outputs": [],
399
+ "stateMutability": "nonpayable",
400
+ "type": "function"
401
+ },
402
+ {
403
+ "inputs": [
404
+ {
405
+ "internalType": "uint8",
406
+ "name": "newDecimals",
407
+ "type": "uint8"
408
+ }
409
+ ],
410
+ "name": "setDecimals",
411
+ "outputs": [],
412
+ "stateMutability": "nonpayable",
413
+ "type": "function"
414
+ },
415
+ {
416
+ "inputs": [
417
+ {
418
+ "internalType": "string",
419
+ "name": "newName",
420
+ "type": "string"
421
+ }
422
+ ],
423
+ "name": "setName",
424
+ "outputs": [],
425
+ "stateMutability": "nonpayable",
426
+ "type": "function"
427
+ },
428
+ {
429
+ "inputs": [
430
+ {
431
+ "internalType": "string",
432
+ "name": "newSymbol",
433
+ "type": "string"
434
+ }
435
+ ],
436
+ "name": "setSymbol",
437
+ "outputs": [],
438
+ "stateMutability": "nonpayable",
439
+ "type": "function"
440
+ },
441
+ {
442
+ "inputs": [],
443
+ "name": "symbol",
444
+ "outputs": [
445
+ {
446
+ "internalType": "string",
447
+ "name": "",
448
+ "type": "string"
449
+ }
450
+ ],
451
+ "stateMutability": "view",
452
+ "type": "function"
453
+ },
454
+ {
455
+ "inputs": [],
456
+ "name": "totalSupply",
457
+ "outputs": [
458
+ {
459
+ "internalType": "uint256",
460
+ "name": "",
461
+ "type": "uint256"
462
+ }
463
+ ],
464
+ "stateMutability": "view",
465
+ "type": "function"
466
+ },
467
+ {
468
+ "inputs": [
469
+ {
470
+ "internalType": "address",
471
+ "name": "to",
472
+ "type": "address"
473
+ },
474
+ {
475
+ "internalType": "uint256",
476
+ "name": "value",
477
+ "type": "uint256"
478
+ }
479
+ ],
480
+ "name": "transfer",
481
+ "outputs": [
482
+ {
483
+ "internalType": "bool",
484
+ "name": "",
485
+ "type": "bool"
486
+ }
487
+ ],
488
+ "stateMutability": "nonpayable",
489
+ "type": "function"
490
+ },
491
+ {
492
+ "inputs": [
493
+ {
494
+ "internalType": "address",
495
+ "name": "from",
496
+ "type": "address"
497
+ },
498
+ {
499
+ "internalType": "address",
500
+ "name": "to",
501
+ "type": "address"
502
+ },
503
+ {
504
+ "internalType": "uint256",
505
+ "name": "value",
506
+ "type": "uint256"
507
+ }
508
+ ],
509
+ "name": "transferFrom",
510
+ "outputs": [
511
+ {
512
+ "internalType": "bool",
513
+ "name": "",
514
+ "type": "bool"
515
+ }
516
+ ],
517
+ "stateMutability": "nonpayable",
518
+ "type": "function"
519
+ },
520
+ {
521
+ "inputs": [
522
+ {
523
+ "internalType": "address",
524
+ "name": "newOwner",
525
+ "type": "address"
526
+ }
527
+ ],
528
+ "name": "transferOwnership",
529
+ "outputs": [],
530
+ "stateMutability": "nonpayable",
531
+ "type": "function"
532
+ }
533
+ ];
534
+ /**
535
+ * ERC20Token Contract Class
536
+ *
537
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
538
+ *
539
+ * @example
540
+ * ```typescript
541
+ * import { createPublicClient, createWalletClient, http } from 'viem';
542
+ * import { mainnet } from 'viem/chains';
543
+ * import { ERC20Token } from 'ERC20Token';
544
+ *
545
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
546
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
547
+ *
548
+ * const contract = new ERC20Token('0x...', { publicClient, walletClient });
549
+ *
550
+ * // Read functions
551
+ * const result = await contract.balanceOf('0x...');
552
+ *
553
+ * // Write functions
554
+ * const hash = await contract.transfer('0x...', 1000n);
555
+ *
556
+ * // Simulate transactions (dry-run)
557
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
558
+ * console.log('Gas estimate:', simulation.request.gas);
559
+ *
560
+ * // Watch events
561
+ * const unwatch = contract.watch.Transfer((event) => {
562
+ * console.log('Transfer event:', event);
563
+ * });
564
+ * ```
565
+ */
566
+ class ERC20Token {
567
+ constructor(address, clients) {
568
+ this.contractAddress = address;
569
+ this.publicClient = clients.publicClient;
570
+ this.contract = (0, viem_1.getContract)({
571
+ address,
572
+ abi: exports.ERC20TokenAbi,
573
+ client: {
574
+ public: clients.publicClient,
575
+ wallet: clients.walletClient,
576
+ },
577
+ });
578
+ }
579
+ /**
580
+ * Get the contract address
581
+ */
582
+ get address() {
583
+ return this.contractAddress;
584
+ }
585
+ /**
586
+ * Get the underlying viem contract instance.
587
+ */
588
+ getContract() {
589
+ return this.contract;
590
+ }
591
+ /**
592
+ * allowance
593
+ * view
594
+ */
595
+ async allowance(owner, spender) {
596
+ return this.contract.read.allowance([owner, spender]);
597
+ }
598
+ /**
599
+ * balanceOf
600
+ * view
601
+ */
602
+ async balanceOf(account) {
603
+ return this.contract.read.balanceOf([account]);
604
+ }
605
+ /**
606
+ * decimals
607
+ * view
608
+ */
609
+ async decimals() {
610
+ return this.contract.read.decimals();
611
+ }
612
+ /**
613
+ * name
614
+ * view
615
+ */
616
+ async name() {
617
+ return this.contract.read.name();
618
+ }
619
+ /**
620
+ * owner
621
+ * view
622
+ */
623
+ async owner() {
624
+ return this.contract.read.owner();
625
+ }
626
+ /**
627
+ * symbol
628
+ * view
629
+ */
630
+ async symbol() {
631
+ return this.contract.read.symbol();
632
+ }
633
+ /**
634
+ * totalSupply
635
+ * view
636
+ */
637
+ async totalSupply() {
638
+ return this.contract.read.totalSupply();
639
+ }
640
+ /**
641
+ * approve
642
+ * nonpayable
643
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
644
+ */
645
+ async approve(spender, value, options) {
646
+ if (!this.contract.write) {
647
+ throw new Error('Wallet client is required for write operations');
648
+ }
649
+ return this.contract.write.approve([spender, value], options);
650
+ }
651
+ /**
652
+ * burn
653
+ * nonpayable
654
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
655
+ */
656
+ async burn(account, amount, options) {
657
+ if (!this.contract.write) {
658
+ throw new Error('Wallet client is required for write operations');
659
+ }
660
+ return this.contract.write.burn([account, amount], options);
661
+ }
662
+ /**
663
+ * mint
664
+ * nonpayable
665
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
666
+ */
667
+ async mint(account, amount, options) {
668
+ if (!this.contract.write) {
669
+ throw new Error('Wallet client is required for write operations');
670
+ }
671
+ return this.contract.write.mint([account, amount], options);
672
+ }
673
+ /**
674
+ * renounceOwnership
675
+ * nonpayable
676
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
677
+ */
678
+ async renounceOwnership(options) {
679
+ if (!this.contract.write) {
680
+ throw new Error('Wallet client is required for write operations');
681
+ }
682
+ return this.contract.write.renounceOwnership(options);
683
+ }
684
+ /**
685
+ * setDecimals
686
+ * nonpayable
687
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
688
+ */
689
+ async setDecimals(newDecimals, options) {
690
+ if (!this.contract.write) {
691
+ throw new Error('Wallet client is required for write operations');
692
+ }
693
+ return this.contract.write.setDecimals([newDecimals], options);
694
+ }
695
+ /**
696
+ * setName
697
+ * nonpayable
698
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
699
+ */
700
+ async setName(newName, options) {
701
+ if (!this.contract.write) {
702
+ throw new Error('Wallet client is required for write operations');
703
+ }
704
+ return this.contract.write.setName([newName], options);
705
+ }
706
+ /**
707
+ * setSymbol
708
+ * nonpayable
709
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
710
+ */
711
+ async setSymbol(newSymbol, options) {
712
+ if (!this.contract.write) {
713
+ throw new Error('Wallet client is required for write operations');
714
+ }
715
+ return this.contract.write.setSymbol([newSymbol], options);
716
+ }
717
+ /**
718
+ * transfer
719
+ * nonpayable
720
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
721
+ */
722
+ async transfer(to, value, options) {
723
+ if (!this.contract.write) {
724
+ throw new Error('Wallet client is required for write operations');
725
+ }
726
+ return this.contract.write.transfer([to, value], options);
727
+ }
728
+ /**
729
+ * transferFrom
730
+ * nonpayable
731
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
732
+ */
733
+ async transferFrom(from, to, value, options) {
734
+ if (!this.contract.write) {
735
+ throw new Error('Wallet client is required for write operations');
736
+ }
737
+ return this.contract.write.transferFrom([from, to, value], options);
738
+ }
739
+ /**
740
+ * transferOwnership
741
+ * nonpayable
742
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
743
+ */
744
+ async transferOwnership(newOwner, options) {
745
+ if (!this.contract.write) {
746
+ throw new Error('Wallet client is required for write operations');
747
+ }
748
+ return this.contract.write.transferOwnership([newOwner], options);
749
+ }
750
+ /**
751
+ * Simulate contract write operations (dry-run without sending transaction)
752
+ *
753
+ * @example
754
+ * const result = await contract.simulate.transfer('0x...', 1000n);
755
+ * console.log('Gas estimate:', result.request.gas);
756
+ * console.log('Would succeed:', result.result);
757
+ */
758
+ get simulate() {
759
+ const contract = this.contract;
760
+ if (!contract.simulate) {
761
+ throw new Error('Public client is required for simulation');
762
+ }
763
+ return {
764
+ /**
765
+ * Simulate approve
766
+ * Returns gas estimate and result without sending transaction
767
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
768
+ */
769
+ async approve(spender, value, options) {
770
+ return contract.simulate.approve([spender, value], options);
771
+ },
772
+ /**
773
+ * Simulate burn
774
+ * Returns gas estimate and result without sending transaction
775
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
776
+ */
777
+ async burn(account, amount, options) {
778
+ return contract.simulate.burn([account, amount], options);
779
+ },
780
+ /**
781
+ * Simulate mint
782
+ * Returns gas estimate and result without sending transaction
783
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
784
+ */
785
+ async mint(account, amount, options) {
786
+ return contract.simulate.mint([account, amount], options);
787
+ },
788
+ /**
789
+ * Simulate renounceOwnership
790
+ * Returns gas estimate and result without sending transaction
791
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
792
+ */
793
+ async renounceOwnership(options) {
794
+ return contract.simulate.renounceOwnership(options);
795
+ },
796
+ /**
797
+ * Simulate setDecimals
798
+ * Returns gas estimate and result without sending transaction
799
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
800
+ */
801
+ async setDecimals(newDecimals, options) {
802
+ return contract.simulate.setDecimals([newDecimals], options);
803
+ },
804
+ /**
805
+ * Simulate setName
806
+ * Returns gas estimate and result without sending transaction
807
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
808
+ */
809
+ async setName(newName, options) {
810
+ return contract.simulate.setName([newName], options);
811
+ },
812
+ /**
813
+ * Simulate setSymbol
814
+ * Returns gas estimate and result without sending transaction
815
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
816
+ */
817
+ async setSymbol(newSymbol, options) {
818
+ return contract.simulate.setSymbol([newSymbol], options);
819
+ },
820
+ /**
821
+ * Simulate transfer
822
+ * Returns gas estimate and result without sending transaction
823
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
824
+ */
825
+ async transfer(to, value, options) {
826
+ return contract.simulate.transfer([to, value], options);
827
+ },
828
+ /**
829
+ * Simulate transferFrom
830
+ * Returns gas estimate and result without sending transaction
831
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
832
+ */
833
+ async transferFrom(from, to, value, options) {
834
+ return contract.simulate.transferFrom([from, to, value], options);
835
+ },
836
+ /**
837
+ * Simulate transferOwnership
838
+ * Returns gas estimate and result without sending transaction
839
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
840
+ */
841
+ async transferOwnership(newOwner, options) {
842
+ return contract.simulate.transferOwnership([newOwner], options);
843
+ }
844
+ };
845
+ }
846
+ /**
847
+ * Watch contract events
848
+ *
849
+ * @example
850
+ * // Watch all Transfer events
851
+ * const unwatch = contract.watch.Transfer((event) => {
852
+ * console.log('Transfer:', event);
853
+ * });
854
+ *
855
+ * // Stop watching
856
+ * unwatch();
857
+ */
858
+ get watch() {
859
+ return {
860
+ /**
861
+ * Watch Approval events
862
+ * @param callback Function to call when event is emitted
863
+ * @param filter Optional filter for indexed parameters
864
+ * @returns Unwatch function to stop listening
865
+ */
866
+ Approval: (callback, filter) => {
867
+ return this.publicClient.watchContractEvent({
868
+ address: this.contractAddress,
869
+ abi: exports.ERC20TokenAbi,
870
+ eventName: 'Approval',
871
+ args: filter,
872
+ onLogs: (logs) => {
873
+ logs.forEach((log) => {
874
+ callback(log.args);
875
+ });
876
+ },
877
+ });
878
+ },
879
+ /**
880
+ * Watch OwnershipTransferred events
881
+ * @param callback Function to call when event is emitted
882
+ * @param filter Optional filter for indexed parameters
883
+ * @returns Unwatch function to stop listening
884
+ */
885
+ OwnershipTransferred: (callback, filter) => {
886
+ return this.publicClient.watchContractEvent({
887
+ address: this.contractAddress,
888
+ abi: exports.ERC20TokenAbi,
889
+ eventName: 'OwnershipTransferred',
890
+ args: filter,
891
+ onLogs: (logs) => {
892
+ logs.forEach((log) => {
893
+ callback(log.args);
894
+ });
895
+ },
896
+ });
897
+ },
898
+ /**
899
+ * Watch SetDecimals events
900
+ * @param callback Function to call when event is emitted
901
+ * @param filter Optional filter for indexed parameters
902
+ * @returns Unwatch function to stop listening
903
+ */
904
+ SetDecimals: (callback) => {
905
+ return this.publicClient.watchContractEvent({
906
+ address: this.contractAddress,
907
+ abi: exports.ERC20TokenAbi,
908
+ eventName: 'SetDecimals',
909
+ onLogs: (logs) => {
910
+ logs.forEach((log) => {
911
+ callback(log.args);
912
+ });
913
+ },
914
+ });
915
+ },
916
+ /**
917
+ * Watch SetName events
918
+ * @param callback Function to call when event is emitted
919
+ * @param filter Optional filter for indexed parameters
920
+ * @returns Unwatch function to stop listening
921
+ */
922
+ SetName: (callback) => {
923
+ return this.publicClient.watchContractEvent({
924
+ address: this.contractAddress,
925
+ abi: exports.ERC20TokenAbi,
926
+ eventName: 'SetName',
927
+ onLogs: (logs) => {
928
+ logs.forEach((log) => {
929
+ callback(log.args);
930
+ });
931
+ },
932
+ });
933
+ },
934
+ /**
935
+ * Watch SetSymbol events
936
+ * @param callback Function to call when event is emitted
937
+ * @param filter Optional filter for indexed parameters
938
+ * @returns Unwatch function to stop listening
939
+ */
940
+ SetSymbol: (callback) => {
941
+ return this.publicClient.watchContractEvent({
942
+ address: this.contractAddress,
943
+ abi: exports.ERC20TokenAbi,
944
+ eventName: 'SetSymbol',
945
+ onLogs: (logs) => {
946
+ logs.forEach((log) => {
947
+ callback(log.args);
948
+ });
949
+ },
950
+ });
951
+ },
952
+ /**
953
+ * Watch Transfer events
954
+ * @param callback Function to call when event is emitted
955
+ * @param filter Optional filter for indexed parameters
956
+ * @returns Unwatch function to stop listening
957
+ */
958
+ Transfer: (callback, filter) => {
959
+ return this.publicClient.watchContractEvent({
960
+ address: this.contractAddress,
961
+ abi: exports.ERC20TokenAbi,
962
+ eventName: 'Transfer',
963
+ args: filter,
964
+ onLogs: (logs) => {
965
+ logs.forEach((log) => {
966
+ callback(log.args);
967
+ });
968
+ },
969
+ });
970
+ }
971
+ };
972
+ }
973
+ }
974
+ exports.ERC20Token = ERC20Token;