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