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