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