@meteora-ag/cp-amm-sdk 1.0.12-rc.0 → 1.1.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.
package/dist/index.mjs CHANGED
@@ -30,7 +30,7 @@ var cp_amm_default = {
30
30
  address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG",
31
31
  metadata: {
32
32
  name: "cp_amm",
33
- version: "0.1.1",
33
+ version: "0.1.3",
34
34
  spec: "0.1.0",
35
35
  description: "Created with Anchor"
36
36
  },
@@ -195,29 +195,7 @@ var cp_amm_default = {
195
195
  accounts: [
196
196
  {
197
197
  name: "pool_authority",
198
- pda: {
199
- seeds: [
200
- {
201
- kind: "const",
202
- value: [
203
- 112,
204
- 111,
205
- 111,
206
- 108,
207
- 95,
208
- 97,
209
- 117,
210
- 116,
211
- 104,
212
- 111,
213
- 114,
214
- 105,
215
- 116,
216
- 121
217
- ]
218
- }
219
- ]
220
- }
198
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
221
199
  },
222
200
  {
223
201
  name: "pool",
@@ -353,29 +331,7 @@ var cp_amm_default = {
353
331
  accounts: [
354
332
  {
355
333
  name: "pool_authority",
356
- pda: {
357
- seeds: [
358
- {
359
- kind: "const",
360
- value: [
361
- 112,
362
- 111,
363
- 111,
364
- 108,
365
- 95,
366
- 97,
367
- 117,
368
- 116,
369
- 104,
370
- 111,
371
- 114,
372
- 105,
373
- 116,
374
- 121
375
- ]
376
- }
377
- ]
378
- }
334
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
379
335
  },
380
336
  {
381
337
  name: "pool",
@@ -514,29 +470,7 @@ var cp_amm_default = {
514
470
  accounts: [
515
471
  {
516
472
  name: "pool_authority",
517
- pda: {
518
- seeds: [
519
- {
520
- kind: "const",
521
- value: [
522
- 112,
523
- 111,
524
- 111,
525
- 108,
526
- 95,
527
- 97,
528
- 117,
529
- 116,
530
- 104,
531
- 111,
532
- 114,
533
- 105,
534
- 116,
535
- 121
536
- ]
537
- }
538
- ]
539
- }
473
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
540
474
  },
541
475
  {
542
476
  name: "pool",
@@ -827,7 +761,16 @@ var cp_amm_default = {
827
761
  name: "program"
828
762
  }
829
763
  ],
830
- args: []
764
+ args: [
765
+ {
766
+ name: "max_amount_a",
767
+ type: "u64"
768
+ },
769
+ {
770
+ name: "max_amount_b",
771
+ type: "u64"
772
+ }
773
+ ]
831
774
  },
832
775
  {
833
776
  name: "claim_reward",
@@ -844,29 +787,7 @@ var cp_amm_default = {
844
787
  accounts: [
845
788
  {
846
789
  name: "pool_authority",
847
- pda: {
848
- seeds: [
849
- {
850
- kind: "const",
851
- value: [
852
- 112,
853
- 111,
854
- 111,
855
- 108,
856
- 95,
857
- 97,
858
- 117,
859
- 116,
860
- 104,
861
- 111,
862
- 114,
863
- 105,
864
- 116,
865
- 121
866
- ]
867
- }
868
- ]
869
- }
790
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
870
791
  },
871
792
  {
872
793
  name: "pool",
@@ -946,6 +867,10 @@ var cp_amm_default = {
946
867
  {
947
868
  name: "reward_index",
948
869
  type: "u8"
870
+ },
871
+ {
872
+ name: "skip_reward",
873
+ type: "u8"
949
874
  }
950
875
  ]
951
876
  },
@@ -1110,15 +1035,40 @@ var cp_amm_default = {
1110
1035
  },
1111
1036
  {
1112
1037
  name: "pool_authority",
1038
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
1039
+ },
1040
+ {
1041
+ name: "rent_receiver",
1042
+ writable: true
1043
+ },
1044
+ {
1045
+ name: "owner",
1046
+ docs: [
1047
+ "Owner of position"
1048
+ ],
1049
+ signer: true
1050
+ },
1051
+ {
1052
+ name: "token_program",
1053
+ docs: [
1054
+ "Program to create NFT mint/token account and transfer for token22 account"
1055
+ ],
1056
+ address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1057
+ },
1058
+ {
1059
+ name: "event_authority",
1113
1060
  pda: {
1114
1061
  seeds: [
1115
1062
  {
1116
1063
  kind: "const",
1117
1064
  value: [
1118
- 112,
1119
- 111,
1120
- 111,
1121
- 108,
1065
+ 95,
1066
+ 95,
1067
+ 101,
1068
+ 118,
1069
+ 101,
1070
+ 110,
1071
+ 116,
1122
1072
  95,
1123
1073
  97,
1124
1074
  117,
@@ -1135,22 +1085,36 @@ var cp_amm_default = {
1135
1085
  }
1136
1086
  },
1137
1087
  {
1138
- name: "rent_receiver",
1088
+ name: "program"
1089
+ }
1090
+ ],
1091
+ args: []
1092
+ },
1093
+ {
1094
+ name: "close_token_badge",
1095
+ discriminator: [
1096
+ 108,
1097
+ 146,
1098
+ 86,
1099
+ 110,
1100
+ 179,
1101
+ 254,
1102
+ 10,
1103
+ 104
1104
+ ],
1105
+ accounts: [
1106
+ {
1107
+ name: "token_badge",
1139
1108
  writable: true
1140
1109
  },
1141
1110
  {
1142
- name: "owner",
1143
- docs: [
1144
- "Owner of position"
1145
- ],
1111
+ name: "admin",
1112
+ writable: true,
1146
1113
  signer: true
1147
1114
  },
1148
1115
  {
1149
- name: "token_program",
1150
- docs: [
1151
- "Program to create NFT mint/token account and transfer for token22 account"
1152
- ],
1153
- address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
1116
+ name: "rent_receiver",
1117
+ writable: true
1154
1118
  },
1155
1119
  {
1156
1120
  name: "event_authority",
@@ -1559,29 +1523,7 @@ var cp_amm_default = {
1559
1523
  },
1560
1524
  {
1561
1525
  name: "pool_authority",
1562
- pda: {
1563
- seeds: [
1564
- {
1565
- kind: "const",
1566
- value: [
1567
- 112,
1568
- 111,
1569
- 111,
1570
- 108,
1571
- 95,
1572
- 97,
1573
- 117,
1574
- 116,
1575
- 104,
1576
- 111,
1577
- 114,
1578
- 105,
1579
- 116,
1580
- 121
1581
- ]
1582
- }
1583
- ]
1584
- }
1526
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
1585
1527
  },
1586
1528
  {
1587
1529
  name: "payer",
@@ -1882,29 +1824,7 @@ var cp_amm_default = {
1882
1824
  },
1883
1825
  {
1884
1826
  name: "pool_authority",
1885
- pda: {
1886
- seeds: [
1887
- {
1888
- kind: "const",
1889
- value: [
1890
- 112,
1891
- 111,
1892
- 111,
1893
- 108,
1894
- 95,
1895
- 97,
1896
- 117,
1897
- 116,
1898
- 104,
1899
- 111,
1900
- 114,
1901
- 105,
1902
- 116,
1903
- 121
1904
- ]
1905
- }
1906
- ]
1907
- }
1827
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
1908
1828
  },
1909
1829
  {
1910
1830
  name: "pool",
@@ -2184,29 +2104,7 @@ var cp_amm_default = {
2184
2104
  },
2185
2105
  {
2186
2106
  name: "pool_authority",
2187
- pda: {
2188
- seeds: [
2189
- {
2190
- kind: "const",
2191
- value: [
2192
- 112,
2193
- 111,
2194
- 111,
2195
- 108,
2196
- 95,
2197
- 97,
2198
- 117,
2199
- 116,
2200
- 104,
2201
- 111,
2202
- 114,
2203
- 105,
2204
- 116,
2205
- 121
2206
- ]
2207
- }
2208
- ]
2209
- }
2107
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
2210
2108
  },
2211
2109
  {
2212
2110
  name: "pool",
@@ -2490,29 +2388,7 @@ var cp_amm_default = {
2490
2388
  },
2491
2389
  {
2492
2390
  name: "pool_authority",
2493
- pda: {
2494
- seeds: [
2495
- {
2496
- kind: "const",
2497
- value: [
2498
- 112,
2499
- 111,
2500
- 111,
2501
- 108,
2502
- 95,
2503
- 97,
2504
- 117,
2505
- 116,
2506
- 104,
2507
- 111,
2508
- 114,
2509
- 105,
2510
- 116,
2511
- 121
2512
- ]
2513
- }
2514
- ]
2515
- }
2391
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
2516
2392
  },
2517
2393
  {
2518
2394
  name: "pool",
@@ -2724,29 +2600,7 @@ var cp_amm_default = {
2724
2600
  accounts: [
2725
2601
  {
2726
2602
  name: "pool_authority",
2727
- pda: {
2728
- seeds: [
2729
- {
2730
- kind: "const",
2731
- value: [
2732
- 112,
2733
- 111,
2734
- 111,
2735
- 108,
2736
- 95,
2737
- 97,
2738
- 117,
2739
- 116,
2740
- 104,
2741
- 111,
2742
- 114,
2743
- 105,
2744
- 116,
2745
- 121
2746
- ]
2747
- }
2748
- ]
2749
- }
2603
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
2750
2604
  },
2751
2605
  {
2752
2606
  name: "pool",
@@ -2789,7 +2643,11 @@ var cp_amm_default = {
2789
2643
  name: "reward_mint"
2790
2644
  },
2791
2645
  {
2792
- name: "admin",
2646
+ name: "signer",
2647
+ signer: true
2648
+ },
2649
+ {
2650
+ name: "payer",
2793
2651
  writable: true,
2794
2652
  signer: true
2795
2653
  },
@@ -3069,29 +2927,7 @@ var cp_amm_default = {
3069
2927
  accounts: [
3070
2928
  {
3071
2929
  name: "pool_authority",
3072
- pda: {
3073
- seeds: [
3074
- {
3075
- kind: "const",
3076
- value: [
3077
- 112,
3078
- 111,
3079
- 111,
3080
- 108,
3081
- 95,
3082
- 97,
3083
- 117,
3084
- 116,
3085
- 104,
3086
- 111,
3087
- 114,
3088
- 105,
3089
- 116,
3090
- 121
3091
- ]
3092
- }
3093
- ]
3094
- }
2930
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
3095
2931
  },
3096
2932
  {
3097
2933
  name: "pool",
@@ -3240,29 +3076,7 @@ var cp_amm_default = {
3240
3076
  accounts: [
3241
3077
  {
3242
3078
  name: "pool_authority",
3243
- pda: {
3244
- seeds: [
3245
- {
3246
- kind: "const",
3247
- value: [
3248
- 112,
3249
- 111,
3250
- 111,
3251
- 108,
3252
- 95,
3253
- 97,
3254
- 117,
3255
- 116,
3256
- 104,
3257
- 111,
3258
- 114,
3259
- 105,
3260
- 116,
3261
- 121
3262
- ]
3263
- }
3264
- ]
3265
- }
3079
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
3266
3080
  },
3267
3081
  {
3268
3082
  name: "pool",
@@ -3458,29 +3272,80 @@ var cp_amm_default = {
3458
3272
  ]
3459
3273
  },
3460
3274
  {
3461
- name: "swap",
3275
+ name: "split_position",
3462
3276
  discriminator: [
3463
- 248,
3464
- 198,
3465
- 158,
3466
- 145,
3467
- 225,
3468
- 117,
3469
- 135,
3470
- 200
3277
+ 172,
3278
+ 241,
3279
+ 221,
3280
+ 138,
3281
+ 161,
3282
+ 29,
3283
+ 253,
3284
+ 42
3471
3285
  ],
3472
3286
  accounts: [
3473
3287
  {
3474
- name: "pool_authority",
3288
+ name: "pool",
3289
+ writable: true,
3290
+ relations: [
3291
+ "first_position",
3292
+ "second_position"
3293
+ ]
3294
+ },
3295
+ {
3296
+ name: "first_position",
3297
+ docs: [
3298
+ "The first position"
3299
+ ],
3300
+ writable: true
3301
+ },
3302
+ {
3303
+ name: "first_position_nft_account",
3304
+ docs: [
3305
+ "The token account for position nft"
3306
+ ]
3307
+ },
3308
+ {
3309
+ name: "second_position",
3310
+ docs: [
3311
+ "The second position"
3312
+ ],
3313
+ writable: true
3314
+ },
3315
+ {
3316
+ name: "second_position_nft_account",
3317
+ docs: [
3318
+ "The token account for position nft"
3319
+ ]
3320
+ },
3321
+ {
3322
+ name: "first_owner",
3323
+ docs: [
3324
+ "Owner of first position"
3325
+ ],
3326
+ signer: true
3327
+ },
3328
+ {
3329
+ name: "second_owner",
3330
+ docs: [
3331
+ "Owner of second position"
3332
+ ],
3333
+ signer: true
3334
+ },
3335
+ {
3336
+ name: "event_authority",
3475
3337
  pda: {
3476
3338
  seeds: [
3477
3339
  {
3478
3340
  kind: "const",
3479
3341
  value: [
3480
- 112,
3481
- 111,
3482
- 111,
3483
- 108,
3342
+ 95,
3343
+ 95,
3344
+ 101,
3345
+ 118,
3346
+ 101,
3347
+ 110,
3348
+ 116,
3484
3349
  95,
3485
3350
  97,
3486
3351
  117,
@@ -3496,6 +3361,38 @@ var cp_amm_default = {
3496
3361
  ]
3497
3362
  }
3498
3363
  },
3364
+ {
3365
+ name: "program"
3366
+ }
3367
+ ],
3368
+ args: [
3369
+ {
3370
+ name: "params",
3371
+ type: {
3372
+ defined: {
3373
+ name: "SplitPositionParameters"
3374
+ }
3375
+ }
3376
+ }
3377
+ ]
3378
+ },
3379
+ {
3380
+ name: "swap",
3381
+ discriminator: [
3382
+ 248,
3383
+ 198,
3384
+ 158,
3385
+ 145,
3386
+ 225,
3387
+ 117,
3388
+ 135,
3389
+ 200
3390
+ ],
3391
+ accounts: [
3392
+ {
3393
+ name: "pool_authority",
3394
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
3395
+ },
3499
3396
  {
3500
3397
  name: "pool",
3501
3398
  docs: [
@@ -3638,7 +3535,7 @@ var cp_amm_default = {
3638
3535
  writable: true
3639
3536
  },
3640
3537
  {
3641
- name: "admin",
3538
+ name: "signer",
3642
3539
  signer: true
3643
3540
  },
3644
3541
  {
@@ -3703,7 +3600,7 @@ var cp_amm_default = {
3703
3600
  writable: true
3704
3601
  },
3705
3602
  {
3706
- name: "admin",
3603
+ name: "signer",
3707
3604
  signer: true
3708
3605
  },
3709
3606
  {
@@ -3765,29 +3662,7 @@ var cp_amm_default = {
3765
3662
  accounts: [
3766
3663
  {
3767
3664
  name: "pool_authority",
3768
- pda: {
3769
- seeds: [
3770
- {
3771
- kind: "const",
3772
- value: [
3773
- 112,
3774
- 111,
3775
- 111,
3776
- 108,
3777
- 95,
3778
- 97,
3779
- 117,
3780
- 116,
3781
- 104,
3782
- 111,
3783
- 114,
3784
- 105,
3785
- 116,
3786
- 121
3787
- ]
3788
- }
3789
- ]
3790
- }
3665
+ address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"
3791
3666
  },
3792
3667
  {
3793
3668
  name: "pool",
@@ -4193,6 +4068,19 @@ var cp_amm_default = {
4193
4068
  146
4194
4069
  ]
4195
4070
  },
4071
+ {
4072
+ name: "EvtSplitPosition",
4073
+ discriminator: [
4074
+ 182,
4075
+ 138,
4076
+ 42,
4077
+ 254,
4078
+ 27,
4079
+ 94,
4080
+ 82,
4081
+ 221
4082
+ ]
4083
+ },
4196
4084
  {
4197
4085
  name: "EvtSwap",
4198
4086
  discriminator: [
@@ -4456,6 +4344,31 @@ var cp_amm_default = {
4456
4344
  code: 6041,
4457
4345
  name: "InvalidConfigType",
4458
4346
  msg: "Invalid config type"
4347
+ },
4348
+ {
4349
+ code: 6042,
4350
+ name: "InvalidPoolCreator",
4351
+ msg: "Invalid pool creator"
4352
+ },
4353
+ {
4354
+ code: 6043,
4355
+ name: "RewardVaultFrozenSkipRequired",
4356
+ msg: "Reward vault is frozen, must skip reward to proceed"
4357
+ },
4358
+ {
4359
+ code: 6044,
4360
+ name: "InvalidSplitPositionParameters",
4361
+ msg: "Invalid parameters for split position"
4362
+ },
4363
+ {
4364
+ code: 6045,
4365
+ name: "UnsupportPositionHasVestingLock",
4366
+ msg: "Unsupported split position has vesting lock"
4367
+ },
4368
+ {
4369
+ code: 6046,
4370
+ name: "SamePosition",
4371
+ msg: "Same position"
4459
4372
  }
4460
4373
  ],
4461
4374
  types: [
@@ -5287,6 +5200,18 @@ var cp_amm_default = {
5287
5200
  {
5288
5201
  name: "transfer_fee_excluded_amount_in",
5289
5202
  type: "u64"
5203
+ },
5204
+ {
5205
+ name: "reward_duration_end",
5206
+ type: "u64"
5207
+ },
5208
+ {
5209
+ name: "pre_reward_rate",
5210
+ type: "u128"
5211
+ },
5212
+ {
5213
+ name: "post_reward_rate",
5214
+ type: "u128"
5290
5215
  }
5291
5216
  ]
5292
5217
  }
@@ -5404,6 +5329,10 @@ var cp_amm_default = {
5404
5329
  name: "funder",
5405
5330
  type: "pubkey"
5406
5331
  },
5332
+ {
5333
+ name: "creator",
5334
+ type: "pubkey"
5335
+ },
5407
5336
  {
5408
5337
  name: "reward_index",
5409
5338
  type: "u8"
@@ -5535,6 +5464,70 @@ var cp_amm_default = {
5535
5464
  ]
5536
5465
  }
5537
5466
  },
5467
+ {
5468
+ name: "EvtSplitPosition",
5469
+ type: {
5470
+ kind: "struct",
5471
+ fields: [
5472
+ {
5473
+ name: "pool",
5474
+ type: "pubkey"
5475
+ },
5476
+ {
5477
+ name: "first_owner",
5478
+ type: "pubkey"
5479
+ },
5480
+ {
5481
+ name: "second_owner",
5482
+ type: "pubkey"
5483
+ },
5484
+ {
5485
+ name: "first_position",
5486
+ type: "pubkey"
5487
+ },
5488
+ {
5489
+ name: "second_position",
5490
+ type: "pubkey"
5491
+ },
5492
+ {
5493
+ name: "current_sqrt_price",
5494
+ type: "u128"
5495
+ },
5496
+ {
5497
+ name: "amount_splits",
5498
+ type: {
5499
+ defined: {
5500
+ name: "SplitAmountInfo"
5501
+ }
5502
+ }
5503
+ },
5504
+ {
5505
+ name: "first_position_info",
5506
+ type: {
5507
+ defined: {
5508
+ name: "SplitPositionInfo"
5509
+ }
5510
+ }
5511
+ },
5512
+ {
5513
+ name: "second_position_info",
5514
+ type: {
5515
+ defined: {
5516
+ name: "SplitPositionInfo"
5517
+ }
5518
+ }
5519
+ },
5520
+ {
5521
+ name: "split_position_parameters",
5522
+ type: {
5523
+ defined: {
5524
+ name: "SplitPositionParameters"
5525
+ }
5526
+ }
5527
+ }
5528
+ ]
5529
+ }
5530
+ },
5538
5531
  {
5539
5532
  name: "EvtSwap",
5540
5533
  type: {
@@ -5980,6 +5973,13 @@ var cp_amm_default = {
5980
5973
  }
5981
5974
  }
5982
5975
  },
5976
+ {
5977
+ name: "creator",
5978
+ docs: [
5979
+ "pool creator"
5980
+ ],
5981
+ type: "pubkey"
5982
+ },
5983
5983
  {
5984
5984
  name: "_padding_1",
5985
5985
  docs: [
@@ -5988,7 +5988,7 @@ var cp_amm_default = {
5988
5988
  type: {
5989
5989
  array: [
5990
5990
  "u64",
5991
- 10
5991
+ 6
5992
5992
  ]
5993
5993
  }
5994
5994
  },
@@ -6031,25 +6031,16 @@ var cp_amm_default = {
6031
6031
  }
6032
6032
  },
6033
6033
  {
6034
- name: "protocol_fee_percent",
6035
- docs: [
6036
- "Protocol trade fee percent"
6037
- ],
6038
- type: "u8"
6039
- },
6040
- {
6041
- name: "partner_fee_percent",
6042
- docs: [
6043
- "partner fee percent"
6044
- ],
6045
- type: "u8"
6046
- },
6047
- {
6048
- name: "referral_fee_percent",
6034
+ name: "padding",
6049
6035
  docs: [
6050
- "referral fee percent"
6036
+ "padding"
6051
6037
  ],
6052
- type: "u8"
6038
+ type: {
6039
+ array: [
6040
+ "u8",
6041
+ 3
6042
+ ]
6043
+ }
6053
6044
  },
6054
6045
  {
6055
6046
  name: "dynamic_fee",
@@ -6552,6 +6543,128 @@ var cp_amm_default = {
6552
6543
  ]
6553
6544
  }
6554
6545
  },
6546
+ {
6547
+ name: "SplitAmountInfo",
6548
+ type: {
6549
+ kind: "struct",
6550
+ fields: [
6551
+ {
6552
+ name: "permanent_locked_liquidity",
6553
+ type: "u128"
6554
+ },
6555
+ {
6556
+ name: "unlocked_liquidity",
6557
+ type: "u128"
6558
+ },
6559
+ {
6560
+ name: "fee_a",
6561
+ type: "u64"
6562
+ },
6563
+ {
6564
+ name: "fee_b",
6565
+ type: "u64"
6566
+ },
6567
+ {
6568
+ name: "reward_0",
6569
+ type: "u64"
6570
+ },
6571
+ {
6572
+ name: "reward_1",
6573
+ type: "u64"
6574
+ }
6575
+ ]
6576
+ }
6577
+ },
6578
+ {
6579
+ name: "SplitPositionInfo",
6580
+ type: {
6581
+ kind: "struct",
6582
+ fields: [
6583
+ {
6584
+ name: "liquidity",
6585
+ type: "u128"
6586
+ },
6587
+ {
6588
+ name: "fee_a",
6589
+ type: "u64"
6590
+ },
6591
+ {
6592
+ name: "fee_b",
6593
+ type: "u64"
6594
+ },
6595
+ {
6596
+ name: "reward_0",
6597
+ type: "u64"
6598
+ },
6599
+ {
6600
+ name: "reward_1",
6601
+ type: "u64"
6602
+ }
6603
+ ]
6604
+ }
6605
+ },
6606
+ {
6607
+ name: "SplitPositionParameters",
6608
+ type: {
6609
+ kind: "struct",
6610
+ fields: [
6611
+ {
6612
+ name: "unlocked_liquidity_percentage",
6613
+ docs: [
6614
+ "Percentage of unlocked liquidity to split to the second position"
6615
+ ],
6616
+ type: "u8"
6617
+ },
6618
+ {
6619
+ name: "permanent_locked_liquidity_percentage",
6620
+ docs: [
6621
+ "Percentage of permanent locked liquidity to split to the second position"
6622
+ ],
6623
+ type: "u8"
6624
+ },
6625
+ {
6626
+ name: "fee_a_percentage",
6627
+ docs: [
6628
+ "Percentage of fee A pending to split to the second position"
6629
+ ],
6630
+ type: "u8"
6631
+ },
6632
+ {
6633
+ name: "fee_b_percentage",
6634
+ docs: [
6635
+ "Percentage of fee B pending to split to the second position"
6636
+ ],
6637
+ type: "u8"
6638
+ },
6639
+ {
6640
+ name: "reward_0_percentage",
6641
+ docs: [
6642
+ "Percentage of reward 0 pending to split to the second position"
6643
+ ],
6644
+ type: "u8"
6645
+ },
6646
+ {
6647
+ name: "reward_1_percentage",
6648
+ docs: [
6649
+ "Percentage of reward 1 pending to split to the second position"
6650
+ ],
6651
+ type: "u8"
6652
+ },
6653
+ {
6654
+ name: "padding",
6655
+ docs: [
6656
+ "padding for future"
6657
+ ],
6658
+ type: {
6659
+ array: [
6660
+ "u8",
6661
+ 16
6662
+ ]
6663
+ }
6664
+ }
6665
+ ]
6666
+ }
6667
+ },
6555
6668
  {
6556
6669
  name: "StaticConfigParameters",
6557
6670
  type: {
@@ -6978,10 +7091,10 @@ import {
6978
7091
  function getTokenProgram(flag) {
6979
7092
  return flag == 0 ? TOKEN_PROGRAM_ID : TOKEN_2022_PROGRAM_ID;
6980
7093
  }
6981
- var getTokenDecimals = (connection, mint) => __async(void 0, null, function* () {
7094
+ var getTokenDecimals = (connection, mint) => __async(null, null, function* () {
6982
7095
  return (yield getMint(connection, mint)).decimals;
6983
7096
  });
6984
- var getOrCreateATAInstruction = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (connection, tokenMint, owner, payer = owner, allowOwnerOffCurve = true, tokenProgram) {
7097
+ var getOrCreateATAInstruction = (_0, _1, _2, ..._3) => __async(null, [_0, _1, _2, ..._3], function* (connection, tokenMint, owner, payer = owner, allowOwnerOffCurve = true, tokenProgram) {
6985
7098
  const toAccount = getAssociatedTokenAddressSync(
6986
7099
  tokenMint,
6987
7100
  owner,
@@ -7027,7 +7140,7 @@ var wrapSOLInstruction = (from, to, amount) => {
7027
7140
  })
7028
7141
  ];
7029
7142
  };
7030
- var unwrapSOLInstruction = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (owner, receiver = owner, allowOwnerOffCurve = true) {
7143
+ var unwrapSOLInstruction = (_0, ..._1) => __async(null, [_0, ..._1], function* (owner, receiver = owner, allowOwnerOffCurve = true) {
7031
7144
  const wSolATAAccount = getAssociatedTokenAddressSync(
7032
7145
  NATIVE_MINT,
7033
7146
  owner,
@@ -7657,7 +7770,7 @@ import {
7657
7770
  TransactionMessage,
7658
7771
  VersionedTransaction
7659
7772
  } from "@solana/web3.js";
7660
- var getSimulationComputeUnits = (connection, instructions, payer, lookupTables, commitment = "confirmed") => __async(void 0, null, function* () {
7773
+ var getSimulationComputeUnits = (connection, instructions, payer, lookupTables, commitment = "confirmed") => __async(null, null, function* () {
7661
7774
  var _a, _b, _c;
7662
7775
  const testInstructions = [
7663
7776
  // Set an arbitrarily high number in simulation
@@ -7689,7 +7802,7 @@ var getSimulationComputeUnits = (connection, instructions, payer, lookupTables,
7689
7802
  }
7690
7803
  return rpcResponse.value.unitsConsumed || null;
7691
7804
  });
7692
- var getEstimatedComputeUnitUsageWithBuffer = (connection, instructions, feePayer, buffer) => __async(void 0, null, function* () {
7805
+ var getEstimatedComputeUnitUsageWithBuffer = (connection, instructions, feePayer, buffer) => __async(null, null, function* () {
7693
7806
  if (!buffer) {
7694
7807
  buffer = 0.1;
7695
7808
  }
@@ -7712,7 +7825,7 @@ var getEstimatedComputeUnitUsageWithBuffer = (connection, instructions, feePayer
7712
7825
  }
7713
7826
  return estimatedComputeUnitUsage + extraComputeUnitBuffer;
7714
7827
  });
7715
- var getEstimatedComputeUnitIxWithBuffer = (connection, instructions, feePayer, buffer) => __async(void 0, null, function* () {
7828
+ var getEstimatedComputeUnitIxWithBuffer = (connection, instructions, feePayer, buffer) => __async(null, null, function* () {
7716
7829
  const units = yield getEstimatedComputeUnitUsageWithBuffer(
7717
7830
  connection,
7718
7831
  instructions,
@@ -9993,7 +10106,7 @@ var CpAmm = class {
9993
10106
  const { pool, admin, rewardIndex, newDuration } = params;
9994
10107
  return yield this._program.methods.updateRewardDuration(rewardIndex, newDuration).accountsPartial({
9995
10108
  pool,
9996
- admin
10109
+ signer: admin
9997
10110
  }).transaction();
9998
10111
  });
9999
10112
  }
@@ -10007,7 +10120,7 @@ var CpAmm = class {
10007
10120
  const { pool, admin, rewardIndex, newFunder } = params;
10008
10121
  return yield this._program.methods.updateRewardFunder(rewardIndex, newFunder).accountsPartial({
10009
10122
  pool,
10010
- admin
10123
+ signer: admin
10011
10124
  }).transaction();
10012
10125
  });
10013
10126
  }
@@ -10284,6 +10397,7 @@ var CpAmm = class {
10284
10397
  position,
10285
10398
  positionNftAccount,
10286
10399
  rewardIndex,
10400
+ skipReward,
10287
10401
  poolState,
10288
10402
  positionState
10289
10403
  } = params;
@@ -10304,7 +10418,7 @@ var CpAmm = class {
10304
10418
  const closeWrappedSOLIx = yield unwrapSOLInstruction(user);
10305
10419
  closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
10306
10420
  }
10307
- return yield this._program.methods.claimReward(rewardIndex).accountsPartial({
10421
+ return yield this._program.methods.claimReward(rewardIndex, skipReward).accountsPartial({
10308
10422
  pool: positionState.pool,
10309
10423
  positionNftAccount,
10310
10424
  rewardVault: rewardInfo.vault,
@@ -10317,6 +10431,42 @@ var CpAmm = class {
10317
10431
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
10318
10432
  });
10319
10433
  }
10434
+ splitPosition(params) {
10435
+ return __async(this, null, function* () {
10436
+ const {
10437
+ firstPositionOwner,
10438
+ secondPositionOwner,
10439
+ pool,
10440
+ firstPosition,
10441
+ firstPositionNftAccount,
10442
+ secondPosition,
10443
+ secondPositionNftAccount,
10444
+ permanentLockedLiquidityPercentage,
10445
+ unlockedLiquidityPercentage,
10446
+ feeAPercentage,
10447
+ feeBPercentage,
10448
+ reward0Percentage,
10449
+ reward1Percentage
10450
+ } = params;
10451
+ return yield this._program.methods.splitPosition({
10452
+ permanentLockedLiquidityPercentage,
10453
+ unlockedLiquidityPercentage,
10454
+ feeAPercentage,
10455
+ feeBPercentage,
10456
+ reward0Percentage,
10457
+ reward1Percentage,
10458
+ padding: new Array(16).fill(0)
10459
+ }).accountsPartial({
10460
+ pool,
10461
+ firstPosition,
10462
+ firstPositionNftAccount,
10463
+ secondPosition,
10464
+ secondPositionNftAccount,
10465
+ firstOwner: firstPositionOwner,
10466
+ secondOwner: secondPositionOwner
10467
+ }).transaction();
10468
+ });
10469
+ }
10320
10470
  };
10321
10471
 
10322
10472
  // src/index.ts