@meteora-ag/cp-amm-sdk 1.4.3 → 1.4.5

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.
package/dist/index.mjs CHANGED
@@ -41,7 +41,11 @@ var __async = (__this, __arguments, generator) => {
41
41
 
42
42
  // src/CpAmm.ts
43
43
  import { Program } from "@coral-xyz/anchor";
44
- import { NATIVE_MINT as NATIVE_MINT2, TOKEN_2022_PROGRAM_ID as TOKEN_2022_PROGRAM_ID3 } from "@solana/spl-token";
44
+ import {
45
+ NATIVE_MINT as NATIVE_MINT2,
46
+ TOKEN_2022_PROGRAM_ID as TOKEN_2022_PROGRAM_ID3,
47
+ createApproveInstruction
48
+ } from "@solana/spl-token";
45
49
  import invariant from "invariant";
46
50
 
47
51
  // src/idl/cp_amm.json
@@ -49,7 +53,7 @@ var cp_amm_default = {
49
53
  address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG",
50
54
  metadata: {
51
55
  name: "cp_amm",
52
- version: "0.2.0",
56
+ version: "0.2.2",
53
57
  spec: "0.1.0",
54
58
  description: "Created with Anchor"
55
59
  },
@@ -137,9 +141,9 @@ var cp_amm_default = {
137
141
  ]
138
142
  },
139
143
  {
140
- name: "owner",
144
+ name: "signer",
141
145
  docs: [
142
- "owner of position"
146
+ "Signer"
143
147
  ],
144
148
  signer: true
145
149
  },
@@ -156,33 +160,7 @@ var cp_amm_default = {
156
160
  ]
157
161
  },
158
162
  {
159
- name: "event_authority",
160
- pda: {
161
- seeds: [
162
- {
163
- kind: "const",
164
- value: [
165
- 95,
166
- 95,
167
- 101,
168
- 118,
169
- 101,
170
- 110,
171
- 116,
172
- 95,
173
- 97,
174
- 117,
175
- 116,
176
- 104,
177
- 111,
178
- 114,
179
- 105,
180
- 116,
181
- 121
182
- ]
183
- }
184
- ]
185
- }
163
+ name: "event_authority"
186
164
  },
187
165
  {
188
166
  name: "program"
@@ -285,9 +263,9 @@ var cp_amm_default = {
285
263
  ]
286
264
  },
287
265
  {
288
- name: "owner",
266
+ name: "signer",
289
267
  docs: [
290
- "owner of position"
268
+ "Signer"
291
269
  ],
292
270
  signer: true
293
271
  },
@@ -304,33 +282,7 @@ var cp_amm_default = {
304
282
  ]
305
283
  },
306
284
  {
307
- name: "event_authority",
308
- pda: {
309
- seeds: [
310
- {
311
- kind: "const",
312
- value: [
313
- 95,
314
- 95,
315
- 101,
316
- 118,
317
- 101,
318
- 110,
319
- 116,
320
- 95,
321
- 97,
322
- 117,
323
- 116,
324
- 104,
325
- 111,
326
- 114,
327
- 105,
328
- 116,
329
- 121
330
- ]
331
- }
332
- ]
333
- }
285
+ name: "event_authority"
334
286
  },
335
287
  {
336
288
  name: "program"
@@ -431,33 +383,7 @@ var cp_amm_default = {
431
383
  ]
432
384
  },
433
385
  {
434
- name: "event_authority",
435
- pda: {
436
- seeds: [
437
- {
438
- kind: "const",
439
- value: [
440
- 95,
441
- 95,
442
- 101,
443
- 118,
444
- 101,
445
- 110,
446
- 116,
447
- 95,
448
- 97,
449
- 117,
450
- 116,
451
- 104,
452
- 111,
453
- 114,
454
- 105,
455
- 116,
456
- 121
457
- ]
458
- }
459
- ]
460
- }
386
+ name: "event_authority"
461
387
  },
462
388
  {
463
389
  name: "program"
@@ -474,6 +400,79 @@ var cp_amm_default = {
474
400
  }
475
401
  ]
476
402
  },
