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