@pancakeswap/v3-sdk 1.0.0 → 2.0.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.
Files changed (86) hide show
  1. package/LICENSE +674 -0
  2. package/dist/constants.d.ts +26 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/entities/index.d.ts +8 -0
  5. package/dist/entities/index.d.ts.map +1 -0
  6. package/dist/entities/pool.d.ts +82 -0
  7. package/dist/entities/pool.d.ts.map +1 -0
  8. package/dist/entities/position.d.ts +131 -0
  9. package/dist/entities/position.d.ts.map +1 -0
  10. package/dist/entities/route.d.ts +27 -0
  11. package/dist/entities/route.d.ts.map +1 -0
  12. package/dist/entities/tick.d.ts +13 -0
  13. package/dist/entities/tick.d.ts.map +1 -0
  14. package/dist/entities/tickDataProvider.d.ts +32 -0
  15. package/dist/entities/tickDataProvider.d.ts.map +1 -0
  16. package/dist/entities/tickListDataProvider.d.ts +16 -0
  17. package/dist/entities/tickListDataProvider.d.ts.map +1 -0
  18. package/dist/entities/trade.d.ts +221 -0
  19. package/dist/entities/trade.d.ts.map +1 -0
  20. package/dist/index.d.ts +12 -1223
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +214 -227
  23. package/dist/index.mjs +214 -229
  24. package/dist/internalConstants.d.ts +11 -0
  25. package/dist/internalConstants.d.ts.map +1 -0
  26. package/dist/masterchefV3.d.ts +39 -0
  27. package/dist/masterchefV3.d.ts.map +1 -0
  28. package/dist/multicall.d.ts +10 -0
  29. package/dist/multicall.d.ts.map +1 -0
  30. package/dist/nonfungiblePositionManager.d.ts +149 -0
  31. package/dist/nonfungiblePositionManager.d.ts.map +1 -0
  32. package/dist/payments.d.ts +24 -0
  33. package/dist/payments.d.ts.map +1 -0
  34. package/dist/quoter.d.ts +38 -0
  35. package/dist/quoter.d.ts.map +1 -0
  36. package/dist/selfPermit.d.ts +26 -0
  37. package/dist/selfPermit.d.ts.map +1 -0
  38. package/dist/staker.d.ts +102 -0
  39. package/dist/staker.d.ts.map +1 -0
  40. package/dist/swapRouter.d.ts +52 -0
  41. package/dist/swapRouter.d.ts.map +1 -0
  42. package/dist/utils/calldata.d.ts +21 -0
  43. package/dist/utils/calldata.d.ts.map +1 -0
  44. package/dist/utils/computePoolAddress.d.ts +19 -0
  45. package/dist/utils/computePoolAddress.d.ts.map +1 -0
  46. package/dist/utils/encodeRouteToPath.d.ts +9 -0
  47. package/dist/utils/encodeRouteToPath.d.ts.map +1 -0
  48. package/dist/utils/encodeSqrtRatioX96.d.ts +9 -0
  49. package/dist/utils/encodeSqrtRatioX96.d.ts.map +1 -0
  50. package/dist/utils/feeCalculator.d.ts +65 -0
  51. package/dist/utils/feeCalculator.d.ts.map +1 -0
  52. package/dist/utils/fullMath.d.ts +8 -0
  53. package/dist/utils/fullMath.d.ts.map +1 -0
  54. package/dist/utils/index.d.ts +22 -0
  55. package/dist/utils/index.d.ts.map +1 -0
  56. package/dist/utils/isSorted.d.ts +8 -0
  57. package/dist/utils/isSorted.d.ts.map +1 -0
  58. package/dist/utils/liquidityMath.d.ts +8 -0
  59. package/dist/utils/liquidityMath.d.ts.map +1 -0
  60. package/dist/utils/maxLiquidityForAmounts.d.ts +14 -0
  61. package/dist/utils/maxLiquidityForAmounts.d.ts.map +1 -0
  62. package/dist/utils/mostSignificantBit.d.ts +2 -0
  63. package/dist/utils/mostSignificantBit.d.ts.map +1 -0
  64. package/dist/utils/nearestUsableTick.d.ts +7 -0
  65. package/dist/utils/nearestUsableTick.d.ts.map +1 -0
  66. package/dist/utils/parseProtocolFees.d.ts +3 -0
  67. package/dist/utils/parseProtocolFees.d.ts.map +1 -0
  68. package/dist/utils/position.d.ts +8 -0
  69. package/dist/utils/position.d.ts.map +1 -0
  70. package/dist/utils/positionMath.d.ts +8 -0
  71. package/dist/utils/positionMath.d.ts.map +1 -0
  72. package/dist/utils/priceTickConversions.d.ts +16 -0
  73. package/dist/utils/priceTickConversions.d.ts.map +1 -0
  74. package/dist/utils/sqrtPriceMath.d.ts +13 -0
  75. package/dist/utils/sqrtPriceMath.d.ts.map +1 -0
  76. package/dist/utils/sqrtRatioX96ToPrice.d.ts +3 -0
  77. package/dist/utils/sqrtRatioX96ToPrice.d.ts.map +1 -0
  78. package/dist/utils/swapMath.d.ts +9 -0
  79. package/dist/utils/swapMath.d.ts.map +1 -0
  80. package/dist/utils/tickLibrary.d.ts +14 -0
  81. package/dist/utils/tickLibrary.d.ts.map +1 -0
  82. package/dist/utils/tickList.d.ts +25 -0
  83. package/dist/utils/tickList.d.ts.map +1 -0
  84. package/dist/utils/tickMath.d.ts +34 -0
  85. package/dist/utils/tickMath.d.ts.map +1 -0
  86. package/package.json +17 -14
