@gitmyabi-stg/ldo 0.0.1

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