@meteora-ag/cp-amm-sdk 1.0.1-rc.10 → 1.0.1-rc.11
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6730,6 +6730,17 @@ function getLiquidityDeltaFromAmountB(maxAmountB, lowerSqrtPrice, upperSqrtPrice
|
|
|
6730
6730
|
const result = maxAmountB.shln(SCALE_OFFSET * 2).div(denominator);
|
|
6731
6731
|
return result;
|
|
6732
6732
|
}
|
|
6733
|
+
function getAmountAFromLiquidityDelta(liquidity, currentSqrtPrice) {
|
|
6734
|
+
const prod = liquidity.mul(MAX_SQRT_PRICE.sub(currentSqrtPrice));
|
|
6735
|
+
const denominator = currentSqrtPrice.mul(MAX_SQRT_PRICE);
|
|
6736
|
+
const result = shlDiv(prod, denominator, SCALE_OFFSET, 1 /* Down */);
|
|
6737
|
+
return result.shrn(SCALE_OFFSET);
|
|
6738
|
+
}
|
|
6739
|
+
function getAmountBFromLiquidityDelta(liquidity, currentSqrtPrice) {
|
|
6740
|
+
const delta = currentSqrtPrice.sub(MIN_SQRT_PRICE);
|
|
6741
|
+
const prod = liquidity.mul(delta);
|
|
6742
|
+
return prod.shrn(SCALE_OFFSET * 2);
|
|
6743
|
+
}
|
|
6733
6744
|
|
|
6734
6745
|
// src/utils/computeUnits.ts
|
|
6735
6746
|
import {
|
|
@@ -7957,6 +7968,8 @@ export {
|
|
|
7957
7968
|
deriveRewardVaultAddress,
|
|
7958
7969
|
deriveTokenBadgeAddress,
|
|
7959
7970
|
deriveTokenVaultAddress,
|
|
7971
|
+
getAmountAFromLiquidityDelta,
|
|
7972
|
+
getAmountBFromLiquidityDelta,
|
|
7960
7973
|
getBaseFeeNumerator,
|
|
7961
7974
|
getDeltaAmountA,
|
|
7962
7975
|
getDeltaAmountB,
|