@gitmyabi/aix 0.0.0-stage → 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,1305 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * AIX ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const AIXAbi = [
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
+ "payable": false,
479
+ "stateMutability": "nonpayable",
480
+ "type": "constructor"
481
+ },
482
+ {
483
+ "payable": true,
484
+ "stateMutability": "payable",
485
+ "type": "fallback"
486
+ },
487
+ {
488
+ "anonymous": false,
489
+ "inputs": [
490
+ {
491
+ "indexed": true,
492
+ "name": "_token",
493
+ "type": "address"
494
+ },
495
+ {
496
+ "indexed": true,
497
+ "name": "_controller",
498
+ "type": "address"
499
+ },
500
+ {
501
+ "indexed": false,
502
+ "name": "_amount",
503
+ "type": "uint256"
504
+ }
505
+ ],
506
+ "name": "ClaimedTokens",
507
+ "type": "event"
508
+ },
509
+ {
510
+ "anonymous": false,
511
+ "inputs": [
512
+ {
513
+ "indexed": true,
514
+ "name": "_from",
515
+ "type": "address"
516
+ },
517
+ {
518
+ "indexed": true,
519
+ "name": "_to",
520
+ "type": "address"
521
+ },
522
+ {
523
+ "indexed": false,
524
+ "name": "_amount",
525
+ "type": "uint256"
526
+ }
527
+ ],
528
+ "name": "Transfer",
529
+ "type": "event"
530
+ },
531
+ {
532
+ "anonymous": false,
533
+ "inputs": [
534
+ {
535
+ "indexed": true,
536
+ "name": "_cloneToken",
537
+ "type": "address"
538
+ },
539
+ {
540
+ "indexed": false,
541
+ "name": "_snapshotBlock",
542
+ "type": "uint256"
543
+ }
544
+ ],
545
+ "name": "NewCloneToken",
546
+ "type": "event"
547
+ },
548
+ {
549
+ "anonymous": false,
550
+ "inputs": [
551
+ {
552
+ "indexed": true,
553
+ "name": "_owner",
554
+ "type": "address"
555
+ },
556
+ {
557
+ "indexed": true,
558
+ "name": "_spender",
559
+ "type": "address"
560
+ },
561
+ {
562
+ "indexed": false,
563
+ "name": "_amount",
564
+ "type": "uint256"
565
+ }
566
+ ],
567
+ "name": "Approval",
568
+ "type": "event"
569
+ }
570
+ ] as const satisfies Abi;
571
+
572
+ /**
573
+ * Type-safe ABI for AIX
574
+ */
575
+ export type AIXAbi = typeof AIXAbi;
576
+
577
+ /**
578
+ * Contract instance type for AIX
579
+ */
580
+ // Use any for contract type to avoid complex viem type issues
581
+ // The runtime behavior is type-safe through viem's ABI typing
582
+ export type AIXContract = any;
583
+
584
+ /**
585
+ * AIX Contract Class
586
+ *
587
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
588
+ *
589
+ * @example
590
+ * ```typescript
591
+ * import { createPublicClient, createWalletClient, http } from 'viem';
592
+ * import { mainnet } from 'viem/chains';
593
+ * import { AIX } from 'AIX';
594
+ *
595
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
596
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
597
+ *
598
+ * const contract = new AIX('0x...', { publicClient, walletClient });
599
+ *
600
+ * // Read functions
601
+ * const result = await contract.balanceOf('0x...');
602
+ *
603
+ * // Write functions
604
+ * const hash = await contract.transfer('0x...', 1000n);
605
+ *
606
+ * // Simulate transactions (dry-run)
607
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
608
+ * console.log('Gas estimate:', simulation.request.gas);
609
+ *
610
+ * // Watch events
611
+ * const unwatch = contract.watch.Transfer((event) => {
612
+ * console.log('Transfer event:', event);
613
+ * });
614
+ * ```
615
+ */
616
+ export class AIX {
617
+ private contract: AIXContract;
618
+ private contractAddress: Address;
619
+ private publicClient: PublicClient;
620
+
621
+ constructor(
622
+ address: Address,
623
+ clients: {
624
+ publicClient: PublicClient;
625
+ walletClient?: WalletClient;
626
+ }
627
+ ) {
628
+ this.contractAddress = address;
629
+ this.publicClient = clients.publicClient;
630
+ this.contract = getContract({
631
+ address,
632
+ abi: AIXAbi,
633
+ client: {
634
+ public: clients.publicClient,
635
+ wallet: clients.walletClient,
636
+ },
637
+ });
638
+ }
639
+
640
+ /**
641
+ * Get the contract address
642
+ */
643
+ get address(): Address {
644
+ return this.contractAddress;
645
+ }
646
+
647
+ /**
648
+ * Get the underlying viem contract instance.
649
+ */
650
+ getContract(): AIXContract {
651
+ return this.contract;
652
+ }
653
+
654
+ /**
655
+ * name
656
+ * view
657
+ */
658
+ async name(): Promise<string> {
659
+ return this.contract.read.name() as Promise<string>;
660
+ }
661
+
662
+ /**
663
+ * creationBlock
664
+ * view
665
+ */
666
+ async creationBlock(): Promise<bigint> {
667
+ return this.contract.read.creationBlock() as Promise<bigint>;
668
+ }
669
+
670
+ /**
671
+ * totalSupply
672
+ * view
673
+ */
674
+ async totalSupply(): Promise<bigint> {
675
+ return this.contract.read.totalSupply() as Promise<bigint>;
676
+ }
677
+
678
+ /**
679
+ * decimals
680
+ * view
681
+ */
682
+ async decimals(): Promise<bigint> {
683
+ return this.contract.read.decimals() as Promise<bigint>;
684
+ }
685
+
686
+ /**
687
+ * balanceOfAt
688
+ * view
689
+ */
690
+ async balanceOfAt(_owner: `0x${string}`, _blockNumber: bigint): Promise<bigint> {
691
+ return this.contract.read.balanceOfAt([_owner, _blockNumber] as const) as Promise<bigint>;
692
+ }
693
+
694
+ /**
695
+ * version
696
+ * view
697
+ */
698
+ async version(): Promise<string> {
699
+ return this.contract.read.version() as Promise<string>;
700
+ }
701
+
702
+ /**
703
+ * balanceOf
704
+ * view
705
+ */
706
+ async balanceOf(_owner: `0x${string}`): Promise<bigint> {
707
+ return this.contract.read.balanceOf([_owner] as const) as Promise<bigint>;
708
+ }
709
+
710
+ /**
711
+ * parentToken
712
+ * view
713
+ */
714
+ async parentToken(): Promise<`0x${string}`> {
715
+ return this.contract.read.parentToken() as Promise<`0x${string}`>;
716
+ }
717
+
718
+ /**
719
+ * symbol
720
+ * view
721
+ */
722
+ async symbol(): Promise<string> {
723
+ return this.contract.read.symbol() as Promise<string>;
724
+ }
725
+
726
+ /**
727
+ * totalSupplyAt
728
+ * view
729
+ */
730
+ async totalSupplyAt(_blockNumber: bigint): Promise<bigint> {
731
+ return this.contract.read.totalSupplyAt([_blockNumber] as const) as Promise<bigint>;
732
+ }
733
+
734
+ /**
735
+ * transfersEnabled
736
+ * view
737
+ */
738
+ async transfersEnabled(): Promise<boolean> {
739
+ return this.contract.read.transfersEnabled() as Promise<boolean>;
740
+ }
741
+
742
+ /**
743
+ * parentSnapShotBlock
744
+ * view
745
+ */
746
+ async parentSnapShotBlock(): Promise<bigint> {
747
+ return this.contract.read.parentSnapShotBlock() as Promise<bigint>;
748
+ }
749
+
750
+ /**
751
+ * allowance
752
+ * view
753
+ */
754
+ async allowance(_owner: `0x${string}`, _spender: `0x${string}`): Promise<bigint> {
755
+ return this.contract.read.allowance([_owner, _spender] as const) as Promise<bigint>;
756
+ }
757
+
758
+ /**
759
+ * tokenFactory
760
+ * view
761
+ */
762
+ async tokenFactory(): Promise<`0x${string}`> {
763
+ return this.contract.read.tokenFactory() as Promise<`0x${string}`>;
764
+ }
765
+
766
+ /**
767
+ * controller
768
+ * view
769
+ */
770
+ async controller(): Promise<`0x${string}`> {
771
+ return this.contract.read.controller() as Promise<`0x${string}`>;
772
+ }
773
+
774
+ /**
775
+ * approve
776
+ * nonpayable
777
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
778
+ */
779
+ async approve(_spender: `0x${string}`, _amount: bigint, options?: {
780
+ accessList?: import('viem').AccessList;
781
+ authorizationList?: import('viem').AuthorizationList;
782
+ chain?: import('viem').Chain | null;
783
+ dataSuffix?: `0x${string}`;
784
+ gas?: bigint;
785
+ gasPrice?: bigint;
786
+ maxFeePerGas?: bigint;
787
+ maxPriorityFeePerGas?: bigint;
788
+ nonce?: number;
789
+ value?: bigint;
790
+ }): Promise<`0x${string}`> {
791
+ if (!this.contract.write) {
792
+ throw new Error('Wallet client is required for write operations');
793
+ }
794
+ return this.contract.write.approve([_spender, _amount] as const, options) as Promise<`0x${string}`>;
795
+ }
796
+
797
+ /**
798
+ * transferFrom
799
+ * nonpayable
800
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
801
+ */
802
+ async transferFrom(_from: `0x${string}`, _to: `0x${string}`, _amount: bigint, options?: {
803
+ accessList?: import('viem').AccessList;
804
+ authorizationList?: import('viem').AuthorizationList;
805
+ chain?: import('viem').Chain | null;
806
+ dataSuffix?: `0x${string}`;
807
+ gas?: bigint;
808
+ gasPrice?: bigint;
809
+ maxFeePerGas?: bigint;
810
+ maxPriorityFeePerGas?: bigint;
811
+ nonce?: number;
812
+ value?: bigint;
813
+ }): Promise<`0x${string}`> {
814
+ if (!this.contract.write) {
815
+ throw new Error('Wallet client is required for write operations');
816
+ }
817
+ return this.contract.write.transferFrom([_from, _to, _amount] as const, options) as Promise<`0x${string}`>;
818
+ }
819
+
820
+ /**
821
+ * changeController
822
+ * nonpayable
823
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
824
+ */
825
+ async changeController(_newController: `0x${string}`, options?: {
826
+ accessList?: import('viem').AccessList;
827
+ authorizationList?: import('viem').AuthorizationList;
828
+ chain?: import('viem').Chain | null;
829
+ dataSuffix?: `0x${string}`;
830
+ gas?: bigint;
831
+ gasPrice?: bigint;
832
+ maxFeePerGas?: bigint;
833
+ maxPriorityFeePerGas?: bigint;
834
+ nonce?: number;
835
+ value?: bigint;
836
+ }): Promise<`0x${string}`> {
837
+ if (!this.contract.write) {
838
+ throw new Error('Wallet client is required for write operations');
839
+ }
840
+ return this.contract.write.changeController([_newController] as const, options) as Promise<`0x${string}`>;
841
+ }
842
+
843
+ /**
844
+ * createCloneToken
845
+ * nonpayable
846
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
847
+ */
848
+ async createCloneToken(_cloneTokenName: string, _cloneDecimalUnits: bigint, _cloneTokenSymbol: string, _snapshotBlock: bigint, _transfersEnabled: boolean, options?: {
849
+ accessList?: import('viem').AccessList;
850
+ authorizationList?: import('viem').AuthorizationList;
851
+ chain?: import('viem').Chain | null;
852
+ dataSuffix?: `0x${string}`;
853
+ gas?: bigint;
854
+ gasPrice?: bigint;
855
+ maxFeePerGas?: bigint;
856
+ maxPriorityFeePerGas?: bigint;
857
+ nonce?: number;
858
+ value?: bigint;
859
+ }): Promise<`0x${string}`> {
860
+ if (!this.contract.write) {
861
+ throw new Error('Wallet client is required for write operations');
862
+ }
863
+ return this.contract.write.createCloneToken([_cloneTokenName, _cloneDecimalUnits, _cloneTokenSymbol, _snapshotBlock, _transfersEnabled] as const, options) as Promise<`0x${string}`>;
864
+ }
865
+
866
+ /**
867
+ * generateTokens
868
+ * nonpayable
869
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
870
+ */
871
+ async generateTokens(_owner: `0x${string}`, _amount: bigint, options?: {
872
+ accessList?: import('viem').AccessList;
873
+ authorizationList?: import('viem').AuthorizationList;
874
+ chain?: import('viem').Chain | null;
875
+ dataSuffix?: `0x${string}`;
876
+ gas?: bigint;
877
+ gasPrice?: bigint;
878
+ maxFeePerGas?: bigint;
879
+ maxPriorityFeePerGas?: bigint;
880
+ nonce?: number;
881
+ value?: bigint;
882
+ }): Promise<`0x${string}`> {
883
+ if (!this.contract.write) {
884
+ throw new Error('Wallet client is required for write operations');
885
+ }
886
+ return this.contract.write.generateTokens([_owner, _amount] as const, options) as Promise<`0x${string}`>;
887
+ }
888
+
889
+ /**
890
+ * transfer
891
+ * nonpayable
892
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
893
+ */
894
+ async transfer(_to: `0x${string}`, _amount: bigint, options?: {
895
+ accessList?: import('viem').AccessList;
896
+ authorizationList?: import('viem').AuthorizationList;
897
+ chain?: import('viem').Chain | null;
898
+ dataSuffix?: `0x${string}`;
899
+ gas?: bigint;
900
+ gasPrice?: bigint;
901
+ maxFeePerGas?: bigint;
902
+ maxPriorityFeePerGas?: bigint;
903
+ nonce?: number;
904
+ value?: bigint;
905
+ }): Promise<`0x${string}`> {
906
+ if (!this.contract.write) {
907
+ throw new Error('Wallet client is required for write operations');
908
+ }
909
+ return this.contract.write.transfer([_to, _amount] as const, options) as Promise<`0x${string}`>;
910
+ }
911
+
912
+ /**
913
+ * approveAndCall
914
+ * nonpayable
915
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
916
+ */
917
+ async approveAndCall(_spender: `0x${string}`, _amount: bigint, _extraData: `0x${string}`, options?: {
918
+ accessList?: import('viem').AccessList;
919
+ authorizationList?: import('viem').AuthorizationList;
920
+ chain?: import('viem').Chain | null;
921
+ dataSuffix?: `0x${string}`;
922
+ gas?: bigint;
923
+ gasPrice?: bigint;
924
+ maxFeePerGas?: bigint;
925
+ maxPriorityFeePerGas?: bigint;
926
+ nonce?: number;
927
+ value?: bigint;
928
+ }): Promise<`0x${string}`> {
929
+ if (!this.contract.write) {
930
+ throw new Error('Wallet client is required for write operations');
931
+ }
932
+ return this.contract.write.approveAndCall([_spender, _amount, _extraData] as const, options) as Promise<`0x${string}`>;
933
+ }
934
+
935
+ /**
936
+ * destroyTokens
937
+ * nonpayable
938
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
939
+ */
940
+ async destroyTokens(_owner: `0x${string}`, _amount: bigint, options?: {
941
+ accessList?: import('viem').AccessList;
942
+ authorizationList?: import('viem').AuthorizationList;
943
+ chain?: import('viem').Chain | null;
944
+ dataSuffix?: `0x${string}`;
945
+ gas?: bigint;
946
+ gasPrice?: bigint;
947
+ maxFeePerGas?: bigint;
948
+ maxPriorityFeePerGas?: bigint;
949
+ nonce?: number;
950
+ value?: bigint;
951
+ }): Promise<`0x${string}`> {
952
+ if (!this.contract.write) {
953
+ throw new Error('Wallet client is required for write operations');
954
+ }
955
+ return this.contract.write.destroyTokens([_owner, _amount] as const, options) as Promise<`0x${string}`>;
956
+ }
957
+
958
+ /**
959
+ * claimTokens
960
+ * nonpayable
961
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
962
+ */
963
+ async claimTokens(_token: `0x${string}`, options?: {
964
+ accessList?: import('viem').AccessList;
965
+ authorizationList?: import('viem').AuthorizationList;
966
+ chain?: import('viem').Chain | null;
967
+ dataSuffix?: `0x${string}`;
968
+ gas?: bigint;
969
+ gasPrice?: bigint;
970
+ maxFeePerGas?: bigint;
971
+ maxPriorityFeePerGas?: bigint;
972
+ nonce?: number;
973
+ value?: bigint;
974
+ }): Promise<`0x${string}`> {
975
+ if (!this.contract.write) {
976
+ throw new Error('Wallet client is required for write operations');
977
+ }
978
+ return this.contract.write.claimTokens([_token] as const, options) as Promise<`0x${string}`>;
979
+ }
980
+
981
+ /**
982
+ * enableTransfers
983
+ * nonpayable
984
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
985
+ */
986
+ async enableTransfers(_transfersEnabled: boolean, options?: {
987
+ accessList?: import('viem').AccessList;
988
+ authorizationList?: import('viem').AuthorizationList;
989
+ chain?: import('viem').Chain | null;
990
+ dataSuffix?: `0x${string}`;
991
+ gas?: bigint;
992
+ gasPrice?: bigint;
993
+ maxFeePerGas?: bigint;
994
+ maxPriorityFeePerGas?: bigint;
995
+ nonce?: number;
996
+ value?: bigint;
997
+ }): Promise<`0x${string}`> {
998
+ if (!this.contract.write) {
999
+ throw new Error('Wallet client is required for write operations');
1000
+ }
1001
+ return this.contract.write.enableTransfers([_transfersEnabled] as const, options) as Promise<`0x${string}`>;
1002
+ }
1003
+
1004
+
1005
+
1006
+ /**
1007
+ * Simulate contract write operations (dry-run without sending transaction)
1008
+ *
1009
+ * @example
1010
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1011
+ * console.log('Gas estimate:', result.request.gas);
1012
+ * console.log('Would succeed:', result.result);
1013
+ */
1014
+ get simulate() {
1015
+ const contract = this.contract;
1016
+ if (!contract.simulate) {
1017
+ throw new Error('Public client is required for simulation');
1018
+ }
1019
+ return {
1020
+ /**
1021
+ * Simulate approve
1022
+ * Returns gas estimate and result without sending transaction
1023
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1024
+ */
1025
+ async approve(_spender: `0x${string}`, _amount: bigint, options?: {
1026
+ accessList?: import('viem').AccessList;
1027
+ authorizationList?: import('viem').AuthorizationList;
1028
+ chain?: import('viem').Chain | null;
1029
+ dataSuffix?: `0x${string}`;
1030
+ gas?: bigint;
1031
+ gasPrice?: bigint;
1032
+ maxFeePerGas?: bigint;
1033
+ maxPriorityFeePerGas?: bigint;
1034
+ nonce?: number;
1035
+ value?: bigint;
1036
+ }): Promise<boolean> {
1037
+ return contract.simulate.approve([_spender, _amount] as const, options) as Promise<boolean>;
1038
+ },
1039
+ /**
1040
+ * Simulate transferFrom
1041
+ * Returns gas estimate and result without sending transaction
1042
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1043
+ */
1044
+ async transferFrom(_from: `0x${string}`, _to: `0x${string}`, _amount: bigint, options?: {
1045
+ accessList?: import('viem').AccessList;
1046
+ authorizationList?: import('viem').AuthorizationList;
1047
+ chain?: import('viem').Chain | null;
1048
+ dataSuffix?: `0x${string}`;
1049
+ gas?: bigint;
1050
+ gasPrice?: bigint;
1051
+ maxFeePerGas?: bigint;
1052
+ maxPriorityFeePerGas?: bigint;
1053
+ nonce?: number;
1054
+ value?: bigint;
1055
+ }): Promise<boolean> {
1056
+ return contract.simulate.transferFrom([_from, _to, _amount] as const, options) as Promise<boolean>;
1057
+ },
1058
+ /**
1059
+ * Simulate changeController
1060
+ * Returns gas estimate and result without sending transaction
1061
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1062
+ */
1063
+ async changeController(_newController: `0x${string}`, options?: {
1064
+ accessList?: import('viem').AccessList;
1065
+ authorizationList?: import('viem').AuthorizationList;
1066
+ chain?: import('viem').Chain | null;
1067
+ dataSuffix?: `0x${string}`;
1068
+ gas?: bigint;
1069
+ gasPrice?: bigint;
1070
+ maxFeePerGas?: bigint;
1071
+ maxPriorityFeePerGas?: bigint;
1072
+ nonce?: number;
1073
+ value?: bigint;
1074
+ }): Promise<void> {
1075
+ return contract.simulate.changeController([_newController] as const, options) as Promise<void>;
1076
+ },
1077
+ /**
1078
+ * Simulate createCloneToken
1079
+ * Returns gas estimate and result without sending transaction
1080
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1081
+ */
1082
+ async createCloneToken(_cloneTokenName: string, _cloneDecimalUnits: bigint, _cloneTokenSymbol: string, _snapshotBlock: bigint, _transfersEnabled: boolean, options?: {
1083
+ accessList?: import('viem').AccessList;
1084
+ authorizationList?: import('viem').AuthorizationList;
1085
+ chain?: import('viem').Chain | null;
1086
+ dataSuffix?: `0x${string}`;
1087
+ gas?: bigint;
1088
+ gasPrice?: bigint;
1089
+ maxFeePerGas?: bigint;
1090
+ maxPriorityFeePerGas?: bigint;
1091
+ nonce?: number;
1092
+ value?: bigint;
1093
+ }): Promise<`0x${string}`> {
1094
+ return contract.simulate.createCloneToken([_cloneTokenName, _cloneDecimalUnits, _cloneTokenSymbol, _snapshotBlock, _transfersEnabled] as const, options) as Promise<`0x${string}`>;
1095
+ },
1096
+ /**
1097
+ * Simulate generateTokens
1098
+ * Returns gas estimate and result without sending transaction
1099
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1100
+ */
1101
+ async generateTokens(_owner: `0x${string}`, _amount: bigint, options?: {
1102
+ accessList?: import('viem').AccessList;
1103
+ authorizationList?: import('viem').AuthorizationList;
1104
+ chain?: import('viem').Chain | null;
1105
+ dataSuffix?: `0x${string}`;
1106
+ gas?: bigint;
1107
+ gasPrice?: bigint;
1108
+ maxFeePerGas?: bigint;
1109
+ maxPriorityFeePerGas?: bigint;
1110
+ nonce?: number;
1111
+ value?: bigint;
1112
+ }): Promise<boolean> {
1113
+ return contract.simulate.generateTokens([_owner, _amount] as const, options) as Promise<boolean>;
1114
+ },
1115
+ /**
1116
+ * Simulate transfer
1117
+ * Returns gas estimate and result without sending transaction
1118
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1119
+ */
1120
+ async transfer(_to: `0x${string}`, _amount: bigint, options?: {
1121
+ accessList?: import('viem').AccessList;
1122
+ authorizationList?: import('viem').AuthorizationList;
1123
+ chain?: import('viem').Chain | null;
1124
+ dataSuffix?: `0x${string}`;
1125
+ gas?: bigint;
1126
+ gasPrice?: bigint;
1127
+ maxFeePerGas?: bigint;
1128
+ maxPriorityFeePerGas?: bigint;
1129
+ nonce?: number;
1130
+ value?: bigint;
1131
+ }): Promise<boolean> {
1132
+ return contract.simulate.transfer([_to, _amount] as const, options) as Promise<boolean>;
1133
+ },
1134
+ /**
1135
+ * Simulate approveAndCall
1136
+ * Returns gas estimate and result without sending transaction
1137
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1138
+ */
1139
+ async approveAndCall(_spender: `0x${string}`, _amount: bigint, _extraData: `0x${string}`, options?: {
1140
+ accessList?: import('viem').AccessList;
1141
+ authorizationList?: import('viem').AuthorizationList;
1142
+ chain?: import('viem').Chain | null;
1143
+ dataSuffix?: `0x${string}`;
1144
+ gas?: bigint;
1145
+ gasPrice?: bigint;
1146
+ maxFeePerGas?: bigint;
1147
+ maxPriorityFeePerGas?: bigint;
1148
+ nonce?: number;
1149
+ value?: bigint;
1150
+ }): Promise<boolean> {
1151
+ return contract.simulate.approveAndCall([_spender, _amount, _extraData] as const, options) as Promise<boolean>;
1152
+ },
1153
+ /**
1154
+ * Simulate destroyTokens
1155
+ * Returns gas estimate and result without sending transaction
1156
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1157
+ */
1158
+ async destroyTokens(_owner: `0x${string}`, _amount: bigint, options?: {
1159
+ accessList?: import('viem').AccessList;
1160
+ authorizationList?: import('viem').AuthorizationList;
1161
+ chain?: import('viem').Chain | null;
1162
+ dataSuffix?: `0x${string}`;
1163
+ gas?: bigint;
1164
+ gasPrice?: bigint;
1165
+ maxFeePerGas?: bigint;
1166
+ maxPriorityFeePerGas?: bigint;
1167
+ nonce?: number;
1168
+ value?: bigint;
1169
+ }): Promise<boolean> {
1170
+ return contract.simulate.destroyTokens([_owner, _amount] as const, options) as Promise<boolean>;
1171
+ },
1172
+ /**
1173
+ * Simulate claimTokens
1174
+ * Returns gas estimate and result without sending transaction
1175
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1176
+ */
1177
+ async claimTokens(_token: `0x${string}`, options?: {
1178
+ accessList?: import('viem').AccessList;
1179
+ authorizationList?: import('viem').AuthorizationList;
1180
+ chain?: import('viem').Chain | null;
1181
+ dataSuffix?: `0x${string}`;
1182
+ gas?: bigint;
1183
+ gasPrice?: bigint;
1184
+ maxFeePerGas?: bigint;
1185
+ maxPriorityFeePerGas?: bigint;
1186
+ nonce?: number;
1187
+ value?: bigint;
1188
+ }): Promise<void> {
1189
+ return contract.simulate.claimTokens([_token] as const, options) as Promise<void>;
1190
+ },
1191
+ /**
1192
+ * Simulate enableTransfers
1193
+ * Returns gas estimate and result without sending transaction
1194
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1195
+ */
1196
+ async enableTransfers(_transfersEnabled: boolean, options?: {
1197
+ accessList?: import('viem').AccessList;
1198
+ authorizationList?: import('viem').AuthorizationList;
1199
+ chain?: import('viem').Chain | null;
1200
+ dataSuffix?: `0x${string}`;
1201
+ gas?: bigint;
1202
+ gasPrice?: bigint;
1203
+ maxFeePerGas?: bigint;
1204
+ maxPriorityFeePerGas?: bigint;
1205
+ nonce?: number;
1206
+ value?: bigint;
1207
+ }): Promise<void> {
1208
+ return contract.simulate.enableTransfers([_transfersEnabled] as const, options) as Promise<void>;
1209
+ }
1210
+ };
1211
+ }
1212
+
1213
+ /**
1214
+ * Watch contract events
1215
+ *
1216
+ * @example
1217
+ * // Watch all Transfer events
1218
+ * const unwatch = contract.watch.Transfer((event) => {
1219
+ * console.log('Transfer:', event);
1220
+ * });
1221
+ *
1222
+ * // Stop watching
1223
+ * unwatch();
1224
+ */
1225
+ get watch() {
1226
+ return {
1227
+ /**
1228
+ * Watch ClaimedTokens events
1229
+ * @param callback Function to call when event is emitted
1230
+ * @param filter Optional filter for indexed parameters
1231
+ * @returns Unwatch function to stop listening
1232
+ */
1233
+ 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 }) => {
1234
+ return this.publicClient.watchContractEvent({
1235
+ address: this.contractAddress,
1236
+ abi: AIXAbi,
1237
+ eventName: 'ClaimedTokens',
1238
+ args: filter as any,
1239
+ onLogs: (logs: any[]) => {
1240
+ logs.forEach((log: any) => {
1241
+ callback(log.args as any);
1242
+ });
1243
+ },
1244
+ }) as () => void;
1245
+ },
1246
+ /**
1247
+ * Watch Transfer events
1248
+ * @param callback Function to call when event is emitted
1249
+ * @param filter Optional filter for indexed parameters
1250
+ * @returns Unwatch function to stop listening
1251
+ */
1252
+ 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 }) => {
1253
+ return this.publicClient.watchContractEvent({
1254
+ address: this.contractAddress,
1255
+ abi: AIXAbi,
1256
+ eventName: 'Transfer',
1257
+ args: filter as any,
1258
+ onLogs: (logs: any[]) => {
1259
+ logs.forEach((log: any) => {
1260
+ callback(log.args as any);
1261
+ });
1262
+ },
1263
+ }) as () => void;
1264
+ },
1265
+ /**
1266
+ * Watch NewCloneToken events
1267
+ * @param callback Function to call when event is emitted
1268
+ * @param filter Optional filter for indexed parameters
1269
+ * @returns Unwatch function to stop listening
1270
+ */
1271
+ NewCloneToken: (callback: (event: { _cloneToken: `0x${string}`; _snapshotBlock: bigint }) => void, filter?: { _cloneToken?: `0x${string}` | `0x${string}`[] | null }) => {
1272
+ return this.publicClient.watchContractEvent({
1273
+ address: this.contractAddress,
1274
+ abi: AIXAbi,
1275
+ eventName: 'NewCloneToken',
1276
+ args: filter as any,
1277
+ onLogs: (logs: any[]) => {
1278
+ logs.forEach((log: any) => {
1279
+ callback(log.args as any);
1280
+ });
1281
+ },
1282
+ }) as () => void;
1283
+ },
1284
+ /**
1285
+ * Watch Approval events
1286
+ * @param callback Function to call when event is emitted
1287
+ * @param filter Optional filter for indexed parameters
1288
+ * @returns Unwatch function to stop listening
1289
+ */
1290
+ 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 }) => {
1291
+ return this.publicClient.watchContractEvent({
1292
+ address: this.contractAddress,
1293
+ abi: AIXAbi,
1294
+ eventName: 'Approval',
1295
+ args: filter as any,
1296
+ onLogs: (logs: any[]) => {
1297
+ logs.forEach((log: any) => {
1298
+ callback(log.args as any);
1299
+ });
1300
+ },
1301
+ }) as () => void;
1302
+ }
1303
+ };
1304
+ }
1305
+ }