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