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