@@ -0,0 +1,8 @@
1
+ export declare abstract class FullMath {
2
+ /**
3
+ * Cannot be constructed.
4
+ */
5
+ private constructor();
6
+ static mulDivRoundingUp(a: bigint, b: bigint, denominator: bigint): bigint;
7
+ }
8
+ //# sourceMappingURL=fullMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullMath.d.ts","sourceRoot":"","sources":["../../src/utils/fullMath.ts"],"names":[],"mappings":"AAEA,8BAAsB,QAAQ;IAC5B;;OAEG;IACH,OAAO;WAEO,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;CAOlF"}
@@ -0,0 +1,22 @@
1
+ export * from './calldata';
2
+ export * from './computePoolAddress';
3
+ export * from './encodeRouteToPath';
4
+ export * from './encodeSqrtRatioX96';
5
+ export * from './fullMath';
6
+ export * from './isSorted';
7
+ export * from './liquidityMath';
8
+ export * from './maxLiquidityForAmounts';
9
+ export * from './mostSignificantBit';
10
+ export * from './nearestUsableTick';
11
+ export * from './position';
12
+ export * from './priceTickConversions';
13
+ export * from './sqrtPriceMath';
14
+ export * from './swapMath';
15
+ export * from './tickLibrary';
16
+ export * from './tickList';
17
+ export * from './tickMath';
18
+ export * from './positionMath';
19
+ export * from './feeCalculator';
20
+ export * from './parseProtocolFees';
21
+ export * from './sqrtRatioX96ToPrice';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Determines if a tick list is sorted
3
+ * @param list The tick list
4
+ * @param comparator The comparator
5
+ * @returns true if sorted
6
+ */
7
+ export declare function isSorted<T>(list: Array<T>, comparator: (a: T, b: T) => number): boolean;
8
+ //# sourceMappingURL=isSorted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSorted.d.ts","sourceRoot":"","sources":["../../src/utils/isSorted.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,OAAO,CAOvF"}
@@ -0,0 +1,8 @@
1
+ export declare abstract class LiquidityMath {
2
+ /**
3
+ * Cannot be constructed.
4
+ */
5
+ private constructor();
6
+ static addDelta(x: bigint, y: bigint): bigint;
7
+ }
8
+ //# sourceMappingURL=liquidityMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquidityMath.d.ts","sourceRoot":"","sources":["../../src/utils/liquidityMath.ts"],"names":[],"mappings":"AAEA,8BAAsB,aAAa;IACjC;;OAEG;IACH,OAAO;WAEO,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;CAMrD"}
@@ -0,0 +1,14 @@
1
+ import { BigintIsh } from '@pancakeswap/sdk';
2
+ /**
3
+ * Computes the maximum amount of liquidity received for a given amount of token0, token1,
4
+ * and the prices at the tick boundaries.
5
+ * @param sqrtRatioCurrentX96 the current price
6
+ * @param sqrtRatioAX96 price at lower boundary
7
+ * @param sqrtRatioBX96 price at upper boundary
8
+ * @param amount0 token0 amount
9
+ * @param amount1 token1 amount
10
+ * @param useFullPrecision if false, liquidity will be maximized according to what the router can calculate,
11
+ * not what core can theoretically support
12
+ */
13
+ export declare function maxLiquidityForAmounts(sqrtRatioCurrentX96: bigint, sqrtRatioAX96: bigint, sqrtRatioBX96: bigint, amount0: BigintIsh, amount1: BigintIsh, useFullPrecision: boolean): bigint;
14
+ //# sourceMappingURL=maxLiquidityForAmounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maxLiquidityForAmounts.d.ts","sourceRoot":"","sources":["../../src/utils/maxLiquidityForAmounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AA0D5C;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,MAAM,EAC3B,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,SAAS,EAClB,gBAAgB,EAAE,OAAO,GACxB,MAAM,CAiBR"}
@@ -0,0 +1,2 @@
1
+ export declare function mostSignificantBit(x: bigint): number;
2
+ //# sourceMappingURL=mostSignificantBit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mostSignificantBit.d.ts","sourceRoot":"","sources":["../../src/utils/mostSignificantBit.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAapD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the closest tick that is nearest a given tick and usable for the given tick spacing
3
+ * @param tick the target tick
4
+ * @param tickSpacing the spacing of the pool
5
+ */
6
+ export declare function nearestUsableTick(tick: number, tickSpacing: number): number;
7
+ //# sourceMappingURL=nearestUsableTick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nearestUsableTick.d.ts","sourceRoot":"","sources":["../../src/utils/nearestUsableTick.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAQlE"}
@@ -0,0 +1,3 @@
1
+ import { Percent } from '@pancakeswap/sdk';
2
+ export declare function parseProtocolFees(feeProtocol: number | string): Percent[];
3
+ //# sourceMappingURL=parseProtocolFees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseProtocolFees.d.ts","sourceRoot":"","sources":["../../src/utils/parseProtocolFees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAI1C,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,aAS7D"}
@@ -0,0 +1,8 @@
1
+ export declare abstract class PositionLibrary {
2
+ /**
3
+ * Cannot be constructed.
4
+ */
5
+ private constructor();
6
+ static getTokensOwed(feeGrowthInside0LastX128: bigint, feeGrowthInside1LastX128: bigint, liquidity: bigint, feeGrowthInside0X128: bigint, feeGrowthInside1X128: bigint): bigint[];
7
+ }
8
+ //# sourceMappingURL=position.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/utils/position.ts"],"names":[],"mappings":"AAGA,8BAAsB,eAAe;IACnC;;OAEG;IACH,OAAO;WAGO,aAAa,CACzB,wBAAwB,EAAE,MAAM,EAChC,wBAAwB,EAAE,MAAM,EAChC,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,oBAAoB,EAAE,MAAM;CAQ/B"}
@@ -0,0 +1,8 @@
1
+ declare function getToken0Amount(tickCurrent: number, tickLower: number, tickUpper: number, sqrtRatioX96: bigint, liquidity: bigint): bigint;
2
+ declare function getToken1Amount(tickCurrent: number, tickLower: number, tickUpper: number, sqrtRatioX96: bigint, liquidity: bigint): bigint;
3
+ export declare const PositionMath: {
4
+ getToken0Amount: typeof getToken0Amount;
5
+ getToken1Amount: typeof getToken1Amount;
6
+ };
7
+ export {};
8
+ //# sourceMappingURL=positionMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionMath.d.ts","sourceRoot":"","sources":["../../src/utils/positionMath.ts"],"names":[],"mappings":"AAGA,iBAAS,eAAe,CACtB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,MAAM,CAaR;AAED,iBAAS,eAAe,CACtB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,MAAM,CAaR;AAED,eAAO,MAAM,YAAY;;;CAGxB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { Price, Token } from '@pancakeswap/sdk';
2
+ /**
3
+ * Returns a price object corresponding to the input tick and the base/quote token
4
+ * Inputs must be tokens because the address order is used to interpret the price represented by the tick
5
+ * @param baseToken the base token of the price
6
+ * @param quoteToken the quote token of the price
7
+ * @param tick the tick for which to return the price
8
+ */
9
+ export declare function tickToPrice(baseToken: Token, quoteToken: Token, tick: number): Price<Token, Token>;
10
+ /**
11
+ * Returns the first tick for which the given price is greater than or equal to the tick price
12
+ * @param price for which to return the closest tick that represents a price less than or equal to the input price,
13
+ * i.e. the price of the returned tick is less than or equal to the input price
14
+ */
15
+ export declare function priceToClosestTick(price: Price<Token, Token>): number;
16
+ //# sourceMappingURL=priceTickConversions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priceTickConversions.d.ts","sourceRoot":"","sources":["../../src/utils/priceTickConversions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAK/C;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAQlG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,CAiBrE"}
@@ -0,0 +1,13 @@
1
+ export declare abstract class SqrtPriceMath {
2
+ /**
3
+ * Cannot be constructed.
4
+ */
5
+ private constructor();
6
+ static getAmount0Delta(sqrtRatioAX96: bigint, sqrtRatioBX96: bigint, liquidity: bigint, roundUp: boolean): bigint;
7
+ static getAmount1Delta(sqrtRatioAX96: bigint, sqrtRatioBX96: bigint, liquidity: bigint, roundUp: boolean): bigint;
8
+ static getNextSqrtPriceFromInput(sqrtPX96: bigint, liquidity: bigint, amountIn: bigint, zeroForOne: boolean): bigint;
9
+ static getNextSqrtPriceFromOutput(sqrtPX96: bigint, liquidity: bigint, amountOut: bigint, zeroForOne: boolean): bigint;
10
+ private static getNextSqrtPriceFromAmount0RoundingUp;
11
+ private static getNextSqrtPriceFromAmount1RoundingDown;
12
+ }
13
+ //# sourceMappingURL=sqrtPriceMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqrtPriceMath.d.ts","sourceRoot":"","sources":["../../src/utils/sqrtPriceMath.ts"],"names":[],"mappings":"AAiBA,8BAAsB,aAAa;IACjC;;OAEG;IACH,OAAO;WAEO,eAAe,CAC3B,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,MAAM;WAcK,eAAe,CAC3B,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,MAAM;WAWK,yBAAyB,CACrC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,GAClB,MAAM;WASK,0BAA0B,CACtC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,OAAO,GAClB,MAAM;IAST,OAAO,CAAC,MAAM,CAAC,qCAAqC;IA4BpD,OAAO,CAAC,MAAM,CAAC,uCAAuC;CAgBvD"}
@@ -0,0 +1,3 @@
1
+ import { Currency, Price } from '@pancakeswap/swap-sdk-core';
2
+ export declare function sqrtRatioX96ToPrice(sqrtRatioX96: bigint, currencyA: Currency, currencyB: Currency): Price<import("@pancakeswap/swap-sdk-core").Token, import("@pancakeswap/swap-sdk-core").Token>;
3
+ //# sourceMappingURL=sqrtRatioX96ToPrice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqrtRatioX96ToPrice.d.ts","sourceRoot":"","sources":["../../src/utils/sqrtRatioX96ToPrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAI5D,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,iGAMjG"}
@@ -0,0 +1,9 @@
1
+ import { FeeAmount } from '../constants';
2
+ export declare abstract class SwapMath {
3
+ /**
4
+ * Cannot be constructed.
5
+ */
6
+ private constructor();
7
+ static computeSwapStep(sqrtRatioCurrentX96: bigint, sqrtRatioTargetX96: bigint, liquidity: bigint, amountRemaining: bigint, feePips: FeeAmount): [bigint, bigint, bigint, bigint];
8
+ }
9
+ //# sourceMappingURL=swapMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swapMath.d.ts","sourceRoot":"","sources":["../../src/utils/swapMath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,8BAAsB,QAAQ;IAC5B;;OAEG;IACH,OAAO;WAEO,eAAe,CAC3B,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAC1B,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,SAAS,GACjB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;CAiFpC"}
@@ -0,0 +1,14 @@
1
+ interface FeeGrowthOutside {
2
+ feeGrowthOutside0X128: bigint;
3
+ feeGrowthOutside1X128: bigint;
4
+ }
5
+ export declare function subIn256(x: bigint, y: bigint): bigint;
6
+ export declare abstract class TickLibrary {
7
+ /**
8
+ * Cannot be constructed.
9
+ */
10
+ private constructor();
11
+ static getFeeGrowthInside(feeGrowthOutsideLower: FeeGrowthOutside, feeGrowthOutsideUpper: FeeGrowthOutside, tickLower: number, tickUpper: number, tickCurrent: number, feeGrowthGlobal0X128: bigint, feeGrowthGlobal1X128: bigint): bigint[];
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=tickLibrary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickLibrary.d.ts","sourceRoot":"","sources":["../../src/utils/tickLibrary.ts"],"names":[],"mappings":"AAEA,UAAU,gBAAgB;IACxB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,qBAAqB,EAAE,MAAM,CAAA;CAC9B;AAID,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOrD;AAED,8BAAsB,WAAW;IAC/B;;OAEG;IACH,OAAO;WAEO,kBAAkB,CAC9B,qBAAqB,EAAE,gBAAgB,EACvC,qBAAqB,EAAE,gBAAgB,EACvC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,MAAM,EAC5B,oBAAoB,EAAE,MAAM;CA2B/B"}
@@ -0,0 +1,25 @@
1
+ import { Tick } from '../entities/tick';
2
+ /**
3
+ * Utility methods for interacting with sorted lists of ticks
4
+ */
5
+ export declare abstract class TickList {
6
+ /**
7
+ * Cannot be constructed
8
+ */
9
+ private constructor();
10
+ static validateList(ticks: Tick[], tickSpacing: number): void;
11
+ static isBelowSmallest(ticks: readonly Tick[], tick: number): boolean;
12
+ static isAtOrAboveLargest(ticks: readonly Tick[], tick: number): boolean;
13
+ static getTick(ticks: readonly Tick[], index: number): Tick;
14
+ /**
15
+ * Finds the largest tick in the list of ticks that is less than or equal to tick
16
+ * @param ticks list of ticks
17
+ * @param tick tick to find the largest tick that is less than or equal to tick
18
+ * @private
19
+ */
20
+ private static binarySearch;
21
+ static nextInitializedTick(ticks: readonly Tick[], tick: number, lte: boolean): Tick;
22
+ static nextInitializedTickWithinOneWord(ticks: readonly Tick[], tick: number, lte: boolean, tickSpacing: number): [number, boolean];
23
+ static countInitializedTicksCrossed(ticks: readonly Tick[], tickBefore: number, tickAfter: number): number;
24
+ }
25
+ //# sourceMappingURL=tickList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickList.d.ts","sourceRoot":"","sources":["../../src/utils/tickList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAQvC;;GAEG;AACH,8BAAsB,QAAQ;IAC5B;;OAEG;IACH,OAAO;WAEO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM;WAc/C,eAAe,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO;WAK9D,kBAAkB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO;WAKjE,OAAO,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAMlE;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;WAqBb,mBAAmB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI;WAiB7E,gCAAgC,CAC5C,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,MAAM,GAClB,CAAC,MAAM,EAAE,OAAO,CAAC;WA2BN,4BAA4B,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAQzG"}
@@ -0,0 +1,34 @@
1
+ export declare abstract class TickMath {
2
+ /**
3
+ * Cannot be constructed.
4
+ */
5
+ private constructor();
6
+ /**
7
+ * The minimum tick that can be used on any pool.
8
+ */
9
+ static MIN_TICK: number;
10
+ /**
11
+ * The maximum tick that can be used on any pool.
12
+ */
13
+ static MAX_TICK: number;
14
+ /**
15
+ * The sqrt ratio corresponding to the minimum tick that could be used on any pool.
16
+ */
17
+ static MIN_SQRT_RATIO: bigint;
18
+ /**
19
+ * The sqrt ratio corresponding to the maximum tick that could be used on any pool.
20
+ */
21
+ static MAX_SQRT_RATIO: bigint;
22
+ /**
23
+ * Returns the sqrt ratio as a Q64.96 for the given tick. The sqrt ratio is computed as sqrt(1.0001)^tick
24
+ * @param tick the tick for which to compute the sqrt ratio
25
+ */
26
+ static getSqrtRatioAtTick(tick: number): bigint;
27
+ /**
28
+ * Returns the tick corresponding to a given sqrt ratio, s.t. #getSqrtRatioAtTick(tick) <= sqrtRatioX96
29
+ * and #getSqrtRatioAtTick(tick + 1) > sqrtRatioX96
30
+ * @param sqrtRatioX96 the sqrt ratio as a Q64.96 for which to compute the tick
31
+ */
32
+ static getTickAtSqrtRatio(sqrtRatioX96: bigint): number;
33
+ }
34
+ //# sourceMappingURL=tickMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tickMath.d.ts","sourceRoot":"","sources":["../../src/utils/tickMath.ts"],"names":[],"mappings":"AAWA,8BAAsB,QAAQ;IAC5B;;OAEG;IACH,OAAO;IAEP;;OAEG;IAEH,OAAc,QAAQ,EAAE,MAAM,CAAU;IAExC;;OAEG;IACH,OAAc,QAAQ,EAAE,MAAM,CAAqB;IAEnD;;OAEG;IACH,OAAc,cAAc,SAAc;IAE1C;;OAEG;IACH,OAAc,cAAc,SAAqD;IAEjF;;;OAGG;WACW,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAkCtD;;;;OAIG;WACW,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAgC/D"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "1.0.0",
7
+ "version": "2.0.0",
8
8
  "description": "⚒️ An SDK for building applications on top of Pancakeswap V3",
9
9
  "files": [
10
10
  "dist"
@@ -17,24 +17,16 @@
17
17
  "main": "dist/index.js",
18
18
  "types": "dist/index.d.ts",
19
19
  "module": "dist/index.mjs",
20
- "scripts": {
21
- "build": "tsup",
22
- "dev": "tsup --watch",
23
- "test": "vitest --run",
24
- "coverage": "vitest run --coverage",
25
- "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
26
- },
27
20
  "dependencies": {
28
- "@pancakeswap/sdk": "*",
29
- "@pancakeswap/swap-sdk-core": "*",
30
- "@pancakeswap/tokens": "*",
31
21
  "@uniswap/v3-staker": "1.0.0",
32
22
  "big.js": "^5.2.2",
33
23
  "decimal.js-light": "^2.5.0",
34
24
  "tiny-invariant": "^1.1.0",
35
25
  "tiny-warning": "^1.0.3",
36
26
  "toformat": "^2.0.0",
37
- "jsbi": "^3.1.4"
27
+ "@pancakeswap/sdk": "4.0.0",
28
+ "@pancakeswap/swap-sdk-core": "1.0.0",
29
+ "@pancakeswap/tokens": "0.1.2"
38
30
  },
39
31
  "peerDependencies": {
40
32
  "@ethersproject/bignumber": "^5.0.0",
@@ -46,7 +38,11 @@
46
38
  "@ethersproject/bignumber": "^5.0.0",
47
39
  "@ethersproject/abi": "^5.0.0",
48
40
  "@ethersproject/solidity": "^5.0.0",
49
- "@types/jest": "^24.0.25"
41
+ "@ethersproject/address": "^5.0.0",
42
+ "vitest": "^0.30.1",
43
+ "tsup": "^6.7.0",
44
+ "typescript": "^4.9.4",
45
+ "@pancakeswap/utils": "1.0.0"
50
46
  },
51
47
  "engines": {
52
48
  "node": ">=10"
@@ -63,5 +59,12 @@
63
59
  "import": "./dist/index.mjs",
64
60
  "require": "./dist/index.js"
65
61
  }
62
+ },
63
+ "scripts": {
64
+ "build": "tsup",
65
+ "dev": "tsup --watch",
66
+ "test": "vitest --run",
67
+ "coverage": "vitest run --coverage",
68
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
66
69
  }
67
- }
70
+ }