403
+ {
404
+ name: "claim_protocol_fee2",
405
+ discriminator: [
406
+ 235,
407
+ 194,
408
+ 54,
409
+ 69,
410
+ 65,
411
+ 10,
412
+ 236,
413
+ 112
414
+ ],
415
+ accounts: [
416
+ {
417
+ name: "receiver_token_account",
418
+ docs: [
419
+ "receiver token account for the claimed token. validated through the protocol_fee program"
420
+ ],
421
+ writable: true
422
+ },
423
+ {
424
+ name: "token_a_mint",
425
+ relations: [
426
+ "pool"
427
+ ]
428
+ },
429
+ {
430
+ name: "token_b_mint",
431
+ relations: [
432
+ "pool"
433
+ ]
434
+ },
435
+ {
436
+ name: "token_a_program"
437
+ },
438
+ {
439
+ name: "token_b_program"
440
+ },
441
+ {
442
+ name: "pool",
443
+ writable: true
444
+ },
445
+ {
446
+ name: "token_a_vault",
447
+ writable: true,
448
+ relations: [
449
+ "pool"
450
+ ]
451
+ },
452
+ {
453
+ name: "token_b_vault",
454
+ writable: true,
455
+ relations: [
456
+ "pool"
457
+ ]
458
+ },
459
+ {
460
+ name: "pool_authority",
461
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
462
+ },
463
+ {
464
+ name: "signer",
465
+ signer: true,
466
+ address: "FkU5rQCWQM131skHCpcEbK8P1JrQGsBgqXe55w525SSF"
467
+ }
468
+ ],
469
+ args: [
470
+ {
471
+ name: "max_amount",
472
+ type: "u64"
473
+ }
474
+ ]
475
+ },
477
476
  {
478
477
  name: "claim_reward",
479
478
  discriminator: [
@@ -523,9 +522,9 @@ var cp_amm_default = {
523
522
  ]
524
523
  },
525
524
  {
526
- name: "owner",
525
+ name: "signer",
527
526
  docs: [
528
- "owner of position"
527
+ "Signer"
529
528
  ],
530
529
  signer: true
531
530
  },
@@ -533,33 +532,7 @@ var cp_amm_default = {
533
532
  name: "token_program"
534
533
  },
535
534
  {
536
- name: "event_authority",
537
- pda: {
538
- seeds: [
539
- {
540
- kind: "const",
541
- value: [
542
- 95,
543
- 95,
544
- 101,
545
- 118,
546
- 101,
547
- 110,
548
- 116,
549
- 95,
550
- 97,
551
- 117,
552
- 116,
553
- 104,
554
- 111,
555
- 114,
556
- 105,
557
- 116,
558
- 121
559
- ]
560
- }
561
- ]
562
- }
535
+ name: "event_authority"
563
536
  },
564
537
  {
565
538
  name: "program"
@@ -605,33 +578,7 @@ var cp_amm_default = {
605
578
  writable: true
606
579
  },
607
580
  {
608
- name: "event_authority",
609
- pda: {
610
- seeds: [
611
- {
612
- kind: "const",
613
- value: [
614
- 95,
615
- 95,
616
- 101,
617
- 118,
618
- 101,
619
- 110,
620
- 116,
621
- 95,
622
- 97,
623
- 117,
624
- 116,
625
- 104,
626
- 111,
627
- 114,
628
- 105,
629
- 116,
630
- 121
631
- ]
632
- }
633
- ]
634
- }
581
+ name: "event_authority"
635
582
  },
636
583
  {
637
584
  name: "program"
@@ -665,33 +612,7 @@ var cp_amm_default = {
665
612
  writable: true
666
613
  },
667
614
  {
668
- name: "event_authority",
669
- pda: {
670
- seeds: [
671
- {
672
- kind: "const",
673
- value: [
674
- 95,
675
- 95,
676
- 101,
677
- 118,
678
- 101,
679
- 110,
680
- 116,
681
- 95,
682
- 97,
683
- 117,
684
- 116,
685
- 104,
686
- 111,
687
- 114,
688
- 105,
689
- 116,
690
- 121
691
- ]
692
- }
693
- ]
694
- }
615
+ name: "event_authority"
695
616
  },
696
617
  {
697
618
  name: "program"
@@ -760,33 +681,7 @@ var cp_amm_default = {
760
681
  address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
761
682
  },
762
683
  {
763
- name: "event_authority",
764
- pda: {
765
- seeds: [
766
- {
767
- kind: "const",
768
- value: [
769
- 95,
770
- 95,
771
- 101,
772
- 118,
773
- 101,
774
- 110,
775
- 116,
776
- 95,
777
- 97,
778
- 117,
779
- 116,
780
- 104,
781
- 111,
782
- 114,
783
- 105,
784
- 116,
785
- 121
786
- ]
787
- }
788
- ]
789
- }
684
+ name: "event_authority"
790
685
  },
791
686
  {
792
687
  name: "program"
@@ -823,33 +718,7 @@ var cp_amm_default = {
823
718
  writable: true
824
719
  },
825
720
  {
826
- name: "event_authority",
827
- pda: {
828
- seeds: [
829
- {
830
- kind: "const",
831
- value: [
832
- 95,
833
- 95,
834
- 101,
835
- 118,
836
- 101,
837
- 110,
838
- 116,
839
- 95,
840
- 97,
841
- 117,
842
- 116,
843
- 104,
844
- 111,
845
- 114,
846
- 105,
847
- 116,
848
- 121
849
- ]
850
- }
851
- ]
852
- }
721
+ name: "event_authority"
853
722
  },
854
723
  {
855
724
  name: "program"
@@ -913,33 +782,7 @@ var cp_amm_default = {
913
782
  address: "11111111111111111111111111111111"
914
783
  },
915
784
  {
916
- name: "event_authority",
917
- pda: {
918
- seeds: [
919
- {
920
- kind: "const",
921
- value: [
922
- 95,
923
- 95,
924
- 101,
925
- 118,
926
- 101,
927
- 110,
928
- 116,
929
- 95,
930
- 97,
931
- 117,
932
- 116,
933
- 104,
934
- 111,
935
- 114,
936
- 105,
937
- 116,
938
- 121
939
- ]
940
- }
941
- ]
942
- }
785
+ name: "event_authority"
943
786
  },
944
787
  {
945
788
  name: "program"
@@ -1013,33 +856,7 @@ var cp_amm_default = {
1013
856
  address: "11111111111111111111111111111111"
1014
857
  },
1015
858
  {
1016
- name: "event_authority",
1017
- pda: {
1018
- seeds: [
1019
- {
1020
- kind: "const",
1021
- value: [
1022
- 95,
1023
- 95,
1024
- 101,
1025
- 118,
1026
- 101,
1027
- 110,
1028
- 116,
1029
- 95,
1030
- 97,
1031
- 117,
1032
- 116,
1033
- 104,
1034
- 111,
1035
- 114,
1036
- 105,
1037
- 116,
1038
- 121
1039
- ]
1040
- }
1041
- ]
1042
- }
859
+ name: "event_authority"
1043
860
  },
1044
861
  {
1045
862
  name: "program"
@@ -1118,33 +935,7 @@ var cp_amm_default = {
1118
935
  address: "11111111111111111111111111111111"
1119
936
  },
1120
937
  {
1121
- name: "event_authority",
1122
- pda: {
1123
- seeds: [
1124
- {
1125
- kind: "const",
1126
- value: [
1127
- 95,
1128
- 95,
1129
- 101,
1130
- 118,
1131
- 101,
1132
- 110,
1133
- 116,
1134
- 95,
1135
- 97,
1136
- 117,
1137
- 116,
1138
- 104,
1139
- 111,
1140
- 114,
1141
- 105,
1142
- 116,
1143
- 121
1144
- ]
1145
- }
1146
- ]
1147
- }
938
+ name: "event_authority"
1148
939
  },
1149
940
  {
1150
941
  name: "program"
@@ -1274,33 +1065,7 @@ var cp_amm_default = {
1274
1065
  address: "11111111111111111111111111111111"
1275
1066
  },
1276
1067
  {
1277
- name: "event_authority",
1278
- pda: {
1279
- seeds: [
1280
- {
1281
- kind: "const",
1282
- value: [
1283
- 95,
1284
- 95,
1285
- 101,
1286
- 118,
1287
- 101,
1288
- 110,
1289
- 116,
1290
- 95,
1291
- 97,
1292
- 117,
1293
- 116,
1294
- 104,
1295
- 111,
1296
- 114,
1297
- 105,
1298
- 116,
1299
- 121
1300
- ]
1301
- }
1302
- ]
1303
- }
1068
+ name: "event_authority"
1304
1069
  },
1305
1070
  {
1306
1071
  name: "program"
@@ -1369,33 +1134,7 @@ var cp_amm_default = {
1369
1134
  address: "11111111111111111111111111111111"
1370
1135
  },
1371
1136
  {
1372
- name: "event_authority",
1373
- pda: {
1374
- seeds: [
1375
- {
1376
- kind: "const",
1377
- value: [
1378
- 95,
1379
- 95,
1380
- 101,
1381
- 118,
1382
- 101,
1383
- 110,
1384
- 116,
1385
- 95,
1386
- 97,
1387
- 117,
1388
- 116,
1389
- 104,
1390
- 111,
1391
- 114,
1392
- 105,
1393
- 116,
1394
- 121
1395
- ]
1396
- }
1397
- ]
1398
- }
1137
+ name: "event_authority"
1399
1138
  },
1400
1139
  {
1401
1140
  name: "program"
@@ -1572,33 +1311,7 @@ var cp_amm_default = {
1572
1311
  name: "token_program"
1573
1312
  },
1574
1313
  {
1575
- name: "event_authority",
1576
- pda: {
1577
- seeds: [
1578
- {
1579
- kind: "const",
1580
- value: [
1581
- 95,
1582
- 95,
1583
- 101,
1584
- 118,
1585
- 101,
1586
- 110,
1587
- 116,
1588
- 95,
1589
- 97,
1590
- 117,
1591
- 116,
1592
- 104,
1593
- 111,
1594
- 114,
1595
- 105,
1596
- 116,
1597
- 121
1598
- ]
1599
- }
1600
- ]
1601
- }
1314
+ name: "event_authority"
1602
1315
  },
1603
1316
  {
1604
1317
  name: "program"
@@ -1847,33 +1560,7 @@ var cp_amm_default = {
1847
1560
  address: "11111111111111111111111111111111"
1848
1561
  },
1849
1562
  {
1850
- name: "event_authority",
1851
- pda: {
1852
- seeds: [
1853
- {
1854
- kind: "const",
1855
- value: [
1856
- 95,
1857
- 95,
1858
- 101,
1859
- 118,
1860
- 101,
1861
- 110,
1862
- 116,
1863
- 95,
1864
- 97,
1865
- 117,
1866
- 116,
1867
- 104,
1868
- 111,
1869
- 114,
1870
- 105,
1871
- 116,
1872
- 121
1873
- ]
1874
- }
1875
- ]
1876
- }
1563
+ name: "event_authority"
1877
1564
  },
1878
1565
  {
1879
1566
  name: "program"
@@ -2127,33 +1814,7 @@ var cp_amm_default = {
2127
1814
  address: "11111111111111111111111111111111"
2128
1815
  },
2129
1816
  {
2130
- name: "event_authority",
2131
- pda: {
2132
- seeds: [
2133
- {
2134
- kind: "const",
2135
- value: [
2136
- 95,
2137
- 95,
2138
- 101,
2139
- 118,
2140
- 101,
2141
- 110,
2142
- 116,
2143
- 95,
2144
- 97,
2145
- 117,
2146
- 116,
2147
- 104,
2148
- 111,
2149
- 114,
2150
- 105,
2151
- 116,
2152
- 121
2153
- ]
2154
- }
2155
- ]
2156
- }
1817
+ name: "event_authority"
2157
1818
  },
2158
1819
  {
2159
1820
  name: "program"
@@ -2411,33 +2072,7 @@ var cp_amm_default = {
2411
2072
  address: "11111111111111111111111111111111"
2412
2073
  },
2413
2074
  {
2414
- name: "event_authority",
2415
- pda: {
2416
- seeds: [
2417
- {
2418
- kind: "const",
2419
- value: [
2420
- 95,
2421
- 95,
2422
- 101,
2423
- 118,
2424
- 101,
2425
- 110,
2426
- 116,
2427
- 95,
2428
- 97,
2429
- 117,
2430
- 116,
2431
- 104,
2432
- 111,
2433
- 114,
2434
- 105,
2435
- 116,
2436
- 121
2437
- ]
2438
- }
2439
- ]
2440
- }
2075
+ name: "event_authority"
2441
2076
  },
2442
2077
  {
2443
2078
  name: "program"
@@ -2528,33 +2163,7 @@ var cp_amm_default = {
2528
2163
  address: "11111111111111111111111111111111"
2529
2164
  },
2530
2165
  {
2531
- name: "event_authority",
2532
- pda: {
2533
- seeds: [
2534
- {
2535
- kind: "const",
2536
- value: [
2537
- 95,
2538
- 95,
2539
- 101,
2540
- 118,
2541
- 101,
2542
- 110,
2543
- 116,
2544
- 95,
2545
- 97,
2546
- 117,
2547
- 116,
2548
- 104,
2549
- 111,
2550
- 114,
2551
- 105,
2552
- 116,
2553
- 121
2554
- ]
2555
- }
2556
- ]
2557
- }
2166
+ name: "event_authority"
2558
2167
  },
2559
2168
  {
2560
2169
  name: "program"
@@ -2605,40 +2214,14 @@ var cp_amm_default = {
2605
2214
  ]
2606
2215
  },
2607
2216
  {
2608
- name: "owner",
2217
+ name: "signer",
2609
2218
  docs: [
2610
- "owner of position"
2219
+ "Signer"
2611
2220
  ],
2612
2221
  signer: true
2613
2222
  },
2614
2223
  {
2615
- name: "event_authority",
2616
- pda: {
2617
- seeds: [
2618
- {
2619
- kind: "const",
2620
- value: [
2621
- 95,
2622
- 95,
2623
- 101,
2624
- 118,
2625
- 101,
2626
- 110,
2627
- 116,
2628
- 95,
2629
- 97,
2630
- 117,
2631
- 116,
2632
- 104,
2633
- 111,
2634
- 114,
2635
- 105,
2636
- 116,
2637
- 121
2638
- ]
2639
- }
2640
- ]
2641
- }
2224
+ name: "event_authority"
2642
2225
  },
2643
2226
  {
2644
2227
  name: "program"
@@ -2690,9 +2273,9 @@ var cp_amm_default = {
2690
2273
  ]
2691
2274
  },
2692
2275
  {
2693
- name: "owner",
2276
+ name: "signer",
2694
2277
  docs: [
2695
- "owner of position"
2278
+ "Signer"
2696
2279
  ],
2697
2280
  signer: true
2698
2281
  },
@@ -2706,33 +2289,7 @@ var cp_amm_default = {
2706
2289
  address: "11111111111111111111111111111111"
2707
2290
  },
2708
2291
  {
2709
- name: "event_authority",
2710
- pda: {
2711
- seeds: [
2712
- {
2713
- kind: "const",
2714
- value: [
2715
- 95,
2716
- 95,
2717
- 101,
2718
- 118,
2719
- 101,
2720
- 110,
2721
- 116,
2722
- 95,
2723
- 97,
2724
- 117,
2725
- 116,
2726
- 104,
2727
- 111,
2728
- 114,
2729
- 105,
2730
- 116,
2731
- 121
2732
- ]
2733
- }
2734
- ]
2735
- }
2292
+ name: "event_authority"
2736
2293
  },
2737
2294
  {
2738
2295
  name: "program"
@@ -2780,40 +2337,14 @@ var cp_amm_default = {
2780
2337
  ]
2781
2338
  },
2782
2339
  {
2783
- name: "owner",
2340
+ name: "signer",
2784
2341
  docs: [
2785
- "owner of position"
2342
+ "Signer"
2786
2343
  ],
2787
2344
  signer: true
2788
2345
  },
2789
2346
  {
2790
- name: "event_authority",
2791
- pda: {
2792
- seeds: [
2793
- {
2794
- kind: "const",
2795
- value: [
2796
- 95,
2797
- 95,
2798
- 101,
2799
- 118,
2800
- 101,
2801
- 110,
2802
- 116,
2803
- 95,
2804
- 97,
2805
- 117,
2806
- 116,
2807
- 104,
2808
- 111,
2809
- 114,
2810
- 105,
2811
- 116,
2812
- 121
2813
- ]
2814
- }
2815
- ]
2816
- }
2347
+ name: "event_authority"
2817
2348
  },
2818
2349
  {
2819
2350
  name: "program"
@@ -2948,9 +2479,9 @@ var cp_amm_default = {
2948
2479
  ]
2949
2480
  },
2950
2481
  {
2951
- name: "owner",
2482
+ name: "signer",
2952
2483
  docs: [
2953
- "owner of position"
2484
+ "Signer"
2954
2485
  ],
2955
2486
  signer: true
2956
2487
  },
@@ -2967,33 +2498,7 @@ var cp_amm_default = {
2967
2498
  ]
2968
2499
  },
2969
2500
  {
2970
- name: "event_authority",
2971
- pda: {
2972
- seeds: [
2973
- {
2974
- kind: "const",
2975
- value: [
2976
- 95,
2977
- 95,
2978
- 101,
2979
- 118,
2980
- 101,
2981
- 110,
2982
- 116,
2983
- 95,
2984
- 97,
2985
- 117,
2986
- 116,
2987
- 104,
2988
- 111,
2989
- 114,
2990
- 105,
2991
- 116,
2992
- 121
2993
- ]
2994
- }
2995
- ]
2996
- }
2501
+ name: "event_authority"
2997
2502
  },
2998
2503
  {
2999
2504
  name: "program"
@@ -3097,9 +2602,9 @@ var cp_amm_default = {
3097
2602
  ]
3098
2603
  },
3099
2604
  {
3100
- name: "owner",
2605
+ name: "signer",
3101
2606
  docs: [
3102
- "owner of position"
2607
+ "Signer"
3103
2608
  ],
3104
2609
  signer: true
3105
2610
  },
@@ -3116,33 +2621,7 @@ var cp_amm_default = {
3116
2621
  ]
3117
2622
  },
3118
2623
  {
3119
- name: "event_authority",
3120
- pda: {
3121
- seeds: [
3122
- {
3123
- kind: "const",
3124
- value: [
3125
- 95,
3126
- 95,
3127
- 101,
3128
- 118,
3129
- 101,
3130
- 110,
3131
- 116,
3132
- 95,
3133
- 97,
3134
- 117,
3135
- 116,
3136
- 104,
3137
- 111,
3138
- 114,
3139
- 105,
3140
- 116,
3141
- 121
3142
- ]
3143
- }
3144
- ]
3145
- }
2624
+ name: "event_authority"
3146
2625
  },
3147
2626
  {
3148
2627
  name: "program"
@@ -3184,33 +2663,7 @@ var cp_amm_default = {
3184
2663
  signer: true
3185
2664
  },
3186
2665
  {
3187
- name: "event_authority",
3188
- pda: {
3189
- seeds: [
3190
- {
3191
- kind: "const",
3192
- value: [
3193
- 95,
3194
- 95,
3195
- 101,
3196
- 118,
3197
- 101,
3198
- 110,
3199
- 116,
3200
- 95,
3201
- 97,
3202
- 117,
3203
- 116,
3204
- 104,
3205
- 111,
3206
- 114,
3207
- 105,
3208
- 116,
3209
- 121
3210
- ]
3211
- }
3212
- ]
3213
- }
2666
+ name: "event_authority"
3214
2667
  },
3215
2668
  {
3216
2669
  name: "program"
@@ -3285,33 +2738,7 @@ var cp_amm_default = {
3285
2738
  signer: true
3286
2739
  },
3287
2740
  {
3288
- name: "event_authority",
3289
- pda: {
3290
- seeds: [
3291
- {
3292
- kind: "const",
3293
- value: [
3294
- 95,
3295
- 95,
3296
- 101,
3297
- 118,
3298
- 101,
3299
- 110,
3300
- 116,
3301
- 95,
3302
- 97,
3303
- 117,
3304
- 116,
3305
- 104,
3306
- 111,
3307
- 114,
3308
- 105,
3309
- 116,
3310
- 121
3311
- ]
3312
- }
3313
- ]
3314
- }
2741
+ name: "event_authority"
3315
2742
  },
3316
2743
  {
3317
2744
  name: "program"
@@ -3390,33 +2817,7 @@ var cp_amm_default = {
3390
2817
  signer: true
3391
2818
  },
3392
2819
  {
3393
- name: "event_authority",
3394
- pda: {
3395
- seeds: [
3396
- {
3397
- kind: "const",
3398
- value: [
3399
- 95,
3400
- 95,
3401
- 101,
3402
- 118,
3403
- 101,
3404
- 110,
3405
- 116,
3406
- 95,
3407
- 97,
3408
- 117,
3409
- 116,
3410
- 104,
3411
- 111,
3412
- 114,
3413
- 105,
3414
- 116,
3415
- 121
3416
- ]
3417
- }
3418
- ]
3419
- }
2820
+ name: "event_authority"
3420
2821
  },
3421
2822
  {
3422
2823
  name: "program"
@@ -3527,33 +2928,7 @@ var cp_amm_default = {
3527
2928
  optional: true
3528
2929
  },
3529
2930
  {
3530
- name: "event_authority",
3531
- pda: {
3532
- seeds: [
3533
- {
3534
- kind: "const",
3535
- value: [
3536
- 95,
3537
- 95,
3538
- 101,
3539
- 118,
3540
- 101,
3541
- 110,
3542
- 116,
3543
- 95,
3544
- 97,
3545
- 117,
3546
- 116,
3547
- 104,
3548
- 111,
3549
- 114,
3550
- 105,
3551
- 116,
3552
- 121
3553
- ]
3554
- }
3555
- ]
3556
- }
2931
+ name: "event_authority"
3557
2932
  },
3558
2933
  {
3559
2934
  name: "program"
@@ -3668,33 +3043,7 @@ var cp_amm_default = {
3668
3043
  optional: true
3669
3044
  },
3670
3045
  {
3671
- name: "event_authority",
3672
- pda: {
3673
- seeds: [
3674
- {
3675
- kind: "const",
3676
- value: [
3677
- 95,
3678
- 95,
3679
- 101,
3680
- 118,
3681
- 101,
3682
- 110,
3683
- 116,
3684
- 95,
3685
- 97,
3686
- 117,
3687
- 116,
3688
- 104,
3689
- 111,
3690
- 114,
3691
- 105,
3692
- 116,
3693
- 121
3694
- ]
3695
- }
3696
- ]
3697
- }
3046
+ name: "event_authority"
3698
3047
  },
3699
3048
  {
3700
3049
  name: "program"
@@ -3711,6 +3060,47 @@ var cp_amm_default = {
3711
3060
  }
3712
3061
  ]
3713
3062
  },
3063
+ {
3064
+ name: "update_delegate_permission",
3065
+ discriminator: [
3066
+ 175,
3067
+ 165,
3068
+ 56,
3069
+ 64,
3070
+ 0,
3071
+ 251,
3072
+ 89,
3073
+ 47
3074
+ ],
3075
+ accounts: [
3076
+ {
3077
+ name: "position",
3078
+ writable: true
3079
+ },
3080
+ {
3081
+ name: "position_nft_account",
3082
+ docs: [
3083
+ "The token account for nft"
3084
+ ]
3085
+ },
3086
+ {
3087
+ name: "owner",
3088
+ signer: true
3089
+ },
3090
+ {
3091
+ name: "event_authority"
3092
+ },
3093
+ {
3094
+ name: "program"
3095
+ }
3096
+ ],
3097
+ args: [
3098
+ {
3099
+ name: "permission",
3100
+ type: "u32"
3101
+ }
3102
+ ]
3103
+ },
3714
3104
  {
3715
3105
  name: "update_pool_fees",
3716
3106
  discriminator: [
@@ -3736,33 +3126,7 @@ var cp_amm_default = {
3736
3126
  signer: true
3737
3127
  },
3738
3128
  {
3739
- name: "event_authority",
3740
- pda: {
3741
- seeds: [
3742
- {
3743
- kind: "const",
3744
- value: [
3745
- 95,
3746
- 95,
3747
- 101,
3748
- 118,
3749
- 101,
3750
- 110,
3751
- 116,
3752
- 95,
3753
- 97,
3754
- 117,
3755
- 116,
3756
- 104,
3757
- 111,
3758
- 114,
3759
- 105,
3760
- 116,
3761
- 121
3762
- ]
3763
- }
3764
- ]
3765
- }
3129
+ name: "event_authority"
3766
3130
  },
3767
3131
  {
3768
3132
  name: "program"
@@ -3801,33 +3165,7 @@ var cp_amm_default = {
3801
3165
  signer: true
3802
3166
  },
3803
3167
  {
3804
- name: "event_authority",
3805
- pda: {
3806
- seeds: [
3807
- {
3808
- kind: "const",
3809
- value: [
3810
- 95,
3811
- 95,
3812
- 101,
3813
- 118,
3814
- 101,
3815
- 110,
3816
- 116,
3817
- 95,
3818
- 97,
3819
- 117,
3820
- 116,
3821
- 104,
3822
- 111,
3823
- 114,
3824
- 105,
3825
- 116,
3826
- 121
3827
- ]
3828
- }
3829
- ]
3830
- }
3168
+ name: "event_authority"
3831
3169
  },
3832
3170
  {
3833
3171
  name: "program"
@@ -3866,33 +3204,64 @@ var cp_amm_default = {
3866
3204
  signer: true
3867
3205
  },
3868
3206
  {
3869
- name: "event_authority",
3870
- pda: {
3871
- seeds: [
3872
- {
3873
- kind: "const",
3874
- value: [
3875
- 95,
3876
- 95,
3877
- 101,
3878
- 118,
3879
- 101,
3880
- 110,
3881
- 116,
3882
- 95,
3883
- 97,
3884
- 117,
3885
- 116,
3886
- 104,
3887
- 111,
3888
- 114,
3889
- 105,
3890
- 116,
3891
- 121
3892
- ]
3893
- }
3894
- ]
3895
- }
3207
+ name: "event_authority"
3208
+ },
3209
+ {
3210
+ name: "program"
3211
+ }
3212
+ ],
3213
+ args: [
3214
+ {
3215
+ name: "reward_index",
3216
+ type: "u8"
3217
+ },
3218
+ {
3219
+ name: "new_funder",
3220
+ type: "pubkey"
3221
+ }
3222
+ ]
3223
+ },
3224
+ {
3225
+ name: "withdraw_dead_liquidity_reward",
3226
+ discriminator: [
3227
+ 121,
3228
+ 99,
3229
+ 224,
3230
+ 91,
3231
+ 178,
3232
+ 14,
3233
+ 22,
3234
+ 132
3235
+ ],
3236
+ accounts: [
3237
+ {
3238
+ name: "pool_authority",
3239
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
3240
+ },
3241
+ {
3242
+ name: "pool",
3243
+ writable: true
3244
+ },
3245
+ {
3246
+ name: "reward_vault",
3247
+ writable: true
3248
+ },
3249
+ {
3250
+ name: "reward_mint"
3251
+ },
3252
+ {
3253
+ name: "funder_token_account",
3254
+ writable: true
3255
+ },
3256
+ {
3257
+ name: "funder",
3258
+ signer: true
3259
+ },
3260
+ {
3261
+ name: "token_program"
3262
+ },
3263
+ {
3264
+ name: "event_authority"
3896
3265
  },
3897
3266
  {
3898
3267
  name: "program"
@@ -3902,10 +3271,6 @@ var cp_amm_default = {
3902
3271
  {
3903
3272
  name: "reward_index",
3904
3273
  type: "u8"
3905
- },
3906
- {
3907
- name: "new_funder",
3908
- type: "pubkey"
3909
3274
  }
3910
3275
  ]
3911
3276
  },
@@ -3949,33 +3314,7 @@ var cp_amm_default = {
3949
3314
  name: "token_program"
3950
3315
  },
3951
3316
  {
3952
- name: "event_authority",
3953
- pda: {
3954
- seeds: [
3955
- {
3956
- kind: "const",
3957
- value: [
3958
- 95,
3959
- 95,
3960
- 101,
3961
- 118,
3962
- 101,
3963
- 110,
3964
- 116,
3965
- 95,
3966
- 97,
3967
- 117,
3968
- 116,
3969
- 104,
3970
- 111,
3971
- 114,
3972
- 105,
3973
- 116,
3974
- 121
3975
- ]
3976
- }
3977
- ]
3978
- }
3317
+ name: "event_authority"
3979
3318
  },
3980
3319
  {
3981
3320
  name: "program"
@@ -4198,6 +3537,19 @@ var cp_amm_default = {
4198
3537
  33
4199
3538
  ]
4200
3539
  },
3540
+ {
3541
+ name: "EvtClaimProtocolFee2",
3542
+ discriminator: [
3543
+ 187,
3544
+ 133,
3545
+ 66,
3546
+ 9,
3547
+ 205,
3548
+ 161,
3549
+ 84,
3550
+ 13
3551
+ ]
3552
+ },
4201
3553
  {
4202
3554
  name: "EvtClaimReward",
4203
3555
  discriminator: [
@@ -4419,6 +3771,19 @@ var cp_amm_default = {
4419
3771
  153
4420
3772
  ]
4421
3773
  },
3774
+ {
3775
+ name: "EvtUpdateDelegatePermission",
3776
+ discriminator: [
3777
+ 66,
3778
+ 188,
3779
+ 75,
3780
+ 151,
3781
+ 150,
3782
+ 232,
3783
+ 87,
3784
+ 93
3785
+ ]
3786
+ },
4422
3787
  {
4423
3788
  name: "EvtUpdatePoolFees",
4424
3789
  discriminator: [
@@ -4458,6 +3823,19 @@ var cp_amm_default = {
4458
3823
  146
4459
3824
  ]
4460
3825
  },
3826
+ {
3827
+ name: "EvtWithdrawDeadLiquidityReward",
3828
+ discriminator: [
3829
+ 228,
3830
+ 66,
3831
+ 150,
3832
+ 195,
3833
+ 42,
3834
+ 62,
3835
+ 163,
3836
+ 13
3837
+ ]
3838
+ },
4461
3839
  {
4462
3840
  name: "EvtWithdrawIneligibleReward",
4463
3841
  discriminator: [
@@ -4812,6 +4190,21 @@ var cp_amm_default = {
4812
4190
  code: 6067,
4813
4191
  name: "InvalidCompoundingFeeBps",
4814
4192
  msg: "Invalid compounding fee bps"
4193
+ },
4194
+ {
4195
+ code: 6068,
4196
+ name: "InvalidClaimProtocolFeeAccounts",
4197
+ msg: "Invalid claim protocol fee accounts"
4198
+ },
4199
+ {
4200
+ code: 6069,
4201
+ name: "TransferFeeExcludedAmountIsZero",
4202
+ msg: "Transfer fee excluded amount is zero"
4203
+ },
4204
+ {
4205
+ code: 6070,
4206
+ name: "DelegatedAmountNonZero",
4207
+ msg: "Delegated amount is not zero"
4815
4208
  }
4816
4209
  ],
4817
4210
  types: [
@@ -5374,6 +4767,30 @@ var cp_amm_default = {
5374
4767
  ]
5375
4768
  }
5376
4769
  },
4770
+ {
4771
+ name: "EvtClaimProtocolFee2",
4772
+ type: {
4773
+ kind: "struct",
4774
+ fields: [
4775
+ {
4776
+ name: "pool",
4777
+ type: "pubkey"
4778
+ },
4779
+ {
4780
+ name: "receiver_token_account",
4781
+ type: "pubkey"
4782
+ },
4783
+ {
4784
+ name: "token_mint",
4785
+ type: "pubkey"
4786
+ },
4787
+ {
4788
+ name: "amount",
4789
+ type: "u64"
4790
+ }
4791
+ ]
4792
+ }
4793
+ },
5377
4794
  {
5378
4795
  name: "EvtClaimReward",
5379
4796
  type: {
@@ -6076,6 +5493,32 @@ var cp_amm_default = {
6076
5493
  ]
6077
5494
  }
6078
5495
  },
5496
+ {
5497
+ name: "EvtUpdateDelegatePermission",
5498
+ type: {
5499
+ kind: "struct",
5500
+ fields: [
5501
+ {
5502
+ name: "position",
5503
+ type: "pubkey"
5504
+ },
5505
+ {
5506
+ name: "owner",
5507
+ type: "pubkey"
5508
+ },
5509
+ {
5510
+ name: "permission",
5511
+ type: "u32"
5512
+ },
5513
+ {
5514
+ name: "delegate",
5515
+ type: {
5516
+ option: "pubkey"
5517
+ }
5518
+ }
5519
+ ]
5520
+ }
5521
+ },
6079
5522
  {
6080
5523
  name: "EvtUpdatePoolFees",
6081
5524
  type: {
@@ -6148,6 +5591,26 @@ var cp_amm_default = {
6148
5591
  ]
6149
5592
  }
6150
5593
  },
5594
+ {
5595
+ name: "EvtWithdrawDeadLiquidityReward",
5596
+ type: {
5597
+ kind: "struct",
5598
+ fields: [
5599
+ {
5600
+ name: "pool",
5601
+ type: "pubkey"
5602
+ },
5603
+ {
5604
+ name: "reward_mint",
5605
+ type: "pubkey"
5606
+ },
5607
+ {
5608
+ name: "amount",
5609
+ type: "u64"
5610
+ }
5611
+ ]
5612
+ }
5613
+ },
6151
5614
  {
6152
5615
  name: "EvtWithdrawIneligibleReward",
6153
5616
  type: {
@@ -7139,12 +6602,24 @@ var cp_amm_default = {
7139
6602
  }
7140
6603
  }
7141
6604
  },
6605
+ {
6606
+ name: "delegate_permission",
6607
+ docs: [
6608
+ "delegate permission bitmask (paired with SPL token Approve)"
6609
+ ],
6610
+ type: "u32"
6611
+ },
7142
6612
  {
7143
6613
  name: "padding",
7144
6614
  docs: [
7145
6615
  "padding for future usage"
7146
6616
  ],
7147
- type: "u128"
6617
+ type: {
6618
+ array: [
6619
+ "u8",
6620
+ 12
6621
+ ]
6622
+ }
7148
6623
  }
7149
6624
  ]
7150
6625
  }
@@ -7237,16 +6712,11 @@ var cp_amm_default = {
7237
6712
  }
7238
6713
  },
7239
6714
  {
7240
- name: "_padding_1",
6715
+ name: "dead_liquidity_reward_checkpoint",
7241
6716
  docs: [
7242
- "Padding to ensure `reward_rate: u128` is 16-byte aligned"
6717
+ "Cumulative dead-liquidity reward (Compounding Pool only)"
7243
6718
  ],
7244
- type: {
7245
- array: [
7246
- "u8",
7247
- 8
7248
- ]
7249
- }
6719
+ type: "u64"
7250
6720
  },
7251
6721
  {
7252
6722
  name: "mint",
@@ -7783,6 +7253,17 @@ var cp_amm_default = {
7783
7253
  }
7784
7254
  }
7785
7255
  }
7256
+ },
7257
+ {
7258
+ name: "compounding_fee_bps",
7259
+ docs: [
7260
+ "Compounding fee update mode:",
7261
+ "- None: skip compounding fee update",
7262
+ "- Some: update compounding_fee_bps; pool must use CollectFeeMode::Compounding"
7263
+ ],
7264
+ type: {
7265
+ option: "u16"
7266
+ }
7786
7267
  }
7787
7268
  ]
7788
7269
  }
@@ -8222,6 +7703,17 @@ var SwapMode = /* @__PURE__ */ ((SwapMode2) => {
8222
7703
  SwapMode2[SwapMode2["ExactOut"] = 2] = "ExactOut";
8223
7704
  return SwapMode2;
8224
7705
  })(SwapMode || {});
7706
+ var PositionDelegatePermission = /* @__PURE__ */ ((PositionDelegatePermission2) => {
7707
+ PositionDelegatePermission2[PositionDelegatePermission2["AddLiquidity"] = 0] = "AddLiquidity";
7708
+ PositionDelegatePermission2[PositionDelegatePermission2["RemoveLiquidity"] = 1] = "RemoveLiquidity";
7709
+ PositionDelegatePermission2[PositionDelegatePermission2["RemoveLiquidityToOwner"] = 2] = "RemoveLiquidityToOwner";
7710
+ PositionDelegatePermission2[PositionDelegatePermission2["ClaimPositionFee"] = 3] = "ClaimPositionFee";
7711
+ PositionDelegatePermission2[PositionDelegatePermission2["ClaimPositionFeeToOwner"] = 4] = "ClaimPositionFeeToOwner";
7712
+ PositionDelegatePermission2[PositionDelegatePermission2["ClaimReward"] = 5] = "ClaimReward";
7713
+ PositionDelegatePermission2[PositionDelegatePermission2["ClaimRewardToOwner"] = 6] = "ClaimRewardToOwner";
7714
+ PositionDelegatePermission2[PositionDelegatePermission2["LockPosition"] = 7] = "LockPosition";
7715
+ return PositionDelegatePermission2;
7716
+ })(PositionDelegatePermission || {});
8225
7717
 
8226
7718
  // src/pda.ts
8227
7719
  import { PublicKey as PublicKey2 } from "@solana/web3.js";
@@ -8269,6 +7761,8 @@ var DEAD_LIQUIDITY = new BN(100).shln(SCALE_OFFSET);
8269
7761
  var NUM_REWARDS = 2;
8270
7762
  var MIN_REWARD_DURATION = 86400;
8271
7763
  var MAX_REWARD_DURATION = 31536e3;
7764
+ var POOL_TOKEN_A_MINT_OFFSET = 168;
7765
+ var POOL_TOKEN_B_MINT_OFFSET = 200;
8272
7766
 
8273
7767
  // src/pda.ts
8274
7768
  function getFirstKey(key1, key2) {
@@ -12049,6 +11543,11 @@ function getDynamicFeeParams(baseFeeBps, maxPriceChangeBps = MAX_PRICE_CHANGE_BP
12049
11543
  };
12050
11544
  }
12051
11545
 
11546
+ // src/helpers/codec.ts
11547
+ function encodeDelegatePermissions(permissions) {
11548
+ return permissions.reduce((acc, p) => acc | 1 << p, 0);
11549
+ }
11550
+
12052
11551
  // src/CpAmm.ts
12053
11552
  import BN20, { min as min2, max } from "bn.js";
12054
11553
  var CpAmm = class {
@@ -12159,7 +11658,7 @@ var CpAmm = class {
12159
11658
  pool,
12160
11659
  position,
12161
11660
  positionNftAccount,
12162
- owner,
11661
+ signer: owner,
12163
11662
  tokenAAccount,
12164
11663
  tokenBAccount,
12165
11664
  tokenAMint,
@@ -12201,7 +11700,7 @@ var CpAmm = class {
12201
11700
  pool,
12202
11701
  position,
12203
11702
  positionNftAccount,
12204
- owner,
11703
+ signer: owner,
12205
11704
  tokenAAccount,
12206
11705
  tokenBAccount,
12207
11706
  tokenAMint,
@@ -12238,7 +11737,7 @@ var CpAmm = class {
12238
11737
  } = params;
12239
11738
  return yield this._program.methods.claimPositionFee().accountsPartial({
12240
11739
  poolAuthority,
12241
- owner,
11740
+ signer: owner,
12242
11741
  pool,
12243
11742
  position,
12244
11743
  positionNftAccount,
@@ -12564,11 +12063,44 @@ var CpAmm = class {
12564
12063
  */
12565
12064
  fetchPoolStatesByTokenAMint(tokenAMint) {
12566
12065
  return __async(this, null, function* () {
12567
- const filters = offsetBasedFilter(tokenAMint, 168);
12066
+ const filters = offsetBasedFilter(tokenAMint, POOL_TOKEN_A_MINT_OFFSET);
12067
+ const pools = yield this._program.account.pool.all(filters);
12068
+ return pools;
12069
+ });
12070
+ }
12071
+ /**
12072
+ * Fetches all Pool states by tokenBMint.
12073
+ * @param tokenBMint - Public key of the tokenB mint.
12074
+ * @returns Array of matched pool accounts and their state.
12075
+ */
12076
+ fetchPoolStatesByTokenBMint(tokenBMint) {
12077
+ return __async(this, null, function* () {
12078
+ const filters = offsetBasedFilter(tokenBMint, POOL_TOKEN_B_MINT_OFFSET);
12568
12079
  const pools = yield this._program.account.pool.all(filters);
12569
12080
  return pools;
12570
12081
  });
12571
12082
  }
12083
+ /**
12084
+ * Fetches all Pool states that contain the given mint on either side of the pair
12085
+ * (tokenAMint or tokenBMint).
12086
+ * @param tokenMint - Public key of the token mint.
12087
+ * @returns Array of matched pool accounts and their state.
12088
+ */
12089
+ fetchPoolStatesByTokenMint(tokenMint) {
12090
+ return __async(this, null, function* () {
12091
+ const [poolsByTokenA, poolsByTokenB] = yield Promise.all([
12092
+ this.fetchPoolStatesByTokenAMint(tokenMint),
12093
+ this.fetchPoolStatesByTokenBMint(tokenMint)
12094
+ ]);
12095
+ const seen = /* @__PURE__ */ new Set();
12096
+ return [...poolsByTokenA, ...poolsByTokenB].filter((pool) => {
12097
+ const key = pool.publicKey.toBase58();
12098
+ if (seen.has(key)) return false;
12099
+ seen.add(key);
12100
+ return true;
12101
+ });
12102
+ });
12103
+ }
12572
12104
  fetchPoolFees(pool) {
12573
12105
  return __async(this, null, function* () {
12574
12106
  const poolState = yield this._program.account.pool.fetchNullable(pool);
@@ -12759,6 +12291,50 @@ var CpAmm = class {
12759
12291
  return positionResult;
12760
12292
  });
12761
12293
  }
12294
+ /**
12295
+ * Gets all positions of a user in pools that contain the given token mint on either side of
12296
+ * the pair. Resolves the user's positions first and then filters by their pools' mints, so it
12297
+ * never scans the program's pool accounts.
12298
+ * @param user - Public key of the user.
12299
+ * @param tokenMint - Public key of the token mint.
12300
+ * @returns Array of user positions (sorted by liquidity, descending) with their pool and state.
12301
+ */
12302
+ getPositionsByUserAndTokenMint(user, tokenMint) {
12303
+ return __async(this, null, function* () {
12304
+ const userPositions = yield this.getPositionsByUser(user);
12305
+ if (userPositions.length === 0) {
12306
+ return [];
12307
+ }
12308
+ const uniquePools = [];
12309
+ const seenPools = /* @__PURE__ */ new Set();
12310
+ for (const { positionState } of userPositions) {
12311
+ const poolKey = positionState.pool.toBase58();
12312
+ if (!seenPools.has(poolKey)) {
12313
+ seenPools.add(poolKey);
12314
+ uniquePools.push(positionState.pool);
12315
+ }
12316
+ }
12317
+ const poolStates = yield this._program.account.pool.fetchMultiple(uniquePools);
12318
+ const matchedPools = /* @__PURE__ */ new Map();
12319
+ uniquePools.forEach((pool, index) => {
12320
+ const poolState = poolStates[index];
12321
+ if (!poolState) return;
12322
+ if (poolState.tokenAMint.equals(tokenMint) || poolState.tokenBMint.equals(tokenMint)) {
12323
+ matchedPools.set(pool.toBase58(), poolState);
12324
+ }
12325
+ });
12326
+ return userPositions.map((userPosition) => {
12327
+ const poolState = matchedPools.get(
12328
+ userPosition.positionState.pool.toBase58()
12329
+ );
12330
+ if (!poolState) return null;
12331
+ return __spreadProps(__spreadValues({}, userPosition), {
12332
+ pool: userPosition.positionState.pool,
12333
+ poolState
12334
+ });
12335
+ }).filter(Boolean);
12336
+ });
12337
+ }
12762
12338
  /**
12763
12339
  * Retrieves all vesting accounts associated with a position.
12764
12340
  * @param position - Public key of the position.
@@ -13292,7 +12868,7 @@ var CpAmm = class {
13292
12868
  position,
13293
12869
  positionNftAccount,
13294
12870
  pool,
13295
- owner: creator
12871
+ signer: creator
13296
12872
  }).instruction();
13297
12873
  postInstruction.push(permanentLockIx);
13298
12874
  }
@@ -13392,7 +12968,7 @@ var CpAmm = class {
13392
12968
  position,
13393
12969
  positionNftAccount,
13394
12970
  pool,
13395
- owner: creator
12971
+ signer: creator
13396
12972
  }).instruction();
13397
12973
  postInstruction.push(permanentLockIx);
13398
12974
  }
@@ -13499,7 +13075,7 @@ var CpAmm = class {
13499
13075
  position,
13500
13076
  positionNftAccount,
13501
13077
  pool,
13502
- owner: creator
13078
+ signer: creator
13503
13079
  }).instruction();
13504
13080
  postInstruction.push(permanentLockIx);
13505
13081
  }
@@ -13548,6 +13124,46 @@ var CpAmm = class {
13548
13124
  return new Transaction().add(ix);
13549
13125
  });
13550
13126
  }
13127
+ /**
13128
+ * Builds a transaction that assigns a delegate to a position and sets its
13129
+ * onchain permissions in a single transaction.
13130
+ *
13131
+ * This performs two actions:
13132
+ * 1. SPL-approves `delegate` on the position NFT account (so the program
13133
+ * recognizes it as the position's delegate), and
13134
+ * 2. sets the on-chain delegate permission bitmask via the
13135
+ * `updateDelegatePermission` instruction.
13136
+ *
13137
+ * Both are kept together so the approved delegate and the granted
13138
+ * permissions never drift out of sync. To revoke, pass an empty permission
13139
+ * set (`permission: 0`).
13140
+ *
13141
+ * @param {UpdateDelegatePermissionParams} params - Parameters for delegate permission update.
13142
+ * @returns Transaction builder.
13143
+ */
13144
+ updateDelegatePermission(params) {
13145
+ return __async(this, null, function* () {
13146
+ const { owner, positionNft, delegate, permission } = params;
13147
+ const position = derivePositionAddress(positionNft);
13148
+ const positionNftAccount = derivePositionNftAccount(positionNft);
13149
+ const updateDelegatePermissionIx = yield this._program.methods.updateDelegatePermission(permission).accountsPartial({
13150
+ position,
13151
+ positionNftAccount,
13152
+ owner
13153
+ }).instruction();
13154
+ const transaction = new Transaction().add(
13155
+ createApproveInstruction(
13156
+ positionNftAccount,
13157
+ delegate,
13158
+ owner,
13159
+ 0,
13160
+ [],
13161
+ TOKEN_2022_PROGRAM_ID3
13162
+ )
13163
+ ).add(updateDelegatePermissionIx);
13164
+ return transaction;
13165
+ });
13166
+ }
13551
13167
  /**
13552
13168
  * Builds a transaction to add liquidity to an existing position.
13553
13169
  * @param {AddLiquidityParams} params - Parameters for adding liquidity.
@@ -13798,7 +13414,7 @@ var CpAmm = class {
13798
13414
  pool,
13799
13415
  position,
13800
13416
  positionNftAccount,
13801
- owner,
13417
+ signer: owner,
13802
13418
  tokenAAccount,
13803
13419
  tokenBAccount,
13804
13420
  tokenAMint,
@@ -14149,7 +13765,7 @@ var CpAmm = class {
14149
13765
  pool,
14150
13766
  position,
14151
13767
  positionNftAccount,
14152
- owner
13768
+ signer: owner
14153
13769
  }).transaction();
14154
13770
  } else {
14155
13771
  return yield this._program.methods.lockPosition({
@@ -14163,7 +13779,7 @@ var CpAmm = class {
14163
13779
  positionNftAccount,
14164
13780
  vesting: vestingAccount,
14165
13781
  pool,
14166
- owner,
13782
+ signer: owner,
14167
13783
  payer,
14168
13784
  systemProgram: SystemProgram2.programId
14169
13785
  }).transaction();
@@ -14182,7 +13798,7 @@ var CpAmm = class {
14182
13798
  position,
14183
13799
  positionNftAccount,
14184
13800
  pool,
14185
- owner
13801
+ signer: owner
14186
13802
  }).transaction();
14187
13803
  });
14188
13804
  }
@@ -14666,6 +14282,38 @@ var CpAmm = class {
14666
14282
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
14667
14283
  });
14668
14284
  }
14285
+ /**
14286
+ * Builds a transaction to withdraw dead liquidity rewards from a pool.
14287
+ * @param {WithdrawDeadLiquidityRewardParams} params - Parameters for withdrawal.
14288
+ * @returns Transaction builder.
14289
+ */
14290
+ withdrawDeadLiquidityReward(params) {
14291
+ return __async(this, null, function* () {
14292
+ validateRewardIndex(params.rewardIndex);
14293
+ const { rewardIndex, pool, funder } = params;
14294
+ const poolState = yield this.fetchPoolState(pool);
14295
+ const rewardInfo = poolState.rewardInfos[rewardIndex];
14296
+ const { mint, vault, rewardTokenFlag } = rewardInfo;
14297
+ const tokenProgram = getTokenProgram(rewardTokenFlag);
14298
+ const preInstructions = [];
14299
+ const postInstructions = [];
14300
+ const { ataPubkey: funderTokenAccount, ix: createFunderTokenAccountIx } = yield getOrCreateATAInstruction(mint, funder, funder, true, tokenProgram);
14301
+ createFunderTokenAccountIx && preInstructions.push(createFunderTokenAccountIx);
14302
+ if (mint.equals(NATIVE_MINT2)) {
14303
+ const closeWrappedSOLIx = yield unwrapSOLInstruction(funder);
14304
+ closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
14305
+ }
14306
+ return yield this._program.methods.withdrawDeadLiquidityReward(rewardIndex).accountsPartial({
14307
+ pool,
14308
+ rewardVault: vault,
14309
+ rewardMint: mint,
14310
+ poolAuthority: this.poolAuthority,
14311
+ funderTokenAccount,
14312
+ funder,
14313
+ tokenProgram
14314
+ }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
14315
+ });
14316
+ }
14669
14317
  /**
14670
14318
  * Builds a transaction to claim position fee rewards.
14671
14319
  * @param {ClaimPositionFeeParams} params - Parameters for claiming position fee.
@@ -14838,7 +14486,7 @@ var CpAmm = class {
14838
14486
  poolAuthority: this.poolAuthority,
14839
14487
  position,
14840
14488
  userTokenAccount,
14841
- owner: user,
14489
+ signer: user,
14842
14490
  tokenProgram
14843
14491
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
14844
14492
  });
@@ -14993,7 +14641,10 @@ export {
14993
14641
  MathOverflowError,
14994
14642
  NUM_REWARDS,
14995
14643
  ONE_Q64,
14644
+ POOL_TOKEN_A_MINT_OFFSET,
14645
+ POOL_TOKEN_B_MINT_OFFSET,
14996
14646
  PoolStatus,
14647
+ PositionDelegatePermission,
14997
14648
  PriceRangeViolationError,
14998
14649
  Rounding,
14999
14650
  SCALE_OFFSET,
@@ -15046,6 +14697,7 @@ export {
15046
14697
  deriveRewardVaultAddress,
15047
14698
  deriveTokenBadgeAddress,
15048
14699
  deriveTokenVaultAddress,
14700
+ encodeDelegatePermissions,
15049
14701
  encodeFeeMarketCapSchedulerParams,
15050
14702
  encodeFeeRateLimiterParams,
15051
14703
  encodeFeeTimeSchedulerParams,