@pancakeswap/v3-sdk 3.5.4 → 3.6.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.js
CHANGED
|
@@ -1804,7 +1804,7 @@ function tryGetEstimatedLPFeeByAmounts({
|
|
|
1804
1804
|
}) {
|
|
1805
1805
|
invariant9__default.default(!Number.isNaN(fee) && fee >= 0, "INVALID_FEE");
|
|
1806
1806
|
const tickCurrent = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
1807
|
-
if (tickCurrent < tickLower || tickCurrent
|
|
1807
|
+
if (tickCurrent < tickLower || tickCurrent >= tickUpper) {
|
|
1808
1808
|
return new swapSdkCore.Fraction(swapSdkCore.ZERO);
|
|
1809
1809
|
}
|
|
1810
1810
|
const liquidity = FeeCalculator.getLiquidityByAmountsAndPrice({
|
|
@@ -1944,6 +1944,15 @@ function sqrtRatioX96ToPrice(sqrtRatioX96, currencyA, currencyB) {
|
|
|
1944
1944
|
const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
|
|
1945
1945
|
return currencyA.wrapped.sortsBefore(currencyB.wrapped) ? new swapSdkCore.Price(currencyA.wrapped, currencyB.wrapped, Q192, ratioX192) : new swapSdkCore.Price(currencyA.wrapped, currencyB.wrapped, ratioX192, Q192);
|
|
1946
1946
|
}
|
|
1947
|
+
|
|
1948
|
+
// src/utils/isPoolTickInRange.ts
|
|
1949
|
+
var isPoolTickInRange = (pool, tickLower, tickUpper) => {
|
|
1950
|
+
if (!pool)
|
|
1951
|
+
return false;
|
|
1952
|
+
const below = typeof tickLower === "number" ? pool.tickCurrent < tickLower : void 0;
|
|
1953
|
+
const above = typeof tickUpper === "number" ? pool.tickCurrent >= tickUpper : void 0;
|
|
1954
|
+
return typeof below === "boolean" && typeof above === "boolean" ? !below && !above : false;
|
|
1955
|
+
};
|
|
1947
1956
|
var IMulticall = [
|
|
1948
1957
|
{
|
|
1949
1958
|
inputs: [
|
|
@@ -6149,6 +6158,7 @@ exports.getLiquidityBySingleAmount = getLiquidityBySingleAmount;
|
|
|
6149
6158
|
exports.getLiquidityFromSqrtRatioX96 = getLiquidityFromSqrtRatioX96;
|
|
6150
6159
|
exports.getLiquidityFromTick = getLiquidityFromTick;
|
|
6151
6160
|
exports.isMint = isMint;
|
|
6161
|
+
exports.isPoolTickInRange = isPoolTickInRange;
|
|
6152
6162
|
exports.isSorted = isSorted;
|
|
6153
6163
|
exports.masterChefV3ABI = masterChefV3ABI;
|
|
6154
6164
|
exports.maxLiquidityForAmounts = maxLiquidityForAmounts;
|
package/dist/index.mjs
CHANGED
|
@@ -1798,7 +1798,7 @@ function tryGetEstimatedLPFeeByAmounts({
|
|
|
1798
1798
|
}) {
|
|
1799
1799
|
invariant9(!Number.isNaN(fee) && fee >= 0, "INVALID_FEE");
|
|
1800
1800
|
const tickCurrent = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
|
|
1801
|
-
if (tickCurrent < tickLower || tickCurrent
|
|
1801
|
+
if (tickCurrent < tickLower || tickCurrent >= tickUpper) {
|
|
1802
1802
|
return new Fraction$1(ZERO$1);
|
|
1803
1803
|
}
|
|
1804
1804
|
const liquidity = FeeCalculator.getLiquidityByAmountsAndPrice({
|
|
@@ -1938,6 +1938,15 @@ function sqrtRatioX96ToPrice(sqrtRatioX96, currencyA, currencyB) {
|
|
|
1938
1938
|
const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
|
|
1939
1939
|
return currencyA.wrapped.sortsBefore(currencyB.wrapped) ? new Price$1(currencyA.wrapped, currencyB.wrapped, Q192, ratioX192) : new Price$1(currencyA.wrapped, currencyB.wrapped, ratioX192, Q192);
|
|
1940
1940
|
}
|
|
1941
|
+
|
|
1942
|
+
// src/utils/isPoolTickInRange.ts
|
|
1943
|
+
var isPoolTickInRange = (pool, tickLower, tickUpper) => {
|
|
1944
|
+
if (!pool)
|
|
1945
|
+
return false;
|
|
1946
|
+
const below = typeof tickLower === "number" ? pool.tickCurrent < tickLower : void 0;
|
|
1947
|
+
const above = typeof tickUpper === "number" ? pool.tickCurrent >= tickUpper : void 0;
|
|
1948
|
+
return typeof below === "boolean" && typeof above === "boolean" ? !below && !above : false;
|
|
1949
|
+
};
|
|
1941
1950
|
var IMulticall = [
|
|
1942
1951
|
{
|
|
1943
1952
|
inputs: [
|
|
@@ -6095,4 +6104,4 @@ var _MasterChefV3 = class {
|
|
|
6095
6104
|
var MasterChefV3 = _MasterChefV3;
|
|
6096
6105
|
MasterChefV3.ABI = masterChefV3ABI;
|
|
6097
6106
|
|
|
6098
|
-
export { ADDRESS_ZERO, DEPLOYER_ADDRESSES, FACTORY_ADDRESSES, FeeAmount, FeeCalculator, FullMath, LiquidityMath, MasterChefV3, MaxUint128, Multicall, NoTickDataProvider, NonfungiblePositionManager, POOL_INIT_CODE_HASHES, Payments, Pool, Position, PositionLibrary, PositionMath, Route, SelfPermit, SqrtPriceMath, Staker, SwapMath, SwapQuoter, SwapRouter, TICK_SPACINGS, Tick, TickLibrary, TickList, TickListDataProvider, TickMath, Trade, computePoolAddress, encodeRouteToPath, encodeSqrtRatioX96, getAmountsAtNewPrice, getAmountsByLiquidityAndPrice, getAverageLiquidity, getDependentAmount, getEstimatedLPFee, getEstimatedLPFeeByAmounts, getEstimatedLPFeeByAmountsWithProtocolFee, getEstimatedLPFeeWithProtocolFee, getLiquidityByAmountsAndPrice, getLiquidityBySingleAmount, getLiquidityFromSqrtRatioX96, getLiquidityFromTick, isMint, isSorted, masterChefV3ABI, maxLiquidityForAmounts, mostSignificantBit, nearestUsableTick, nonfungiblePositionManagerABI, parseProtocolFees, peripheryPaymentsWithFeeABI, priceToClosestTick, quoterABI, quoterV2ABI, selfPermitABI, sqrtRatioX96ToPrice, subIn256, swapRouterABI, tickToPrice, toHex, tradeComparator, v3StakerABI };
|
|
6107
|
+
export { ADDRESS_ZERO, DEPLOYER_ADDRESSES, FACTORY_ADDRESSES, FeeAmount, FeeCalculator, FullMath, LiquidityMath, MasterChefV3, MaxUint128, Multicall, NoTickDataProvider, NonfungiblePositionManager, POOL_INIT_CODE_HASHES, Payments, Pool, Position, PositionLibrary, PositionMath, Route, SelfPermit, SqrtPriceMath, Staker, SwapMath, SwapQuoter, SwapRouter, TICK_SPACINGS, Tick, TickLibrary, TickList, TickListDataProvider, TickMath, Trade, computePoolAddress, encodeRouteToPath, encodeSqrtRatioX96, getAmountsAtNewPrice, getAmountsByLiquidityAndPrice, getAverageLiquidity, getDependentAmount, getEstimatedLPFee, getEstimatedLPFeeByAmounts, getEstimatedLPFeeByAmountsWithProtocolFee, getEstimatedLPFeeWithProtocolFee, getLiquidityByAmountsAndPrice, getLiquidityBySingleAmount, getLiquidityFromSqrtRatioX96, getLiquidityFromTick, isMint, isPoolTickInRange, isSorted, masterChefV3ABI, maxLiquidityForAmounts, mostSignificantBit, nearestUsableTick, nonfungiblePositionManagerABI, parseProtocolFees, peripheryPaymentsWithFeeABI, priceToClosestTick, quoterABI, quoterV2ABI, selfPermitABI, sqrtRatioX96ToPrice, subIn256, swapRouterABI, tickToPrice, toHex, tradeComparator, v3StakerABI };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPoolTickInRange.d.ts","sourceRoot":"","sources":["../../src/utils/isPoolTickInRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEvC,eAAO,MAAM,iBAAiB,SACtB,IAAI,GAAG,SAAS,GAAG,IAAI,aAClB,MAAM,GAAG,SAAS,aAClB,MAAM,GAAG,SAAS,YAM9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "3.
|
|
7
|
+
"version": "3.6.0",
|
|
8
8
|
"description": "⚒️ An SDK for building applications on top of Pancakeswap V3",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@uniswap/v3-staker": "1.0.0",
|
|
22
22
|
"big.js": "^5.2.2",
|
|
23
23
|
"decimal.js-light": "^2.5.0",
|
|
24
|
-
"tiny-invariant": "^1.
|
|
24
|
+
"tiny-invariant": "^1.3.0",
|
|
25
25
|
"tiny-warning": "^1.0.3",
|
|
26
26
|
"toformat": "^2.0.0",
|
|
27
|
-
"viem": "
|
|
27
|
+
"viem": "1.15.1",
|
|
28
28
|
"@pancakeswap/sdk": "5.7.2",
|
|
29
29
|
"@pancakeswap/swap-sdk-core": "1.0.0",
|
|
30
30
|
"@pancakeswap/tokens": "0.5.4",
|
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsup": "^6.7.0",
|
|
35
|
-
"
|
|
36
|
-
"vitest": "^0.30.1",
|
|
37
|
-
"@pancakeswap/utils": "5.0.6"
|
|
35
|
+
"@pancakeswap/utils": "5.0.7"
|
|
38
36
|
},
|
|
39
37
|
"engines": {
|
|
40
38
|
"node": ">=10"
|