@gitmyabi/obtc 1.0.0

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,1538 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * OToken_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const OToken_jsonAbi = [
10
+ {
11
+ "inputs": [
12
+ {
13
+ "internalType": "string",
14
+ "name": "name_",
15
+ "type": "string"
16
+ },
17
+ {
18
+ "internalType": "string",
19
+ "name": "symbol_",
20
+ "type": "string"
21
+ },
22
+ {
23
+ "internalType": "uint8",
24
+ "name": "decimal_",
25
+ "type": "uint8"
26
+ },
27
+ {
28
+ "internalType": "address",
29
+ "name": "admin",
30
+ "type": "address"
31
+ }
32
+ ],
33
+ "stateMutability": "nonpayable",
34
+ "type": "constructor"
35
+ },
36
+ {
37
+ "anonymous": false,
38
+ "inputs": [
39
+ {
40
+ "indexed": true,
41
+ "internalType": "address",
42
+ "name": "owner",
43
+ "type": "address"
44
+ },
45
+ {
46
+ "indexed": true,
47
+ "internalType": "address",
48
+ "name": "spender",
49
+ "type": "address"
50
+ },
51
+ {
52
+ "indexed": false,
53
+ "internalType": "uint256",
54
+ "name": "value",
55
+ "type": "uint256"
56
+ }
57
+ ],
58
+ "name": "Approval",
59
+ "type": "event"
60
+ },
61
+ {
62
+ "anonymous": false,
63
+ "inputs": [
64
+ {
65
+ "indexed": false,
66
+ "internalType": "address",
67
+ "name": "account",
68
+ "type": "address"
69
+ }
70
+ ],
71
+ "name": "Paused",
72
+ "type": "event"
73
+ },
74
+ {
75
+ "anonymous": false,
76
+ "inputs": [
77
+ {
78
+ "indexed": true,
79
+ "internalType": "bytes32",
80
+ "name": "role",
81
+ "type": "bytes32"
82
+ },
83
+ {
84
+ "indexed": true,
85
+ "internalType": "bytes32",
86
+ "name": "previousAdminRole",
87
+ "type": "bytes32"
88
+ },
89
+ {
90
+ "indexed": true,
91
+ "internalType": "bytes32",
92
+ "name": "newAdminRole",
93
+ "type": "bytes32"
94
+ }
95
+ ],
96
+ "name": "RoleAdminChanged",
97
+ "type": "event"
98
+ },
99
+ {
100
+ "anonymous": false,
101
+ "inputs": [
102
+ {
103
+ "indexed": true,
104
+ "internalType": "bytes32",
105
+ "name": "role",
106
+ "type": "bytes32"
107
+ },
108
+ {
109
+ "indexed": true,
110
+ "internalType": "address",
111
+ "name": "account",
112
+ "type": "address"
113
+ },
114
+ {
115
+ "indexed": true,
116
+ "internalType": "address",
117
+ "name": "sender",
118
+ "type": "address"
119
+ }
120
+ ],
121
+ "name": "RoleGranted",
122
+ "type": "event"
123
+ },
124
+ {
125
+ "anonymous": false,
126
+ "inputs": [
127
+ {
128
+ "indexed": true,
129
+ "internalType": "bytes32",
130
+ "name": "role",
131
+ "type": "bytes32"
132
+ },
133
+ {
134
+ "indexed": true,
135
+ "internalType": "address",
136
+ "name": "account",
137
+ "type": "address"
138
+ },
139
+ {
140
+ "indexed": true,
141
+ "internalType": "address",
142
+ "name": "sender",
143
+ "type": "address"
144
+ }
145
+ ],
146
+ "name": "RoleRevoked",
147
+ "type": "event"
148
+ },
149
+ {
150
+ "anonymous": false,
151
+ "inputs": [
152
+ {
153
+ "indexed": true,
154
+ "internalType": "address",
155
+ "name": "from",
156
+ "type": "address"
157
+ },
158
+ {
159
+ "indexed": true,
160
+ "internalType": "address",
161
+ "name": "to",
162
+ "type": "address"
163
+ },
164
+ {
165
+ "indexed": false,
166
+ "internalType": "uint256",
167
+ "name": "value",
168
+ "type": "uint256"
169
+ }
170
+ ],
171
+ "name": "Transfer",
172
+ "type": "event"
173
+ },
174
+ {
175
+ "anonymous": false,
176
+ "inputs": [
177
+ {
178
+ "indexed": false,
179
+ "internalType": "address",
180
+ "name": "account",
181
+ "type": "address"
182
+ }
183
+ ],
184
+ "name": "Unpaused",
185
+ "type": "event"
186
+ },
187
+ {
188
+ "inputs": [],
189
+ "name": "BURNER_ROLE",
190
+ "outputs": [
191
+ {
192
+ "internalType": "bytes32",
193
+ "name": "",
194
+ "type": "bytes32"
195
+ }
196
+ ],
197
+ "stateMutability": "view",
198
+ "type": "function"
199
+ },
200
+ {
201
+ "inputs": [],
202
+ "name": "DEFAULT_ADMIN_ROLE",
203
+ "outputs": [
204
+ {
205
+ "internalType": "bytes32",
206
+ "name": "",
207
+ "type": "bytes32"
208
+ }
209
+ ],
210
+ "stateMutability": "view",
211
+ "type": "function"
212
+ },
213
+ {
214
+ "inputs": [],
215
+ "name": "LIQUIDATION",
216
+ "outputs": [
217
+ {
218
+ "internalType": "bytes32",
219
+ "name": "",
220
+ "type": "bytes32"
221
+ }
222
+ ],
223
+ "stateMutability": "view",
224
+ "type": "function"
225
+ },
226
+ {
227
+ "inputs": [],
228
+ "name": "MINTER_ROLE",
229
+ "outputs": [
230
+ {
231
+ "internalType": "bytes32",
232
+ "name": "",
233
+ "type": "bytes32"
234
+ }
235
+ ],
236
+ "stateMutability": "view",
237
+ "type": "function"
238
+ },
239
+ {
240
+ "inputs": [
241
+ {
242
+ "internalType": "address",
243
+ "name": "owner",
244
+ "type": "address"
245
+ },
246
+ {
247
+ "internalType": "address",
248
+ "name": "spender",
249
+ "type": "address"
250
+ }
251
+ ],
252
+ "name": "allowance",
253
+ "outputs": [
254
+ {
255
+ "internalType": "uint256",
256
+ "name": "",
257
+ "type": "uint256"
258
+ }
259
+ ],
260
+ "stateMutability": "view",
261
+ "type": "function"
262
+ },
263
+ {
264
+ "inputs": [
265
+ {
266
+ "internalType": "address",
267
+ "name": "spender",
268
+ "type": "address"
269
+ },
270
+ {
271
+ "internalType": "uint256",
272
+ "name": "amount",
273
+ "type": "uint256"
274
+ }
275
+ ],
276
+ "name": "approve",
277
+ "outputs": [
278
+ {
279
+ "internalType": "bool",
280
+ "name": "",
281
+ "type": "bool"
282
+ }
283
+ ],
284
+ "stateMutability": "nonpayable",
285
+ "type": "function"
286
+ },
287
+ {
288
+ "inputs": [
289
+ {
290
+ "internalType": "address",
291
+ "name": "account",
292
+ "type": "address"
293
+ }
294
+ ],
295
+ "name": "balanceOf",
296
+ "outputs": [
297
+ {
298
+ "internalType": "uint256",
299
+ "name": "",
300
+ "type": "uint256"
301
+ }
302
+ ],
303
+ "stateMutability": "view",
304
+ "type": "function"
305
+ },
306
+ {
307
+ "inputs": [
308
+ {
309
+ "internalType": "address",
310
+ "name": "account",
311
+ "type": "address"
312
+ },
313
+ {
314
+ "internalType": "uint256",
315
+ "name": "amount",
316
+ "type": "uint256"
317
+ }
318
+ ],
319
+ "name": "burn",
320
+ "outputs": [],
321
+ "stateMutability": "nonpayable",
322
+ "type": "function"
323
+ },
324
+ {
325
+ "inputs": [],
326
+ "name": "decimals",
327
+ "outputs": [
328
+ {
329
+ "internalType": "uint8",
330
+ "name": "",
331
+ "type": "uint8"
332
+ }
333
+ ],
334
+ "stateMutability": "view",
335
+ "type": "function"
336
+ },
337
+ {
338
+ "inputs": [
339
+ {
340
+ "internalType": "address",
341
+ "name": "spender",
342
+ "type": "address"
343
+ },
344
+ {
345
+ "internalType": "uint256",
346
+ "name": "subtractedValue",
347
+ "type": "uint256"
348
+ }
349
+ ],
350
+ "name": "decreaseAllowance",
351
+ "outputs": [
352
+ {
353
+ "internalType": "bool",
354
+ "name": "",
355
+ "type": "bool"
356
+ }
357
+ ],
358
+ "stateMutability": "nonpayable",
359
+ "type": "function"
360
+ },
361
+ {
362
+ "inputs": [
363
+ {
364
+ "internalType": "bytes32",
365
+ "name": "role",
366
+ "type": "bytes32"
367
+ }
368
+ ],
369
+ "name": "getRoleAdmin",
370
+ "outputs": [
371
+ {
372
+ "internalType": "bytes32",
373
+ "name": "",
374
+ "type": "bytes32"
375
+ }
376
+ ],
377
+ "stateMutability": "view",
378
+ "type": "function"
379
+ },
380
+ {
381
+ "inputs": [
382
+ {
383
+ "internalType": "bytes32",
384
+ "name": "role",
385
+ "type": "bytes32"
386
+ },
387
+ {
388
+ "internalType": "uint256",
389
+ "name": "index",
390
+ "type": "uint256"
391
+ }
392
+ ],
393
+ "name": "getRoleMember",
394
+ "outputs": [
395
+ {
396
+ "internalType": "address",
397
+ "name": "",
398
+ "type": "address"
399
+ }
400
+ ],
401
+ "stateMutability": "view",
402
+ "type": "function"
403
+ },
404
+ {
405
+ "inputs": [
406
+ {
407
+ "internalType": "bytes32",
408
+ "name": "role",
409
+ "type": "bytes32"
410
+ }
411
+ ],
412
+ "name": "getRoleMemberCount",
413
+ "outputs": [
414
+ {
415
+ "internalType": "uint256",
416
+ "name": "",
417
+ "type": "uint256"
418
+ }
419
+ ],
420
+ "stateMutability": "view",
421
+ "type": "function"
422
+ },
423
+ {
424
+ "inputs": [
425
+ {
426
+ "internalType": "bytes32",
427
+ "name": "role",
428
+ "type": "bytes32"
429
+ },
430
+ {
431
+ "internalType": "address",
432
+ "name": "account",
433
+ "type": "address"
434
+ }
435
+ ],
436
+ "name": "grantRole",
437
+ "outputs": [],
438
+ "stateMutability": "nonpayable",
439
+ "type": "function"
440
+ },
441
+ {
442
+ "inputs": [
443
+ {
444
+ "internalType": "bytes32",
445
+ "name": "role",
446
+ "type": "bytes32"
447
+ },
448
+ {
449
+ "internalType": "address",
450
+ "name": "account",
451
+ "type": "address"
452
+ }
453
+ ],
454
+ "name": "hasRole",
455
+ "outputs": [
456
+ {
457
+ "internalType": "bool",
458
+ "name": "",
459
+ "type": "bool"
460
+ }
461
+ ],
462
+ "stateMutability": "view",
463
+ "type": "function"
464
+ },
465
+ {
466
+ "inputs": [
467
+ {
468
+ "internalType": "address",
469
+ "name": "spender",
470
+ "type": "address"
471
+ },
472
+ {
473
+ "internalType": "uint256",
474
+ "name": "addedValue",
475
+ "type": "uint256"
476
+ }
477
+ ],
478
+ "name": "increaseAllowance",
479
+ "outputs": [
480
+ {
481
+ "internalType": "bool",
482
+ "name": "",
483
+ "type": "bool"
484
+ }
485
+ ],
486
+ "stateMutability": "nonpayable",
487
+ "type": "function"
488
+ },
489
+ {
490
+ "inputs": [
491
+ {
492
+ "internalType": "address",
493
+ "name": "account",
494
+ "type": "address"
495
+ },
496
+ {
497
+ "internalType": "uint256",
498
+ "name": "amount",
499
+ "type": "uint256"
500
+ }
501
+ ],
502
+ "name": "mint",
503
+ "outputs": [],
504
+ "stateMutability": "nonpayable",
505
+ "type": "function"
506
+ },
507
+ {
508
+ "inputs": [],
509
+ "name": "name",
510
+ "outputs": [
511
+ {
512
+ "internalType": "string",
513
+ "name": "",
514
+ "type": "string"
515
+ }
516
+ ],
517
+ "stateMutability": "view",
518
+ "type": "function"
519
+ },
520
+ {
521
+ "inputs": [],
522
+ "name": "pause",
523
+ "outputs": [],
524
+ "stateMutability": "nonpayable",
525
+ "type": "function"
526
+ },
527
+ {
528
+ "inputs": [],
529
+ "name": "paused",
530
+ "outputs": [
531
+ {
532
+ "internalType": "bool",
533
+ "name": "",
534
+ "type": "bool"
535
+ }
536
+ ],
537
+ "stateMutability": "view",
538
+ "type": "function"
539
+ },
540
+ {
541
+ "inputs": [
542
+ {
543
+ "internalType": "bytes32",
544
+ "name": "role",
545
+ "type": "bytes32"
546
+ },
547
+ {
548
+ "internalType": "address",
549
+ "name": "account",
550
+ "type": "address"
551
+ }
552
+ ],
553
+ "name": "renounceRole",
554
+ "outputs": [],
555
+ "stateMutability": "nonpayable",
556
+ "type": "function"
557
+ },
558
+ {
559
+ "inputs": [
560
+ {
561
+ "internalType": "bytes32",
562
+ "name": "role",
563
+ "type": "bytes32"
564
+ },
565
+ {
566
+ "internalType": "address",
567
+ "name": "account",
568
+ "type": "address"
569
+ }
570
+ ],
571
+ "name": "revokeRole",
572
+ "outputs": [],
573
+ "stateMutability": "nonpayable",
574
+ "type": "function"
575
+ },
576
+ {
577
+ "inputs": [],
578
+ "name": "symbol",
579
+ "outputs": [
580
+ {
581
+ "internalType": "string",
582
+ "name": "",
583
+ "type": "string"
584
+ }
585
+ ],
586
+ "stateMutability": "view",
587
+ "type": "function"
588
+ },
589
+ {
590
+ "inputs": [],
591
+ "name": "totalSupply",
592
+ "outputs": [
593
+ {
594
+ "internalType": "uint256",
595
+ "name": "",
596
+ "type": "uint256"
597
+ }
598
+ ],
599
+ "stateMutability": "view",
600
+ "type": "function"
601
+ },
602
+ {
603
+ "inputs": [
604
+ {
605
+ "internalType": "address",
606
+ "name": "recipient",
607
+ "type": "address"
608
+ },
609
+ {
610
+ "internalType": "uint256",
611
+ "name": "amount",
612
+ "type": "uint256"
613
+ }
614
+ ],
615
+ "name": "transfer",
616
+ "outputs": [
617
+ {
618
+ "internalType": "bool",
619
+ "name": "",
620
+ "type": "bool"
621
+ }
622
+ ],
623
+ "stateMutability": "nonpayable",
624
+ "type": "function"
625
+ },
626
+ {
627
+ "inputs": [
628
+ {
629
+ "internalType": "address",
630
+ "name": "sender",
631
+ "type": "address"
632
+ },
633
+ {
634
+ "internalType": "address",
635
+ "name": "recipient",
636
+ "type": "address"
637
+ },
638
+ {
639
+ "internalType": "uint256",
640
+ "name": "amount",
641
+ "type": "uint256"
642
+ }
643
+ ],
644
+ "name": "transferFrom",
645
+ "outputs": [
646
+ {
647
+ "internalType": "bool",
648
+ "name": "",
649
+ "type": "bool"
650
+ }
651
+ ],
652
+ "stateMutability": "nonpayable",
653
+ "type": "function"
654
+ },
655
+ {
656
+ "inputs": [],
657
+ "name": "unpause",
658
+ "outputs": [],
659
+ "stateMutability": "nonpayable",
660
+ "type": "function"
661
+ }
662
+ ] as const satisfies Abi;
663
+
664
+ /**
665
+ * Type-safe ABI for OToken_json
666
+ */
667
+ export type OToken_jsonAbi = typeof OToken_jsonAbi;
668
+
669
+ /**
670
+ * Contract instance type for OToken_json
671
+ */
672
+ // Use any for contract type to avoid complex viem type issues
673
+ // The runtime behavior is type-safe through viem's ABI typing
674
+ export type OToken_jsonContract = any;
675
+
676
+ /**
677
+ * OToken_json Contract Class
678
+ *
679
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
680
+ *
681
+ * @example
682
+ * ```typescript
683
+ * import { createPublicClient, createWalletClient, http } from 'viem';
684
+ * import { mainnet } from 'viem/chains';
685
+ * import { OToken_json } from 'OToken_json';
686
+ *
687
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
688
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
689
+ *
690
+ * const contract = new OToken_json('0x...', { publicClient, walletClient });
691
+ *
692
+ * // Read functions
693
+ * const result = await contract.balanceOf('0x...');
694
+ *
695
+ * // Write functions
696
+ * const hash = await contract.transfer('0x...', 1000n);
697
+ *
698
+ * // Simulate transactions (dry-run)
699
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
700
+ * console.log('Gas estimate:', simulation.request.gas);
701
+ *
702
+ * // Watch events
703
+ * const unwatch = contract.watch.Transfer((event) => {
704
+ * console.log('Transfer event:', event);
705
+ * });
706
+ * ```
707
+ */
708
+ export class OToken_json {
709
+ private contract: OToken_jsonContract;
710
+ private contractAddress: Address;
711
+ private publicClient: PublicClient;
712
+
713
+ constructor(
714
+ address: Address,
715
+ clients: {
716
+ publicClient: PublicClient;
717
+ walletClient?: WalletClient;
718
+ }
719
+ ) {
720
+ this.contractAddress = address;
721
+ this.publicClient = clients.publicClient;
722
+ this.contract = getContract({
723
+ address,
724
+ abi: OToken_jsonAbi,
725
+ client: {
726
+ public: clients.publicClient,
727
+ wallet: clients.walletClient,
728
+ },
729
+ });
730
+ }
731
+
732
+ /**
733
+ * Get the contract address
734
+ */
735
+ get address(): Address {
736
+ return this.contractAddress;
737
+ }
738
+
739
+ /**
740
+ * Get the underlying viem contract instance
741
+ */
742
+ getContract(): OToken_jsonContract {
743
+ return this.contract;
744
+ }
745
+
746
+ /**
747
+ * BURNER_ROLE
748
+ * view
749
+ */
750
+ async BURNER_ROLE(): Promise<`0x${string}`> {
751
+ return this.contract.read.BURNER_ROLE() as Promise<`0x${string}`>;
752
+ }
753
+
754
+ /**
755
+ * DEFAULT_ADMIN_ROLE
756
+ * view
757
+ */
758
+ async DEFAULT_ADMIN_ROLE(): Promise<`0x${string}`> {
759
+ return this.contract.read.DEFAULT_ADMIN_ROLE() as Promise<`0x${string}`>;
760
+ }
761
+
762
+ /**
763
+ * LIQUIDATION
764
+ * view
765
+ */
766
+ async LIQUIDATION(): Promise<`0x${string}`> {
767
+ return this.contract.read.LIQUIDATION() as Promise<`0x${string}`>;
768
+ }
769
+
770
+ /**
771
+ * MINTER_ROLE
772
+ * view
773
+ */
774
+ async MINTER_ROLE(): Promise<`0x${string}`> {
775
+ return this.contract.read.MINTER_ROLE() as Promise<`0x${string}`>;
776
+ }
777
+
778
+ /**
779
+ * allowance
780
+ * view
781
+ */
782
+ async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
783
+ return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
784
+ }
785
+
786
+ /**
787
+ * balanceOf
788
+ * view
789
+ */
790
+ async balanceOf(account: `0x${string}`): Promise<bigint> {
791
+ return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
792
+ }
793
+
794
+ /**
795
+ * decimals
796
+ * view
797
+ */
798
+ async decimals(): Promise<bigint> {
799
+ return this.contract.read.decimals() as Promise<bigint>;
800
+ }
801
+
802
+ /**
803
+ * getRoleAdmin
804
+ * view
805
+ */
806
+ async getRoleAdmin(role: `0x${string}`): Promise<`0x${string}`> {
807
+ return this.contract.read.getRoleAdmin([role] as const) as Promise<`0x${string}`>;
808
+ }
809
+
810
+ /**
811
+ * getRoleMember
812
+ * view
813
+ */
814
+ async getRoleMember(role: `0x${string}`, index: bigint): Promise<`0x${string}`> {
815
+ return this.contract.read.getRoleMember([role, index] as const) as Promise<`0x${string}`>;
816
+ }
817
+
818
+ /**
819
+ * getRoleMemberCount
820
+ * view
821
+ */
822
+ async getRoleMemberCount(role: `0x${string}`): Promise<bigint> {
823
+ return this.contract.read.getRoleMemberCount([role] as const) as Promise<bigint>;
824
+ }
825
+
826
+ /**
827
+ * hasRole
828
+ * view
829
+ */
830
+ async hasRole(role: `0x${string}`, account: `0x${string}`): Promise<boolean> {
831
+ return this.contract.read.hasRole([role, account] as const) as Promise<boolean>;
832
+ }
833
+
834
+ /**
835
+ * name
836
+ * view
837
+ */
838
+ async name(): Promise<string> {
839
+ return this.contract.read.name() as Promise<string>;
840
+ }
841
+
842
+ /**
843
+ * paused
844
+ * view
845
+ */
846
+ async paused(): Promise<boolean> {
847
+ return this.contract.read.paused() as Promise<boolean>;
848
+ }
849
+
850
+ /**
851
+ * symbol
852
+ * view
853
+ */
854
+ async symbol(): Promise<string> {
855
+ return this.contract.read.symbol() as Promise<string>;
856
+ }
857
+
858
+ /**
859
+ * totalSupply
860
+ * view
861
+ */
862
+ async totalSupply(): Promise<bigint> {
863
+ return this.contract.read.totalSupply() as Promise<bigint>;
864
+ }
865
+
866
+ /**
867
+ * approve
868
+ * nonpayable
869
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
870
+ */
871
+ async approve(spender: `0x${string}`, amount: bigint, options?: {
872
+ accessList?: import('viem').AccessList;
873
+ authorizationList?: import('viem').AuthorizationList;
874
+ chain?: import('viem').Chain | null;
875
+ dataSuffix?: `0x${string}`;
876
+ gas?: bigint;
877
+ gasPrice?: bigint;
878
+ maxFeePerGas?: bigint;
879
+ maxPriorityFeePerGas?: bigint;
880
+ nonce?: number;
881
+ value?: bigint;
882
+ }): Promise<`0x${string}`> {
883
+ if (!this.contract.write) {
884
+ throw new Error('Wallet client is required for write operations');
885
+ }
886
+ return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
887
+ }
888
+
889
+ /**
890
+ * burn
891
+ * nonpayable
892
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
893
+ */
894
+ async burn(account: `0x${string}`, amount: bigint, options?: {
895
+ accessList?: import('viem').AccessList;
896
+ authorizationList?: import('viem').AuthorizationList;
897
+ chain?: import('viem').Chain | null;
898
+ dataSuffix?: `0x${string}`;
899
+ gas?: bigint;
900
+ gasPrice?: bigint;
901
+ maxFeePerGas?: bigint;
902
+ maxPriorityFeePerGas?: bigint;
903
+ nonce?: number;
904
+ value?: bigint;
905
+ }): Promise<`0x${string}`> {
906
+ if (!this.contract.write) {
907
+ throw new Error('Wallet client is required for write operations');
908
+ }
909
+ return this.contract.write.burn([account, amount] as const, options) as Promise<`0x${string}`>;
910
+ }
911
+
912
+ /**
913
+ * decreaseAllowance
914
+ * nonpayable
915
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
916
+ */
917
+ async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
918
+ accessList?: import('viem').AccessList;
919
+ authorizationList?: import('viem').AuthorizationList;
920
+ chain?: import('viem').Chain | null;
921
+ dataSuffix?: `0x${string}`;
922
+ gas?: bigint;
923
+ gasPrice?: bigint;
924
+ maxFeePerGas?: bigint;
925
+ maxPriorityFeePerGas?: bigint;
926
+ nonce?: number;
927
+ value?: bigint;
928
+ }): Promise<`0x${string}`> {
929
+ if (!this.contract.write) {
930
+ throw new Error('Wallet client is required for write operations');
931
+ }
932
+ return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
933
+ }
934
+
935
+ /**
936
+ * grantRole
937
+ * nonpayable
938
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
939
+ */
940
+ async grantRole(role: `0x${string}`, account: `0x${string}`, options?: {
941
+ accessList?: import('viem').AccessList;
942
+ authorizationList?: import('viem').AuthorizationList;
943
+ chain?: import('viem').Chain | null;
944
+ dataSuffix?: `0x${string}`;
945
+ gas?: bigint;
946
+ gasPrice?: bigint;
947
+ maxFeePerGas?: bigint;
948
+ maxPriorityFeePerGas?: bigint;
949
+ nonce?: number;
950
+ value?: bigint;
951
+ }): Promise<`0x${string}`> {
952
+ if (!this.contract.write) {
953
+ throw new Error('Wallet client is required for write operations');
954
+ }
955
+ return this.contract.write.grantRole([role, account] as const, options) as Promise<`0x${string}`>;
956
+ }
957
+
958
+ /**
959
+ * increaseAllowance
960
+ * nonpayable
961
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
962
+ */
963
+ async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
964
+ accessList?: import('viem').AccessList;
965
+ authorizationList?: import('viem').AuthorizationList;
966
+ chain?: import('viem').Chain | null;
967
+ dataSuffix?: `0x${string}`;
968
+ gas?: bigint;
969
+ gasPrice?: bigint;
970
+ maxFeePerGas?: bigint;
971
+ maxPriorityFeePerGas?: bigint;
972
+ nonce?: number;
973
+ value?: bigint;
974
+ }): Promise<`0x${string}`> {
975
+ if (!this.contract.write) {
976
+ throw new Error('Wallet client is required for write operations');
977
+ }
978
+ return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
979
+ }
980
+
981
+ /**
982
+ * mint
983
+ * nonpayable
984
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
985
+ */
986
+ async mint(account: `0x${string}`, amount: bigint, options?: {
987
+ accessList?: import('viem').AccessList;
988
+ authorizationList?: import('viem').AuthorizationList;
989
+ chain?: import('viem').Chain | null;
990
+ dataSuffix?: `0x${string}`;
991
+ gas?: bigint;
992
+ gasPrice?: bigint;
993
+ maxFeePerGas?: bigint;
994
+ maxPriorityFeePerGas?: bigint;
995
+ nonce?: number;
996
+ value?: bigint;
997
+ }): Promise<`0x${string}`> {
998
+ if (!this.contract.write) {
999
+ throw new Error('Wallet client is required for write operations');
1000
+ }
1001
+ return this.contract.write.mint([account, amount] as const, options) as Promise<`0x${string}`>;
1002
+ }
1003
+
1004
+ /**
1005
+ * pause
1006
+ * nonpayable
1007
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1008
+ */
1009
+ async pause(options?: {
1010
+ accessList?: import('viem').AccessList;
1011
+ authorizationList?: import('viem').AuthorizationList;
1012
+ chain?: import('viem').Chain | null;
1013
+ dataSuffix?: `0x${string}`;
1014
+ gas?: bigint;
1015
+ gasPrice?: bigint;
1016
+ maxFeePerGas?: bigint;
1017
+ maxPriorityFeePerGas?: bigint;
1018
+ nonce?: number;
1019
+ value?: bigint;
1020
+ }): Promise<`0x${string}`> {
1021
+ if (!this.contract.write) {
1022
+ throw new Error('Wallet client is required for write operations');
1023
+ }
1024
+ return this.contract.write.pause(options) as Promise<`0x${string}`>;
1025
+ }
1026
+
1027
+ /**
1028
+ * renounceRole
1029
+ * nonpayable
1030
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1031
+ */
1032
+ async renounceRole(role: `0x${string}`, account: `0x${string}`, options?: {
1033
+ accessList?: import('viem').AccessList;
1034
+ authorizationList?: import('viem').AuthorizationList;
1035
+ chain?: import('viem').Chain | null;
1036
+ dataSuffix?: `0x${string}`;
1037
+ gas?: bigint;
1038
+ gasPrice?: bigint;
1039
+ maxFeePerGas?: bigint;
1040
+ maxPriorityFeePerGas?: bigint;
1041
+ nonce?: number;
1042
+ value?: bigint;
1043
+ }): Promise<`0x${string}`> {
1044
+ if (!this.contract.write) {
1045
+ throw new Error('Wallet client is required for write operations');
1046
+ }
1047
+ return this.contract.write.renounceRole([role, account] as const, options) as Promise<`0x${string}`>;
1048
+ }
1049
+
1050
+ /**
1051
+ * revokeRole
1052
+ * nonpayable
1053
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1054
+ */
1055
+ async revokeRole(role: `0x${string}`, account: `0x${string}`, options?: {
1056
+ accessList?: import('viem').AccessList;
1057
+ authorizationList?: import('viem').AuthorizationList;
1058
+ chain?: import('viem').Chain | null;
1059
+ dataSuffix?: `0x${string}`;
1060
+ gas?: bigint;
1061
+ gasPrice?: bigint;
1062
+ maxFeePerGas?: bigint;
1063
+ maxPriorityFeePerGas?: bigint;
1064
+ nonce?: number;
1065
+ value?: bigint;
1066
+ }): Promise<`0x${string}`> {
1067
+ if (!this.contract.write) {
1068
+ throw new Error('Wallet client is required for write operations');
1069
+ }
1070
+ return this.contract.write.revokeRole([role, account] as const, options) as Promise<`0x${string}`>;
1071
+ }
1072
+
1073
+ /**
1074
+ * transfer
1075
+ * nonpayable
1076
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1077
+ */
1078
+ async transfer(recipient: `0x${string}`, amount: bigint, options?: {
1079
+ accessList?: import('viem').AccessList;
1080
+ authorizationList?: import('viem').AuthorizationList;
1081
+ chain?: import('viem').Chain | null;
1082
+ dataSuffix?: `0x${string}`;
1083
+ gas?: bigint;
1084
+ gasPrice?: bigint;
1085
+ maxFeePerGas?: bigint;
1086
+ maxPriorityFeePerGas?: bigint;
1087
+ nonce?: number;
1088
+ value?: bigint;
1089
+ }): Promise<`0x${string}`> {
1090
+ if (!this.contract.write) {
1091
+ throw new Error('Wallet client is required for write operations');
1092
+ }
1093
+ return this.contract.write.transfer([recipient, amount] as const, options) as Promise<`0x${string}`>;
1094
+ }
1095
+
1096
+ /**
1097
+ * transferFrom
1098
+ * nonpayable
1099
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1100
+ */
1101
+ async transferFrom(sender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
1102
+ accessList?: import('viem').AccessList;
1103
+ authorizationList?: import('viem').AuthorizationList;
1104
+ chain?: import('viem').Chain | null;
1105
+ dataSuffix?: `0x${string}`;
1106
+ gas?: bigint;
1107
+ gasPrice?: bigint;
1108
+ maxFeePerGas?: bigint;
1109
+ maxPriorityFeePerGas?: bigint;
1110
+ nonce?: number;
1111
+ value?: bigint;
1112
+ }): Promise<`0x${string}`> {
1113
+ if (!this.contract.write) {
1114
+ throw new Error('Wallet client is required for write operations');
1115
+ }
1116
+ return this.contract.write.transferFrom([sender, recipient, amount] as const, options) as Promise<`0x${string}`>;
1117
+ }
1118
+
1119
+ /**
1120
+ * unpause
1121
+ * nonpayable
1122
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1123
+ */
1124
+ async unpause(options?: {
1125
+ accessList?: import('viem').AccessList;
1126
+ authorizationList?: import('viem').AuthorizationList;
1127
+ chain?: import('viem').Chain | null;
1128
+ dataSuffix?: `0x${string}`;
1129
+ gas?: bigint;
1130
+ gasPrice?: bigint;
1131
+ maxFeePerGas?: bigint;
1132
+ maxPriorityFeePerGas?: bigint;
1133
+ nonce?: number;
1134
+ value?: bigint;
1135
+ }): Promise<`0x${string}`> {
1136
+ if (!this.contract.write) {
1137
+ throw new Error('Wallet client is required for write operations');
1138
+ }
1139
+ return this.contract.write.unpause(options) as Promise<`0x${string}`>;
1140
+ }
1141
+
1142
+
1143
+
1144
+ /**
1145
+ * Simulate contract write operations (dry-run without sending transaction)
1146
+ *
1147
+ * @example
1148
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1149
+ * console.log('Gas estimate:', result.request.gas);
1150
+ * console.log('Would succeed:', result.result);
1151
+ */
1152
+ get simulate() {
1153
+ const contract = this.contract;
1154
+ if (!contract.simulate) {
1155
+ throw new Error('Public client is required for simulation');
1156
+ }
1157
+ return {
1158
+ /**
1159
+ * Simulate approve
1160
+ * Returns gas estimate and result without sending transaction
1161
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1162
+ */
1163
+ async approve(spender: `0x${string}`, amount: bigint, options?: {
1164
+ accessList?: import('viem').AccessList;
1165
+ authorizationList?: import('viem').AuthorizationList;
1166
+ chain?: import('viem').Chain | null;
1167
+ dataSuffix?: `0x${string}`;
1168
+ gas?: bigint;
1169
+ gasPrice?: bigint;
1170
+ maxFeePerGas?: bigint;
1171
+ maxPriorityFeePerGas?: bigint;
1172
+ nonce?: number;
1173
+ value?: bigint;
1174
+ }): Promise<boolean> {
1175
+ return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
1176
+ },
1177
+ /**
1178
+ * Simulate burn
1179
+ * Returns gas estimate and result without sending transaction
1180
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1181
+ */
1182
+ async burn(account: `0x${string}`, amount: bigint, options?: {
1183
+ accessList?: import('viem').AccessList;
1184
+ authorizationList?: import('viem').AuthorizationList;
1185
+ chain?: import('viem').Chain | null;
1186
+ dataSuffix?: `0x${string}`;
1187
+ gas?: bigint;
1188
+ gasPrice?: bigint;
1189
+ maxFeePerGas?: bigint;
1190
+ maxPriorityFeePerGas?: bigint;
1191
+ nonce?: number;
1192
+ value?: bigint;
1193
+ }): Promise<void> {
1194
+ return contract.simulate.burn([account, amount] as const, options) as Promise<void>;
1195
+ },
1196
+ /**
1197
+ * Simulate decreaseAllowance
1198
+ * Returns gas estimate and result without sending transaction
1199
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1200
+ */
1201
+ async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
1202
+ accessList?: import('viem').AccessList;
1203
+ authorizationList?: import('viem').AuthorizationList;
1204
+ chain?: import('viem').Chain | null;
1205
+ dataSuffix?: `0x${string}`;
1206
+ gas?: bigint;
1207
+ gasPrice?: bigint;
1208
+ maxFeePerGas?: bigint;
1209
+ maxPriorityFeePerGas?: bigint;
1210
+ nonce?: number;
1211
+ value?: bigint;
1212
+ }): Promise<boolean> {
1213
+ return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
1214
+ },
1215
+ /**
1216
+ * Simulate grantRole
1217
+ * Returns gas estimate and result without sending transaction
1218
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1219
+ */
1220
+ async grantRole(role: `0x${string}`, account: `0x${string}`, options?: {
1221
+ accessList?: import('viem').AccessList;
1222
+ authorizationList?: import('viem').AuthorizationList;
1223
+ chain?: import('viem').Chain | null;
1224
+ dataSuffix?: `0x${string}`;
1225
+ gas?: bigint;
1226
+ gasPrice?: bigint;
1227
+ maxFeePerGas?: bigint;
1228
+ maxPriorityFeePerGas?: bigint;
1229
+ nonce?: number;
1230
+ value?: bigint;
1231
+ }): Promise<void> {
1232
+ return contract.simulate.grantRole([role, account] as const, options) as Promise<void>;
1233
+ },
1234
+ /**
1235
+ * Simulate increaseAllowance
1236
+ * Returns gas estimate and result without sending transaction
1237
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1238
+ */
1239
+ async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
1240
+ accessList?: import('viem').AccessList;
1241
+ authorizationList?: import('viem').AuthorizationList;
1242
+ chain?: import('viem').Chain | null;
1243
+ dataSuffix?: `0x${string}`;
1244
+ gas?: bigint;
1245
+ gasPrice?: bigint;
1246
+ maxFeePerGas?: bigint;
1247
+ maxPriorityFeePerGas?: bigint;
1248
+ nonce?: number;
1249
+ value?: bigint;
1250
+ }): Promise<boolean> {
1251
+ return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
1252
+ },
1253
+ /**
1254
+ * Simulate mint
1255
+ * Returns gas estimate and result without sending transaction
1256
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1257
+ */
1258
+ async mint(account: `0x${string}`, amount: bigint, options?: {
1259
+ accessList?: import('viem').AccessList;
1260
+ authorizationList?: import('viem').AuthorizationList;
1261
+ chain?: import('viem').Chain | null;
1262
+ dataSuffix?: `0x${string}`;
1263
+ gas?: bigint;
1264
+ gasPrice?: bigint;
1265
+ maxFeePerGas?: bigint;
1266
+ maxPriorityFeePerGas?: bigint;
1267
+ nonce?: number;
1268
+ value?: bigint;
1269
+ }): Promise<void> {
1270
+ return contract.simulate.mint([account, amount] as const, options) as Promise<void>;
1271
+ },
1272
+ /**
1273
+ * Simulate pause
1274
+ * Returns gas estimate and result without sending transaction
1275
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1276
+ */
1277
+ async pause(options?: {
1278
+ accessList?: import('viem').AccessList;
1279
+ authorizationList?: import('viem').AuthorizationList;
1280
+ chain?: import('viem').Chain | null;
1281
+ dataSuffix?: `0x${string}`;
1282
+ gas?: bigint;
1283
+ gasPrice?: bigint;
1284
+ maxFeePerGas?: bigint;
1285
+ maxPriorityFeePerGas?: bigint;
1286
+ nonce?: number;
1287
+ value?: bigint;
1288
+ }): Promise<void> {
1289
+ return contract.simulate.pause(options) as Promise<void>;
1290
+ },
1291
+ /**
1292
+ * Simulate renounceRole
1293
+ * Returns gas estimate and result without sending transaction
1294
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1295
+ */
1296
+ async renounceRole(role: `0x${string}`, account: `0x${string}`, options?: {
1297
+ accessList?: import('viem').AccessList;
1298
+ authorizationList?: import('viem').AuthorizationList;
1299
+ chain?: import('viem').Chain | null;
1300
+ dataSuffix?: `0x${string}`;
1301
+ gas?: bigint;
1302
+ gasPrice?: bigint;
1303
+ maxFeePerGas?: bigint;
1304
+ maxPriorityFeePerGas?: bigint;
1305
+ nonce?: number;
1306
+ value?: bigint;
1307
+ }): Promise<void> {
1308
+ return contract.simulate.renounceRole([role, account] as const, options) as Promise<void>;
1309
+ },
1310
+ /**
1311
+ * Simulate revokeRole
1312
+ * Returns gas estimate and result without sending transaction
1313
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1314
+ */
1315
+ async revokeRole(role: `0x${string}`, account: `0x${string}`, options?: {
1316
+ accessList?: import('viem').AccessList;
1317
+ authorizationList?: import('viem').AuthorizationList;
1318
+ chain?: import('viem').Chain | null;
1319
+ dataSuffix?: `0x${string}`;
1320
+ gas?: bigint;
1321
+ gasPrice?: bigint;
1322
+ maxFeePerGas?: bigint;
1323
+ maxPriorityFeePerGas?: bigint;
1324
+ nonce?: number;
1325
+ value?: bigint;
1326
+ }): Promise<void> {
1327
+ return contract.simulate.revokeRole([role, account] as const, options) as Promise<void>;
1328
+ },
1329
+ /**
1330
+ * Simulate transfer
1331
+ * Returns gas estimate and result without sending transaction
1332
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1333
+ */
1334
+ async transfer(recipient: `0x${string}`, amount: bigint, options?: {
1335
+ accessList?: import('viem').AccessList;
1336
+ authorizationList?: import('viem').AuthorizationList;
1337
+ chain?: import('viem').Chain | null;
1338
+ dataSuffix?: `0x${string}`;
1339
+ gas?: bigint;
1340
+ gasPrice?: bigint;
1341
+ maxFeePerGas?: bigint;
1342
+ maxPriorityFeePerGas?: bigint;
1343
+ nonce?: number;
1344
+ value?: bigint;
1345
+ }): Promise<boolean> {
1346
+ return contract.simulate.transfer([recipient, amount] as const, options) as Promise<boolean>;
1347
+ },
1348
+ /**
1349
+ * Simulate transferFrom
1350
+ * Returns gas estimate and result without sending transaction
1351
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1352
+ */
1353
+ async transferFrom(sender: `0x${string}`, recipient: `0x${string}`, amount: bigint, options?: {
1354
+ accessList?: import('viem').AccessList;
1355
+ authorizationList?: import('viem').AuthorizationList;
1356
+ chain?: import('viem').Chain | null;
1357
+ dataSuffix?: `0x${string}`;
1358
+ gas?: bigint;
1359
+ gasPrice?: bigint;
1360
+ maxFeePerGas?: bigint;
1361
+ maxPriorityFeePerGas?: bigint;
1362
+ nonce?: number;
1363
+ value?: bigint;
1364
+ }): Promise<boolean> {
1365
+ return contract.simulate.transferFrom([sender, recipient, amount] as const, options) as Promise<boolean>;
1366
+ },
1367
+ /**
1368
+ * Simulate unpause
1369
+ * Returns gas estimate and result without sending transaction
1370
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1371
+ */
1372
+ async unpause(options?: {
1373
+ accessList?: import('viem').AccessList;
1374
+ authorizationList?: import('viem').AuthorizationList;
1375
+ chain?: import('viem').Chain | null;
1376
+ dataSuffix?: `0x${string}`;
1377
+ gas?: bigint;
1378
+ gasPrice?: bigint;
1379
+ maxFeePerGas?: bigint;
1380
+ maxPriorityFeePerGas?: bigint;
1381
+ nonce?: number;
1382
+ value?: bigint;
1383
+ }): Promise<void> {
1384
+ return contract.simulate.unpause(options) as Promise<void>;
1385
+ }
1386
+ };
1387
+ }
1388
+
1389
+ /**
1390
+ * Watch contract events
1391
+ *
1392
+ * @example
1393
+ * // Watch all Transfer events
1394
+ * const unwatch = contract.watch.Transfer((event) => {
1395
+ * console.log('Transfer:', event);
1396
+ * });
1397
+ *
1398
+ * // Stop watching
1399
+ * unwatch();
1400
+ */
1401
+ get watch() {
1402
+ return {
1403
+ /**
1404
+ * Watch Approval events
1405
+ * @param callback Function to call when event is emitted
1406
+ * @param filter Optional filter for indexed parameters
1407
+ * @returns Unwatch function to stop listening
1408
+ */
1409
+ Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner: `0x${string}`; spender: `0x${string}` }) => {
1410
+ return this.publicClient.watchContractEvent({
1411
+ address: this.contractAddress,
1412
+ abi: OToken_jsonAbi,
1413
+ eventName: 'Approval',
1414
+ args: filter,
1415
+ onLogs: (logs: any[]) => {
1416
+ logs.forEach((log: any) => {
1417
+ callback(log.args as any);
1418
+ });
1419
+ },
1420
+ }) as () => void;
1421
+ },
1422
+ /**
1423
+ * Watch Paused events
1424
+ * @param callback Function to call when event is emitted
1425
+ * @param filter Optional filter for indexed parameters
1426
+ * @returns Unwatch function to stop listening
1427
+ */
1428
+ Paused: (callback: (event: { account: `0x${string}` }) => void) => {
1429
+ return this.publicClient.watchContractEvent({
1430
+ address: this.contractAddress,
1431
+ abi: OToken_jsonAbi,
1432
+ eventName: 'Paused',
1433
+
1434
+ onLogs: (logs: any[]) => {
1435
+ logs.forEach((log: any) => {
1436
+ callback(log.args as any);
1437
+ });
1438
+ },
1439
+ }) as () => void;
1440
+ },
1441
+ /**
1442
+ * Watch RoleAdminChanged events
1443
+ * @param callback Function to call when event is emitted
1444
+ * @param filter Optional filter for indexed parameters
1445
+ * @returns Unwatch function to stop listening
1446
+ */
1447
+ RoleAdminChanged: (callback: (event: { role: `0x${string}`; previousAdminRole: `0x${string}`; newAdminRole: `0x${string}` }) => void, filter?: { role: `0x${string}`; previousAdminRole: `0x${string}`; newAdminRole: `0x${string}` }) => {
1448
+ return this.publicClient.watchContractEvent({
1449
+ address: this.contractAddress,
1450
+ abi: OToken_jsonAbi,
1451
+ eventName: 'RoleAdminChanged',
1452
+ args: filter,
1453
+ onLogs: (logs: any[]) => {
1454
+ logs.forEach((log: any) => {
1455
+ callback(log.args as any);
1456
+ });
1457
+ },
1458
+ }) as () => void;
1459
+ },
1460
+ /**
1461
+ * Watch RoleGranted events
1462
+ * @param callback Function to call when event is emitted
1463
+ * @param filter Optional filter for indexed parameters
1464
+ * @returns Unwatch function to stop listening
1465
+ */
1466
+ RoleGranted: (callback: (event: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => void, filter?: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => {
1467
+ return this.publicClient.watchContractEvent({
1468
+ address: this.contractAddress,
1469
+ abi: OToken_jsonAbi,
1470
+ eventName: 'RoleGranted',
1471
+ args: filter,
1472
+ onLogs: (logs: any[]) => {
1473
+ logs.forEach((log: any) => {
1474
+ callback(log.args as any);
1475
+ });
1476
+ },
1477
+ }) as () => void;
1478
+ },
1479
+ /**
1480
+ * Watch RoleRevoked events
1481
+ * @param callback Function to call when event is emitted
1482
+ * @param filter Optional filter for indexed parameters
1483
+ * @returns Unwatch function to stop listening
1484
+ */
1485
+ RoleRevoked: (callback: (event: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => void, filter?: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => {
1486
+ return this.publicClient.watchContractEvent({
1487
+ address: this.contractAddress,
1488
+ abi: OToken_jsonAbi,
1489
+ eventName: 'RoleRevoked',
1490
+ args: filter,
1491
+ onLogs: (logs: any[]) => {
1492
+ logs.forEach((log: any) => {
1493
+ callback(log.args as any);
1494
+ });
1495
+ },
1496
+ }) as () => void;
1497
+ },
1498
+ /**
1499
+ * Watch Transfer events
1500
+ * @param callback Function to call when event is emitted
1501
+ * @param filter Optional filter for indexed parameters
1502
+ * @returns Unwatch function to stop listening
1503
+ */
1504
+ Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from: `0x${string}`; to: `0x${string}` }) => {
1505
+ return this.publicClient.watchContractEvent({
1506
+ address: this.contractAddress,
1507
+ abi: OToken_jsonAbi,
1508
+ eventName: 'Transfer',
1509
+ args: filter,
1510
+ onLogs: (logs: any[]) => {
1511
+ logs.forEach((log: any) => {
1512
+ callback(log.args as any);
1513
+ });
1514
+ },
1515
+ }) as () => void;
1516
+ },
1517
+ /**
1518
+ * Watch Unpaused events
1519
+ * @param callback Function to call when event is emitted
1520
+ * @param filter Optional filter for indexed parameters
1521
+ * @returns Unwatch function to stop listening
1522
+ */
1523
+ Unpaused: (callback: (event: { account: `0x${string}` }) => void) => {
1524
+ return this.publicClient.watchContractEvent({
1525
+ address: this.contractAddress,
1526
+ abi: OToken_jsonAbi,
1527
+ eventName: 'Unpaused',
1528
+
1529
+ onLogs: (logs: any[]) => {
1530
+ logs.forEach((log: any) => {
1531
+ callback(log.args as any);
1532
+ });
1533
+ },
1534
+ }) as () => void;
1535
+ }
1536
+ };
1537
+ }
1538
+ }