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