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