@gitmyabi/uniswapv3pool 0.0.0-stage → 1.0.89

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,1800 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * UniswapV3Pool ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const UniswapV3PoolAbi = [
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": "int24",
27
+ "name": "tickLower",
28
+ "type": "int24"
29
+ },
30
+ {
31
+ "indexed": true,
32
+ "internalType": "int24",
33
+ "name": "tickUpper",
34
+ "type": "int24"
35
+ },
36
+ {
37
+ "indexed": false,
38
+ "internalType": "uint128",
39
+ "name": "amount",
40
+ "type": "uint128"
41
+ },
42
+ {
43
+ "indexed": false,
44
+ "internalType": "uint256",
45
+ "name": "amount0",
46
+ "type": "uint256"
47
+ },
48
+ {
49
+ "indexed": false,
50
+ "internalType": "uint256",
51
+ "name": "amount1",
52
+ "type": "uint256"
53
+ }
54
+ ],
55
+ "name": "Burn",
56
+ "type": "event"
57
+ },
58
+ {
59
+ "anonymous": false,
60
+ "inputs": [
61
+ {
62
+ "indexed": true,
63
+ "internalType": "address",
64
+ "name": "owner",
65
+ "type": "address"
66
+ },
67
+ {
68
+ "indexed": false,
69
+ "internalType": "address",
70
+ "name": "recipient",
71
+ "type": "address"
72
+ },
73
+ {
74
+ "indexed": true,
75
+ "internalType": "int24",
76
+ "name": "tickLower",
77
+ "type": "int24"
78
+ },
79
+ {
80
+ "indexed": true,
81
+ "internalType": "int24",
82
+ "name": "tickUpper",
83
+ "type": "int24"
84
+ },
85
+ {
86
+ "indexed": false,
87
+ "internalType": "uint128",
88
+ "name": "amount0",
89
+ "type": "uint128"
90
+ },
91
+ {
92
+ "indexed": false,
93
+ "internalType": "uint128",
94
+ "name": "amount1",
95
+ "type": "uint128"
96
+ }
97
+ ],
98
+ "name": "Collect",
99
+ "type": "event"
100
+ },
101
+ {
102
+ "anonymous": false,
103
+ "inputs": [
104
+ {
105
+ "indexed": true,
106
+ "internalType": "address",
107
+ "name": "sender",
108
+ "type": "address"
109
+ },
110
+ {
111
+ "indexed": true,
112
+ "internalType": "address",
113
+ "name": "recipient",
114
+ "type": "address"
115
+ },
116
+ {
117
+ "indexed": false,
118
+ "internalType": "uint128",
119
+ "name": "amount0",
120
+ "type": "uint128"
121
+ },
122
+ {
123
+ "indexed": false,
124
+ "internalType": "uint128",
125
+ "name": "amount1",
126
+ "type": "uint128"
127
+ }
128
+ ],
129
+ "name": "CollectProtocol",
130
+ "type": "event"
131
+ },
132
+ {
133
+ "anonymous": false,
134
+ "inputs": [
135
+ {
136
+ "indexed": true,
137
+ "internalType": "address",
138
+ "name": "sender",
139
+ "type": "address"
140
+ },
141
+ {
142
+ "indexed": true,
143
+ "internalType": "address",
144
+ "name": "recipient",
145
+ "type": "address"
146
+ },
147
+ {
148
+ "indexed": false,
149
+ "internalType": "uint256",
150
+ "name": "amount0",
151
+ "type": "uint256"
152
+ },
153
+ {
154
+ "indexed": false,
155
+ "internalType": "uint256",
156
+ "name": "amount1",
157
+ "type": "uint256"
158
+ },
159
+ {
160
+ "indexed": false,
161
+ "internalType": "uint256",
162
+ "name": "paid0",
163
+ "type": "uint256"
164
+ },
165
+ {
166
+ "indexed": false,
167
+ "internalType": "uint256",
168
+ "name": "paid1",
169
+ "type": "uint256"
170
+ }
171
+ ],
172
+ "name": "Flash",
173
+ "type": "event"
174
+ },
175
+ {
176
+ "anonymous": false,
177
+ "inputs": [
178
+ {
179
+ "indexed": false,
180
+ "internalType": "uint16",
181
+ "name": "observationCardinalityNextOld",
182
+ "type": "uint16"
183
+ },
184
+ {
185
+ "indexed": false,
186
+ "internalType": "uint16",
187
+ "name": "observationCardinalityNextNew",
188
+ "type": "uint16"
189
+ }
190
+ ],
191
+ "name": "IncreaseObservationCardinalityNext",
192
+ "type": "event"
193
+ },
194
+ {
195
+ "anonymous": false,
196
+ "inputs": [
197
+ {
198
+ "indexed": false,
199
+ "internalType": "uint160",
200
+ "name": "sqrtPriceX96",
201
+ "type": "uint160"
202
+ },
203
+ {
204
+ "indexed": false,
205
+ "internalType": "int24",
206
+ "name": "tick",
207
+ "type": "int24"
208
+ }
209
+ ],
210
+ "name": "Initialize",
211
+ "type": "event"
212
+ },
213
+ {
214
+ "anonymous": false,
215
+ "inputs": [
216
+ {
217
+ "indexed": false,
218
+ "internalType": "address",
219
+ "name": "sender",
220
+ "type": "address"
221
+ },
222
+ {
223
+ "indexed": true,
224
+ "internalType": "address",
225
+ "name": "owner",
226
+ "type": "address"
227
+ },
228
+ {
229
+ "indexed": true,
230
+ "internalType": "int24",
231
+ "name": "tickLower",
232
+ "type": "int24"
233
+ },
234
+ {
235
+ "indexed": true,
236
+ "internalType": "int24",
237
+ "name": "tickUpper",
238
+ "type": "int24"
239
+ },
240
+ {
241
+ "indexed": false,
242
+ "internalType": "uint128",
243
+ "name": "amount",
244
+ "type": "uint128"
245
+ },
246
+ {
247
+ "indexed": false,
248
+ "internalType": "uint256",
249
+ "name": "amount0",
250
+ "type": "uint256"
251
+ },
252
+ {
253
+ "indexed": false,
254
+ "internalType": "uint256",
255
+ "name": "amount1",
256
+ "type": "uint256"
257
+ }
258
+ ],
259
+ "name": "Mint",
260
+ "type": "event"
261
+ },
262
+ {
263
+ "anonymous": false,
264
+ "inputs": [
265
+ {
266
+ "indexed": false,
267
+ "internalType": "uint8",
268
+ "name": "feeProtocol0Old",
269
+ "type": "uint8"
270
+ },
271
+ {
272
+ "indexed": false,
273
+ "internalType": "uint8",
274
+ "name": "feeProtocol1Old",
275
+ "type": "uint8"
276
+ },
277
+ {
278
+ "indexed": false,
279
+ "internalType": "uint8",
280
+ "name": "feeProtocol0New",
281
+ "type": "uint8"
282
+ },
283
+ {
284
+ "indexed": false,
285
+ "internalType": "uint8",
286
+ "name": "feeProtocol1New",
287
+ "type": "uint8"
288
+ }
289
+ ],
290
+ "name": "SetFeeProtocol",
291
+ "type": "event"
292
+ },
293
+ {
294
+ "anonymous": false,
295
+ "inputs": [
296
+ {
297
+ "indexed": true,
298
+ "internalType": "address",
299
+ "name": "sender",
300
+ "type": "address"
301
+ },
302
+ {
303
+ "indexed": true,
304
+ "internalType": "address",
305
+ "name": "recipient",
306
+ "type": "address"
307
+ },
308
+ {
309
+ "indexed": false,
310
+ "internalType": "int256",
311
+ "name": "amount0",
312
+ "type": "int256"
313
+ },
314
+ {
315
+ "indexed": false,
316
+ "internalType": "int256",
317
+ "name": "amount1",
318
+ "type": "int256"
319
+ },
320
+ {
321
+ "indexed": false,
322
+ "internalType": "uint160",
323
+ "name": "sqrtPriceX96",
324
+ "type": "uint160"
325
+ },
326
+ {
327
+ "indexed": false,
328
+ "internalType": "uint128",
329
+ "name": "liquidity",
330
+ "type": "uint128"
331
+ },
332
+ {
333
+ "indexed": false,
334
+ "internalType": "int24",
335
+ "name": "tick",
336
+ "type": "int24"
337
+ }
338
+ ],
339
+ "name": "Swap",
340
+ "type": "event"
341
+ },
342
+ {
343
+ "inputs": [
344
+ {
345
+ "internalType": "int24",
346
+ "name": "tickLower",
347
+ "type": "int24"
348
+ },
349
+ {
350
+ "internalType": "int24",
351
+ "name": "tickUpper",
352
+ "type": "int24"
353
+ },
354
+ {
355
+ "internalType": "uint128",
356
+ "name": "amount",
357
+ "type": "uint128"
358
+ }
359
+ ],
360
+ "name": "burn",
361
+ "outputs": [
362
+ {
363
+ "internalType": "uint256",
364
+ "name": "amount0",
365
+ "type": "uint256"
366
+ },
367
+ {
368
+ "internalType": "uint256",
369
+ "name": "amount1",
370
+ "type": "uint256"
371
+ }
372
+ ],
373
+ "stateMutability": "nonpayable",
374
+ "type": "function"
375
+ },
376
+ {
377
+ "inputs": [
378
+ {
379
+ "internalType": "address",
380
+ "name": "recipient",
381
+ "type": "address"
382
+ },
383
+ {
384
+ "internalType": "int24",
385
+ "name": "tickLower",
386
+ "type": "int24"
387
+ },
388
+ {
389
+ "internalType": "int24",
390
+ "name": "tickUpper",
391
+ "type": "int24"
392
+ },
393
+ {
394
+ "internalType": "uint128",
395
+ "name": "amount0Requested",
396
+ "type": "uint128"
397
+ },
398
+ {
399
+ "internalType": "uint128",
400
+ "name": "amount1Requested",
401
+ "type": "uint128"
402
+ }
403
+ ],
404
+ "name": "collect",
405
+ "outputs": [
406
+ {
407
+ "internalType": "uint128",
408
+ "name": "amount0",
409
+ "type": "uint128"
410
+ },
411
+ {
412
+ "internalType": "uint128",
413
+ "name": "amount1",
414
+ "type": "uint128"
415
+ }
416
+ ],
417
+ "stateMutability": "nonpayable",
418
+ "type": "function"
419
+ },
420
+ {
421
+ "inputs": [
422
+ {
423
+ "internalType": "address",
424
+ "name": "recipient",
425
+ "type": "address"
426
+ },
427
+ {
428
+ "internalType": "uint128",
429
+ "name": "amount0Requested",
430
+ "type": "uint128"
431
+ },
432
+ {
433
+ "internalType": "uint128",
434
+ "name": "amount1Requested",
435
+ "type": "uint128"
436
+ }
437
+ ],
438
+ "name": "collectProtocol",
439
+ "outputs": [
440
+ {
441
+ "internalType": "uint128",
442
+ "name": "amount0",
443
+ "type": "uint128"
444
+ },
445
+ {
446
+ "internalType": "uint128",
447
+ "name": "amount1",
448
+ "type": "uint128"
449
+ }
450
+ ],
451
+ "stateMutability": "nonpayable",
452
+ "type": "function"
453
+ },
454
+ {
455
+ "inputs": [],
456
+ "name": "factory",
457
+ "outputs": [
458
+ {
459
+ "internalType": "address",
460
+ "name": "",
461
+ "type": "address"
462
+ }
463
+ ],
464
+ "stateMutability": "view",
465
+ "type": "function"
466
+ },
467
+ {
468
+ "inputs": [],
469
+ "name": "fee",
470
+ "outputs": [
471
+ {
472
+ "internalType": "uint24",
473
+ "name": "",
474
+ "type": "uint24"
475
+ }
476
+ ],
477
+ "stateMutability": "view",
478
+ "type": "function"
479
+ },
480
+ {
481
+ "inputs": [],
482
+ "name": "feeGrowthGlobal0X128",
483
+ "outputs": [
484
+ {
485
+ "internalType": "uint256",
486
+ "name": "",
487
+ "type": "uint256"
488
+ }
489
+ ],
490
+ "stateMutability": "view",
491
+ "type": "function"
492
+ },
493
+ {
494
+ "inputs": [],
495
+ "name": "feeGrowthGlobal1X128",
496
+ "outputs": [
497
+ {
498
+ "internalType": "uint256",
499
+ "name": "",
500
+ "type": "uint256"
501
+ }
502
+ ],
503
+ "stateMutability": "view",
504
+ "type": "function"
505
+ },
506
+ {
507
+ "inputs": [
508
+ {
509
+ "internalType": "address",
510
+ "name": "recipient",
511
+ "type": "address"
512
+ },
513
+ {
514
+ "internalType": "uint256",
515
+ "name": "amount0",
516
+ "type": "uint256"
517
+ },
518
+ {
519
+ "internalType": "uint256",
520
+ "name": "amount1",
521
+ "type": "uint256"
522
+ },
523
+ {
524
+ "internalType": "bytes",
525
+ "name": "data",
526
+ "type": "bytes"
527
+ }
528
+ ],
529
+ "name": "flash",
530
+ "outputs": [],
531
+ "stateMutability": "nonpayable",
532
+ "type": "function"
533
+ },
534
+ {
535
+ "inputs": [
536
+ {
537
+ "internalType": "uint16",
538
+ "name": "observationCardinalityNext",
539
+ "type": "uint16"
540
+ }
541
+ ],
542
+ "name": "increaseObservationCardinalityNext",
543
+ "outputs": [],
544
+ "stateMutability": "nonpayable",
545
+ "type": "function"
546
+ },
547
+ {
548
+ "inputs": [
549
+ {
550
+ "internalType": "uint160",
551
+ "name": "sqrtPriceX96",
552
+ "type": "uint160"
553
+ }
554
+ ],
555
+ "name": "initialize",
556
+ "outputs": [],
557
+ "stateMutability": "nonpayable",
558
+ "type": "function"
559
+ },
560
+ {
561
+ "inputs": [],
562
+ "name": "liquidity",
563
+ "outputs": [
564
+ {
565
+ "internalType": "uint128",
566
+ "name": "",
567
+ "type": "uint128"
568
+ }
569
+ ],
570
+ "stateMutability": "view",
571
+ "type": "function"
572
+ },
573
+ {
574
+ "inputs": [],
575
+ "name": "maxLiquidityPerTick",
576
+ "outputs": [
577
+ {
578
+ "internalType": "uint128",
579
+ "name": "",
580
+ "type": "uint128"
581
+ }
582
+ ],
583
+ "stateMutability": "view",
584
+ "type": "function"
585
+ },
586
+ {
587
+ "inputs": [
588
+ {
589
+ "internalType": "address",
590
+ "name": "recipient",
591
+ "type": "address"
592
+ },
593
+ {
594
+ "internalType": "int24",
595
+ "name": "tickLower",
596
+ "type": "int24"
597
+ },
598
+ {
599
+ "internalType": "int24",
600
+ "name": "tickUpper",
601
+ "type": "int24"
602
+ },
603
+ {
604
+ "internalType": "uint128",
605
+ "name": "amount",
606
+ "type": "uint128"
607
+ },
608
+ {
609
+ "internalType": "bytes",
610
+ "name": "data",
611
+ "type": "bytes"
612
+ }
613
+ ],
614
+ "name": "mint",
615
+ "outputs": [
616
+ {
617
+ "internalType": "uint256",
618
+ "name": "amount0",
619
+ "type": "uint256"
620
+ },
621
+ {
622
+ "internalType": "uint256",
623
+ "name": "amount1",
624
+ "type": "uint256"
625
+ }
626
+ ],
627
+ "stateMutability": "nonpayable",
628
+ "type": "function"
629
+ },
630
+ {
631
+ "inputs": [
632
+ {
633
+ "internalType": "uint256",
634
+ "name": "",
635
+ "type": "uint256"
636
+ }
637
+ ],
638
+ "name": "observations",
639
+ "outputs": [
640
+ {
641
+ "internalType": "uint32",
642
+ "name": "blockTimestamp",
643
+ "type": "uint32"
644
+ },
645
+ {
646
+ "internalType": "int56",
647
+ "name": "tickCumulative",
648
+ "type": "int56"
649
+ },
650
+ {
651
+ "internalType": "uint160",
652
+ "name": "secondsPerLiquidityCumulativeX128",
653
+ "type": "uint160"
654
+ },
655
+ {
656
+ "internalType": "bool",
657
+ "name": "initialized",
658
+ "type": "bool"
659
+ }
660
+ ],
661
+ "stateMutability": "view",
662
+ "type": "function"
663
+ },
664
+ {
665
+ "inputs": [
666
+ {
667
+ "internalType": "uint32[]",
668
+ "name": "secondsAgos",
669
+ "type": "uint32[]"
670
+ }
671
+ ],
672
+ "name": "observe",
673
+ "outputs": [
674
+ {
675
+ "internalType": "int56[]",
676
+ "name": "tickCumulatives",
677
+ "type": "int56[]"
678
+ },
679
+ {
680
+ "internalType": "uint160[]",
681
+ "name": "secondsPerLiquidityCumulativeX128s",
682
+ "type": "uint160[]"
683
+ }
684
+ ],
685
+ "stateMutability": "view",
686
+ "type": "function"
687
+ },
688
+ {
689
+ "inputs": [
690
+ {
691
+ "internalType": "bytes32",
692
+ "name": "",
693
+ "type": "bytes32"
694
+ }
695
+ ],
696
+ "name": "positions",
697
+ "outputs": [
698
+ {
699
+ "internalType": "uint128",
700
+ "name": "liquidity",
701
+ "type": "uint128"
702
+ },
703
+ {
704
+ "internalType": "uint256",
705
+ "name": "feeGrowthInside0LastX128",
706
+ "type": "uint256"
707
+ },
708
+ {
709
+ "internalType": "uint256",
710
+ "name": "feeGrowthInside1LastX128",
711
+ "type": "uint256"
712
+ },
713
+ {
714
+ "internalType": "uint128",
715
+ "name": "tokensOwed0",
716
+ "type": "uint128"
717
+ },
718
+ {
719
+ "internalType": "uint128",
720
+ "name": "tokensOwed1",
721
+ "type": "uint128"
722
+ }
723
+ ],
724
+ "stateMutability": "view",
725
+ "type": "function"
726
+ },
727
+ {
728
+ "inputs": [],
729
+ "name": "protocolFees",
730
+ "outputs": [
731
+ {
732
+ "internalType": "uint128",
733
+ "name": "token0",
734
+ "type": "uint128"
735
+ },
736
+ {
737
+ "internalType": "uint128",
738
+ "name": "token1",
739
+ "type": "uint128"
740
+ }
741
+ ],
742
+ "stateMutability": "view",
743
+ "type": "function"
744
+ },
745
+ {
746
+ "inputs": [
747
+ {
748
+ "internalType": "uint8",
749
+ "name": "feeProtocol0",
750
+ "type": "uint8"
751
+ },
752
+ {
753
+ "internalType": "uint8",
754
+ "name": "feeProtocol1",
755
+ "type": "uint8"
756
+ }
757
+ ],
758
+ "name": "setFeeProtocol",
759
+ "outputs": [],
760
+ "stateMutability": "nonpayable",
761
+ "type": "function"
762
+ },
763
+ {
764
+ "inputs": [],
765
+ "name": "slot0",
766
+ "outputs": [
767
+ {
768
+ "internalType": "uint160",
769
+ "name": "sqrtPriceX96",
770
+ "type": "uint160"
771
+ },
772
+ {
773
+ "internalType": "int24",
774
+ "name": "tick",
775
+ "type": "int24"
776
+ },
777
+ {
778
+ "internalType": "uint16",
779
+ "name": "observationIndex",
780
+ "type": "uint16"
781
+ },
782
+ {
783
+ "internalType": "uint16",
784
+ "name": "observationCardinality",
785
+ "type": "uint16"
786
+ },
787
+ {
788
+ "internalType": "uint16",
789
+ "name": "observationCardinalityNext",
790
+ "type": "uint16"
791
+ },
792
+ {
793
+ "internalType": "uint8",
794
+ "name": "feeProtocol",
795
+ "type": "uint8"
796
+ },
797
+ {
798
+ "internalType": "bool",
799
+ "name": "unlocked",
800
+ "type": "bool"
801
+ }
802
+ ],
803
+ "stateMutability": "view",
804
+ "type": "function"
805
+ },
806
+ {
807
+ "inputs": [
808
+ {
809
+ "internalType": "int24",
810
+ "name": "tickLower",
811
+ "type": "int24"
812
+ },
813
+ {
814
+ "internalType": "int24",
815
+ "name": "tickUpper",
816
+ "type": "int24"
817
+ }
818
+ ],
819
+ "name": "snapshotCumulativesInside",
820
+ "outputs": [
821
+ {
822
+ "internalType": "int56",
823
+ "name": "tickCumulativeInside",
824
+ "type": "int56"
825
+ },
826
+ {
827
+ "internalType": "uint160",
828
+ "name": "secondsPerLiquidityInsideX128",
829
+ "type": "uint160"
830
+ },
831
+ {
832
+ "internalType": "uint32",
833
+ "name": "secondsInside",
834
+ "type": "uint32"
835
+ }
836
+ ],
837
+ "stateMutability": "view",
838
+ "type": "function"
839
+ },
840
+ {
841
+ "inputs": [
842
+ {
843
+ "internalType": "address",
844
+ "name": "recipient",
845
+ "type": "address"
846
+ },
847
+ {
848
+ "internalType": "bool",
849
+ "name": "zeroForOne",
850
+ "type": "bool"
851
+ },
852
+ {
853
+ "internalType": "int256",
854
+ "name": "amountSpecified",
855
+ "type": "int256"
856
+ },
857
+ {
858
+ "internalType": "uint160",
859
+ "name": "sqrtPriceLimitX96",
860
+ "type": "uint160"
861
+ },
862
+ {
863
+ "internalType": "bytes",
864
+ "name": "data",
865
+ "type": "bytes"
866
+ }
867
+ ],
868
+ "name": "swap",
869
+ "outputs": [
870
+ {
871
+ "internalType": "int256",
872
+ "name": "amount0",
873
+ "type": "int256"
874
+ },
875
+ {
876
+ "internalType": "int256",
877
+ "name": "amount1",
878
+ "type": "int256"
879
+ }
880
+ ],
881
+ "stateMutability": "nonpayable",
882
+ "type": "function"
883
+ },
884
+ {
885
+ "inputs": [
886
+ {
887
+ "internalType": "int16",
888
+ "name": "",
889
+ "type": "int16"
890
+ }
891
+ ],
892
+ "name": "tickBitmap",
893
+ "outputs": [
894
+ {
895
+ "internalType": "uint256",
896
+ "name": "",
897
+ "type": "uint256"
898
+ }
899
+ ],
900
+ "stateMutability": "view",
901
+ "type": "function"
902
+ },
903
+ {
904
+ "inputs": [],
905
+ "name": "tickSpacing",
906
+ "outputs": [
907
+ {
908
+ "internalType": "int24",
909
+ "name": "",
910
+ "type": "int24"
911
+ }
912
+ ],
913
+ "stateMutability": "view",
914
+ "type": "function"
915
+ },
916
+ {
917
+ "inputs": [
918
+ {
919
+ "internalType": "int24",
920
+ "name": "",
921
+ "type": "int24"
922
+ }
923
+ ],
924
+ "name": "ticks",
925
+ "outputs": [
926
+ {
927
+ "internalType": "uint128",
928
+ "name": "liquidityGross",
929
+ "type": "uint128"
930
+ },
931
+ {
932
+ "internalType": "int128",
933
+ "name": "liquidityNet",
934
+ "type": "int128"
935
+ },
936
+ {
937
+ "internalType": "uint256",
938
+ "name": "feeGrowthOutside0X128",
939
+ "type": "uint256"
940
+ },
941
+ {
942
+ "internalType": "uint256",
943
+ "name": "feeGrowthOutside1X128",
944
+ "type": "uint256"
945
+ },
946
+ {
947
+ "internalType": "int56",
948
+ "name": "tickCumulativeOutside",
949
+ "type": "int56"
950
+ },
951
+ {
952
+ "internalType": "uint160",
953
+ "name": "secondsPerLiquidityOutsideX128",
954
+ "type": "uint160"
955
+ },
956
+ {
957
+ "internalType": "uint32",
958
+ "name": "secondsOutside",
959
+ "type": "uint32"
960
+ },
961
+ {
962
+ "internalType": "bool",
963
+ "name": "initialized",
964
+ "type": "bool"
965
+ }
966
+ ],
967
+ "stateMutability": "view",
968
+ "type": "function"
969
+ },
970
+ {
971
+ "inputs": [],
972
+ "name": "token0",
973
+ "outputs": [
974
+ {
975
+ "internalType": "address",
976
+ "name": "",
977
+ "type": "address"
978
+ }
979
+ ],
980
+ "stateMutability": "view",
981
+ "type": "function"
982
+ },
983
+ {
984
+ "inputs": [],
985
+ "name": "token1",
986
+ "outputs": [
987
+ {
988
+ "internalType": "address",
989
+ "name": "",
990
+ "type": "address"
991
+ }
992
+ ],
993
+ "stateMutability": "view",
994
+ "type": "function"
995
+ }
996
+ ] as const satisfies Abi;
997
+
998
+ /**
999
+ * Type-safe ABI for UniswapV3Pool
1000
+ */
1001
+ export type UniswapV3PoolAbi = typeof UniswapV3PoolAbi;
1002
+
1003
+ /**
1004
+ * Contract instance type for UniswapV3Pool
1005
+ */
1006
+ // Use any for contract type to avoid complex viem type issues
1007
+ // The runtime behavior is type-safe through viem's ABI typing
1008
+ export type UniswapV3PoolContract = any;
1009
+
1010
+ /**
1011
+ * UniswapV3Pool Contract Class
1012
+ *
1013
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
1014
+ *
1015
+ * @example
1016
+ * ```typescript
1017
+ * import { createPublicClient, createWalletClient, http } from 'viem';
1018
+ * import { mainnet } from 'viem/chains';
1019
+ * import { UniswapV3Pool } from 'UniswapV3Pool';
1020
+ *
1021
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
1022
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
1023
+ *
1024
+ * const contract = new UniswapV3Pool('0x...', { publicClient, walletClient });
1025
+ *
1026
+ * // Read functions
1027
+ * const result = await contract.balanceOf('0x...');
1028
+ *
1029
+ * // Write functions
1030
+ * const hash = await contract.transfer('0x...', 1000n);
1031
+ *
1032
+ * // Simulate transactions (dry-run)
1033
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
1034
+ * console.log('Gas estimate:', simulation.request.gas);
1035
+ *
1036
+ * // Watch events
1037
+ * const unwatch = contract.watch.Transfer((event) => {
1038
+ * console.log('Transfer event:', event);
1039
+ * });
1040
+ * ```
1041
+ */
1042
+ export class UniswapV3Pool {
1043
+ private contract: UniswapV3PoolContract;
1044
+ private contractAddress: Address;
1045
+ private publicClient: PublicClient;
1046
+
1047
+ constructor(
1048
+ address: Address,
1049
+ clients: {
1050
+ publicClient: PublicClient;
1051
+ walletClient?: WalletClient;
1052
+ }
1053
+ ) {
1054
+ this.contractAddress = address;
1055
+ this.publicClient = clients.publicClient;
1056
+ this.contract = getContract({
1057
+ address,
1058
+ abi: UniswapV3PoolAbi,
1059
+ client: {
1060
+ public: clients.publicClient,
1061
+ wallet: clients.walletClient,
1062
+ },
1063
+ });
1064
+ }
1065
+
1066
+ /**
1067
+ * Get the contract address
1068
+ */
1069
+ get address(): Address {
1070
+ return this.contractAddress;
1071
+ }
1072
+
1073
+ /**
1074
+ * Get the underlying viem contract instance.
1075
+ */
1076
+ getContract(): UniswapV3PoolContract {
1077
+ return this.contract;
1078
+ }
1079
+
1080
+ /**
1081
+ * factory
1082
+ * view
1083
+ */
1084
+ async factory(): Promise<`0x${string}`> {
1085
+ return this.contract.read.factory() as Promise<`0x${string}`>;
1086
+ }
1087
+
1088
+ /**
1089
+ * fee
1090
+ * view
1091
+ */
1092
+ async fee(): Promise<bigint> {
1093
+ return this.contract.read.fee() as Promise<bigint>;
1094
+ }
1095
+
1096
+ /**
1097
+ * feeGrowthGlobal0X128
1098
+ * view
1099
+ */
1100
+ async feeGrowthGlobal0X128(): Promise<bigint> {
1101
+ return this.contract.read.feeGrowthGlobal0X128() as Promise<bigint>;
1102
+ }
1103
+
1104
+ /**
1105
+ * feeGrowthGlobal1X128
1106
+ * view
1107
+ */
1108
+ async feeGrowthGlobal1X128(): Promise<bigint> {
1109
+ return this.contract.read.feeGrowthGlobal1X128() as Promise<bigint>;
1110
+ }
1111
+
1112
+ /**
1113
+ * liquidity
1114
+ * view
1115
+ */
1116
+ async liquidity(): Promise<bigint> {
1117
+ return this.contract.read.liquidity() as Promise<bigint>;
1118
+ }
1119
+
1120
+ /**
1121
+ * maxLiquidityPerTick
1122
+ * view
1123
+ */
1124
+ async maxLiquidityPerTick(): Promise<bigint> {
1125
+ return this.contract.read.maxLiquidityPerTick() as Promise<bigint>;
1126
+ }
1127
+
1128
+ /**
1129
+ * observations
1130
+ * view
1131
+ */
1132
+ async observations(arg0: bigint): Promise<[bigint, bigint, bigint, boolean]> {
1133
+ return this.contract.read.observations([arg0] as const) as Promise<[bigint, bigint, bigint, boolean]>;
1134
+ }
1135
+
1136
+ /**
1137
+ * observe
1138
+ * view
1139
+ */
1140
+ async observe(secondsAgos: bigint[]): Promise<[bigint[], bigint[]]> {
1141
+ return this.contract.read.observe([secondsAgos] as const) as Promise<[bigint[], bigint[]]>;
1142
+ }
1143
+
1144
+ /**
1145
+ * positions
1146
+ * view
1147
+ */
1148
+ async positions(arg0: `0x${string}`): Promise<[bigint, bigint, bigint, bigint, bigint]> {
1149
+ return this.contract.read.positions([arg0] as const) as Promise<[bigint, bigint, bigint, bigint, bigint]>;
1150
+ }
1151
+
1152
+ /**
1153
+ * protocolFees
1154
+ * view
1155
+ */
1156
+ async protocolFees(): Promise<[bigint, bigint]> {
1157
+ return this.contract.read.protocolFees() as Promise<[bigint, bigint]>;
1158
+ }
1159
+
1160
+ /**
1161
+ * slot0
1162
+ * view
1163
+ */
1164
+ async slot0(): Promise<[bigint, bigint, bigint, bigint, bigint, bigint, boolean]> {
1165
+ return this.contract.read.slot0() as Promise<[bigint, bigint, bigint, bigint, bigint, bigint, boolean]>;
1166
+ }
1167
+
1168
+ /**
1169
+ * snapshotCumulativesInside
1170
+ * view
1171
+ */
1172
+ async snapshotCumulativesInside(tickLower: bigint, tickUpper: bigint): Promise<[bigint, bigint, bigint]> {
1173
+ return this.contract.read.snapshotCumulativesInside([tickLower, tickUpper] as const) as Promise<[bigint, bigint, bigint]>;
1174
+ }
1175
+
1176
+ /**
1177
+ * tickBitmap
1178
+ * view
1179
+ */
1180
+ async tickBitmap(arg0: bigint): Promise<bigint> {
1181
+ return this.contract.read.tickBitmap([arg0] as const) as Promise<bigint>;
1182
+ }
1183
+
1184
+ /**
1185
+ * tickSpacing
1186
+ * view
1187
+ */
1188
+ async tickSpacing(): Promise<bigint> {
1189
+ return this.contract.read.tickSpacing() as Promise<bigint>;
1190
+ }
1191
+
1192
+ /**
1193
+ * ticks
1194
+ * view
1195
+ */
1196
+ async ticks(arg0: bigint): Promise<[bigint, bigint, bigint, bigint, bigint, bigint, bigint, boolean]> {
1197
+ return this.contract.read.ticks([arg0] as const) as Promise<[bigint, bigint, bigint, bigint, bigint, bigint, bigint, boolean]>;
1198
+ }
1199
+
1200
+ /**
1201
+ * token0
1202
+ * view
1203
+ */
1204
+ async token0(): Promise<`0x${string}`> {
1205
+ return this.contract.read.token0() as Promise<`0x${string}`>;
1206
+ }
1207
+
1208
+ /**
1209
+ * token1
1210
+ * view
1211
+ */
1212
+ async token1(): Promise<`0x${string}`> {
1213
+ return this.contract.read.token1() as Promise<`0x${string}`>;
1214
+ }
1215
+
1216
+ /**
1217
+ * burn
1218
+ * nonpayable
1219
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1220
+ */
1221
+ async burn(tickLower: bigint, tickUpper: bigint, amount: bigint, options?: {
1222
+ accessList?: import('viem').AccessList;
1223
+ authorizationList?: import('viem').AuthorizationList;
1224
+ chain?: import('viem').Chain | null;
1225
+ dataSuffix?: `0x${string}`;
1226
+ gas?: bigint;
1227
+ gasPrice?: bigint;
1228
+ maxFeePerGas?: bigint;
1229
+ maxPriorityFeePerGas?: bigint;
1230
+ nonce?: number;
1231
+ value?: bigint;
1232
+ }): Promise<`0x${string}`> {
1233
+ if (!this.contract.write) {
1234
+ throw new Error('Wallet client is required for write operations');
1235
+ }
1236
+ return this.contract.write.burn([tickLower, tickUpper, amount] as const, options) as Promise<`0x${string}`>;
1237
+ }
1238
+
1239
+ /**
1240
+ * collect
1241
+ * nonpayable
1242
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1243
+ */
1244
+ async collect(recipient: `0x${string}`, tickLower: bigint, tickUpper: bigint, amount0Requested: bigint, amount1Requested: bigint, options?: {
1245
+ accessList?: import('viem').AccessList;
1246
+ authorizationList?: import('viem').AuthorizationList;
1247
+ chain?: import('viem').Chain | null;
1248
+ dataSuffix?: `0x${string}`;
1249
+ gas?: bigint;
1250
+ gasPrice?: bigint;
1251
+ maxFeePerGas?: bigint;
1252
+ maxPriorityFeePerGas?: bigint;
1253
+ nonce?: number;
1254
+ value?: bigint;
1255
+ }): Promise<`0x${string}`> {
1256
+ if (!this.contract.write) {
1257
+ throw new Error('Wallet client is required for write operations');
1258
+ }
1259
+ return this.contract.write.collect([recipient, tickLower, tickUpper, amount0Requested, amount1Requested] as const, options) as Promise<`0x${string}`>;
1260
+ }
1261
+
1262
+ /**
1263
+ * collectProtocol
1264
+ * nonpayable
1265
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1266
+ */
1267
+ async collectProtocol(recipient: `0x${string}`, amount0Requested: bigint, amount1Requested: bigint, options?: {
1268
+ accessList?: import('viem').AccessList;
1269
+ authorizationList?: import('viem').AuthorizationList;
1270
+ chain?: import('viem').Chain | null;
1271
+ dataSuffix?: `0x${string}`;
1272
+ gas?: bigint;
1273
+ gasPrice?: bigint;
1274
+ maxFeePerGas?: bigint;
1275
+ maxPriorityFeePerGas?: bigint;
1276
+ nonce?: number;
1277
+ value?: bigint;
1278
+ }): Promise<`0x${string}`> {
1279
+ if (!this.contract.write) {
1280
+ throw new Error('Wallet client is required for write operations');
1281
+ }
1282
+ return this.contract.write.collectProtocol([recipient, amount0Requested, amount1Requested] as const, options) as Promise<`0x${string}`>;
1283
+ }
1284
+
1285
+ /**
1286
+ * flash
1287
+ * nonpayable
1288
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1289
+ */
1290
+ async flash(recipient: `0x${string}`, amount0: bigint, amount1: bigint, data: `0x${string}`, options?: {
1291
+ accessList?: import('viem').AccessList;
1292
+ authorizationList?: import('viem').AuthorizationList;
1293
+ chain?: import('viem').Chain | null;
1294
+ dataSuffix?: `0x${string}`;
1295
+ gas?: bigint;
1296
+ gasPrice?: bigint;
1297
+ maxFeePerGas?: bigint;
1298
+ maxPriorityFeePerGas?: bigint;
1299
+ nonce?: number;
1300
+ value?: bigint;
1301
+ }): Promise<`0x${string}`> {
1302
+ if (!this.contract.write) {
1303
+ throw new Error('Wallet client is required for write operations');
1304
+ }
1305
+ return this.contract.write.flash([recipient, amount0, amount1, data] as const, options) as Promise<`0x${string}`>;
1306
+ }
1307
+
1308
+ /**
1309
+ * increaseObservationCardinalityNext
1310
+ * nonpayable
1311
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1312
+ */
1313
+ async increaseObservationCardinalityNext(observationCardinalityNext: bigint, options?: {
1314
+ accessList?: import('viem').AccessList;
1315
+ authorizationList?: import('viem').AuthorizationList;
1316
+ chain?: import('viem').Chain | null;
1317
+ dataSuffix?: `0x${string}`;
1318
+ gas?: bigint;
1319
+ gasPrice?: bigint;
1320
+ maxFeePerGas?: bigint;
1321
+ maxPriorityFeePerGas?: bigint;
1322
+ nonce?: number;
1323
+ value?: bigint;
1324
+ }): Promise<`0x${string}`> {
1325
+ if (!this.contract.write) {
1326
+ throw new Error('Wallet client is required for write operations');
1327
+ }
1328
+ return this.contract.write.increaseObservationCardinalityNext([observationCardinalityNext] as const, options) as Promise<`0x${string}`>;
1329
+ }
1330
+
1331
+ /**
1332
+ * initialize
1333
+ * nonpayable
1334
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1335
+ */
1336
+ async initialize(sqrtPriceX96: bigint, options?: {
1337
+ accessList?: import('viem').AccessList;
1338
+ authorizationList?: import('viem').AuthorizationList;
1339
+ chain?: import('viem').Chain | null;
1340
+ dataSuffix?: `0x${string}`;
1341
+ gas?: bigint;
1342
+ gasPrice?: bigint;
1343
+ maxFeePerGas?: bigint;
1344
+ maxPriorityFeePerGas?: bigint;
1345
+ nonce?: number;
1346
+ value?: bigint;
1347
+ }): Promise<`0x${string}`> {
1348
+ if (!this.contract.write) {
1349
+ throw new Error('Wallet client is required for write operations');
1350
+ }
1351
+ return this.contract.write.initialize([sqrtPriceX96] as const, options) as Promise<`0x${string}`>;
1352
+ }
1353
+
1354
+ /**
1355
+ * mint
1356
+ * nonpayable
1357
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1358
+ */
1359
+ async mint(recipient: `0x${string}`, tickLower: bigint, tickUpper: bigint, amount: bigint, data: `0x${string}`, options?: {
1360
+ accessList?: import('viem').AccessList;
1361
+ authorizationList?: import('viem').AuthorizationList;
1362
+ chain?: import('viem').Chain | null;
1363
+ dataSuffix?: `0x${string}`;
1364
+ gas?: bigint;
1365
+ gasPrice?: bigint;
1366
+ maxFeePerGas?: bigint;
1367
+ maxPriorityFeePerGas?: bigint;
1368
+ nonce?: number;
1369
+ value?: bigint;
1370
+ }): Promise<`0x${string}`> {
1371
+ if (!this.contract.write) {
1372
+ throw new Error('Wallet client is required for write operations');
1373
+ }
1374
+ return this.contract.write.mint([recipient, tickLower, tickUpper, amount, data] as const, options) as Promise<`0x${string}`>;
1375
+ }
1376
+
1377
+ /**
1378
+ * setFeeProtocol
1379
+ * nonpayable
1380
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1381
+ */
1382
+ async setFeeProtocol(feeProtocol0: bigint, feeProtocol1: bigint, options?: {
1383
+ accessList?: import('viem').AccessList;
1384
+ authorizationList?: import('viem').AuthorizationList;
1385
+ chain?: import('viem').Chain | null;
1386
+ dataSuffix?: `0x${string}`;
1387
+ gas?: bigint;
1388
+ gasPrice?: bigint;
1389
+ maxFeePerGas?: bigint;
1390
+ maxPriorityFeePerGas?: bigint;
1391
+ nonce?: number;
1392
+ value?: bigint;
1393
+ }): Promise<`0x${string}`> {
1394
+ if (!this.contract.write) {
1395
+ throw new Error('Wallet client is required for write operations');
1396
+ }
1397
+ return this.contract.write.setFeeProtocol([feeProtocol0, feeProtocol1] as const, options) as Promise<`0x${string}`>;
1398
+ }
1399
+
1400
+ /**
1401
+ * swap
1402
+ * nonpayable
1403
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1404
+ */
1405
+ async swap(recipient: `0x${string}`, zeroForOne: boolean, amountSpecified: bigint, sqrtPriceLimitX96: bigint, data: `0x${string}`, options?: {
1406
+ accessList?: import('viem').AccessList;
1407
+ authorizationList?: import('viem').AuthorizationList;
1408
+ chain?: import('viem').Chain | null;
1409
+ dataSuffix?: `0x${string}`;
1410
+ gas?: bigint;
1411
+ gasPrice?: bigint;
1412
+ maxFeePerGas?: bigint;
1413
+ maxPriorityFeePerGas?: bigint;
1414
+ nonce?: number;
1415
+ value?: bigint;
1416
+ }): Promise<`0x${string}`> {
1417
+ if (!this.contract.write) {
1418
+ throw new Error('Wallet client is required for write operations');
1419
+ }
1420
+ return this.contract.write.swap([recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data] as const, options) as Promise<`0x${string}`>;
1421
+ }
1422
+
1423
+
1424
+
1425
+ /**
1426
+ * Simulate contract write operations (dry-run without sending transaction)
1427
+ *
1428
+ * @example
1429
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1430
+ * console.log('Gas estimate:', result.request.gas);
1431
+ * console.log('Would succeed:', result.result);
1432
+ */
1433
+ get simulate() {
1434
+ const contract = this.contract;
1435
+ if (!contract.simulate) {
1436
+ throw new Error('Public client is required for simulation');
1437
+ }
1438
+ return {
1439
+ /**
1440
+ * Simulate burn
1441
+ * Returns gas estimate and result without sending transaction
1442
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1443
+ */
1444
+ async burn(tickLower: bigint, tickUpper: bigint, amount: bigint, options?: {
1445
+ accessList?: import('viem').AccessList;
1446
+ authorizationList?: import('viem').AuthorizationList;
1447
+ chain?: import('viem').Chain | null;
1448
+ dataSuffix?: `0x${string}`;
1449
+ gas?: bigint;
1450
+ gasPrice?: bigint;
1451
+ maxFeePerGas?: bigint;
1452
+ maxPriorityFeePerGas?: bigint;
1453
+ nonce?: number;
1454
+ value?: bigint;
1455
+ }): Promise<[bigint, bigint]> {
1456
+ return contract.simulate.burn([tickLower, tickUpper, amount] as const, options) as Promise<[bigint, bigint]>;
1457
+ },
1458
+ /**
1459
+ * Simulate collect
1460
+ * Returns gas estimate and result without sending transaction
1461
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1462
+ */
1463
+ async collect(recipient: `0x${string}`, tickLower: bigint, tickUpper: bigint, amount0Requested: bigint, amount1Requested: bigint, options?: {
1464
+ accessList?: import('viem').AccessList;
1465
+ authorizationList?: import('viem').AuthorizationList;
1466
+ chain?: import('viem').Chain | null;
1467
+ dataSuffix?: `0x${string}`;
1468
+ gas?: bigint;
1469
+ gasPrice?: bigint;
1470
+ maxFeePerGas?: bigint;
1471
+ maxPriorityFeePerGas?: bigint;
1472
+ nonce?: number;
1473
+ value?: bigint;
1474
+ }): Promise<[bigint, bigint]> {
1475
+ return contract.simulate.collect([recipient, tickLower, tickUpper, amount0Requested, amount1Requested] as const, options) as Promise<[bigint, bigint]>;
1476
+ },
1477
+ /**
1478
+ * Simulate collectProtocol
1479
+ * Returns gas estimate and result without sending transaction
1480
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1481
+ */
1482
+ async collectProtocol(recipient: `0x${string}`, amount0Requested: bigint, amount1Requested: bigint, options?: {
1483
+ accessList?: import('viem').AccessList;
1484
+ authorizationList?: import('viem').AuthorizationList;
1485
+ chain?: import('viem').Chain | null;
1486
+ dataSuffix?: `0x${string}`;
1487
+ gas?: bigint;
1488
+ gasPrice?: bigint;
1489
+ maxFeePerGas?: bigint;
1490
+ maxPriorityFeePerGas?: bigint;
1491
+ nonce?: number;
1492
+ value?: bigint;
1493
+ }): Promise<[bigint, bigint]> {
1494
+ return contract.simulate.collectProtocol([recipient, amount0Requested, amount1Requested] as const, options) as Promise<[bigint, bigint]>;
1495
+ },
1496
+ /**
1497
+ * Simulate flash
1498
+ * Returns gas estimate and result without sending transaction
1499
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1500
+ */
1501
+ async flash(recipient: `0x${string}`, amount0: bigint, amount1: bigint, data: `0x${string}`, options?: {
1502
+ accessList?: import('viem').AccessList;
1503
+ authorizationList?: import('viem').AuthorizationList;
1504
+ chain?: import('viem').Chain | null;
1505
+ dataSuffix?: `0x${string}`;
1506
+ gas?: bigint;
1507
+ gasPrice?: bigint;
1508
+ maxFeePerGas?: bigint;
1509
+ maxPriorityFeePerGas?: bigint;
1510
+ nonce?: number;
1511
+ value?: bigint;
1512
+ }): Promise<void> {
1513
+ return contract.simulate.flash([recipient, amount0, amount1, data] as const, options) as Promise<void>;
1514
+ },
1515
+ /**
1516
+ * Simulate increaseObservationCardinalityNext
1517
+ * Returns gas estimate and result without sending transaction
1518
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1519
+ */
1520
+ async increaseObservationCardinalityNext(observationCardinalityNext: bigint, options?: {
1521
+ accessList?: import('viem').AccessList;
1522
+ authorizationList?: import('viem').AuthorizationList;
1523
+ chain?: import('viem').Chain | null;
1524
+ dataSuffix?: `0x${string}`;
1525
+ gas?: bigint;
1526
+ gasPrice?: bigint;
1527
+ maxFeePerGas?: bigint;
1528
+ maxPriorityFeePerGas?: bigint;
1529
+ nonce?: number;
1530
+ value?: bigint;
1531
+ }): Promise<void> {
1532
+ return contract.simulate.increaseObservationCardinalityNext([observationCardinalityNext] as const, options) as Promise<void>;
1533
+ },
1534
+ /**
1535
+ * Simulate initialize
1536
+ * Returns gas estimate and result without sending transaction
1537
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1538
+ */
1539
+ async initialize(sqrtPriceX96: bigint, options?: {
1540
+ accessList?: import('viem').AccessList;
1541
+ authorizationList?: import('viem').AuthorizationList;
1542
+ chain?: import('viem').Chain | null;
1543
+ dataSuffix?: `0x${string}`;
1544
+ gas?: bigint;
1545
+ gasPrice?: bigint;
1546
+ maxFeePerGas?: bigint;
1547
+ maxPriorityFeePerGas?: bigint;
1548
+ nonce?: number;
1549
+ value?: bigint;
1550
+ }): Promise<void> {
1551
+ return contract.simulate.initialize([sqrtPriceX96] as const, options) as Promise<void>;
1552
+ },
1553
+ /**
1554
+ * Simulate mint
1555
+ * Returns gas estimate and result without sending transaction
1556
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1557
+ */
1558
+ async mint(recipient: `0x${string}`, tickLower: bigint, tickUpper: bigint, amount: bigint, data: `0x${string}`, options?: {
1559
+ accessList?: import('viem').AccessList;
1560
+ authorizationList?: import('viem').AuthorizationList;
1561
+ chain?: import('viem').Chain | null;
1562
+ dataSuffix?: `0x${string}`;
1563
+ gas?: bigint;
1564
+ gasPrice?: bigint;
1565
+ maxFeePerGas?: bigint;
1566
+ maxPriorityFeePerGas?: bigint;
1567
+ nonce?: number;
1568
+ value?: bigint;
1569
+ }): Promise<[bigint, bigint]> {
1570
+ return contract.simulate.mint([recipient, tickLower, tickUpper, amount, data] as const, options) as Promise<[bigint, bigint]>;
1571
+ },
1572
+ /**
1573
+ * Simulate setFeeProtocol
1574
+ * Returns gas estimate and result without sending transaction
1575
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1576
+ */
1577
+ async setFeeProtocol(feeProtocol0: bigint, feeProtocol1: bigint, options?: {
1578
+ accessList?: import('viem').AccessList;
1579
+ authorizationList?: import('viem').AuthorizationList;
1580
+ chain?: import('viem').Chain | null;
1581
+ dataSuffix?: `0x${string}`;
1582
+ gas?: bigint;
1583
+ gasPrice?: bigint;
1584
+ maxFeePerGas?: bigint;
1585
+ maxPriorityFeePerGas?: bigint;
1586
+ nonce?: number;
1587
+ value?: bigint;
1588
+ }): Promise<void> {
1589
+ return contract.simulate.setFeeProtocol([feeProtocol0, feeProtocol1] as const, options) as Promise<void>;
1590
+ },
1591
+ /**
1592
+ * Simulate swap
1593
+ * Returns gas estimate and result without sending transaction
1594
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1595
+ */
1596
+ async swap(recipient: `0x${string}`, zeroForOne: boolean, amountSpecified: bigint, sqrtPriceLimitX96: bigint, data: `0x${string}`, options?: {
1597
+ accessList?: import('viem').AccessList;
1598
+ authorizationList?: import('viem').AuthorizationList;
1599
+ chain?: import('viem').Chain | null;
1600
+ dataSuffix?: `0x${string}`;
1601
+ gas?: bigint;
1602
+ gasPrice?: bigint;
1603
+ maxFeePerGas?: bigint;
1604
+ maxPriorityFeePerGas?: bigint;
1605
+ nonce?: number;
1606
+ value?: bigint;
1607
+ }): Promise<[bigint, bigint]> {
1608
+ return contract.simulate.swap([recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data] as const, options) as Promise<[bigint, bigint]>;
1609
+ }
1610
+ };
1611
+ }
1612
+
1613
+ /**
1614
+ * Watch contract events
1615
+ *
1616
+ * @example
1617
+ * // Watch all Transfer events
1618
+ * const unwatch = contract.watch.Transfer((event) => {
1619
+ * console.log('Transfer:', event);
1620
+ * });
1621
+ *
1622
+ * // Stop watching
1623
+ * unwatch();
1624
+ */
1625
+ get watch() {
1626
+ return {
1627
+ /**
1628
+ * Watch Burn events
1629
+ * @param callback Function to call when event is emitted
1630
+ * @param filter Optional filter for indexed parameters
1631
+ * @returns Unwatch function to stop listening
1632
+ */
1633
+ Burn: (callback: (event: { owner: `0x${string}`; tickLower: bigint; tickUpper: bigint; amount: bigint; amount0: bigint; amount1: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; tickLower?: number | number[] | null; tickUpper?: number | number[] | null }) => {
1634
+ return this.publicClient.watchContractEvent({
1635
+ address: this.contractAddress,
1636
+ abi: UniswapV3PoolAbi,
1637
+ eventName: 'Burn',
1638
+ args: filter as any,
1639
+ onLogs: (logs: any[]) => {
1640
+ logs.forEach((log: any) => {
1641
+ callback(log.args as any);
1642
+ });
1643
+ },
1644
+ }) as () => void;
1645
+ },
1646
+ /**
1647
+ * Watch Collect events
1648
+ * @param callback Function to call when event is emitted
1649
+ * @param filter Optional filter for indexed parameters
1650
+ * @returns Unwatch function to stop listening
1651
+ */
1652
+ Collect: (callback: (event: { owner: `0x${string}`; recipient: `0x${string}`; tickLower: bigint; tickUpper: bigint; amount0: bigint; amount1: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; tickLower?: number | number[] | null; tickUpper?: number | number[] | null }) => {
1653
+ return this.publicClient.watchContractEvent({
1654
+ address: this.contractAddress,
1655
+ abi: UniswapV3PoolAbi,
1656
+ eventName: 'Collect',
1657
+ args: filter as any,
1658
+ onLogs: (logs: any[]) => {
1659
+ logs.forEach((log: any) => {
1660
+ callback(log.args as any);
1661
+ });
1662
+ },
1663
+ }) as () => void;
1664
+ },
1665
+ /**
1666
+ * Watch CollectProtocol events
1667
+ * @param callback Function to call when event is emitted
1668
+ * @param filter Optional filter for indexed parameters
1669
+ * @returns Unwatch function to stop listening
1670
+ */
1671
+ CollectProtocol: (callback: (event: { sender: `0x${string}`; recipient: `0x${string}`; amount0: bigint; amount1: bigint }) => void, filter?: { sender?: `0x${string}` | `0x${string}`[] | null; recipient?: `0x${string}` | `0x${string}`[] | null }) => {
1672
+ return this.publicClient.watchContractEvent({
1673
+ address: this.contractAddress,
1674
+ abi: UniswapV3PoolAbi,
1675
+ eventName: 'CollectProtocol',
1676
+ args: filter as any,
1677
+ onLogs: (logs: any[]) => {
1678
+ logs.forEach((log: any) => {
1679
+ callback(log.args as any);
1680
+ });
1681
+ },
1682
+ }) as () => void;
1683
+ },
1684
+ /**
1685
+ * Watch Flash events
1686
+ * @param callback Function to call when event is emitted
1687
+ * @param filter Optional filter for indexed parameters
1688
+ * @returns Unwatch function to stop listening
1689
+ */
1690
+ Flash: (callback: (event: { sender: `0x${string}`; recipient: `0x${string}`; amount0: bigint; amount1: bigint; paid0: bigint; paid1: bigint }) => void, filter?: { sender?: `0x${string}` | `0x${string}`[] | null; recipient?: `0x${string}` | `0x${string}`[] | null }) => {
1691
+ return this.publicClient.watchContractEvent({
1692
+ address: this.contractAddress,
1693
+ abi: UniswapV3PoolAbi,
1694
+ eventName: 'Flash',
1695
+ args: filter as any,
1696
+ onLogs: (logs: any[]) => {
1697
+ logs.forEach((log: any) => {
1698
+ callback(log.args as any);
1699
+ });
1700
+ },
1701
+ }) as () => void;
1702
+ },
1703
+ /**
1704
+ * Watch IncreaseObservationCardinalityNext events
1705
+ * @param callback Function to call when event is emitted
1706
+ * @param filter Optional filter for indexed parameters
1707
+ * @returns Unwatch function to stop listening
1708
+ */
1709
+ IncreaseObservationCardinalityNext: (callback: (event: { observationCardinalityNextOld: bigint; observationCardinalityNextNew: bigint }) => void) => {
1710
+ return this.publicClient.watchContractEvent({
1711
+ address: this.contractAddress,
1712
+ abi: UniswapV3PoolAbi,
1713
+ eventName: 'IncreaseObservationCardinalityNext',
1714
+
1715
+ onLogs: (logs: any[]) => {
1716
+ logs.forEach((log: any) => {
1717
+ callback(log.args as any);
1718
+ });
1719
+ },
1720
+ }) as () => void;
1721
+ },
1722
+ /**
1723
+ * Watch Initialize events
1724
+ * @param callback Function to call when event is emitted
1725
+ * @param filter Optional filter for indexed parameters
1726
+ * @returns Unwatch function to stop listening
1727
+ */
1728
+ Initialize: (callback: (event: { sqrtPriceX96: bigint; tick: bigint }) => void) => {
1729
+ return this.publicClient.watchContractEvent({
1730
+ address: this.contractAddress,
1731
+ abi: UniswapV3PoolAbi,
1732
+ eventName: 'Initialize',
1733
+
1734
+ onLogs: (logs: any[]) => {
1735
+ logs.forEach((log: any) => {
1736
+ callback(log.args as any);
1737
+ });
1738
+ },
1739
+ }) as () => void;
1740
+ },
1741
+ /**
1742
+ * Watch Mint events
1743
+ * @param callback Function to call when event is emitted
1744
+ * @param filter Optional filter for indexed parameters
1745
+ * @returns Unwatch function to stop listening
1746
+ */
1747
+ Mint: (callback: (event: { sender: `0x${string}`; owner: `0x${string}`; tickLower: bigint; tickUpper: bigint; amount: bigint; amount0: bigint; amount1: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; tickLower?: number | number[] | null; tickUpper?: number | number[] | null }) => {
1748
+ return this.publicClient.watchContractEvent({
1749
+ address: this.contractAddress,
1750
+ abi: UniswapV3PoolAbi,
1751
+ eventName: 'Mint',
1752
+ args: filter as any,
1753
+ onLogs: (logs: any[]) => {
1754
+ logs.forEach((log: any) => {
1755
+ callback(log.args as any);
1756
+ });
1757
+ },
1758
+ }) as () => void;
1759
+ },
1760
+ /**
1761
+ * Watch SetFeeProtocol events
1762
+ * @param callback Function to call when event is emitted
1763
+ * @param filter Optional filter for indexed parameters
1764
+ * @returns Unwatch function to stop listening
1765
+ */
1766
+ SetFeeProtocol: (callback: (event: { feeProtocol0Old: bigint; feeProtocol1Old: bigint; feeProtocol0New: bigint; feeProtocol1New: bigint }) => void) => {
1767
+ return this.publicClient.watchContractEvent({
1768
+ address: this.contractAddress,
1769
+ abi: UniswapV3PoolAbi,
1770
+ eventName: 'SetFeeProtocol',
1771
+
1772
+ onLogs: (logs: any[]) => {
1773
+ logs.forEach((log: any) => {
1774
+ callback(log.args as any);
1775
+ });
1776
+ },
1777
+ }) as () => void;
1778
+ },
1779
+ /**
1780
+ * Watch Swap events
1781
+ * @param callback Function to call when event is emitted
1782
+ * @param filter Optional filter for indexed parameters
1783
+ * @returns Unwatch function to stop listening
1784
+ */
1785
+ Swap: (callback: (event: { sender: `0x${string}`; recipient: `0x${string}`; amount0: bigint; amount1: bigint; sqrtPriceX96: bigint; liquidity: bigint; tick: bigint }) => void, filter?: { sender?: `0x${string}` | `0x${string}`[] | null; recipient?: `0x${string}` | `0x${string}`[] | null }) => {
1786
+ return this.publicClient.watchContractEvent({
1787
+ address: this.contractAddress,
1788
+ abi: UniswapV3PoolAbi,
1789
+ eventName: 'Swap',
1790
+ args: filter as any,
1791
+ onLogs: (logs: any[]) => {
1792
+ logs.forEach((log: any) => {
1793
+ callback(log.args as any);
1794
+ });
1795
+ },
1796
+ }) as () => void;
1797
+ }
1798
+ };
1799
+ }
1800
+ }