@meteora-ag/cp-amm-sdk 1.1.4 → 1.1.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.d.mts +272 -18
- package/dist/index.d.ts +272 -18
- package/dist/index.js +171 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
33
|
+
version: "0.1.4",
|
|
34
34
|
spec: "0.1.0",
|
|
35
35
|
description: "Created with Anchor"
|
|
36
36
|
},
|
|
@@ -3376,6 +3376,107 @@ var cp_amm_default = {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
]
|
|
3378
3378
|
},
|
|
3379
|
+
{
|
|
3380
|
+
name: "split_position2",
|
|
3381
|
+
discriminator: [
|
|
3382
|
+
221,
|
|
3383
|
+
147,
|
|
3384
|
+
228,
|
|
3385
|
+
207,
|
|
3386
|
+
140,
|
|
3387
|
+
212,
|
|
3388
|
+
17,
|
|
3389
|
+
119
|
|
3390
|
+
],
|
|
3391
|
+
accounts: [
|
|
3392
|
+
{
|
|
3393
|
+
name: "pool",
|
|
3394
|
+
writable: true,
|
|
3395
|
+
relations: [
|
|
3396
|
+
"first_position",
|
|
3397
|
+
"second_position"
|
|
3398
|
+
]
|
|
3399
|
+
},
|
|
3400
|
+
{
|
|
3401
|
+
name: "first_position",
|
|
3402
|
+
docs: [
|
|
3403
|
+
"The first position"
|
|
3404
|
+
],
|
|
3405
|
+
writable: true
|
|
3406
|
+
},
|
|
3407
|
+
{
|
|
3408
|
+
name: "first_position_nft_account",
|
|
3409
|
+
docs: [
|
|
3410
|
+
"The token account for position nft"
|
|
3411
|
+
]
|
|
3412
|
+
},
|
|
3413
|
+
{
|
|
3414
|
+
name: "second_position",
|
|
3415
|
+
docs: [
|
|
3416
|
+
"The second position"
|
|
3417
|
+
],
|
|
3418
|
+
writable: true
|
|
3419
|
+
},
|
|
3420
|
+
{
|
|
3421
|
+
name: "second_position_nft_account",
|
|
3422
|
+
docs: [
|
|
3423
|
+
"The token account for position nft"
|
|
3424
|
+
]
|
|
3425
|
+
},
|
|
3426
|
+
{
|
|
3427
|
+
name: "first_owner",
|
|
3428
|
+
docs: [
|
|
3429
|
+
"Owner of first position"
|
|
3430
|
+
],
|
|
3431
|
+
signer: true
|
|
3432
|
+
},
|
|
3433
|
+
{
|
|
3434
|
+
name: "second_owner",
|
|
3435
|
+
docs: [
|
|
3436
|
+
"Owner of second position"
|
|
3437
|
+
],
|
|
3438
|
+
signer: true
|
|
3439
|
+
},
|
|
3440
|
+
{
|
|
3441
|
+
name: "event_authority",
|
|
3442
|
+
pda: {
|
|
3443
|
+
seeds: [
|
|
3444
|
+
{
|
|
3445
|
+
kind: "const",
|
|
3446
|
+
value: [
|
|
3447
|
+
95,
|
|
3448
|
+
95,
|
|
3449
|
+
101,
|
|
3450
|
+
118,
|
|
3451
|
+
101,
|
|
3452
|
+
110,
|
|
3453
|
+
116,
|
|
3454
|
+
95,
|
|
3455
|
+
97,
|
|
3456
|
+
117,
|
|
3457
|
+
116,
|
|
3458
|
+
104,
|
|
3459
|
+
111,
|
|
3460
|
+
114,
|
|
3461
|
+
105,
|
|
3462
|
+
116,
|
|
3463
|
+
121
|
|
3464
|
+
]
|
|
3465
|
+
}
|
|
3466
|
+
]
|
|
3467
|
+
}
|
|
3468
|
+
},
|
|
3469
|
+
{
|
|
3470
|
+
name: "program"
|
|
3471
|
+
}
|
|
3472
|
+
],
|
|
3473
|
+
args: [
|
|
3474
|
+
{
|
|
3475
|
+
name: "numerator",
|
|
3476
|
+
type: "u32"
|
|
3477
|
+
}
|
|
3478
|
+
]
|
|
3479
|
+
},
|
|
3379
3480
|
{
|
|
3380
3481
|
name: "swap",
|
|
3381
3482
|
discriminator: [
|
|
@@ -4069,16 +4170,16 @@ var cp_amm_default = {
|
|
|
4069
4170
|
]
|
|
4070
4171
|
},
|
|
4071
4172
|
{
|
|
4072
|
-
name: "
|
|
4173
|
+
name: "EvtSplitPosition2",
|
|
4073
4174
|
discriminator: [
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4175
|
+
165,
|
|
4176
|
+
32,
|
|
4177
|
+
203,
|
|
4178
|
+
174,
|
|
4179
|
+
72,
|
|
4180
|
+
100,
|
|
4181
|
+
233,
|
|
4182
|
+
103
|
|
4082
4183
|
]
|
|
4083
4184
|
},
|
|
4084
4185
|
{
|
|
@@ -5465,7 +5566,7 @@ var cp_amm_default = {
|
|
|
5465
5566
|
}
|
|
5466
5567
|
},
|
|
5467
5568
|
{
|
|
5468
|
-
name: "
|
|
5569
|
+
name: "EvtSplitPosition2",
|
|
5469
5570
|
type: {
|
|
5470
5571
|
kind: "struct",
|
|
5471
5572
|
fields: [
|
|
@@ -5521,7 +5622,7 @@ var cp_amm_default = {
|
|
|
5521
5622
|
name: "split_position_parameters",
|
|
5522
5623
|
type: {
|
|
5523
5624
|
defined: {
|
|
5524
|
-
name: "
|
|
5625
|
+
name: "SplitPositionParameters2"
|
|
5525
5626
|
}
|
|
5526
5627
|
}
|
|
5527
5628
|
}
|
|
@@ -6665,6 +6766,38 @@ var cp_amm_default = {
|
|
|
6665
6766
|
]
|
|
6666
6767
|
}
|
|
6667
6768
|
},
|
|
6769
|
+
{
|
|
6770
|
+
name: "SplitPositionParameters2",
|
|
6771
|
+
type: {
|
|
6772
|
+
kind: "struct",
|
|
6773
|
+
fields: [
|
|
6774
|
+
{
|
|
6775
|
+
name: "unlocked_liquidity_numerator",
|
|
6776
|
+
type: "u32"
|
|
6777
|
+
},
|
|
6778
|
+
{
|
|
6779
|
+
name: "permanent_locked_liquidity_numerator",
|
|
6780
|
+
type: "u32"
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
name: "fee_a_numerator",
|
|
6784
|
+
type: "u32"
|
|
6785
|
+
},
|
|
6786
|
+
{
|
|
6787
|
+
name: "fee_b_numerator",
|
|
6788
|
+
type: "u32"
|
|
6789
|
+
},
|
|
6790
|
+
{
|
|
6791
|
+
name: "reward_0_numerator",
|
|
6792
|
+
type: "u32"
|
|
6793
|
+
},
|
|
6794
|
+
{
|
|
6795
|
+
name: "reward_1_numerator",
|
|
6796
|
+
type: "u32"
|
|
6797
|
+
}
|
|
6798
|
+
]
|
|
6799
|
+
}
|
|
6800
|
+
},
|
|
6668
6801
|
{
|
|
6669
6802
|
name: "StaticConfigParameters",
|
|
6670
6803
|
type: {
|
|
@@ -6981,6 +7114,7 @@ var DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = 5e3;
|
|
|
6981
7114
|
var BIN_STEP_BPS_DEFAULT = 1;
|
|
6982
7115
|
var BIN_STEP_BPS_U128_DEFAULT = new BN("1844674407370955");
|
|
6983
7116
|
var MAX_PRICE_CHANGE_BPS_DEFAULT = 1500;
|
|
7117
|
+
var SPLIT_POSITION_DENOMINATOR = 1e9;
|
|
6984
7118
|
|
|
6985
7119
|
// src/pda.ts
|
|
6986
7120
|
function getFirstKey(key1, key2) {
|
|
@@ -10512,6 +10646,29 @@ var CpAmm = class {
|
|
|
10512
10646
|
}).transaction();
|
|
10513
10647
|
});
|
|
10514
10648
|
}
|
|
10649
|
+
splitPosition2(params) {
|
|
10650
|
+
return __async(this, null, function* () {
|
|
10651
|
+
const {
|
|
10652
|
+
firstPositionOwner,
|
|
10653
|
+
secondPositionOwner,
|
|
10654
|
+
pool,
|
|
10655
|
+
firstPosition,
|
|
10656
|
+
firstPositionNftAccount,
|
|
10657
|
+
secondPosition,
|
|
10658
|
+
secondPositionNftAccount,
|
|
10659
|
+
numerator
|
|
10660
|
+
} = params;
|
|
10661
|
+
return yield this._program.methods.splitPosition2(numerator).accountsPartial({
|
|
10662
|
+
pool,
|
|
10663
|
+
firstPosition,
|
|
10664
|
+
firstPositionNftAccount,
|
|
10665
|
+
secondPosition,
|
|
10666
|
+
secondPositionNftAccount,
|
|
10667
|
+
firstOwner: firstPositionOwner,
|
|
10668
|
+
secondOwner: secondPositionOwner
|
|
10669
|
+
}).transaction();
|
|
10670
|
+
});
|
|
10671
|
+
}
|
|
10515
10672
|
};
|
|
10516
10673
|
|
|
10517
10674
|
// src/index.ts
|
|
@@ -10540,6 +10697,7 @@ export {
|
|
|
10540
10697
|
ONE,
|
|
10541
10698
|
Rounding,
|
|
10542
10699
|
SCALE_OFFSET,
|
|
10700
|
+
SPLIT_POSITION_DENOMINATOR,
|
|
10543
10701
|
TradeDirection,
|
|
10544
10702
|
bpsToFeeNumerator,
|
|
10545
10703
|
calculateInitSqrtPrice,
|