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