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