@gitmyabi/eusd 1.0.0 → 1.0.2

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