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