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