@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,980 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OokiToken = exports.OokiTokenAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * OokiToken ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.OokiTokenAbi = [
11
+ {
12
+ "inputs": [],
13
+ "stateMutability": "nonpayable",
14
+ "type": "constructor"
15
+ },
16
+ {
17
+ "anonymous": false,
18
+ "inputs": [
19
+ {
20
+ "indexed": true,
21
+ "internalType": "address",
22
+ "name": "owner",
23
+ "type": "address"
24
+ },
25
+ {
26
+ "indexed": true,
27
+ "internalType": "address",
28
+ "name": "spender",
29
+ "type": "address"
30
+ },
31
+ {
32
+ "indexed": false,
33
+ "internalType": "uint256",
34
+ "name": "value",
35
+ "type": "uint256"
36
+ }
37
+ ],
38
+ "name": "Approval",
39
+ "type": "event"
40
+ },
41
+ {
42
+ "anonymous": false,
43
+ "inputs": [
44
+ {
45
+ "indexed": true,
46
+ "internalType": "address",
47
+ "name": "previousOwner",
48
+ "type": "address"
49
+ },
50
+ {
51
+ "indexed": true,
52
+ "internalType": "address",
53
+ "name": "newOwner",
54
+ "type": "address"
55
+ }
56
+ ],
57
+ "name": "OwnershipTransferred",
58
+ "type": "event"
59
+ },
60
+ {
61
+ "anonymous": false,
62
+ "inputs": [
63
+ {
64
+ "indexed": true,
65
+ "internalType": "address",
66
+ "name": "from",
67
+ "type": "address"
68
+ },
69
+ {
70
+ "indexed": true,
71
+ "internalType": "address",
72
+ "name": "to",
73
+ "type": "address"
74
+ },
75
+ {
76
+ "indexed": false,
77
+ "internalType": "uint256",
78
+ "name": "value",
79
+ "type": "uint256"
80
+ }
81
+ ],
82
+ "name": "Transfer",
83
+ "type": "event"
84
+ },
85
+ {
86
+ "inputs": [],
87
+ "name": "DOMAIN_SEPARATOR",
88
+ "outputs": [
89
+ {
90
+ "internalType": "bytes32",
91
+ "name": "",
92
+ "type": "bytes32"
93
+ }
94
+ ],
95
+ "stateMutability": "view",
96
+ "type": "function"
97
+ },
98
+ {
99
+ "inputs": [],
100
+ "name": "PERMIT_TYPEHASH",
101
+ "outputs": [
102
+ {
103
+ "internalType": "bytes32",
104
+ "name": "",
105
+ "type": "bytes32"
106
+ }
107
+ ],
108
+ "stateMutability": "view",
109
+ "type": "function"
110
+ },
111
+ {
112
+ "inputs": [
113
+ {
114
+ "internalType": "address",
115
+ "name": "owner",
116
+ "type": "address"
117
+ },
118
+ {
119
+ "internalType": "address",
120
+ "name": "spender",
121
+ "type": "address"
122
+ }
123
+ ],
124
+ "name": "allowance",
125
+ "outputs": [
126
+ {
127
+ "internalType": "uint256",
128
+ "name": "",
129
+ "type": "uint256"
130
+ }
131
+ ],
132
+ "stateMutability": "view",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "inputs": [
137
+ {
138
+ "internalType": "address",
139
+ "name": "spender",
140
+ "type": "address"
141
+ },
142
+ {
143
+ "internalType": "uint256",
144
+ "name": "amount",
145
+ "type": "uint256"
146
+ }
147
+ ],
148
+ "name": "approve",
149
+ "outputs": [
150
+ {
151
+ "internalType": "bool",
152
+ "name": "",
153
+ "type": "bool"
154
+ }
155
+ ],
156
+ "stateMutability": "nonpayable",
157
+ "type": "function"
158
+ },
159
+ {
160
+ "inputs": [
161
+ {
162
+ "internalType": "address",
163
+ "name": "account",
164
+ "type": "address"
165
+ }
166
+ ],
167
+ "name": "balanceOf",
168
+ "outputs": [
169
+ {
170
+ "internalType": "uint256",
171
+ "name": "",
172
+ "type": "uint256"
173
+ }
174
+ ],
175
+ "stateMutability": "view",
176
+ "type": "function"
177
+ },
178
+ {
179
+ "inputs": [
180
+ {
181
+ "internalType": "uint256",
182
+ "name": "amount",
183
+ "type": "uint256"
184
+ }
185
+ ],
186
+ "name": "burn",
187
+ "outputs": [],
188
+ "stateMutability": "nonpayable",
189
+ "type": "function"
190
+ },
191
+ {
192
+ "inputs": [
193
+ {
194
+ "internalType": "address",
195
+ "name": "account",
196
+ "type": "address"
197
+ },
198
+ {
199
+ "internalType": "uint256",
200
+ "name": "amount",
201
+ "type": "uint256"
202
+ }
203
+ ],
204
+ "name": "burnFrom",
205
+ "outputs": [],
206
+ "stateMutability": "nonpayable",
207
+ "type": "function"
208
+ },
209
+ {
210
+ "inputs": [],
211
+ "name": "decimals",
212
+ "outputs": [
213
+ {
214
+ "internalType": "uint8",
215
+ "name": "",
216
+ "type": "uint8"
217
+ }
218
+ ],
219
+ "stateMutability": "view",
220
+ "type": "function"
221
+ },
222
+ {
223
+ "inputs": [
224
+ {
225
+ "internalType": "address",
226
+ "name": "spender",
227
+ "type": "address"
228
+ },
229
+ {
230
+ "internalType": "uint256",
231
+ "name": "subtractedValue",
232
+ "type": "uint256"
233
+ }
234
+ ],
235
+ "name": "decreaseAllowance",
236
+ "outputs": [
237
+ {
238
+ "internalType": "bool",
239
+ "name": "",
240
+ "type": "bool"
241
+ }
242
+ ],
243
+ "stateMutability": "nonpayable",
244
+ "type": "function"
245
+ },
246
+ {
247
+ "inputs": [],
248
+ "name": "implementation",
249
+ "outputs": [
250
+ {
251
+ "internalType": "address",
252
+ "name": "",
253
+ "type": "address"
254
+ }
255
+ ],
256
+ "stateMutability": "view",
257
+ "type": "function"
258
+ },
259
+ {
260
+ "inputs": [
261
+ {
262
+ "internalType": "address",
263
+ "name": "spender",
264
+ "type": "address"
265
+ },
266
+ {
267
+ "internalType": "uint256",
268
+ "name": "addedValue",
269
+ "type": "uint256"
270
+ }
271
+ ],
272
+ "name": "increaseAllowance",
273
+ "outputs": [
274
+ {
275
+ "internalType": "bool",
276
+ "name": "",
277
+ "type": "bool"
278
+ }
279
+ ],
280
+ "stateMutability": "nonpayable",
281
+ "type": "function"
282
+ },
283
+ {
284
+ "inputs": [],
285
+ "name": "initialize",
286
+ "outputs": [],
287
+ "stateMutability": "nonpayable",
288
+ "type": "function"
289
+ },
290
+ {
291
+ "inputs": [
292
+ {
293
+ "internalType": "address",
294
+ "name": "_to",
295
+ "type": "address"
296
+ },
297
+ {
298
+ "internalType": "uint256",
299
+ "name": "_amount",
300
+ "type": "uint256"
301
+ }
302
+ ],
303
+ "name": "mint",
304
+ "outputs": [],
305
+ "stateMutability": "nonpayable",
306
+ "type": "function"
307
+ },
308
+ {
309
+ "inputs": [],
310
+ "name": "name",
311
+ "outputs": [
312
+ {
313
+ "internalType": "string",
314
+ "name": "",
315
+ "type": "string"
316
+ }
317
+ ],
318
+ "stateMutability": "view",
319
+ "type": "function"
320
+ },
321
+ {
322
+ "inputs": [
323
+ {
324
+ "internalType": "address",
325
+ "name": "",
326
+ "type": "address"
327
+ }
328
+ ],
329
+ "name": "nonces",
330
+ "outputs": [
331
+ {
332
+ "internalType": "uint256",
333
+ "name": "",
334
+ "type": "uint256"
335
+ }
336
+ ],
337
+ "stateMutability": "view",
338
+ "type": "function"
339
+ },
340
+ {
341
+ "inputs": [],
342
+ "name": "owner",
343
+ "outputs": [
344
+ {
345
+ "internalType": "address",
346
+ "name": "",
347
+ "type": "address"
348
+ }
349
+ ],
350
+ "stateMutability": "view",
351
+ "type": "function"
352
+ },
353
+ {
354
+ "inputs": [
355
+ {
356
+ "internalType": "address",
357
+ "name": "owner",
358
+ "type": "address"
359
+ },
360
+ {
361
+ "internalType": "address",
362
+ "name": "spender",
363
+ "type": "address"
364
+ },
365
+ {
366
+ "internalType": "uint256",
367
+ "name": "value",
368
+ "type": "uint256"
369
+ },
370
+ {
371
+ "internalType": "uint256",
372
+ "name": "deadline",
373
+ "type": "uint256"
374
+ },
375
+ {
376
+ "internalType": "uint8",
377
+ "name": "v",
378
+ "type": "uint8"
379
+ },
380
+ {
381
+ "internalType": "bytes32",
382
+ "name": "r",
383
+ "type": "bytes32"
384
+ },
385
+ {
386
+ "internalType": "bytes32",
387
+ "name": "s",
388
+ "type": "bytes32"
389
+ }
390
+ ],
391
+ "name": "permit",
392
+ "outputs": [],
393
+ "stateMutability": "nonpayable",
394
+ "type": "function"
395
+ },
396
+ {
397
+ "inputs": [],
398
+ "name": "renounceOwnership",
399
+ "outputs": [],
400
+ "stateMutability": "nonpayable",
401
+ "type": "function"
402
+ },
403
+ {
404
+ "inputs": [
405
+ {
406
+ "internalType": "contract IERC20",
407
+ "name": "_token",
408
+ "type": "address"
409
+ }
410
+ ],
411
+ "name": "rescue",
412
+ "outputs": [],
413
+ "stateMutability": "nonpayable",
414
+ "type": "function"
415
+ },
416
+ {
417
+ "inputs": [],
418
+ "name": "symbol",
419
+ "outputs": [
420
+ {
421
+ "internalType": "string",
422
+ "name": "",
423
+ "type": "string"
424
+ }
425
+ ],
426
+ "stateMutability": "view",
427
+ "type": "function"
428
+ },
429
+ {
430
+ "inputs": [],
431
+ "name": "totalSupply",
432
+ "outputs": [
433
+ {
434
+ "internalType": "uint256",
435
+ "name": "",
436
+ "type": "uint256"
437
+ }
438
+ ],
439
+ "stateMutability": "view",
440
+ "type": "function"
441
+ },
442
+ {
443
+ "inputs": [
444
+ {
445
+ "internalType": "address",
446
+ "name": "recipient",
447
+ "type": "address"
448
+ },
449
+ {
450
+ "internalType": "uint256",
451
+ "name": "amount",
452
+ "type": "uint256"
453
+ }
454
+ ],
455
+ "name": "transfer",
456
+ "outputs": [
457
+ {
458
+ "internalType": "bool",
459
+ "name": "",
460
+ "type": "bool"
461
+ }
462
+ ],
463
+ "stateMutability": "nonpayable",
464
+ "type": "function"
465
+ },
466
+ {
467
+ "inputs": [
468
+ {
469
+ "internalType": "address",
470
+ "name": "sender",
471
+ "type": "address"
472
+ },
473
+ {
474
+ "internalType": "address",
475
+ "name": "recipient",
476
+ "type": "address"
477
+ },
478
+ {
479
+ "internalType": "uint256",
480
+ "name": "amount",
481
+ "type": "uint256"
482
+ }
483
+ ],
484
+ "name": "transferFrom",
485
+ "outputs": [
486
+ {
487
+ "internalType": "bool",
488
+ "name": "",
489
+ "type": "bool"
490
+ }
491
+ ],
492
+ "stateMutability": "nonpayable",
493
+ "type": "function"
494
+ },
495
+ {
496
+ "inputs": [
497
+ {
498
+ "internalType": "address",
499
+ "name": "newOwner",
500
+ "type": "address"
501
+ }
502
+ ],
503
+ "name": "transferOwnership",
504
+ "outputs": [],
505
+ "stateMutability": "nonpayable",
506
+ "type": "function"
507
+ }
508
+ ];
509
+ /**
510
+ * OokiToken Contract Class
511
+ *
512
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * import { createPublicClient, createWalletClient, http } from 'viem';
517
+ * import { mainnet } from 'viem/chains';
518
+ * import { OokiToken } from 'OokiToken';
519
+ *
520
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
521
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
522
+ *
523
+ * const contract = new OokiToken('0x...', { publicClient, walletClient });
524
+ *
525
+ * // Read functions
526
+ * const result = await contract.balanceOf('0x...');
527
+ *
528
+ * // Write functions
529
+ * const hash = await contract.transfer('0x...', 1000n);
530
+ *
531
+ * // Simulate transactions (dry-run)
532
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
533
+ * console.log('Gas estimate:', simulation.request.gas);
534
+ *
535
+ * // Watch events
536
+ * const unwatch = contract.watch.Transfer((event) => {
537
+ * console.log('Transfer event:', event);
538
+ * });
539
+ * ```
540
+ */
541
+ class OokiToken {
542
+ constructor(address, clients) {
543
+ this.contractAddress = address;
544
+ this.publicClient = clients.publicClient;
545
+ this.contract = (0, viem_1.getContract)({
546
+ address,
547
+ abi: exports.OokiTokenAbi,
548
+ client: {
549
+ public: clients.publicClient,
550
+ wallet: clients.walletClient,
551
+ },
552
+ });
553
+ }
554
+ /**
555
+ * Get the contract address
556
+ */
557
+ get address() {
558
+ return this.contractAddress;
559
+ }
560
+ /**
561
+ * Get the underlying viem contract instance.
562
+ */
563
+ getContract() {
564
+ return this.contract;
565
+ }
566
+ /**
567
+ * DOMAIN_SEPARATOR
568
+ * view
569
+ */
570
+ async DOMAIN_SEPARATOR() {
571
+ return this.contract.read.DOMAIN_SEPARATOR();
572
+ }
573
+ /**
574
+ * PERMIT_TYPEHASH
575
+ * view
576
+ */
577
+ async PERMIT_TYPEHASH() {
578
+ return this.contract.read.PERMIT_TYPEHASH();
579
+ }
580
+ /**
581
+ * allowance
582
+ * view
583
+ */
584
+ async allowance(owner, spender) {
585
+ return this.contract.read.allowance([owner, spender]);
586
+ }
587
+ /**
588
+ * balanceOf
589
+ * view
590
+ */
591
+ async balanceOf(account) {
592
+ return this.contract.read.balanceOf([account]);
593
+ }
594
+ /**
595
+ * decimals
596
+ * view
597
+ */
598
+ async decimals() {
599
+ return this.contract.read.decimals();
600
+ }
601
+ /**
602
+ * implementation
603
+ * view
604
+ */
605
+ async implementation() {
606
+ return this.contract.read.implementation();
607
+ }
608
+ /**
609
+ * name
610
+ * view
611
+ */
612
+ async name() {
613
+ return this.contract.read.name();
614
+ }
615
+ /**
616
+ * nonces
617
+ * view
618
+ */
619
+ async nonces(arg0) {
620
+ return this.contract.read.nonces([arg0]);
621
+ }
622
+ /**
623
+ * owner
624
+ * view
625
+ */
626
+ async owner() {
627
+ return this.contract.read.owner();
628
+ }
629
+ /**
630
+ * symbol
631
+ * view
632
+ */
633
+ async symbol() {
634
+ return this.contract.read.symbol();
635
+ }
636
+ /**
637
+ * totalSupply
638
+ * view
639
+ */
640
+ async totalSupply() {
641
+ return this.contract.read.totalSupply();
642
+ }
643
+ /**
644
+ * approve
645
+ * nonpayable
646
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
647
+ */
648
+ async approve(spender, amount, options) {
649
+ if (!this.contract.write) {
650
+ throw new Error('Wallet client is required for write operations');
651
+ }
652
+ return this.contract.write.approve([spender, amount], options);
653
+ }
654
+ /**
655
+ * burn
656
+ * nonpayable
657
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
658
+ */
659
+ async burn(amount, options) {
660
+ if (!this.contract.write) {
661
+ throw new Error('Wallet client is required for write operations');
662
+ }
663
+ return this.contract.write.burn([amount], options);
664
+ }
665
+ /**
666
+ * burnFrom
667
+ * nonpayable
668
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
669
+ */
670
+ async burnFrom(account, amount, options) {
671
+ if (!this.contract.write) {
672
+ throw new Error('Wallet client is required for write operations');
673
+ }
674
+ return this.contract.write.burnFrom([account, amount], options);
675
+ }
676
+ /**
677
+ * decreaseAllowance
678
+ * nonpayable
679
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
680
+ */
681
+ async decreaseAllowance(spender, subtractedValue, options) {
682
+ if (!this.contract.write) {
683
+ throw new Error('Wallet client is required for write operations');
684
+ }
685
+ return this.contract.write.decreaseAllowance([spender, subtractedValue], options);
686
+ }
687
+ /**
688
+ * increaseAllowance
689
+ * nonpayable
690
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
691
+ */
692
+ async increaseAllowance(spender, addedValue, options) {
693
+ if (!this.contract.write) {
694
+ throw new Error('Wallet client is required for write operations');
695
+ }
696
+ return this.contract.write.increaseAllowance([spender, addedValue], options);
697
+ }
698
+ /**
699
+ * initialize
700
+ * nonpayable
701
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
702
+ */
703
+ async initialize(options) {
704
+ if (!this.contract.write) {
705
+ throw new Error('Wallet client is required for write operations');
706
+ }
707
+ return this.contract.write.initialize(options);
708
+ }
709
+ /**
710
+ * mint
711
+ * nonpayable
712
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
713
+ */
714
+ async mint(_to, _amount, options) {
715
+ if (!this.contract.write) {
716
+ throw new Error('Wallet client is required for write operations');
717
+ }
718
+ return this.contract.write.mint([_to, _amount], options);
719
+ }
720
+ /**
721
+ * permit
722
+ * nonpayable
723
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
724
+ */
725
+ async permit(owner, spender, value, deadline, v, r, s, options) {
726
+ if (!this.contract.write) {
727
+ throw new Error('Wallet client is required for write operations');
728
+ }
729
+ return this.contract.write.permit([owner, spender, value, deadline, v, r, s], options);
730
+ }
731
+ /**
732
+ * renounceOwnership
733
+ * nonpayable
734
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
735
+ */
736
+ async renounceOwnership(options) {
737
+ if (!this.contract.write) {
738
+ throw new Error('Wallet client is required for write operations');
739
+ }
740
+ return this.contract.write.renounceOwnership(options);
741
+ }
742
+ /**
743
+ * rescue
744
+ * nonpayable
745
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
746
+ */
747
+ async rescue(_token, options) {
748
+ if (!this.contract.write) {
749
+ throw new Error('Wallet client is required for write operations');
750
+ }
751
+ return this.contract.write.rescue([_token], options);
752
+ }
753
+ /**
754
+ * transfer
755
+ * nonpayable
756
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
757
+ */
758
+ async transfer(recipient, amount, options) {
759
+ if (!this.contract.write) {
760
+ throw new Error('Wallet client is required for write operations');
761
+ }
762
+ return this.contract.write.transfer([recipient, amount], options);
763
+ }
764
+ /**
765
+ * transferFrom
766
+ * nonpayable
767
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
768
+ */
769
+ async transferFrom(sender, recipient, amount, options) {
770
+ if (!this.contract.write) {
771
+ throw new Error('Wallet client is required for write operations');
772
+ }
773
+ return this.contract.write.transferFrom([sender, recipient, amount], options);
774
+ }
775
+ /**
776
+ * transferOwnership
777
+ * nonpayable
778
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
779
+ */
780
+ async transferOwnership(newOwner, options) {
781
+ if (!this.contract.write) {
782
+ throw new Error('Wallet client is required for write operations');
783
+ }
784
+ return this.contract.write.transferOwnership([newOwner], options);
785
+ }
786
+ /**
787
+ * Simulate contract write operations (dry-run without sending transaction)
788
+ *
789
+ * @example
790
+ * const result = await contract.simulate.transfer('0x...', 1000n);
791
+ * console.log('Gas estimate:', result.request.gas);
792
+ * console.log('Would succeed:', result.result);
793
+ */
794
+ get simulate() {
795
+ const contract = this.contract;
796
+ if (!contract.simulate) {
797
+ throw new Error('Public client is required for simulation');
798
+ }
799
+ return {
800
+ /**
801
+ * Simulate approve
802
+ * Returns gas estimate and result without sending transaction
803
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
804
+ */
805
+ async approve(spender, amount, options) {
806
+ return contract.simulate.approve([spender, amount], options);
807
+ },
808
+ /**
809
+ * Simulate burn
810
+ * Returns gas estimate and result without sending transaction
811
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
812
+ */
813
+ async burn(amount, options) {
814
+ return contract.simulate.burn([amount], options);
815
+ },
816
+ /**
817
+ * Simulate burnFrom
818
+ * Returns gas estimate and result without sending transaction
819
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
820
+ */
821
+ async burnFrom(account, amount, options) {
822
+ return contract.simulate.burnFrom([account, amount], options);
823
+ },
824
+ /**
825
+ * Simulate decreaseAllowance
826
+ * Returns gas estimate and result without sending transaction
827
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
828
+ */
829
+ async decreaseAllowance(spender, subtractedValue, options) {
830
+ return contract.simulate.decreaseAllowance([spender, subtractedValue], options);
831
+ },
832
+ /**
833
+ * Simulate increaseAllowance
834
+ * Returns gas estimate and result without sending transaction
835
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
836
+ */
837
+ async increaseAllowance(spender, addedValue, options) {
838
+ return contract.simulate.increaseAllowance([spender, addedValue], options);
839
+ },
840
+ /**
841
+ * Simulate initialize
842
+ * Returns gas estimate and result without sending transaction
843
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
844
+ */
845
+ async initialize(options) {
846
+ return contract.simulate.initialize(options);
847
+ },
848
+ /**
849
+ * Simulate mint
850
+ * Returns gas estimate and result without sending transaction
851
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
852
+ */
853
+ async mint(_to, _amount, options) {
854
+ return contract.simulate.mint([_to, _amount], options);
855
+ },
856
+ /**
857
+ * Simulate permit
858
+ * Returns gas estimate and result without sending transaction
859
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
860
+ */
861
+ async permit(owner, spender, value, deadline, v, r, s, options) {
862
+ return contract.simulate.permit([owner, spender, value, deadline, v, r, s], options);
863
+ },
864
+ /**
865
+ * Simulate renounceOwnership
866
+ * Returns gas estimate and result without sending transaction
867
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
868
+ */
869
+ async renounceOwnership(options) {
870
+ return contract.simulate.renounceOwnership(options);
871
+ },
872
+ /**
873
+ * Simulate rescue
874
+ * Returns gas estimate and result without sending transaction
875
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
876
+ */
877
+ async rescue(_token, options) {
878
+ return contract.simulate.rescue([_token], options);
879
+ },
880
+ /**
881
+ * Simulate transfer
882
+ * Returns gas estimate and result without sending transaction
883
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
884
+ */
885
+ async transfer(recipient, amount, options) {
886
+ return contract.simulate.transfer([recipient, amount], options);
887
+ },
888
+ /**
889
+ * Simulate transferFrom
890
+ * Returns gas estimate and result without sending transaction
891
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
892
+ */
893
+ async transferFrom(sender, recipient, amount, options) {
894
+ return contract.simulate.transferFrom([sender, recipient, amount], options);
895
+ },
896
+ /**
897
+ * Simulate transferOwnership
898
+ * Returns gas estimate and result without sending transaction
899
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
900
+ */
901
+ async transferOwnership(newOwner, options) {
902
+ return contract.simulate.transferOwnership([newOwner], options);
903
+ }
904
+ };
905
+ }
906
+ /**
907
+ * Watch contract events
908
+ *
909
+ * @example
910
+ * // Watch all Transfer events
911
+ * const unwatch = contract.watch.Transfer((event) => {
912
+ * console.log('Transfer:', event);
913
+ * });
914
+ *
915
+ * // Stop watching
916
+ * unwatch();
917
+ */
918
+ get watch() {
919
+ return {
920
+ /**
921
+ * Watch Approval events
922
+ * @param callback Function to call when event is emitted
923
+ * @param filter Optional filter for indexed parameters
924
+ * @returns Unwatch function to stop listening
925
+ */
926
+ Approval: (callback, filter) => {
927
+ return this.publicClient.watchContractEvent({
928
+ address: this.contractAddress,
929
+ abi: exports.OokiTokenAbi,
930
+ eventName: 'Approval',
931
+ args: filter,
932
+ onLogs: (logs) => {
933
+ logs.forEach((log) => {
934
+ callback(log.args);
935
+ });
936
+ },
937
+ });
938
+ },
939
+ /**
940
+ * Watch OwnershipTransferred events
941
+ * @param callback Function to call when event is emitted
942
+ * @param filter Optional filter for indexed parameters
943
+ * @returns Unwatch function to stop listening
944
+ */
945
+ OwnershipTransferred: (callback, filter) => {
946
+ return this.publicClient.watchContractEvent({
947
+ address: this.contractAddress,
948
+ abi: exports.OokiTokenAbi,
949
+ eventName: 'OwnershipTransferred',
950
+ args: filter,
951
+ onLogs: (logs) => {
952
+ logs.forEach((log) => {
953
+ callback(log.args);
954
+ });
955
+ },
956
+ });
957
+ },
958
+ /**
959
+ * Watch Transfer events
960
+ * @param callback Function to call when event is emitted
961
+ * @param filter Optional filter for indexed parameters
962
+ * @returns Unwatch function to stop listening
963
+ */
964
+ Transfer: (callback, filter) => {
965
+ return this.publicClient.watchContractEvent({
966
+ address: this.contractAddress,
967
+ abi: exports.OokiTokenAbi,
968
+ eventName: 'Transfer',
969
+ args: filter,
970
+ onLogs: (logs) => {
971
+ logs.forEach((log) => {
972
+ callback(log.args);
973
+ });
974
+ },
975
+ });
976
+ }
977
+ };
978
+ }
979
+ }
980
+ exports.OokiToken = OokiToken;