@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,1218 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OToken_json = exports.OToken_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * OToken_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.OToken_jsonAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "string",
15
+ "name": "name_",
16
+ "type": "string"
17
+ },
18
+ {
19
+ "internalType": "string",
20
+ "name": "symbol_",
21
+ "type": "string"
22
+ },
23
+ {
24
+ "internalType": "uint8",
25
+ "name": "decimal_",
26
+ "type": "uint8"
27
+ },
28
+ {
29
+ "internalType": "address",
30
+ "name": "admin",
31
+ "type": "address"
32
+ }
33
+ ],
34
+ "stateMutability": "nonpayable",
35
+ "type": "constructor"
36
+ },
37
+ {
38
+ "anonymous": false,
39
+ "inputs": [
40
+ {
41
+ "indexed": true,
42
+ "internalType": "address",
43
+ "name": "owner",
44
+ "type": "address"
45
+ },
46
+ {
47
+ "indexed": true,
48
+ "internalType": "address",
49
+ "name": "spender",
50
+ "type": "address"
51
+ },
52
+ {
53
+ "indexed": false,
54
+ "internalType": "uint256",
55
+ "name": "value",
56
+ "type": "uint256"
57
+ }
58
+ ],
59
+ "name": "Approval",
60
+ "type": "event"
61
+ },
62
+ {
63
+ "anonymous": false,
64
+ "inputs": [
65
+ {
66
+ "indexed": false,
67
+ "internalType": "address",
68
+ "name": "account",
69
+ "type": "address"
70
+ }
71
+ ],
72
+ "name": "Paused",
73
+ "type": "event"
74
+ },
75
+ {
76
+ "anonymous": false,
77
+ "inputs": [
78
+ {
79
+ "indexed": true,
80
+ "internalType": "bytes32",
81
+ "name": "role",
82
+ "type": "bytes32"
83
+ },
84
+ {
85
+ "indexed": true,
86
+ "internalType": "bytes32",
87
+ "name": "previousAdminRole",
88
+ "type": "bytes32"
89
+ },
90
+ {
91
+ "indexed": true,
92
+ "internalType": "bytes32",
93
+ "name": "newAdminRole",
94
+ "type": "bytes32"
95
+ }
96
+ ],
97
+ "name": "RoleAdminChanged",
98
+ "type": "event"
99
+ },
100
+ {
101
+ "anonymous": false,
102
+ "inputs": [
103
+ {
104
+ "indexed": true,
105
+ "internalType": "bytes32",
106
+ "name": "role",
107
+ "type": "bytes32"
108
+ },
109
+ {
110
+ "indexed": true,
111
+ "internalType": "address",
112
+ "name": "account",
113
+ "type": "address"
114
+ },
115
+ {
116
+ "indexed": true,
117
+ "internalType": "address",
118
+ "name": "sender",
119
+ "type": "address"
120
+ }
121
+ ],
122
+ "name": "RoleGranted",
123
+ "type": "event"
124
+ },
125
+ {
126
+ "anonymous": false,
127
+ "inputs": [
128
+ {
129
+ "indexed": true,
130
+ "internalType": "bytes32",
131
+ "name": "role",
132
+ "type": "bytes32"
133
+ },
134
+ {
135
+ "indexed": true,
136
+ "internalType": "address",
137
+ "name": "account",
138
+ "type": "address"
139
+ },
140
+ {
141
+ "indexed": true,
142
+ "internalType": "address",
143
+ "name": "sender",
144
+ "type": "address"
145
+ }
146
+ ],
147
+ "name": "RoleRevoked",
148
+ "type": "event"
149
+ },
150
+ {
151
+ "anonymous": false,
152
+ "inputs": [
153
+ {
154
+ "indexed": true,
155
+ "internalType": "address",
156
+ "name": "from",
157
+ "type": "address"
158
+ },
159
+ {
160
+ "indexed": true,
161
+ "internalType": "address",
162
+ "name": "to",
163
+ "type": "address"
164
+ },
165
+ {
166
+ "indexed": false,
167
+ "internalType": "uint256",
168
+ "name": "value",
169
+ "type": "uint256"
170
+ }
171
+ ],
172
+ "name": "Transfer",
173
+ "type": "event"
174
+ },
175
+ {
176
+ "anonymous": false,
177
+ "inputs": [
178
+ {
179
+ "indexed": false,
180
+ "internalType": "address",
181
+ "name": "account",
182
+ "type": "address"
183
+ }
184
+ ],
185
+ "name": "Unpaused",
186
+ "type": "event"
187
+ },
188
+ {
189
+ "inputs": [],
190
+ "name": "BURNER_ROLE",
191
+ "outputs": [
192
+ {
193
+ "internalType": "bytes32",
194
+ "name": "",
195
+ "type": "bytes32"
196
+ }
197
+ ],
198
+ "stateMutability": "view",
199
+ "type": "function"
200
+ },
201
+ {
202
+ "inputs": [],
203
+ "name": "DEFAULT_ADMIN_ROLE",
204
+ "outputs": [
205
+ {
206
+ "internalType": "bytes32",
207
+ "name": "",
208
+ "type": "bytes32"
209
+ }
210
+ ],
211
+ "stateMutability": "view",
212
+ "type": "function"
213
+ },
214
+ {
215
+ "inputs": [],
216
+ "name": "LIQUIDATION",
217
+ "outputs": [
218
+ {
219
+ "internalType": "bytes32",
220
+ "name": "",
221
+ "type": "bytes32"
222
+ }
223
+ ],
224
+ "stateMutability": "view",
225
+ "type": "function"
226
+ },
227
+ {
228
+ "inputs": [],
229
+ "name": "MINTER_ROLE",
230
+ "outputs": [
231
+ {
232
+ "internalType": "bytes32",
233
+ "name": "",
234
+ "type": "bytes32"
235
+ }
236
+ ],
237
+ "stateMutability": "view",
238
+ "type": "function"
239
+ },
240
+ {
241
+ "inputs": [
242
+ {
243
+ "internalType": "address",
244
+ "name": "owner",
245
+ "type": "address"
246
+ },
247
+ {
248
+ "internalType": "address",
249
+ "name": "spender",
250
+ "type": "address"
251
+ }
252
+ ],
253
+ "name": "allowance",
254
+ "outputs": [
255
+ {
256
+ "internalType": "uint256",
257
+ "name": "",
258
+ "type": "uint256"
259
+ }
260
+ ],
261
+ "stateMutability": "view",
262
+ "type": "function"
263
+ },
264
+ {
265
+ "inputs": [
266
+ {
267
+ "internalType": "address",
268
+ "name": "spender",
269
+ "type": "address"
270
+ },
271
+ {
272
+ "internalType": "uint256",
273
+ "name": "amount",
274
+ "type": "uint256"
275
+ }
276
+ ],
277
+ "name": "approve",
278
+ "outputs": [
279
+ {
280
+ "internalType": "bool",
281
+ "name": "",
282
+ "type": "bool"
283
+ }
284
+ ],
285
+ "stateMutability": "nonpayable",
286
+ "type": "function"
287
+ },
288
+ {
289
+ "inputs": [
290
+ {
291
+ "internalType": "address",
292
+ "name": "account",
293
+ "type": "address"
294
+ }
295
+ ],
296
+ "name": "balanceOf",
297
+ "outputs": [
298
+ {
299
+ "internalType": "uint256",
300
+ "name": "",
301
+ "type": "uint256"
302
+ }
303
+ ],
304
+ "stateMutability": "view",
305
+ "type": "function"
306
+ },
307
+ {
308
+ "inputs": [
309
+ {
310
+ "internalType": "address",
311
+ "name": "account",
312
+ "type": "address"
313
+ },
314
+ {
315
+ "internalType": "uint256",
316
+ "name": "amount",
317
+ "type": "uint256"
318
+ }
319
+ ],
320
+ "name": "burn",
321
+ "outputs": [],
322
+ "stateMutability": "nonpayable",
323
+ "type": "function"
324
+ },
325
+ {
326
+ "inputs": [],
327
+ "name": "decimals",
328
+ "outputs": [
329
+ {
330
+ "internalType": "uint8",
331
+ "name": "",
332
+ "type": "uint8"
333
+ }
334
+ ],
335
+ "stateMutability": "view",
336
+ "type": "function"
337
+ },
338
+ {
339
+ "inputs": [
340
+ {
341
+ "internalType": "address",
342
+ "name": "spender",
343
+ "type": "address"
344
+ },
345
+ {
346
+ "internalType": "uint256",
347
+ "name": "subtractedValue",
348
+ "type": "uint256"
349
+ }
350
+ ],
351
+ "name": "decreaseAllowance",
352
+ "outputs": [
353
+ {
354
+ "internalType": "bool",
355
+ "name": "",
356
+ "type": "bool"
357
+ }
358
+ ],
359
+ "stateMutability": "nonpayable",
360
+ "type": "function"
361
+ },
362
+ {
363
+ "inputs": [
364
+ {
365
+ "internalType": "bytes32",
366
+ "name": "role",
367
+ "type": "bytes32"
368
+ }
369
+ ],
370
+ "name": "getRoleAdmin",
371
+ "outputs": [
372
+ {
373
+ "internalType": "bytes32",
374
+ "name": "",
375
+ "type": "bytes32"
376
+ }
377
+ ],
378
+ "stateMutability": "view",
379
+ "type": "function"
380
+ },
381
+ {
382
+ "inputs": [
383
+ {
384
+ "internalType": "bytes32",
385
+ "name": "role",
386
+ "type": "bytes32"
387
+ },
388
+ {
389
+ "internalType": "uint256",
390
+ "name": "index",
391
+ "type": "uint256"
392
+ }
393
+ ],
394
+ "name": "getRoleMember",
395
+ "outputs": [
396
+ {
397
+ "internalType": "address",
398
+ "name": "",
399
+ "type": "address"
400
+ }
401
+ ],
402
+ "stateMutability": "view",
403
+ "type": "function"
404
+ },
405
+ {
406
+ "inputs": [
407
+ {
408
+ "internalType": "bytes32",
409
+ "name": "role",
410
+ "type": "bytes32"
411
+ }
412
+ ],
413
+ "name": "getRoleMemberCount",
414
+ "outputs": [
415
+ {
416
+ "internalType": "uint256",
417
+ "name": "",
418
+ "type": "uint256"
419
+ }
420
+ ],
421
+ "stateMutability": "view",
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": "grantRole",
438
+ "outputs": [],
439
+ "stateMutability": "nonpayable",
440
+ "type": "function"
441
+ },
442
+ {
443
+ "inputs": [
444
+ {
445
+ "internalType": "bytes32",
446
+ "name": "role",
447
+ "type": "bytes32"
448
+ },
449
+ {
450
+ "internalType": "address",
451
+ "name": "account",
452
+ "type": "address"
453
+ }
454
+ ],
455
+ "name": "hasRole",
456
+ "outputs": [
457
+ {
458
+ "internalType": "bool",
459
+ "name": "",
460
+ "type": "bool"
461
+ }
462
+ ],
463
+ "stateMutability": "view",
464
+ "type": "function"
465
+ },
466
+ {
467
+ "inputs": [
468
+ {
469
+ "internalType": "address",
470
+ "name": "spender",
471
+ "type": "address"
472
+ },
473
+ {
474
+ "internalType": "uint256",
475
+ "name": "addedValue",
476
+ "type": "uint256"
477
+ }
478
+ ],
479
+ "name": "increaseAllowance",
480
+ "outputs": [
481
+ {
482
+ "internalType": "bool",
483
+ "name": "",
484
+ "type": "bool"
485
+ }
486
+ ],
487
+ "stateMutability": "nonpayable",
488
+ "type": "function"
489
+ },
490
+ {
491
+ "inputs": [
492
+ {
493
+ "internalType": "address",
494
+ "name": "account",
495
+ "type": "address"
496
+ },
497
+ {
498
+ "internalType": "uint256",
499
+ "name": "amount",
500
+ "type": "uint256"
501
+ }
502
+ ],
503
+ "name": "mint",
504
+ "outputs": [],
505
+ "stateMutability": "nonpayable",
506
+ "type": "function"
507
+ },
508
+ {
509
+ "inputs": [],
510
+ "name": "name",
511
+ "outputs": [
512
+ {
513
+ "internalType": "string",
514
+ "name": "",
515
+ "type": "string"
516
+ }
517
+ ],
518
+ "stateMutability": "view",
519
+ "type": "function"
520
+ },
521
+ {
522
+ "inputs": [],
523
+ "name": "pause",
524
+ "outputs": [],
525
+ "stateMutability": "nonpayable",
526
+ "type": "function"
527
+ },
528
+ {
529
+ "inputs": [],
530
+ "name": "paused",
531
+ "outputs": [
532
+ {
533
+ "internalType": "bool",
534
+ "name": "",
535
+ "type": "bool"
536
+ }
537
+ ],
538
+ "stateMutability": "view",
539
+ "type": "function"
540
+ },
541
+ {
542
+ "inputs": [
543
+ {
544
+ "internalType": "bytes32",
545
+ "name": "role",
546
+ "type": "bytes32"
547
+ },
548
+ {
549
+ "internalType": "address",
550
+ "name": "account",
551
+ "type": "address"
552
+ }
553
+ ],
554
+ "name": "renounceRole",
555
+ "outputs": [],
556
+ "stateMutability": "nonpayable",
557
+ "type": "function"
558
+ },
559
+ {
560
+ "inputs": [
561
+ {
562
+ "internalType": "bytes32",
563
+ "name": "role",
564
+ "type": "bytes32"
565
+ },
566
+ {
567
+ "internalType": "address",
568
+ "name": "account",
569
+ "type": "address"
570
+ }
571
+ ],
572
+ "name": "revokeRole",
573
+ "outputs": [],
574
+ "stateMutability": "nonpayable",
575
+ "type": "function"
576
+ },
577
+ {
578
+ "inputs": [],
579
+ "name": "symbol",
580
+ "outputs": [
581
+ {
582
+ "internalType": "string",
583
+ "name": "",
584
+ "type": "string"
585
+ }
586
+ ],
587
+ "stateMutability": "view",
588
+ "type": "function"
589
+ },
590
+ {
591
+ "inputs": [],
592
+ "name": "totalSupply",
593
+ "outputs": [
594
+ {
595
+ "internalType": "uint256",
596
+ "name": "",
597
+ "type": "uint256"
598
+ }
599
+ ],
600
+ "stateMutability": "view",
601
+ "type": "function"
602
+ },
603
+ {
604
+ "inputs": [
605
+ {
606
+ "internalType": "address",
607
+ "name": "recipient",
608
+ "type": "address"
609
+ },
610
+ {
611
+ "internalType": "uint256",
612
+ "name": "amount",
613
+ "type": "uint256"
614
+ }
615
+ ],
616
+ "name": "transfer",
617
+ "outputs": [
618
+ {
619
+ "internalType": "bool",
620
+ "name": "",
621
+ "type": "bool"
622
+ }
623
+ ],
624
+ "stateMutability": "nonpayable",
625
+ "type": "function"
626
+ },
627
+ {
628
+ "inputs": [
629
+ {
630
+ "internalType": "address",
631
+ "name": "sender",
632
+ "type": "address"
633
+ },
634
+ {
635
+ "internalType": "address",
636
+ "name": "recipient",
637
+ "type": "address"
638
+ },
639
+ {
640
+ "internalType": "uint256",
641
+ "name": "amount",
642
+ "type": "uint256"
643
+ }
644
+ ],
645
+ "name": "transferFrom",
646
+ "outputs": [
647
+ {
648
+ "internalType": "bool",
649
+ "name": "",
650
+ "type": "bool"
651
+ }
652
+ ],
653
+ "stateMutability": "nonpayable",
654
+ "type": "function"
655
+ },
656
+ {
657
+ "inputs": [],
658
+ "name": "unpause",
659
+ "outputs": [],
660
+ "stateMutability": "nonpayable",
661
+ "type": "function"
662
+ }
663
+ ];
664
+ /**
665
+ * OToken_json Contract Class
666
+ *
667
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
668
+ *
669
+ * @example
670
+ * ```typescript
671
+ * import { createPublicClient, createWalletClient, http } from 'viem';
672
+ * import { mainnet } from 'viem/chains';
673
+ * import { OToken_json } from 'OToken_json';
674
+ *
675
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
676
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
677
+ *
678
+ * const contract = new OToken_json('0x...', { publicClient, walletClient });
679
+ *
680
+ * // Read functions
681
+ * const result = await contract.balanceOf('0x...');
682
+ *
683
+ * // Write functions
684
+ * const hash = await contract.transfer('0x...', 1000n);
685
+ *
686
+ * // Simulate transactions (dry-run)
687
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
688
+ * console.log('Gas estimate:', simulation.request.gas);
689
+ *
690
+ * // Watch events
691
+ * const unwatch = contract.watch.Transfer((event) => {
692
+ * console.log('Transfer event:', event);
693
+ * });
694
+ * ```
695
+ */
696
+ class OToken_json {
697
+ constructor(address, clients) {
698
+ this.contractAddress = address;
699
+ this.publicClient = clients.publicClient;
700
+ this.contract = (0, viem_1.getContract)({
701
+ address,
702
+ abi: exports.OToken_jsonAbi,
703
+ client: {
704
+ public: clients.publicClient,
705
+ wallet: clients.walletClient,
706
+ },
707
+ });
708
+ }
709
+ /**
710
+ * Get the contract address
711
+ */
712
+ get address() {
713
+ return this.contractAddress;
714
+ }
715
+ /**
716
+ * Get the underlying viem contract instance
717
+ */
718
+ getContract() {
719
+ return this.contract;
720
+ }
721
+ /**
722
+ * BURNER_ROLE
723
+ * view
724
+ */
725
+ async BURNER_ROLE() {
726
+ return this.contract.read.BURNER_ROLE();
727
+ }
728
+ /**
729
+ * DEFAULT_ADMIN_ROLE
730
+ * view
731
+ */
732
+ async DEFAULT_ADMIN_ROLE() {
733
+ return this.contract.read.DEFAULT_ADMIN_ROLE();
734
+ }
735
+ /**
736
+ * LIQUIDATION
737
+ * view
738
+ */
739
+ async LIQUIDATION() {
740
+ return this.contract.read.LIQUIDATION();
741
+ }
742
+ /**
743
+ * MINTER_ROLE
744
+ * view
745
+ */
746
+ async MINTER_ROLE() {
747
+ return this.contract.read.MINTER_ROLE();
748
+ }
749
+ /**
750
+ * allowance
751
+ * view
752
+ */
753
+ async allowance(owner, spender) {
754
+ return this.contract.read.allowance([owner, spender]);
755
+ }
756
+ /**
757
+ * balanceOf
758
+ * view
759
+ */
760
+ async balanceOf(account) {
761
+ return this.contract.read.balanceOf([account]);
762
+ }
763
+ /**
764
+ * decimals
765
+ * view
766
+ */
767
+ async decimals() {
768
+ return this.contract.read.decimals();
769
+ }
770
+ /**
771
+ * getRoleAdmin
772
+ * view
773
+ */
774
+ async getRoleAdmin(role) {
775
+ return this.contract.read.getRoleAdmin([role]);
776
+ }
777
+ /**
778
+ * getRoleMember
779
+ * view
780
+ */
781
+ async getRoleMember(role, index) {
782
+ return this.contract.read.getRoleMember([role, index]);
783
+ }
784
+ /**
785
+ * getRoleMemberCount
786
+ * view
787
+ */
788
+ async getRoleMemberCount(role) {
789
+ return this.contract.read.getRoleMemberCount([role]);
790
+ }
791
+ /**
792
+ * hasRole
793
+ * view
794
+ */
795
+ async hasRole(role, account) {
796
+ return this.contract.read.hasRole([role, account]);
797
+ }
798
+ /**
799
+ * name
800
+ * view
801
+ */
802
+ async name() {
803
+ return this.contract.read.name();
804
+ }
805
+ /**
806
+ * paused
807
+ * view
808
+ */
809
+ async paused() {
810
+ return this.contract.read.paused();
811
+ }
812
+ /**
813
+ * symbol
814
+ * view
815
+ */
816
+ async symbol() {
817
+ return this.contract.read.symbol();
818
+ }
819
+ /**
820
+ * totalSupply
821
+ * view
822
+ */
823
+ async totalSupply() {
824
+ return this.contract.read.totalSupply();
825
+ }
826
+ /**
827
+ * approve
828
+ * nonpayable
829
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
830
+ */
831
+ async approve(spender, amount, options) {
832
+ if (!this.contract.write) {
833
+ throw new Error('Wallet client is required for write operations');
834
+ }
835
+ return this.contract.write.approve([spender, amount], options);
836
+ }
837
+ /**
838
+ * burn
839
+ * nonpayable
840
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
841
+ */
842
+ async burn(account, amount, options) {
843
+ if (!this.contract.write) {
844
+ throw new Error('Wallet client is required for write operations');
845
+ }
846
+ return this.contract.write.burn([account, amount], options);
847
+ }
848
+ /**
849
+ * decreaseAllowance
850
+ * nonpayable
851
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
852
+ */
853
+ async decreaseAllowance(spender, subtractedValue, options) {
854
+ if (!this.contract.write) {
855
+ throw new Error('Wallet client is required for write operations');
856
+ }
857
+ return this.contract.write.decreaseAllowance([spender, subtractedValue], options);
858
+ }
859
+ /**
860
+ * grantRole
861
+ * nonpayable
862
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
863
+ */
864
+ async grantRole(role, account, options) {
865
+ if (!this.contract.write) {
866
+ throw new Error('Wallet client is required for write operations');
867
+ }
868
+ return this.contract.write.grantRole([role, account], options);
869
+ }
870
+ /**
871
+ * increaseAllowance
872
+ * nonpayable
873
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
874
+ */
875
+ async increaseAllowance(spender, addedValue, options) {
876
+ if (!this.contract.write) {
877
+ throw new Error('Wallet client is required for write operations');
878
+ }
879
+ return this.contract.write.increaseAllowance([spender, addedValue], options);
880
+ }
881
+ /**
882
+ * mint
883
+ * nonpayable
884
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
885
+ */
886
+ async mint(account, amount, options) {
887
+ if (!this.contract.write) {
888
+ throw new Error('Wallet client is required for write operations');
889
+ }
890
+ return this.contract.write.mint([account, amount], options);
891
+ }
892
+ /**
893
+ * pause
894
+ * nonpayable
895
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
896
+ */
897
+ async pause(options) {
898
+ if (!this.contract.write) {
899
+ throw new Error('Wallet client is required for write operations');
900
+ }
901
+ return this.contract.write.pause(options);
902
+ }
903
+ /**
904
+ * renounceRole
905
+ * nonpayable
906
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
907
+ */
908
+ async renounceRole(role, account, options) {
909
+ if (!this.contract.write) {
910
+ throw new Error('Wallet client is required for write operations');
911
+ }
912
+ return this.contract.write.renounceRole([role, account], options);
913
+ }
914
+ /**
915
+ * revokeRole
916
+ * nonpayable
917
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
918
+ */
919
+ async revokeRole(role, account, options) {
920
+ if (!this.contract.write) {
921
+ throw new Error('Wallet client is required for write operations');
922
+ }
923
+ return this.contract.write.revokeRole([role, account], options);
924
+ }
925
+ /**
926
+ * transfer
927
+ * nonpayable
928
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
929
+ */
930
+ async transfer(recipient, amount, options) {
931
+ if (!this.contract.write) {
932
+ throw new Error('Wallet client is required for write operations');
933
+ }
934
+ return this.contract.write.transfer([recipient, amount], options);
935
+ }
936
+ /**
937
+ * transferFrom
938
+ * nonpayable
939
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
940
+ */
941
+ async transferFrom(sender, recipient, amount, options) {
942
+ if (!this.contract.write) {
943
+ throw new Error('Wallet client is required for write operations');
944
+ }
945
+ return this.contract.write.transferFrom([sender, recipient, amount], options);
946
+ }
947
+ /**
948
+ * unpause
949
+ * nonpayable
950
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
951
+ */
952
+ async unpause(options) {
953
+ if (!this.contract.write) {
954
+ throw new Error('Wallet client is required for write operations');
955
+ }
956
+ return this.contract.write.unpause(options);
957
+ }
958
+ /**
959
+ * Simulate contract write operations (dry-run without sending transaction)
960
+ *
961
+ * @example
962
+ * const result = await contract.simulate.transfer('0x...', 1000n);
963
+ * console.log('Gas estimate:', result.request.gas);
964
+ * console.log('Would succeed:', result.result);
965
+ */
966
+ get simulate() {
967
+ const contract = this.contract;
968
+ if (!contract.simulate) {
969
+ throw new Error('Public client is required for simulation');
970
+ }
971
+ return {
972
+ /**
973
+ * Simulate approve
974
+ * Returns gas estimate and result without sending transaction
975
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
976
+ */
977
+ async approve(spender, amount, options) {
978
+ return contract.simulate.approve([spender, amount], options);
979
+ },
980
+ /**
981
+ * Simulate burn
982
+ * Returns gas estimate and result without sending transaction
983
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
984
+ */
985
+ async burn(account, amount, options) {
986
+ return contract.simulate.burn([account, amount], options);
987
+ },
988
+ /**
989
+ * Simulate decreaseAllowance
990
+ * Returns gas estimate and result without sending transaction
991
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
992
+ */
993
+ async decreaseAllowance(spender, subtractedValue, options) {
994
+ return contract.simulate.decreaseAllowance([spender, subtractedValue], options);
995
+ },
996
+ /**
997
+ * Simulate grantRole
998
+ * Returns gas estimate and result without sending transaction
999
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1000
+ */
1001
+ async grantRole(role, account, options) {
1002
+ return contract.simulate.grantRole([role, account], options);
1003
+ },
1004
+ /**
1005
+ * Simulate increaseAllowance
1006
+ * Returns gas estimate and result without sending transaction
1007
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1008
+ */
1009
+ async increaseAllowance(spender, addedValue, options) {
1010
+ return contract.simulate.increaseAllowance([spender, addedValue], options);
1011
+ },
1012
+ /**
1013
+ * Simulate mint
1014
+ * Returns gas estimate and result without sending transaction
1015
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1016
+ */
1017
+ async mint(account, amount, options) {
1018
+ return contract.simulate.mint([account, amount], options);
1019
+ },
1020
+ /**
1021
+ * Simulate pause
1022
+ * Returns gas estimate and result without sending transaction
1023
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1024
+ */
1025
+ async pause(options) {
1026
+ return contract.simulate.pause(options);
1027
+ },
1028
+ /**
1029
+ * Simulate renounceRole
1030
+ * Returns gas estimate and result without sending transaction
1031
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1032
+ */
1033
+ async renounceRole(role, account, options) {
1034
+ return contract.simulate.renounceRole([role, account], options);
1035
+ },
1036
+ /**
1037
+ * Simulate revokeRole
1038
+ * Returns gas estimate and result without sending transaction
1039
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1040
+ */
1041
+ async revokeRole(role, account, options) {
1042
+ return contract.simulate.revokeRole([role, account], options);
1043
+ },
1044
+ /**
1045
+ * Simulate transfer
1046
+ * Returns gas estimate and result without sending transaction
1047
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1048
+ */
1049
+ async transfer(recipient, amount, options) {
1050
+ return contract.simulate.transfer([recipient, amount], options);
1051
+ },
1052
+ /**
1053
+ * Simulate transferFrom
1054
+ * Returns gas estimate and result without sending transaction
1055
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1056
+ */
1057
+ async transferFrom(sender, recipient, amount, options) {
1058
+ return contract.simulate.transferFrom([sender, recipient, amount], options);
1059
+ },
1060
+ /**
1061
+ * Simulate unpause
1062
+ * Returns gas estimate and result without sending transaction
1063
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1064
+ */
1065
+ async unpause(options) {
1066
+ return contract.simulate.unpause(options);
1067
+ }
1068
+ };
1069
+ }
1070
+ /**
1071
+ * Watch contract events
1072
+ *
1073
+ * @example
1074
+ * // Watch all Transfer events
1075
+ * const unwatch = contract.watch.Transfer((event) => {
1076
+ * console.log('Transfer:', event);
1077
+ * });
1078
+ *
1079
+ * // Stop watching
1080
+ * unwatch();
1081
+ */
1082
+ get watch() {
1083
+ return {
1084
+ /**
1085
+ * Watch Approval events
1086
+ * @param callback Function to call when event is emitted
1087
+ * @param filter Optional filter for indexed parameters
1088
+ * @returns Unwatch function to stop listening
1089
+ */
1090
+ Approval: (callback, filter) => {
1091
+ return this.publicClient.watchContractEvent({
1092
+ address: this.contractAddress,
1093
+ abi: exports.OToken_jsonAbi,
1094
+ eventName: 'Approval',
1095
+ args: filter,
1096
+ onLogs: (logs) => {
1097
+ logs.forEach((log) => {
1098
+ callback(log.args);
1099
+ });
1100
+ },
1101
+ });
1102
+ },
1103
+ /**
1104
+ * Watch Paused events
1105
+ * @param callback Function to call when event is emitted
1106
+ * @param filter Optional filter for indexed parameters
1107
+ * @returns Unwatch function to stop listening
1108
+ */
1109
+ Paused: (callback) => {
1110
+ return this.publicClient.watchContractEvent({
1111
+ address: this.contractAddress,
1112
+ abi: exports.OToken_jsonAbi,
1113
+ eventName: 'Paused',
1114
+ onLogs: (logs) => {
1115
+ logs.forEach((log) => {
1116
+ callback(log.args);
1117
+ });
1118
+ },
1119
+ });
1120
+ },
1121
+ /**
1122
+ * Watch RoleAdminChanged events
1123
+ * @param callback Function to call when event is emitted
1124
+ * @param filter Optional filter for indexed parameters
1125
+ * @returns Unwatch function to stop listening
1126
+ */
1127
+ RoleAdminChanged: (callback, filter) => {
1128
+ return this.publicClient.watchContractEvent({
1129
+ address: this.contractAddress,
1130
+ abi: exports.OToken_jsonAbi,
1131
+ eventName: 'RoleAdminChanged',
1132
+ args: filter,
1133
+ onLogs: (logs) => {
1134
+ logs.forEach((log) => {
1135
+ callback(log.args);
1136
+ });
1137
+ },
1138
+ });
1139
+ },
1140
+ /**
1141
+ * Watch RoleGranted events
1142
+ * @param callback Function to call when event is emitted
1143
+ * @param filter Optional filter for indexed parameters
1144
+ * @returns Unwatch function to stop listening
1145
+ */
1146
+ RoleGranted: (callback, filter) => {
1147
+ return this.publicClient.watchContractEvent({
1148
+ address: this.contractAddress,
1149
+ abi: exports.OToken_jsonAbi,
1150
+ eventName: 'RoleGranted',
1151
+ args: filter,
1152
+ onLogs: (logs) => {
1153
+ logs.forEach((log) => {
1154
+ callback(log.args);
1155
+ });
1156
+ },
1157
+ });
1158
+ },
1159
+ /**
1160
+ * Watch RoleRevoked events
1161
+ * @param callback Function to call when event is emitted
1162
+ * @param filter Optional filter for indexed parameters
1163
+ * @returns Unwatch function to stop listening
1164
+ */
1165
+ RoleRevoked: (callback, filter) => {
1166
+ return this.publicClient.watchContractEvent({
1167
+ address: this.contractAddress,
1168
+ abi: exports.OToken_jsonAbi,
1169
+ eventName: 'RoleRevoked',
1170
+ args: filter,
1171
+ onLogs: (logs) => {
1172
+ logs.forEach((log) => {
1173
+ callback(log.args);
1174
+ });
1175
+ },
1176
+ });
1177
+ },
1178
+ /**
1179
+ * Watch Transfer events
1180
+ * @param callback Function to call when event is emitted
1181
+ * @param filter Optional filter for indexed parameters
1182
+ * @returns Unwatch function to stop listening
1183
+ */
1184
+ Transfer: (callback, filter) => {
1185
+ return this.publicClient.watchContractEvent({
1186
+ address: this.contractAddress,
1187
+ abi: exports.OToken_jsonAbi,
1188
+ eventName: 'Transfer',
1189
+ args: filter,
1190
+ onLogs: (logs) => {
1191
+ logs.forEach((log) => {
1192
+ callback(log.args);
1193
+ });
1194
+ },
1195
+ });
1196
+ },
1197
+ /**
1198
+ * Watch Unpaused events
1199
+ * @param callback Function to call when event is emitted
1200
+ * @param filter Optional filter for indexed parameters
1201
+ * @returns Unwatch function to stop listening
1202
+ */
1203
+ Unpaused: (callback) => {
1204
+ return this.publicClient.watchContractEvent({
1205
+ address: this.contractAddress,
1206
+ abi: exports.OToken_jsonAbi,
1207
+ eventName: 'Unpaused',
1208
+ onLogs: (logs) => {
1209
+ logs.forEach((log) => {
1210
+ callback(log.args);
1211
+ });
1212
+ },
1213
+ });
1214
+ }
1215
+ };
1216
+ }
1217
+ }
1218
+ exports.OToken_json = OToken_json;