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