@pancakeswap/infinity-sdk 1.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 (207) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +12 -0
  3. package/dist/abis/BinMigratorAbi.d.ts +652 -0
  4. package/dist/abis/BinMigratorAbi.d.ts.map +1 -0
  5. package/dist/abis/BinPoolManagerAbi.d.ts +1184 -0
  6. package/dist/abis/BinPoolManagerAbi.d.ts.map +1 -0
  7. package/dist/abis/BinPositionManagerAbi.d.ts +667 -0
  8. package/dist/abis/BinPositionManagerAbi.d.ts.map +1 -0
  9. package/dist/abis/BinQuoterAbi.d.ts +644 -0
  10. package/dist/abis/BinQuoterAbi.d.ts.map +1 -0
  11. package/dist/abis/CLMigratorAbi.d.ts +650 -0
  12. package/dist/abis/CLMigratorAbi.d.ts.map +1 -0
  13. package/dist/abis/CLPoolManagerAbi.d.ts +1075 -0
  14. package/dist/abis/CLPoolManagerAbi.d.ts.map +1 -0
  15. package/dist/abis/CLPositionManagerAbi.d.ts +1130 -0
  16. package/dist/abis/CLPositionManagerAbi.d.ts.map +1 -0
  17. package/dist/abis/CLQuoterAbi.d.ts +644 -0
  18. package/dist/abis/CLQuoterAbi.d.ts.map +1 -0
  19. package/dist/abis/FarmingOffChainAbi.d.ts +982 -0
  20. package/dist/abis/FarmingOffChainAbi.d.ts.map +1 -0
  21. package/dist/abis/FarmingOffChainCLHelperAbi.d.ts +40 -0
  22. package/dist/abis/FarmingOffChainCLHelperAbi.d.ts.map +1 -0
  23. package/dist/abis/MixedQuoterAbi.d.ts +347 -0
  24. package/dist/abis/MixedQuoterAbi.d.ts.map +1 -0
  25. package/dist/abis/Permit2ForwardAbi.d.ts +124 -0
  26. package/dist/abis/Permit2ForwardAbi.d.ts.map +1 -0
  27. package/dist/abis/ProtocolFeeControllerAbi.d.ts +276 -0
  28. package/dist/abis/ProtocolFeeControllerAbi.d.ts.map +1 -0
  29. package/dist/abis/VaultAbi.d.ts +669 -0
  30. package/dist/abis/VaultAbi.d.ts.map +1 -0
  31. package/dist/abis/index.d.ts +15 -0
  32. package/dist/abis/index.d.ts.map +1 -0
  33. package/dist/constants/abiStructFragments.d.ts +15 -0
  34. package/dist/constants/abiStructFragments.d.ts.map +1 -0
  35. package/dist/constants/actions.d.ts +43 -0
  36. package/dist/constants/actions.d.ts.map +1 -0
  37. package/dist/constants/actionsAbiParameters.d.ts +244 -0
  38. package/dist/constants/actionsAbiParameters.d.ts.map +1 -0
  39. package/dist/constants/addresses.d.ts +22 -0
  40. package/dist/constants/addresses.d.ts.map +1 -0
  41. package/dist/constants/binPool.d.ts +11 -0
  42. package/dist/constants/binPool.d.ts.map +1 -0
  43. package/dist/constants/fee.d.ts +21 -0
  44. package/dist/constants/fee.d.ts.map +1 -0
  45. package/dist/constants/hooksList/bsc.d.ts +8 -0
  46. package/dist/constants/hooksList/bsc.d.ts.map +1 -0
  47. package/dist/constants/hooksList/bscTestnet.d.ts +21 -0
  48. package/dist/constants/hooksList/bscTestnet.d.ts.map +1 -0
  49. package/dist/constants/hooksList/dynamicFeeHook.d.ts +15 -0
  50. package/dist/constants/hooksList/dynamicFeeHook.d.ts.map +1 -0
  51. package/dist/constants/hooksList/index.d.ts +14 -0
  52. package/dist/constants/hooksList/index.d.ts.map +1 -0
  53. package/dist/constants/index.d.ts +11 -0
  54. package/dist/constants/index.d.ts.map +1 -0
  55. package/dist/constants/internalConstants.d.ts +11 -0
  56. package/dist/constants/internalConstants.d.ts.map +1 -0
  57. package/dist/entities/index.d.ts +2 -0
  58. package/dist/entities/index.d.ts.map +1 -0
  59. package/dist/entities/pool.d.ts +104 -0
  60. package/dist/entities/pool.d.ts.map +1 -0
  61. package/dist/functions/bin/addBinLiquidityMulticall.d.ts +22 -0
  62. package/dist/functions/bin/addBinLiquidityMulticall.d.ts.map +1 -0
  63. package/dist/functions/bin/calldatas/addLiquidity.d.ts +18 -0
  64. package/dist/functions/bin/calldatas/addLiquidity.d.ts.map +1 -0
  65. package/dist/functions/bin/calldatas/index.d.ts +7 -0
  66. package/dist/functions/bin/calldatas/index.d.ts.map +1 -0
  67. package/dist/functions/bin/calldatas/initializePool.d.ts +3 -0
  68. package/dist/functions/bin/calldatas/initializePool.d.ts.map +1 -0
  69. package/dist/functions/bin/calldatas/liquidity.d.ts +1 -0
  70. package/dist/functions/bin/calldatas/liquidity.d.ts.map +1 -0
  71. package/dist/functions/bin/calldatas/mint.d.ts +15 -0
  72. package/dist/functions/bin/calldatas/mint.d.ts.map +1 -0
  73. package/dist/functions/bin/calldatas/modifyLiquidities.d.ts +3 -0
  74. package/dist/functions/bin/calldatas/modifyLiquidities.d.ts.map +1 -0
  75. package/dist/functions/bin/calldatas/removeLiquidity.d.ts +15 -0
  76. package/dist/functions/bin/calldatas/removeLiquidity.d.ts.map +1 -0
  77. package/dist/functions/bin/calldatas/swap.d.ts +4 -0
  78. package/dist/functions/bin/calldatas/swap.d.ts.map +1 -0
  79. package/dist/functions/bin/createBinPool.d.ts +62 -0
  80. package/dist/functions/bin/createBinPool.d.ts.map +1 -0
  81. package/dist/functions/bin/decodeBinAmount.d.ts +16 -0
  82. package/dist/functions/bin/decodeBinAmount.d.ts.map +1 -0
  83. package/dist/functions/bin/getAmounts.d.ts +26 -0
  84. package/dist/functions/bin/getAmounts.d.ts.map +1 -0
  85. package/dist/functions/bin/getBinLiquidityConfigs.d.ts +7 -0
  86. package/dist/functions/bin/getBinLiquidityConfigs.d.ts.map +1 -0
  87. package/dist/functions/bin/getBinPoolTokenPrice.d.ts +4 -0
  88. package/dist/functions/bin/getBinPoolTokenPrice.d.ts.map +1 -0
  89. package/dist/functions/bin/getExternalFeeAmt.d.ts +6 -0
  90. package/dist/functions/bin/getExternalFeeAmt.d.ts.map +1 -0
  91. package/dist/functions/bin/getFeeAmount.d.ts +8 -0
  92. package/dist/functions/bin/getFeeAmount.d.ts.map +1 -0
  93. package/dist/functions/bin/getFeeAmountFrom.d.ts +9 -0
  94. package/dist/functions/bin/getFeeAmountFrom.d.ts.map +1 -0
  95. package/dist/functions/bin/getIdFromPrice.d.ts +11 -0
  96. package/dist/functions/bin/getIdFromPrice.d.ts.map +1 -0
  97. package/dist/functions/bin/getIdSlippage.d.ts +2 -0
  98. package/dist/functions/bin/getIdSlippage.d.ts.map +1 -0
  99. package/dist/functions/bin/getLiquidityShape.d.ts +32 -0
  100. package/dist/functions/bin/getLiquidityShape.d.ts.map +1 -0
  101. package/dist/functions/bin/getNextNonEmptyBin.d.ts +15 -0
  102. package/dist/functions/bin/getNextNonEmptyBin.d.ts.map +1 -0
  103. package/dist/functions/bin/getPriceFromId.d.ts +13 -0
  104. package/dist/functions/bin/getPriceFromId.d.ts.map +1 -0
  105. package/dist/functions/bin/index.d.ts +17 -0
  106. package/dist/functions/bin/index.d.ts.map +1 -0
  107. package/dist/functions/bin/liquidityConfigs.d.ts +15 -0
  108. package/dist/functions/bin/liquidityConfigs.d.ts.map +1 -0
  109. package/dist/functions/bin/parseReserveOfBin.d.ts +11 -0
  110. package/dist/functions/bin/parseReserveOfBin.d.ts.map +1 -0
  111. package/dist/functions/bin/priceConvert.d.ts +3 -0
  112. package/dist/functions/bin/priceConvert.d.ts.map +1 -0
  113. package/dist/functions/bin/swap.d.ts +20 -0
  114. package/dist/functions/bin/swap.d.ts.map +1 -0
  115. package/dist/functions/clamm/addCLLiquidityMulticall.d.ts +18 -0
  116. package/dist/functions/clamm/addCLLiquidityMulticall.d.ts.map +1 -0
  117. package/dist/functions/clamm/calldatas/burn.d.ts +4 -0
  118. package/dist/functions/clamm/calldatas/burn.d.ts.map +1 -0
  119. package/dist/functions/clamm/calldatas/claim.d.ts +9 -0
  120. package/dist/functions/clamm/calldatas/claim.d.ts.map +1 -0
  121. package/dist/functions/clamm/calldatas/decreaseLiquidity.d.ts +14 -0
  122. package/dist/functions/clamm/calldatas/decreaseLiquidity.d.ts.map +1 -0
  123. package/dist/functions/clamm/calldatas/donate.d.ts +4 -0
  124. package/dist/functions/clamm/calldatas/donate.d.ts.map +1 -0
  125. package/dist/functions/clamm/calldatas/increaseLiquidity.d.ts +4 -0
  126. package/dist/functions/clamm/calldatas/increaseLiquidity.d.ts.map +1 -0
  127. package/dist/functions/clamm/calldatas/index.d.ts +12 -0
  128. package/dist/functions/clamm/calldatas/index.d.ts.map +1 -0
  129. package/dist/functions/clamm/calldatas/initialize.d.ts +3 -0
  130. package/dist/functions/clamm/calldatas/initialize.d.ts.map +1 -0
  131. package/dist/functions/clamm/calldatas/initializePool.d.ts +3 -0
  132. package/dist/functions/clamm/calldatas/initializePool.d.ts.map +1 -0
  133. package/dist/functions/clamm/calldatas/mint.d.ts +4 -0
  134. package/dist/functions/clamm/calldatas/mint.d.ts.map +1 -0
  135. package/dist/functions/clamm/calldatas/modifyLiquidities.d.ts +3 -0
  136. package/dist/functions/clamm/calldatas/modifyLiquidities.d.ts.map +1 -0
  137. package/dist/functions/clamm/calldatas/modifyLiquidity.d.ts +10 -0
  138. package/dist/functions/clamm/calldatas/modifyLiquidity.d.ts.map +1 -0
  139. package/dist/functions/clamm/calldatas/swap.d.ts +9 -0
  140. package/dist/functions/clamm/calldatas/swap.d.ts.map +1 -0
  141. package/dist/functions/clamm/getCLPool.d.ts +6 -0
  142. package/dist/functions/clamm/getCLPool.d.ts.map +1 -0
  143. package/dist/functions/clamm/index.d.ts +5 -0
  144. package/dist/functions/clamm/index.d.ts.map +1 -0
  145. package/dist/functions/getPool.d.ts +19 -0
  146. package/dist/functions/getPool.d.ts.map +1 -0
  147. package/dist/functions/hooks/index.d.ts +2 -0
  148. package/dist/functions/hooks/index.d.ts.map +1 -0
  149. package/dist/functions/hooks/isDynamicFeeHook.d.ts +5 -0
  150. package/dist/functions/hooks/isDynamicFeeHook.d.ts.map +1 -0
  151. package/dist/functions/index.d.ts +5 -0
  152. package/dist/functions/index.d.ts.map +1 -0
  153. package/dist/functions/tick.d.ts +3 -0
  154. package/dist/functions/tick.d.ts.map +1 -0
  155. package/dist/index.d.ts +7 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +7578 -0
  158. package/dist/index.mjs +7430 -0
  159. package/dist/types.d.ts +183 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/dist/utils/ActionsPlanner.d.ts +32 -0
  162. package/dist/utils/ActionsPlanner.d.ts.map +1 -0
  163. package/dist/utils/calculateSwapFee.d.ts +11 -0
  164. package/dist/utils/calculateSwapFee.d.ts.map +1 -0
  165. package/dist/utils/convertBinIdsToRelative.d.ts +12 -0
  166. package/dist/utils/convertBinIdsToRelative.d.ts.map +1 -0
  167. package/dist/utils/decodeHooksRegistration.d.ts +4 -0
  168. package/dist/utils/decodeHooksRegistration.d.ts.map +1 -0
  169. package/dist/utils/decodePoolKey.d.ts +3 -0
  170. package/dist/utils/decodePoolKey.d.ts.map +1 -0
  171. package/dist/utils/decodePoolParameters.d.ts +4 -0
  172. package/dist/utils/decodePoolParameters.d.ts.map +1 -0
  173. package/dist/utils/encodeHooksRegistration.d.ts +4 -0
  174. package/dist/utils/encodeHooksRegistration.d.ts.map +1 -0
  175. package/dist/utils/encodeMulticall.d.ts +3 -0
  176. package/dist/utils/encodeMulticall.d.ts.map +1 -0
  177. package/dist/utils/encodePermit2.d.ts +6 -0
  178. package/dist/utils/encodePermit2.d.ts.map +1 -0
  179. package/dist/utils/encodePoolKey.d.ts +9 -0
  180. package/dist/utils/encodePoolKey.d.ts.map +1 -0
  181. package/dist/utils/encodePoolParameters.d.ts +5 -0
  182. package/dist/utils/encodePoolParameters.d.ts.map +1 -0
  183. package/dist/utils/getAddLiquidityParameters.d.ts +66 -0
  184. package/dist/utils/getAddLiquidityParameters.d.ts.map +1 -0
  185. package/dist/utils/getBinIds.d.ts +9 -0
  186. package/dist/utils/getBinIds.d.ts.map +1 -0
  187. package/dist/utils/getIsInitializedByPoolKey.d.ts +4 -0
  188. package/dist/utils/getIsInitializedByPoolKey.d.ts.map +1 -0
  189. package/dist/utils/getPoolId.d.ts +10 -0
  190. package/dist/utils/getPoolId.d.ts.map +1 -0
  191. package/dist/utils/index.d.ts +17 -0
  192. package/dist/utils/index.d.ts.map +1 -0
  193. package/dist/utils/isInfinitySupported.d.ts +6 -0
  194. package/dist/utils/isInfinitySupported.d.ts.map +1 -0
  195. package/dist/utils/math/TreeMath.d.ts +12 -0
  196. package/dist/utils/math/TreeMath.d.ts.map +1 -0
  197. package/dist/utils/math/index.d.ts +4 -0
  198. package/dist/utils/math/index.d.ts.map +1 -0
  199. package/dist/utils/math/mulShift.d.ts +3 -0
  200. package/dist/utils/math/mulShift.d.ts.map +1 -0
  201. package/dist/utils/math/shiftDiv.d.ts +3 -0
  202. package/dist/utils/math/shiftDiv.d.ts.map +1 -0
  203. package/dist/utils/parseProtocolFee.d.ts +4 -0
  204. package/dist/utils/parseProtocolFee.d.ts.map +1 -0
  205. package/dist/utils/poolIdToPoolKey.d.ts +17 -0
  206. package/dist/utils/poolIdToPoolKey.d.ts.map +1 -0
  207. package/package.json +58 -0
