@gitmyabi/fet 1.0.0 → 1.0.1

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