@meteora-ag/cp-amm-sdk 1.1.3 → 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 +184 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type CpAmm$1 = {
|
|
|
13
13
|
address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
|
|
14
14
|
metadata: {
|
|
15
15
|
name: "cpAmm";
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.4";
|
|
17
17
|
spec: "0.1.0";
|
|
18
18
|
description: "Created with Anchor";
|
|
19
19
|
};
|
|
@@ -2668,6 +2668,83 @@ type CpAmm$1 = {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
];
|
|
2670
2670
|
},
|
|
2671
|
+
{
|
|
2672
|
+
name: "splitPosition2";
|
|
2673
|
+
discriminator: [221, 147, 228, 207, 140, 212, 17, 119];
|
|
2674
|
+
accounts: [
|
|
2675
|
+
{
|
|
2676
|
+
name: "pool";
|
|
2677
|
+
writable: true;
|
|
2678
|
+
relations: ["firstPosition", "secondPosition"];
|
|
2679
|
+
},
|
|
2680
|
+
{
|
|
2681
|
+
name: "firstPosition";
|
|
2682
|
+
docs: ["The first position"];
|
|
2683
|
+
writable: true;
|
|
2684
|
+
},
|
|
2685
|
+
{
|
|
2686
|
+
name: "firstPositionNftAccount";
|
|
2687
|
+
docs: ["The token account for position nft"];
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
name: "secondPosition";
|
|
2691
|
+
docs: ["The second position"];
|
|
2692
|
+
writable: true;
|
|
2693
|
+
},
|
|
2694
|
+
{
|
|
2695
|
+
name: "secondPositionNftAccount";
|
|
2696
|
+
docs: ["The token account for position nft"];
|
|
2697
|
+
},
|
|
2698
|
+
{
|
|
2699
|
+
name: "firstOwner";
|
|
2700
|
+
docs: ["Owner of first position"];
|
|
2701
|
+
signer: true;
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
name: "secondOwner";
|
|
2705
|
+
docs: ["Owner of second position"];
|
|
2706
|
+
signer: true;
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
name: "eventAuthority";
|
|
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
|
+
};
|
|
2736
|
+
},
|
|
2737
|
+
{
|
|
2738
|
+
name: "program";
|
|
2739
|
+
}
|
|
2740
|
+
];
|
|
2741
|
+
args: [
|
|
2742
|
+
{
|
|
2743
|
+
name: "numerator";
|
|
2744
|
+
type: "u32";
|
|
2745
|
+
}
|
|
2746
|
+
];
|
|
2747
|
+
},
|
|
2671
2748
|
{
|
|
2672
2749
|
name: "swap";
|
|
2673
2750
|
discriminator: [248, 198, 158, 145, 225, 117, 135, 200];
|
|
@@ -3065,8 +3142,8 @@ type CpAmm$1 = {
|
|
|
3065
3142
|
discriminator: [100, 213, 74, 3, 95, 91, 228, 146];
|
|
3066
3143
|
},
|
|
3067
3144
|
{
|
|
3068
|
-
name: "
|
|
3069
|
-
discriminator: [
|
|
3145
|
+
name: "evtSplitPosition2";
|
|
3146
|
+
discriminator: [165, 32, 203, 174, 72, 100, 233, 103];
|
|
3070
3147
|
},
|
|
3071
3148
|
{
|
|
3072
3149
|
name: "evtSwap";
|
|
@@ -4343,7 +4420,7 @@ type CpAmm$1 = {
|
|
|
4343
4420
|
};
|
|
4344
4421
|
},
|
|
4345
4422
|
{
|
|
4346
|
-
name: "
|
|
4423
|
+
name: "evtSplitPosition2";
|
|
4347
4424
|
type: {
|
|
4348
4425
|
kind: "struct";
|
|
4349
4426
|
fields: [
|
|
@@ -4399,7 +4476,7 @@ type CpAmm$1 = {
|
|
|
4399
4476
|
name: "splitPositionParameters";
|
|
4400
4477
|
type: {
|
|
4401
4478
|
defined: {
|
|
4402
|
-
name: "
|
|
4479
|
+
name: "splitPositionParameters2";
|
|
4403
4480
|
};
|
|
4404
4481
|
};
|
|
4405
4482
|
}
|
|
@@ -5347,6 +5424,38 @@ type CpAmm$1 = {
|
|
|
5347
5424
|
];
|
|
5348
5425
|
};
|
|
5349
5426
|
},
|
|
5427
|
+
{
|
|
5428
|
+
name: "splitPositionParameters2";
|
|
5429
|
+
type: {
|
|
5430
|
+
kind: "struct";
|
|
5431
|
+
fields: [
|
|
5432
|
+
{
|
|
5433
|
+
name: "unlockedLiquidityNumerator";
|
|
5434
|
+
type: "u32";
|
|
5435
|
+
},
|
|
5436
|
+
{
|
|
5437
|
+
name: "permanentLockedLiquidityNumerator";
|
|
5438
|
+
type: "u32";
|
|
5439
|
+
},
|
|
5440
|
+
{
|
|
5441
|
+
name: "feeANumerator";
|
|
5442
|
+
type: "u32";
|
|
5443
|
+
},
|
|
5444
|
+
{
|
|
5445
|
+
name: "feeBNumerator";
|
|
5446
|
+
type: "u32";
|
|
5447
|
+
},
|
|
5448
|
+
{
|
|
5449
|
+
name: "reward0Numerator";
|
|
5450
|
+
type: "u32";
|
|
5451
|
+
},
|
|
5452
|
+
{
|
|
5453
|
+
name: "reward1Numerator";
|
|
5454
|
+
type: "u32";
|
|
5455
|
+
}
|
|
5456
|
+
];
|
|
5457
|
+
};
|
|
5458
|
+
},
|
|
5350
5459
|
{
|
|
5351
5460
|
name: "staticConfigParameters";
|
|
5352
5461
|
type: {
|
|
@@ -6151,6 +6260,16 @@ type SplitPositionParams = {
|
|
|
6151
6260
|
reward0Percentage: number;
|
|
6152
6261
|
reward1Percentage: number;
|
|
6153
6262
|
};
|
|
6263
|
+
type SplitPosition2Params = {
|
|
6264
|
+
firstPositionOwner: PublicKey;
|
|
6265
|
+
secondPositionOwner: PublicKey;
|
|
6266
|
+
pool: PublicKey;
|
|
6267
|
+
firstPosition: PublicKey;
|
|
6268
|
+
firstPositionNftAccount: PublicKey;
|
|
6269
|
+
secondPosition: PublicKey;
|
|
6270
|
+
secondPositionNftAccount: PublicKey;
|
|
6271
|
+
numerator: number;
|
|
6272
|
+
};
|
|
6154
6273
|
|
|
6155
6274
|
/**
|
|
6156
6275
|
* CpAmm SDK class to interact with the DAMM-V2
|
|
@@ -6559,6 +6678,7 @@ declare class CpAmm {
|
|
|
6559
6678
|
*/
|
|
6560
6679
|
claimReward(params: ClaimRewardParams): TxBuilder;
|
|
6561
6680
|
splitPosition(params: SplitPositionParams): TxBuilder;
|
|
6681
|
+
splitPosition2(params: SplitPosition2Params): TxBuilder;
|
|
6562
6682
|
}
|
|
6563
6683
|
|
|
6564
6684
|
declare function getFirstKey(key1: PublicKey, key2: PublicKey): Buffer<ArrayBufferLike>;
|
|
@@ -6590,6 +6710,7 @@ declare const DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = 5000;
|
|
|
6590
6710
|
declare const BIN_STEP_BPS_DEFAULT = 1;
|
|
6591
6711
|
declare const BIN_STEP_BPS_U128_DEFAULT: BN;
|
|
6592
6712
|
declare const MAX_PRICE_CHANGE_BPS_DEFAULT = 1500;
|
|
6713
|
+
declare const SPLIT_POSITION_DENOMINATOR = 1000000000;
|
|
6593
6714
|
|
|
6594
6715
|
declare function getTokenProgram(flag: number): PublicKey;
|
|
6595
6716
|
declare const getTokenDecimals: (connection: Connection, mint: PublicKey) => Promise<number>;
|
|
@@ -6858,7 +6979,7 @@ declare function decimalToQ64(num: Decimal): BN;
|
|
|
6858
6979
|
var address = "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG";
|
|
6859
6980
|
var metadata = {
|
|
6860
6981
|
name: "cp_amm",
|
|
6861
|
-
version: "0.1.
|
|
6982
|
+
version: "0.1.4",
|
|
6862
6983
|
spec: "0.1.0",
|
|
6863
6984
|
description: "Created with Anchor"
|
|
6864
6985
|
};
|
|
@@ -10213,6 +10334,107 @@ var instructions = [
|
|
|
10213
10334
|
}
|
|
10214
10335
|
]
|
|
10215
10336
|
},
|
|
10337
|
+
{
|
|
10338
|
+
name: "split_position2",
|
|
10339
|
+
discriminator: [
|
|
10340
|
+
221,
|
|
10341
|
+
147,
|
|
10342
|
+
228,
|
|
10343
|
+
207,
|
|
10344
|
+
140,
|
|
10345
|
+
212,
|
|
10346
|
+
17,
|
|
10347
|
+
119
|
|
10348
|
+
],
|
|
10349
|
+
accounts: [
|
|
10350
|
+
{
|
|
10351
|
+
name: "pool",
|
|
10352
|
+
writable: true,
|
|
10353
|
+
relations: [
|
|
10354
|
+
"first_position",
|
|
10355
|
+
"second_position"
|
|
10356
|
+
]
|
|
10357
|
+
},
|
|
10358
|
+
{
|
|
10359
|
+
name: "first_position",
|
|
10360
|
+
docs: [
|
|
10361
|
+
"The first position"
|
|
10362
|
+
],
|
|
10363
|
+
writable: true
|
|
10364
|
+
},
|
|
10365
|
+
{
|
|
10366
|
+
name: "first_position_nft_account",
|
|
10367
|
+
docs: [
|
|
10368
|
+
"The token account for position nft"
|
|
10369
|
+
]
|
|
10370
|
+
},
|
|
10371
|
+
{
|
|
10372
|
+
name: "second_position",
|
|
10373
|
+
docs: [
|
|
10374
|
+
"The second position"
|
|
10375
|
+
],
|
|
10376
|
+
writable: true
|
|
10377
|
+
},
|
|
10378
|
+
{
|
|
10379
|
+
name: "second_position_nft_account",
|
|
10380
|
+
docs: [
|
|
10381
|
+
"The token account for position nft"
|
|
10382
|
+
]
|
|
10383
|
+
},
|
|
10384
|
+
{
|
|
10385
|
+
name: "first_owner",
|
|
10386
|
+
docs: [
|
|
10387
|
+
"Owner of first position"
|
|
10388
|
+
],
|
|
10389
|
+
signer: true
|
|
10390
|
+
},
|
|
10391
|
+
{
|
|
10392
|
+
name: "second_owner",
|
|
10393
|
+
docs: [
|
|
10394
|
+
"Owner of second position"
|
|
10395
|
+
],
|
|
10396
|
+
signer: true
|
|
10397
|
+
},
|
|
10398
|
+
{
|
|
10399
|
+
name: "event_authority",
|
|
10400
|
+
pda: {
|
|
10401
|
+
seeds: [
|
|
10402
|
+
{
|
|
10403
|
+
kind: "const",
|
|
10404
|
+
value: [
|
|
10405
|
+
95,
|
|
10406
|
+
95,
|
|
10407
|
+
101,
|
|
10408
|
+
118,
|
|
10409
|
+
101,
|
|
10410
|
+
110,
|
|
10411
|
+
116,
|
|
10412
|
+
95,
|
|
10413
|
+
97,
|
|
10414
|
+
117,
|
|
10415
|
+
116,
|
|
10416
|
+
104,
|
|
10417
|
+
111,
|
|
10418
|
+
114,
|
|
10419
|
+
105,
|
|
10420
|
+
116,
|
|
10421
|
+
121
|
|
10422
|
+
]
|
|
10423
|
+
}
|
|
10424
|
+
]
|
|
10425
|
+
}
|
|
10426
|
+
},
|
|
10427
|
+
{
|
|
10428
|
+
name: "program"
|
|
10429
|
+
}
|
|
10430
|
+
],
|
|
10431
|
+
args: [
|
|
10432
|
+
{
|
|
10433
|
+
name: "numerator",
|
|
10434
|
+
type: "u32"
|
|
10435
|
+
}
|
|
10436
|
+
]
|
|
10437
|
+
},
|
|
10216
10438
|
{
|
|
10217
10439
|
name: "swap",
|
|
10218
10440
|
discriminator: [
|
|
@@ -10906,16 +11128,16 @@ var events = [
|
|
|
10906
11128
|
]
|
|
10907
11129
|
},
|
|
10908
11130
|
{
|
|
10909
|
-
name: "
|
|
11131
|
+
name: "EvtSplitPosition2",
|
|
10910
11132
|
discriminator: [
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
11133
|
+
165,
|
|
11134
|
+
32,
|
|
11135
|
+
203,
|
|
11136
|
+
174,
|
|
11137
|
+
72,
|
|
11138
|
+
100,
|
|
11139
|
+
233,
|
|
11140
|
+
103
|
|
10919
11141
|
]
|
|
10920
11142
|
},
|
|
10921
11143
|
{
|
|
@@ -12302,7 +12524,7 @@ var types = [
|
|
|
12302
12524
|
}
|
|
12303
12525
|
},
|
|
12304
12526
|
{
|
|
12305
|
-
name: "
|
|
12527
|
+
name: "EvtSplitPosition2",
|
|
12306
12528
|
type: {
|
|
12307
12529
|
kind: "struct",
|
|
12308
12530
|
fields: [
|
|
@@ -12358,7 +12580,7 @@ var types = [
|
|
|
12358
12580
|
name: "split_position_parameters",
|
|
12359
12581
|
type: {
|
|
12360
12582
|
defined: {
|
|
12361
|
-
name: "
|
|
12583
|
+
name: "SplitPositionParameters2"
|
|
12362
12584
|
}
|
|
12363
12585
|
}
|
|
12364
12586
|
}
|
|
@@ -13502,6 +13724,38 @@ var types = [
|
|
|
13502
13724
|
]
|
|
13503
13725
|
}
|
|
13504
13726
|
},
|
|
13727
|
+
{
|
|
13728
|
+
name: "SplitPositionParameters2",
|
|
13729
|
+
type: {
|
|
13730
|
+
kind: "struct",
|
|
13731
|
+
fields: [
|
|
13732
|
+
{
|
|
13733
|
+
name: "unlocked_liquidity_numerator",
|
|
13734
|
+
type: "u32"
|
|
13735
|
+
},
|
|
13736
|
+
{
|
|
13737
|
+
name: "permanent_locked_liquidity_numerator",
|
|
13738
|
+
type: "u32"
|
|
13739
|
+
},
|
|
13740
|
+
{
|
|
13741
|
+
name: "fee_a_numerator",
|
|
13742
|
+
type: "u32"
|
|
13743
|
+
},
|
|
13744
|
+
{
|
|
13745
|
+
name: "fee_b_numerator",
|
|
13746
|
+
type: "u32"
|
|
13747
|
+
},
|
|
13748
|
+
{
|
|
13749
|
+
name: "reward_0_numerator",
|
|
13750
|
+
type: "u32"
|
|
13751
|
+
},
|
|
13752
|
+
{
|
|
13753
|
+
name: "reward_1_numerator",
|
|
13754
|
+
type: "u32"
|
|
13755
|
+
}
|
|
13756
|
+
]
|
|
13757
|
+
}
|
|
13758
|
+
},
|
|
13505
13759
|
{
|
|
13506
13760
|
name: "StaticConfigParameters",
|
|
13507
13761
|
type: {
|
|
@@ -13764,4 +14018,4 @@ var CpAmmIDL = {
|
|
|
13764
14018
|
types: types
|
|
13765
14019
|
};
|
|
13766
14020
|
|
|
13767
|
-
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimPositionFeeParams2, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteExactOutParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type QuoteExactOutResult, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, type SetupFeeClaimAccountsParams, type SplitPositionParams, type SwapAmount, type SwapParams, type SwapQuotes, type SwapResult, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getExcludedFeeAmount, getFeeMode, getFeeNumerator, getFirstKey, getIncludedFeeAmount, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNextSqrtPriceFromAmountARoundingDown, getNextSqrtPriceFromAmountBRoundingUp, getNextSqrtPriceFromOutput, getOrCreateATAInstruction, getPriceChange, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getSwapResultFromOutAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
|
14021
|
+
export { ActivationPoint, ActivationType, type AddLiquidityParams, type AmmProgram, BASIS_POINT_MAX, BIN_STEP_BPS_DEFAULT, BIN_STEP_BPS_U128_DEFAULT, type BaseFee, type BuildAddLiquidityParams, type BuildLiquidatePositionInstructionParams, type BuildRemoveAllLiquidityInstructionParams, CP_AMM_PROGRAM_ID, type ClaimPartnerFeeParams, type ClaimPositionFeeInstructionParams, type ClaimPositionFeeParams, type ClaimPositionFeeParams2, type ClaimRewardParams, type ClosePositionInstructionParams, type ClosePositionParams, CollectFeeMode, type ConfigState, CpAmm, type CpAmm$1 as CpAmmTypes, type CreatePoolParams, type CreatePositionAndAddLiquidity, type CreatePositionParams, DYNAMIC_FEE_DECAY_PERIOD_DEFAULT, DYNAMIC_FEE_FILTER_PERIOD_DEFAULT, DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT, type DepositQuote, type DynamicFee, type DynamicFeeParams, FEE_DENOMINATOR, type FeeMode, FeeSchedulerMode, type FundRewardParams, type GetDepositQuoteParams, type GetQuoteExactOutParams, type GetQuoteParams, type GetWithdrawQuoteParams, type InitializeCustomizeablePoolParams, type InitializeCustomizeablePoolWithDynamicConfigParams, type InitializeRewardParams, LIQUIDITY_SCALE, type LiquidityDeltaParams, type LockPositionParams, MAX_CU_BUFFER, MAX_FEE_NUMERATOR, MAX_PRICE_CHANGE_BPS_DEFAULT, MAX_SQRT_PRICE, MIN_CU_BUFFER, MIN_SQRT_PRICE, type MergePositionParams, ONE, type PermanentLockParams, type PoolFeesParams, type PoolState, type PositionState, type PrepareCustomizablePoolParams, type PreparePoolCreationParams, type PreparePoolCreationSingleSide, type PrepareTokenAccountParams, type PreparedPoolCreation, type QuoteExactOutResult, type RefreshVestingParams, type RemoveAllLiquidityAndClosePositionParams, type RemoveAllLiquidityParams, type RemoveLiquidityParams, type RewardInfo, Rounding, SCALE_OFFSET, SPLIT_POSITION_DENOMINATOR, type SetupFeeClaimAccountsParams, type SplitPosition2Params, type SplitPositionParams, type SwapAmount, type SwapParams, type SwapQuotes, type SwapResult, type TokenBadgeState, TradeDirection, type TxBuilder, type UpdateRewardDurationParams, type UpdateRewardFunderParams, type VestingState, type WithdrawIneligibleRewardParams, type WithdrawQuote, bpsToFeeNumerator, calculateInitSqrtPrice, calculateTransferFeeExcludedAmount, calculateTransferFeeIncludedAmount, decimalToQ64, CpAmmIDL as default, deriveClaimFeeOperatorAddress, deriveConfigAddress, deriveCustomizablePoolAddress, derivePoolAddress, derivePoolAuthority, derivePositionAddress, derivePositionNftAccount, deriveRewardVaultAddress, deriveTokenBadgeAddress, deriveTokenVaultAddress, feeNumeratorToBps, getAllPositionNftAccountByOwner, getAllUserPositionNftAccount, getAmountAFromLiquidityDelta, getAmountBFromLiquidityDelta, getAvailableVestingLiquidity, getBaseFeeNumerator, getBaseFeeParams, getDynamicFeeNumerator, getDynamicFeeParams, getEstimatedComputeUnitIxWithBuffer, getEstimatedComputeUnitUsageWithBuffer, getExcludedFeeAmount, getFeeMode, getFeeNumerator, getFirstKey, getIncludedFeeAmount, getLiquidityDeltaFromAmountA, getLiquidityDeltaFromAmountB, getMaxAmountWithSlippage, getMinAmountWithSlippage, getNextSqrtPrice, getNextSqrtPriceFromAmountARoundingDown, getNextSqrtPriceFromAmountBRoundingUp, getNextSqrtPriceFromOutput, getOrCreateATAInstruction, getPriceChange, getPriceFromSqrtPrice, getPriceImpact, getSecondKey, getSimulationComputeUnits, getSqrtPriceFromPrice, getSwapAmount, getSwapResultFromOutAmount, getTokenDecimals, getTokenProgram, getTotalLockedLiquidity, getUnClaimReward, isVestingComplete, mulDiv, positionByPoolFilter, pow, q64ToDecimal, unwrapSOLInstruction, vestingByPositionFilter, wrapSOLInstruction };
|
package/dist/index.js
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 (0, _anchor.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) {
|
|
@@ -7440,19 +7574,21 @@ function getDynamicFeeNumerator(volatilityAccumulator, binStep, variableFeeContr
|
|
|
7440
7574
|
return vFee.add(new (0, _anchor.BN)(99999999999)).div(new (0, _anchor.BN)(1e11));
|
|
7441
7575
|
}
|
|
7442
7576
|
function getFeeNumerator(currentPoint, activationPoint, numberOfPeriod, periodFrequency, feeSchedulerMode, cliffFeeNumerator, reductionFactor, dynamicFeeParams) {
|
|
7577
|
+
let feeNumerator;
|
|
7443
7578
|
if (Number(periodFrequency) == 0 || new (0, _anchor.BN)(currentPoint).lt(activationPoint)) {
|
|
7444
|
-
|
|
7579
|
+
feeNumerator = cliffFeeNumerator;
|
|
7580
|
+
} else {
|
|
7581
|
+
const period = _anchor.BN.min(
|
|
7582
|
+
new (0, _anchor.BN)(numberOfPeriod),
|
|
7583
|
+
new (0, _anchor.BN)(currentPoint).sub(activationPoint).div(periodFrequency)
|
|
7584
|
+
);
|
|
7585
|
+
feeNumerator = getBaseFeeNumerator(
|
|
7586
|
+
feeSchedulerMode,
|
|
7587
|
+
cliffFeeNumerator,
|
|
7588
|
+
period,
|
|
7589
|
+
reductionFactor
|
|
7590
|
+
);
|
|
7445
7591
|
}
|
|
7446
|
-
const period = _anchor.BN.min(
|
|
7447
|
-
new (0, _anchor.BN)(numberOfPeriod),
|
|
7448
|
-
new (0, _anchor.BN)(currentPoint).sub(activationPoint).div(periodFrequency)
|
|
7449
|
-
);
|
|
7450
|
-
let feeNumerator = getBaseFeeNumerator(
|
|
7451
|
-
feeSchedulerMode,
|
|
7452
|
-
cliffFeeNumerator,
|
|
7453
|
-
period,
|
|
7454
|
-
reductionFactor
|
|
7455
|
-
);
|
|
7456
7592
|
if (dynamicFeeParams) {
|
|
7457
7593
|
const { volatilityAccumulator, binStep, variableFeeControl } = dynamicFeeParams;
|
|
7458
7594
|
const dynamicFeeNumberator = getDynamicFeeNumerator(
|
|
@@ -10510,6 +10646,29 @@ var CpAmm = class {
|
|
|
10510
10646
|
}).transaction();
|
|
10511
10647
|
});
|
|
10512
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
|
+
}
|
|
10513
10672
|
};
|
|
10514
10673
|
|
|
10515
10674
|
// src/index.ts
|
|
@@ -10601,5 +10760,6 @@ var index_default = cp_amm_default;
|
|
|
10601
10760
|
|
|
10602
10761
|
|
|
10603
10762
|
|
|
10604
|
-
|
|
10763
|
+
|
|
10764
|
+
exports.ActivationPoint = ActivationPoint; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_STEP_BPS_DEFAULT = BIN_STEP_BPS_DEFAULT; exports.BIN_STEP_BPS_U128_DEFAULT = BIN_STEP_BPS_U128_DEFAULT; exports.CP_AMM_PROGRAM_ID = CP_AMM_PROGRAM_ID; exports.CollectFeeMode = CollectFeeMode; exports.CpAmm = CpAmm; exports.DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = DYNAMIC_FEE_DECAY_PERIOD_DEFAULT; exports.DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = DYNAMIC_FEE_FILTER_PERIOD_DEFAULT; exports.DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.LIQUIDITY_SCALE = LIQUIDITY_SCALE; exports.MAX_CU_BUFFER = MAX_CU_BUFFER; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_PRICE_CHANGE_BPS_DEFAULT = MAX_PRICE_CHANGE_BPS_DEFAULT; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MIN_CU_BUFFER = MIN_CU_BUFFER; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.ONE = ONE; exports.Rounding = Rounding; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SPLIT_POSITION_DENOMINATOR = SPLIT_POSITION_DENOMINATOR; exports.TradeDirection = TradeDirection; exports.bpsToFeeNumerator = bpsToFeeNumerator; exports.calculateInitSqrtPrice = calculateInitSqrtPrice; exports.calculateTransferFeeExcludedAmount = calculateTransferFeeExcludedAmount; exports.calculateTransferFeeIncludedAmount = calculateTransferFeeIncludedAmount; exports.decimalToQ64 = decimalToQ64; exports.default = index_default; exports.deriveClaimFeeOperatorAddress = deriveClaimFeeOperatorAddress; exports.deriveConfigAddress = deriveConfigAddress; exports.deriveCustomizablePoolAddress = deriveCustomizablePoolAddress; exports.derivePoolAddress = derivePoolAddress; exports.derivePoolAuthority = derivePoolAuthority; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveRewardVaultAddress = deriveRewardVaultAddress; exports.deriveTokenBadgeAddress = deriveTokenBadgeAddress; exports.deriveTokenVaultAddress = deriveTokenVaultAddress; exports.feeNumeratorToBps = feeNumeratorToBps; exports.getAllPositionNftAccountByOwner = getAllPositionNftAccountByOwner; exports.getAllUserPositionNftAccount = getAllUserPositionNftAccount; exports.getAmountAFromLiquidityDelta = getAmountAFromLiquidityDelta; exports.getAmountBFromLiquidityDelta = getAmountBFromLiquidityDelta; exports.getAvailableVestingLiquidity = getAvailableVestingLiquidity; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getBaseFeeParams = getBaseFeeParams; exports.getDynamicFeeNumerator = getDynamicFeeNumerator; exports.getDynamicFeeParams = getDynamicFeeParams; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getExcludedFeeAmount = getExcludedFeeAmount; exports.getFeeMode = getFeeMode; exports.getFeeNumerator = getFeeNumerator; exports.getFirstKey = getFirstKey; exports.getIncludedFeeAmount = getIncludedFeeAmount; exports.getLiquidityDeltaFromAmountA = getLiquidityDeltaFromAmountA; exports.getLiquidityDeltaFromAmountB = getLiquidityDeltaFromAmountB; exports.getMaxAmountWithSlippage = getMaxAmountWithSlippage; exports.getMinAmountWithSlippage = getMinAmountWithSlippage; exports.getNextSqrtPrice = getNextSqrtPrice; exports.getNextSqrtPriceFromAmountARoundingDown = getNextSqrtPriceFromAmountARoundingDown; exports.getNextSqrtPriceFromAmountBRoundingUp = getNextSqrtPriceFromAmountBRoundingUp; exports.getNextSqrtPriceFromOutput = getNextSqrtPriceFromOutput; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPriceChange = getPriceChange; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getPriceImpact = getPriceImpact; exports.getSecondKey = getSecondKey; exports.getSimulationComputeUnits = getSimulationComputeUnits; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getSwapAmount = getSwapAmount; exports.getSwapResultFromOutAmount = getSwapResultFromOutAmount; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTotalLockedLiquidity = getTotalLockedLiquidity; exports.getUnClaimReward = getUnClaimReward; exports.isVestingComplete = isVestingComplete; exports.mulDiv = mulDiv; exports.positionByPoolFilter = positionByPoolFilter; exports.pow = pow; exports.q64ToDecimal = q64ToDecimal; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.vestingByPositionFilter = vestingByPositionFilter; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
10605
10765
|
//# sourceMappingURL=index.js.map
|