@@ -0,0 +1,183 @@
1
+ import { PermitSingle } from '@pancakeswap/permit2-sdk';
2
+ import { Currency } from '@pancakeswap/swap-sdk-core';
3
+ import { Address, Prettify } from 'viem';
4
+ export interface Permit2Signature extends PermitSingle {
5
+ signature: `0x${string}`;
6
+ }
7
+ export type Tuple<T, N, R extends T[] = []> = R['length'] extends N ? R : Tuple<T, N, [...R, T]>;
8
+ export type Bytes32 = `0x${string}`;
9
+ /**
10
+ * Hooks registration for all type pool
11
+ * if the value is true, the hook will be registered
12
+ */
13
+ export type HooksRegistration = {
14
+ beforeInitialize?: boolean;
15
+ afterInitialize?: boolean;
16
+ beforeAddLiquidity?: boolean;
17
+ afterAddLiquidity?: boolean;
18
+ beforeRemoveLiquidity?: boolean;
19
+ afterRemoveLiquidity?: boolean;
20
+ beforeSwap?: boolean;
21
+ afterSwap?: boolean;
22
+ beforeDonate?: boolean;
23
+ afterDonate?: boolean;
24
+ };
25
+ export type BinTree = {
26
+ level0: Bytes32;
27
+ level1: Record<number, Bytes32>;
28
+ level2: Record<number, Bytes32>;
29
+ };
30
+ export declare enum BinLiquidityShape {
31
+ Spot = "Spot",
32
+ Curve = "Curve",
33
+ BidAsk = "BidAsk"
34
+ }
35
+ export declare enum POOL_TYPE {
36
+ CLAMM = "CL",
37
+ Bin = "Bin"
38
+ }
39
+ export type PoolType = `${POOL_TYPE}`;
40
+ export type CLPoolParameter = {
41
+ /**
42
+ * Hooks registration for the pool
43
+ * @see {@link HooksRegistration}
44
+ */
45
+ hooksRegistration?: HooksRegistration;
46
+ tickSpacing: number;
47
+ };
48
+ export type BinPoolParameter = {
49
+ /**
50
+ * Hooks registration for the pool
51
+ * @see {@link HooksRegistration}
52
+ */
53
+ hooksRegistration?: HooksRegistration;
54
+ binStep: number;
55
+ };
56
+ /**
57
+ * PoolKey is a unique identifier for a pool
58
+ *
59
+ * decoded version of `PoolKey`
60
+ *
61
+ */
62
+ export type PoolKey<TPoolType extends PoolType = 'CL' | 'Bin'> = {
63
+ /**
64
+ * the lower currency address of the pool, use zero address for native token
65
+ */
66
+ currency0: Address;
67
+ /**
68
+ * the higher currency address of the pool
69
+ */
70
+ currency1: Address;
71
+ /**
72
+ * the address of the hooks contract, if not set, use zero address
73
+ */
74
+ hooks?: Address;
75
+ /**
76
+ * the address of the pool manager contract
77
+ */
78
+ poolManager: Address;
79
+ /**
80
+ * the lp fee of the pool, the max fee for cl pool is 1_000_000(100%) and for bin, it is 100_000(10%).
81
+ * If the pool has dynamic fee then it must be exactly equal to 0x800000
82
+ *
83
+ * @see DYNAMIC_FEE_FLAG
84
+ */
85
+ fee: number;
86
+ /**
87
+ * the parameters of the pool
88
+ * include:
89
+ * 1. hooks registration callback
90
+ * 2. pool specific parameters: tickSpacing for CLPool, binStep for BinPool
91
+ *
92
+ * @see BinPoolParameter
93
+ * @see CLPoolParameter
94
+ * @see HooksRegistration
95
+ */
96
+ parameters: TPoolType extends 'CL' ? CLPoolParameter : TPoolType extends 'Bin' ? BinPoolParameter : CLPoolParameter | BinPoolParameter;
97
+ };
98
+ /**
99
+ * encoded poolKey struct
100
+ *
101
+ * @see PoolKey
102
+ * @see {@link https://github.com/pancakeswap/infinity-core/blob/main/src/types/PoolKey.sol|infinity-core}
103
+ */
104
+ export type EncodedPoolKey = {
105
+ currency0: Address;
106
+ currency1: Address;
107
+ hooks: Address;
108
+ poolManager: Address;
109
+ fee: number;
110
+ parameters: Bytes32;
111
+ };
112
+ export type CLPositionConfig = {
113
+ poolKey: PoolKey<'CL'>;
114
+ tickLower: number;
115
+ tickUpper: number;
116
+ };
117
+ export type EncodedCLPositionConfig = {
118
+ poolKey: Prettify<Omit<PoolKey<'CL'>, 'parameters'> & {
119
+ parameters: Bytes32;
120
+ }>;
121
+ tickLower: number;
122
+ tickUpper: number;
123
+ };
124
+ export type BinPool = {
125
+ poolType: 'Bin';
126
+ token0: Currency;
127
+ token1: Currency;
128
+ fee: number;
129
+ protocolFee: number;
130
+ dynamic: boolean;
131
+ activeId: number;
132
+ binStep: number;
133
+ hooksRegistration?: HooksRegistration | undefined;
134
+ };
135
+ export type CLSlot0 = {
136
+ sqrtPriceX96: bigint;
137
+ tick: number;
138
+ protocolFee: number;
139
+ lpFee: number;
140
+ };
141
+ export type BinSlot0 = {
142
+ activeId: number;
143
+ protocolFee: number;
144
+ lpFee: number;
145
+ };
146
+ export type Slot0<TPoolType extends PoolType | unknown = unknown> = TPoolType extends 'CL' ? CLSlot0 : TPoolType extends 'Bin' ? BinSlot0 : unknown;
147
+ export type HookTag = 'CL' | 'Bin' | 'Dynamic' | (string & NonNullable<unknown>);
148
+ export declare enum HOOK_CATEGORY {
149
+ DynamicFees = "Dynamic Fees",
150
+ LiquidityIncentivisation = "Liquidity Incentivisation",
151
+ YieldOptimisation = "Yield Optimisation",
152
+ JIT = "JIT",
153
+ MEV = "MEV",
154
+ RWA = "RWA",
155
+ ALM = "ALM",
156
+ CrossChain = "Cross-Chain",
157
+ Leverage = "Leverage",
158
+ PricingCurve = "Pricing Curve",
159
+ OrderType = "Order Type",
160
+ Oracle = "Oracle",
161
+ Others = "Others"
162
+ }
163
+ export interface HookData {
164
+ address: Address;
165
+ name?: string;
166
+ category?: HOOK_CATEGORY[];
167
+ description?: string;
168
+ poolType?: POOL_TYPE;
169
+ github?: string;
170
+ audit?: string;
171
+ learnMoreLink?: string;
172
+ creator?: string;
173
+ isVerified?: boolean;
174
+ isUpgradable?: boolean;
175
+ hooksRegistration?: HooksRegistration;
176
+ hookType?: HookType;
177
+ defaultFee?: number;
178
+ }
179
+ export declare enum HookType {
180
+ Universal = "Universal",
181
+ PerPool = "PerPool"
182
+ }
183
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAExC,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,SAAS,EAAE,KAAK,MAAM,EAAE,CAAA;CACzB;AAED,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEhG,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAA;AAEnC;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAA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AE,MAAM,CAAA;CACpB;AAED,oBAAY,QAAQ;IAClB,SAAS,cAAc;IACvB,OAAO,YAAY;CACpB"}
@@ -0,0 +1,32 @@
1
+ import { Address, Hex } from 'viem';
2
+ import { ACTIONS } from '../constants/actions';
3
+ import { InfinityABIParametersToValuesType, InfinityUsedAction } from '../constants/actionsAbiParameters';
4
+ import { PoolKey } from '../types';
5
+ export declare class ActionsPlanner {
6
+ private plans;
7
+ add<TAction extends InfinityUsedAction>(action: TAction, param: InfinityABIParametersToValuesType<TAction>): void;
8
+ encodeActions(): `0x${string}`;
9
+ encodePlans(): `0x${string}`[];
10
+ encode(): Hex;
11
+ static decode(calls: Hex): {
12
+ action: ACTIONS;
13
+ actionName: string;
14
+ param: readonly [bigint, bigint, bigint, bigint, `0x${string}`] | readonly [unknown, bigint, bigint, bigint, `0x${string}`, `0x${string}`] | readonly [bigint, unknown, bigint, bigint, `0x${string}`] | readonly [bigint, bigint, bigint, `0x${string}`] | readonly [unknown, number, number, bigint, bigint, `0x${string}`, `0x${string}`] | readonly [unknown] | readonly [`0x${string}`, bigint, boolean] | readonly [`0x${string}`, bigint] | readonly [`0x${string}`, `0x${string}`] | readonly [`0x${string}`, `0x${string}`, bigint] | readonly [`0x${string}`, `0x${string}`, `0x${string}`] | readonly [`0x${string}`] | readonly [bigint];
15
+ }[];
16
+ finalizeModifyLiquidityWithTake(poolKey: PoolKey, takeRecipient: Address): `0x${string}`;
17
+ finalizeModifyLiquidityWithClose(poolKey: PoolKey): `0x${string}`;
18
+ finalizeModifyLiquidityWithCloseWrap(poolKey: PoolKey, wrapAddress: Address, recipient: Address): `0x${string}`;
19
+ finalizeModifyLiquidityWithCloseNative(poolKey: PoolKey, sweepRecipient: Address): `0x${string}`;
20
+ /**
21
+ * Pay and settle currency pair. User's token0 and token1 will be transferred from user and paid.
22
+ * This is commonly used for increase liquidity or mint action.
23
+ */
24
+ finalizeModifyLiquidityWithSettlePair(poolKey: PoolKey, sweepRecipient: Address): `0x${string}`;
25
+ /**
26
+ * Take all amount owed from currency pair. Owed token0 and token1 will be transferred to `takeRecipient`.
27
+ * This is commonly used for decrease liquidity or burn action.
28
+ */
29
+ finalizeModifyLiquidityWithTakePair(poolKey: PoolKey, takeRecipient: Address): `0x${string}`;
30
+ finalizeSwap(inputCurrency: Address, outputCurrency: Address, takeRecipient: Address): `0x${string}`;
31
+ }
32
+ //# sourceMappingURL=ActionsPlanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsPlanner.d.ts","sourceRoot":"","sources":["../../src/utils/ActionsPlanner.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EAIP,GAAG,EAQJ,MAAM,MAAM,CAAA;AACb,OAAO,EAAoB,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAe,iCAAiC,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAOlC,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAa;IAEnB,GAAG,CAAC,OAAO,SAAS,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC,CAAC,OAAO,CAAC;IAI1G,aAAa;IAWb,WAAW;IAIX,MAAM,IAAI,GAAG;IAepB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG;;;;;IAqBjB,+BAA+B,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO;IAOxE,gCAAgC,CAAC,OAAO,EAAE,OAAO;IAOjD,oCAAoC,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO;IAU/F,sCAAsC,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO;IASvF;;;OAGG;IACI,qCAAqC,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO;IAStF;;;OAGG;IACI,mCAAmC,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO;IAM5E,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO;CAW5F"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * protocol fee charged first, then LP fee charged remaining
3
+ * @param protocolFee
4
+ * @param lpFee
5
+ *
6
+ * @returns swapFee bigint
7
+ * unit: bps/100
8
+ * 1 = 0.0001%
9
+ */
10
+ export declare const calculateSwapFee: (protocolFee: bigint, lpFee: bigint) => bigint;
11
+ //# sourceMappingURL=calculateSwapFee.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateSwapFee.d.ts","sourceRoot":"","sources":["../../src/utils/calculateSwapFee.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,SAAS,MAAM,KAAG,MAErE,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * covert from absolute BinIds to activeId relative ids
3
+ *
4
+ * @example
5
+ * given absolute BinIdS: [100, 101, 102], activeId: 101,
6
+ * returns relative ids [-1, 0, 1]
7
+ *
8
+ * @param absoluteIds
9
+ * @param activeId
10
+ */
11
+ export declare const convertBinIdsToRelative: (absoluteIds: number[], activeId: number) => number[];
12
+ //# sourceMappingURL=convertBinIdsToRelative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertBinIdsToRelative.d.ts","sourceRoot":"","sources":["../../src/utils/convertBinIdsToRelative.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,gBAAiB,MAAM,EAAE,YAAY,MAAM,KAAG,MAAM,EAEvF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Hex } from 'viem';
2
+ import { HooksRegistration } from '../types';
3
+ export declare const decodeHooksRegistration: (encoded: Hex | number) => HooksRegistration;
4
+ //# sourceMappingURL=decodeHooksRegistration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodeHooksRegistration.d.ts","sourceRoot":"","sources":["../../src/utils/decodeHooksRegistration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAe5C,eAAO,MAAM,uBAAuB,YAAa,GAAG,GAAG,MAAM,KAAG,iBAe/D,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { EncodedPoolKey, PoolKey } from '../types';
2
+ export declare const decodePoolKey: (encodedPoolKey: EncodedPoolKey, poolType: "CL" | "Bin") => PoolKey<typeof poolType>;
3
+ //# sourceMappingURL=decodePoolKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodePoolKey.d.ts","sourceRoot":"","sources":["../../src/utils/decodePoolKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGlD,eAAO,MAAM,aAAa,mBAAoB,cAAc,YAAY,IAAI,GAAG,KAAK,KAAG,OAAO,CAAC,OAAO,QAAQ,CA4B7G,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { BinPoolParameter, Bytes32, CLPoolParameter } from '../types';
2
+ export declare const decodeCLPoolParameters: (encoded: Bytes32) => CLPoolParameter;
3
+ export declare const decodeBinPoolParameters: (encoded: Bytes32) => BinPoolParameter;
4
+ //# sourceMappingURL=decodePoolParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodePoolParameters.d.ts","sourceRoot":"","sources":["../../src/utils/decodePoolParameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1E,eAAO,MAAM,sBAAsB,YAAa,OAAO,KAAG,eAYzD,CAAA;AAED,eAAO,MAAM,uBAAuB,YAAa,OAAO,KAAG,gBAQ1D,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Hex } from 'viem';
2
+ import { HooksRegistration } from '../types';
3
+ export declare const encodeHooksRegistration: (hooksRegistration?: HooksRegistration) => Hex;
4
+ //# sourceMappingURL=encodeHooksRegistration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodeHooksRegistration.d.ts","sourceRoot":"","sources":["../../src/utils/encodeHooksRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAe5C,eAAO,MAAM,uBAAuB,uBAAwB,iBAAiB,KAAG,GAa/E,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Hex } from 'viem';
2
+ export declare const encodeMulticall: (calldatas: Hex | Hex[]) => Hex;
3
+ //# sourceMappingURL=encodeMulticall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodeMulticall.d.ts","sourceRoot":"","sources":["../../src/utils/encodeMulticall.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,GAAG,EAAE,MAAM,MAAM,CAAA;AAE9C,eAAO,MAAM,eAAe,cAAe,GAAG,GAAG,GAAG,EAAE,KAAG,GASxD,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { PermitBatch } from '@pancakeswap/permit2-sdk';
2
+ import { Address, Hex } from 'viem';
3
+ import { Permit2Signature } from '../types';
4
+ export declare const encodePermit2: (owner: Address, permit2Signature: Permit2Signature) => `0x${string}`;
5
+ export declare const encodePermit2Batch: (owner: Address, permit2Batch: PermitBatch, signatures: Hex) => `0x${string}`;
6
+ //# sourceMappingURL=encodePermit2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodePermit2.d.ts","sourceRoot":"","sources":["../../src/utils/encodePermit2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,OAAO,EAAsB,GAAG,EAAE,MAAM,MAAM,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,eAAO,MAAM,aAAa,UAAW,OAAO,oBAAoB,gBAAgB,kBAkB/E,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAW,OAAO,gBAAgB,WAAW,cAAc,GAAG,kBAmB5F,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { EncodedPoolKey, PoolKey } from '../types';
2
+ /**
3
+ * encode `PoolKey` to `EncodedPoolKey`
4
+ *
5
+ * @param poolKey PoolKey
6
+ * @returns EncodedPoolKey
7
+ */
8
+ export declare const encodePoolKey: (poolKey: PoolKey) => EncodedPoolKey;
9
+ //# sourceMappingURL=encodePoolKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodePoolKey.d.ts","sourceRoot":"","sources":["../../src/utils/encodePoolKey.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGvD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,YAAa,OAAO,KAAG,cAMhD,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { BinPoolParameter, Bytes32, CLPoolParameter } from '../types';
2
+ export declare const encodeCLPoolParameters: (params: CLPoolParameter) => Bytes32;
3
+ export declare const encodeBinPoolParameters: (params: BinPoolParameter) => Bytes32;
4
+ export declare const encodePoolParameters: (params: CLPoolParameter | BinPoolParameter) => Bytes32;
5
+ //# sourceMappingURL=encodePoolParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodePoolParameters.d.ts","sourceRoot":"","sources":["../../src/utils/encodePoolParameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1E,eAAO,MAAM,sBAAsB,WAAY,eAAe,KAAG,OAKhE,CAAA;AAED,eAAO,MAAM,uBAAuB,WAAY,gBAAgB,KAAG,OAKlE,CAAA;AAED,eAAO,MAAM,oBAAoB,WAAY,eAAe,GAAG,gBAAgB,KAAG,OAKjF,CAAA"}
@@ -0,0 +1,66 @@
1
+ import { Address } from 'viem';
2
+ import { Bytes32 } from '../types';
3
+ export type AddBinLiquidityParams = {
4
+ /**
5
+ * @see {@link PoolKey}
6
+ */
7
+ poolKey: Bytes32;
8
+ /**
9
+ * Amount to send for token0
10
+ */
11
+ amount0: bigint;
12
+ /**
13
+ * Amount to send for token1
14
+ */
15
+ amount1: bigint;
16
+ /**
17
+ * Min amount to send for token0
18
+ */
19
+ amount0Min: bigint;
20
+ /**
21
+ * Min amount to send for token1
22
+ */
23
+ amount1Min: bigint;
24
+ /**
25
+ * Active id that user wants to add liquidity from
26
+ */
27
+ activeIdDesired: bigint;
28
+ /**
29
+ * Number of id that are allowed to slip
30
+ */
31
+ isSlippage: bigint;
32
+ /**
33
+ * List of delta ids to add liquidity (`deltaId = activeId - desiredId`)
34
+ */
35
+ deltaIds: bigint[];
36
+ /**
37
+ * Distribution of tokenX with sum(distributionX) = 100e18 (100%) or 0 (0%)
38
+ */
39
+ distributionX: bigint[];
40
+ /**
41
+ * Distribution of tokenY with sum(distributionY) = 100e18 (100%) or 0 (0%)
42
+ */
43
+ distributionY: bigint[];
44
+ /**
45
+ * Address of recipient
46
+ */
47
+ to: Address;
48
+ /**
49
+ * Deadline of transaction
50
+ */
51
+ deadline: bigint;
52
+ };
53
+ export type GetAddBinParams = {
54
+ poolKey: Bytes32;
55
+ binIds: bigint[];
56
+ amount0: bigint;
57
+ amount0Min?: bigint;
58
+ amount1: bigint;
59
+ amount1Min: bigint;
60
+ activeId: bigint;
61
+ isSlippage?: bigint;
62
+ recipient: Address;
63
+ deadline: bigint;
64
+ };
65
+ export declare const getAddBinParams: ({ poolKey, binIds, amount0, amount0Min, amount1, amount1Min, activeId, isSlippage, recipient, deadline, }: GetAddBinParams) => AddBinLiquidityParams;
66
+ //# sourceMappingURL=getAddLiquidityParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAddLiquidityParameters.d.ts","sourceRoot":"","sources":["../../src/utils/getAddLiquidityParameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGlC,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB;;OAEG;IACH,EAAE,EAAE,OAAO,CAAA;IACX;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAGD,eAAO,MAAM,eAAe,8GAWzB,eAAe,KAAG,qBA+CpB,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generate list of BinIds.
3
+ *
4
+ * @example
5
+ * given activeId = 100, numBins = 3, returns [99, 100, 101]
6
+ * given activeId = 100, numBins = 4, returns [98, 99, 100, 101]
7
+ */
8
+ export declare const getBinIds: (activeId: number, numBins: number, relative?: boolean) => number[];
9
+ //# sourceMappingURL=getBinIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBinIds.d.ts","sourceRoot":"","sources":["../../src/utils/getBinIds.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,aAAc,MAAM,WAAW,MAAM,yBAAqB,MAAM,EAUrF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { PublicClient } from 'viem';
2
+ import { PoolKey } from '../types';
3
+ export declare const getIsInitializedByPoolKey: (publicClient: PublicClient, poolKey: PoolKey) => Promise<boolean>;
4
+ //# sourceMappingURL=getIsInitializedByPoolKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIsInitializedByPoolKey.d.ts","sourceRoot":"","sources":["../../src/utils/getIsInitializedByPoolKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,MAAM,CAAA;AAQhD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGlC,eAAO,MAAM,yBAAyB,iBAAwB,YAAY,WAAW,OAAO,qBAuB3F,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { Bytes32, PoolKey } from '../types';
2
+ /**
3
+ * `PoolId` is a bytes32 of `keccak256(abi.encode(poolKey))`
4
+ * @see {@link PoolKey}
5
+ * @see {@link https://github.com/pancakeswap/infinity-core/blob/main/src/types/PoolId.sol|infinity-core}
6
+ * @param param0
7
+ * @returns
8
+ */
9
+ export declare const getPoolId: ({ currency0, currency1, hooks, poolManager, fee, parameters, }: PoolKey) => Bytes32;
10
+ //# sourceMappingURL=getPoolId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPoolId.d.ts","sourceRoot":"","sources":["../../src/utils/getPoolId.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAG3C;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,mEAOnB,OAAO,KAAG,OAaZ,CAAA"}
@@ -0,0 +1,17 @@
1
+ export * from './ActionsPlanner';
2
+ export * from './convertBinIdsToRelative';
3
+ export * from './decodeHooksRegistration';
4
+ export * from './decodePoolKey';
5
+ export * from './decodePoolParameters';
6
+ export * from './encodeHooksRegistration';
7
+ export * from './encodePoolKey';
8
+ export * from './encodePoolParameters';
9
+ export * from './getAddLiquidityParameters';
10
+ export * from './getBinIds';
11
+ export * from './getIsInitializedByPoolKey';
12
+ export * from './getPoolId';
13
+ export * from './isInfinitySupported';
14
+ export * from './math';
15
+ export * from './parseProtocolFee';
16
+ export * from './poolIdToPoolKey';
17
+ //# 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,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,QAAQ,CAAA;AACtB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { ChainId } from '@pancakeswap/chains';
2
+ import { INFINITY_SUPPORTED_CHAINS } from '../constants';
3
+ type InfinitySupportedChain = (typeof INFINITY_SUPPORTED_CHAINS)[number];
4
+ export declare function isInfinitySupported(chainId: ChainId): chainId is InfinitySupportedChain;
5
+ export {};
6
+ //# sourceMappingURL=isInfinitySupported.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInfinitySupported.d.ts","sourceRoot":"","sources":["../../src/utils/isInfinitySupported.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAExD,KAAK,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAExE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,sBAAsB,CAEvF"}
@@ -0,0 +1,12 @@
1
+ import type { BinTree } from '../../types';
2
+ /**
3
+ * functions to interact with the binTree
4
+ */
5
+ export declare const TreeMath: {
6
+ contains: (tree: BinTree, id: bigint) => boolean;
7
+ add: (tree: BinTree, id: bigint) => boolean;
8
+ remove: (tree: BinTree, id: bigint) => boolean;
9
+ findFirstLeft: (tree: BinTree, id: bigint) => bigint;
10
+ findFirstRight: (tree: BinTree, id: bigint) => bigint;
11
+ };
12
+ //# sourceMappingURL=TreeMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeMath.d.ts","sourceRoot":"","sources":["../../../src/utils/math/TreeMath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,aAAa,CAAA;AA+MnD;;GAEG;AACH,eAAO,MAAM,QAAQ;qBAzMG,OAAO,MAAM,MAAM,KAAG,OAAO;gBAUlC,OAAO,MAAM,MAAM,KAAG,OAAO;mBA4B1B,OAAO,MAAM,MAAM,KAAG,OAAO;0BA+GtB,OAAO,MAAM,MAAM,KAAG,MAAM;2BArD3B,OAAO,MAAM,MAAM,KAAG,MAAM;CA+GzD,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './TreeMath';
2
+ export * from './mulShift';
3
+ export * from './shiftDiv';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const mulShiftRoundUp: (x: bigint, y: bigint, offset: bigint) => bigint;
2
+ export declare const mulShiftRoundDown: (x: bigint, y: bigint, offset: bigint) => bigint;
3
+ //# sourceMappingURL=mulShift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mulShift.d.ts","sourceRoot":"","sources":["../../../src/utils/math/mulShift.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,MAAO,MAAM,KAAK,MAAM,UAAU,MAAM,KAAG,MAMtE,CAAA;AAED,eAAO,MAAM,iBAAiB,MAAO,MAAM,KAAK,MAAM,UAAU,MAAM,KAAG,MAexE,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const shiftDivRoundDown: (x: bigint, offset: bigint | number, denominator: bigint) => bigint;
2
+ export declare const shiftDivRoundUp: (x: bigint, offset: bigint | number, denominator: bigint) => bigint;
3
+ //# sourceMappingURL=shiftDiv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shiftDiv.d.ts","sourceRoot":"","sources":["../../../src/utils/math/shiftDiv.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,MAAO,MAAM,UAAU,MAAM,GAAG,MAAM,eAAe,MAAM,KAAG,MAK3F,CAAA;AAED,eAAO,MAAM,eAAe,MAAO,MAAM,UAAU,MAAM,GAAG,MAAM,eAAe,MAAM,KAAG,MAMzF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Percent } from '@pancakeswap/swap-sdk-core';
2
+ export declare function parseProtocolFees(feeProtocol?: number | string): [Percent, Percent] | undefined;
3
+ export declare function parseProtocolFeesToNumbers(feeProtocol?: number | string): [number, number] | undefined;
4
+ //# sourceMappingURL=parseProtocolFee.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseProtocolFee.d.ts","sourceRoot":"","sources":["../../src/utils/parseProtocolFee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAIpD,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAK/F;AAED,wBAAgB,0BAA0B,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAatG"}
@@ -0,0 +1,17 @@
1
+ import { Address, Hex, PublicClient } from 'viem';
2
+ import { POOL_TYPE, PoolKey, PoolType } from '../types';
3
+ export declare const parsePoolKey: <T extends PoolType = "CL" | "Bin">(poolType: T, currency0: Address, currency1: Address, hooks: Address, poolManager: Address, fee: number, parameters: Address) => PoolKey<T>;
4
+ export declare const poolIdToPoolKey: <TPoolType extends PoolType = "CL" | "Bin">({ poolId, poolType, publicClient, }: {
5
+ poolId: Hex | undefined;
6
+ poolType?: TPoolType | undefined;
7
+ publicClient: PublicClient | undefined;
8
+ }) => Promise<PoolKey<TPoolType> | undefined>;
9
+ export declare const binPoolIdToPoolKey: ({ poolId, publicClient, }: {
10
+ poolId: Hex | undefined;
11
+ publicClient: PublicClient | undefined;
12
+ }) => Promise<PoolKey<POOL_TYPE.Bin> | undefined>;
13
+ export declare const clPoolIdToPoolKey: ({ poolId, publicClient, }: {
14
+ poolId: Hex | undefined;
15
+ publicClient: PublicClient | undefined;
16
+ }) => Promise<PoolKey<POOL_TYPE.CLAMM> | undefined>;
17
+ //# sourceMappingURL=poolIdToPoolKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poolIdToPoolKey.d.ts","sourceRoot":"","sources":["../../src/utils/poolIdToPoolKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAA6B,YAAY,EAAe,MAAM,MAAM,CAAA;AAQzF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGvD,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,QAAQ,2BACnC,CAAC,aACA,OAAO,aACP,OAAO,SACX,OAAO,eACD,OAAO,OACf,MAAM,cACC,OAAO,KASd,OAAO,CAAC,CAAC,CACf,CAAA;AAED,eAAO,MAAM,eAAe,GAAU,SAAS,SAAS,QAAQ,sDAI7D;IACD,MAAM,EAAE,GAAG,GAAG,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAChC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,KAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAgEzC,CAAA;AAED,eAAO,MAAM,kBAAkB,8BAG5B;IACD,MAAM,EAAE,GAAG,GAAG,SAAS,CAAA;IACvB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,gDAEA,CAAA;AAED,eAAO,MAAM,iBAAiB,8BAG3B;IACD,MAAM,EAAE,GAAG,GAAG,SAAS,CAAA;IACvB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,kDAEA,CAAA"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@pancakeswap/infinity-sdk",
3
+ "license": "MIT",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "version": "1.0.0",
8
+ "description": "⚒️ An SDK for building applications on top of Pancakeswap Infinity",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "keywords": [
13
+ "pancakeswap",
14
+ "infinity"
15
+ ],
16
+ "sideEffects": false,
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "module": "dist/index.mjs",
20
+ "dependencies": {
21
+ "bignumber.js": "^9.0.0",
22
+ "tiny-invariant": "^1.3.3",
23
+ "viem": "^2.22.23",
24
+ "@pancakeswap/chains": "0.5.1",
25
+ "@pancakeswap/swap-sdk-core": "1.4.0",
26
+ "@pancakeswap/v3-sdk": "3.9.2",
27
+ "@pancakeswap/permit2-sdk": "1.1.2",
28
+ "@pancakeswap/utils": "6.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "tsup": "^6.7.0",
32
+ "@pancakeswap/swap-sdk-evm": "1.1.2"
33
+ },
34
+ "engines": {
35
+ "node": ">=10"
36
+ },
37
+ "prettier": {
38
+ "printWidth": 120,
39
+ "semi": false,
40
+ "singleQuote": true
41
+ },
42
+ "exports": {
43
+ "./package.json": "./package.json",
44
+ ".": {
45
+ "types": "./dist/index.d.ts",
46
+ "import": "./dist/index.mjs",
47
+ "require": "./dist/index.js"
48
+ }
49
+ },
50
+ "scripts": {
51
+ "build": "tsup",
52
+ "dev": "tsup --watch",
53
+ "test": "vitest --run",
54
+ "update:snapshot": "vitest -u",
55
+ "coverage": "vitest run --coverage",
56
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
57
+ }
58
+ }