@hawksightco/hawk-sdk 1.3.265 → 1.3.267

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 (181) hide show
  1. package/dist/addresses.d.ts +37 -0
  2. package/dist/addresses.d.ts.map +1 -0
  3. package/dist/addresses.js +84 -0
  4. package/dist/anchor.d.ts +22 -0
  5. package/dist/anchor.d.ts.map +1 -0
  6. package/dist/anchor.js +121 -0
  7. package/dist/classes/AltStorage.d.ts +29 -0
  8. package/dist/classes/AltStorage.d.ts.map +1 -0
  9. package/dist/classes/AltStorage.js +58 -0
  10. package/dist/classes/Atomicity.d.ts +34 -0
  11. package/dist/classes/Atomicity.d.ts.map +1 -0
  12. package/dist/classes/Atomicity.js +110 -0
  13. package/dist/classes/Client.d.ts +35 -0
  14. package/dist/classes/Client.d.ts.map +1 -0
  15. package/dist/classes/Client.js +66 -0
  16. package/dist/classes/CombineTransactions.d.ts +11 -0
  17. package/dist/classes/CombineTransactions.d.ts.map +1 -0
  18. package/dist/classes/CombineTransactions.js +58 -0
  19. package/dist/classes/CreateTxMetadata.d.ts +100 -0
  20. package/dist/classes/CreateTxMetadata.d.ts.map +1 -0
  21. package/dist/classes/CreateTxMetadata.js +415 -0
  22. package/dist/classes/General.d.ts +87 -0
  23. package/dist/classes/General.d.ts.map +1 -0
  24. package/dist/classes/General.js +176 -0
  25. package/dist/classes/GeneralUtility.d.ts +79 -0
  26. package/dist/classes/GeneralUtility.d.ts.map +1 -0
  27. package/dist/classes/GeneralUtility.js +121 -0
  28. package/dist/classes/HawkAPI.d.ts +122 -0
  29. package/dist/classes/HawkAPI.d.ts.map +1 -0
  30. package/dist/classes/HawkAPI.js +169 -0
  31. package/dist/classes/Health.d.ts +29 -0
  32. package/dist/classes/Health.d.ts.map +1 -0
  33. package/dist/classes/Health.js +48 -0
  34. package/dist/classes/JupiterAlts.d.ts +37 -0
  35. package/dist/classes/JupiterAlts.d.ts.map +1 -0
  36. package/dist/classes/JupiterAlts.js +114 -0
  37. package/dist/classes/JupiterSwap.d.ts +21 -0
  38. package/dist/classes/JupiterSwap.d.ts.map +1 -0
  39. package/dist/classes/JupiterSwap.js +40 -0
  40. package/dist/classes/Logging.d.ts +13 -0
  41. package/dist/classes/Logging.d.ts.map +1 -0
  42. package/dist/classes/Logging.js +50 -0
  43. package/dist/classes/MultiTransaction.d.ts +75 -0
  44. package/dist/classes/MultiTransaction.d.ts.map +1 -0
  45. package/dist/classes/MultiTransaction.js +296 -0
  46. package/dist/classes/RaydiumSDK.d.ts +67 -0
  47. package/dist/classes/RaydiumSDK.d.ts.map +1 -0
  48. package/dist/classes/RaydiumSDK.js +206 -0
  49. package/dist/classes/Search.d.ts +100 -0
  50. package/dist/classes/Search.d.ts.map +1 -0
  51. package/dist/classes/Search.js +216 -0
  52. package/dist/classes/SimpleIxGenerator.d.ts +57 -0
  53. package/dist/classes/SimpleIxGenerator.d.ts.map +1 -0
  54. package/dist/classes/SimpleIxGenerator.js +62 -0
  55. package/dist/classes/SimplePdaGenerator.d.ts +28 -0
  56. package/dist/classes/SimplePdaGenerator.d.ts.map +1 -0
  57. package/dist/classes/SimplePdaGenerator.js +33 -0
  58. package/dist/classes/Transaction.d.ts +229 -0
  59. package/dist/classes/Transaction.d.ts.map +1 -0
  60. package/dist/classes/Transaction.js +643 -0
  61. package/dist/classes/Transaction2.d.ts +107 -0
  62. package/dist/classes/Transaction2.d.ts.map +1 -0
  63. package/dist/classes/Transaction2.js +249 -0
  64. package/dist/classes/Transaction3.d.ts +165 -0
  65. package/dist/classes/Transaction3.d.ts.map +1 -0
  66. package/dist/classes/Transaction3.js +416 -0
  67. package/dist/classes/TransactionBatchExecute.d.ts +163 -0
  68. package/dist/classes/TransactionBatchExecute.d.ts.map +1 -0
  69. package/dist/classes/TransactionBatchExecute.js +466 -0
  70. package/dist/classes/TransactionBatchExecute2.d.ts +99 -0
  71. package/dist/classes/TransactionBatchExecute2.d.ts.map +1 -0
  72. package/dist/classes/TransactionBatchExecute2.js +357 -0
  73. package/dist/classes/Transactions.d.ts +586 -0
  74. package/dist/classes/Transactions.d.ts.map +1 -0
  75. package/dist/classes/Transactions.js +7667 -0
  76. package/dist/classes/TxGenerator.d.ts +350 -0
  77. package/dist/classes/TxGenerator.d.ts.map +1 -0
  78. package/dist/classes/TxGenerator.js +1957 -0
  79. package/dist/classes/TxGeneratorAutomations.d.ts +186 -0
  80. package/dist/classes/TxGeneratorAutomations.d.ts.map +1 -0
  81. package/dist/classes/TxGeneratorAutomations.js +897 -0
  82. package/dist/classes/Util.d.ts +87 -0
  83. package/dist/classes/Util.d.ts.map +1 -0
  84. package/dist/classes/Util.js +148 -0
  85. package/dist/classes/account-cache/AccountCache.d.ts +54 -0
  86. package/dist/classes/account-cache/AccountCache.d.ts.map +1 -0
  87. package/dist/classes/account-cache/AccountCache.js +143 -0
  88. package/dist/classes/account-cache/MintCache.d.ts +33 -0
  89. package/dist/classes/account-cache/MintCache.d.ts.map +1 -0
  90. package/dist/classes/account-cache/MintCache.js +47 -0
  91. package/dist/classes/account-cache/TokenCache.d.ts +33 -0
  92. package/dist/classes/account-cache/TokenCache.d.ts.map +1 -0
  93. package/dist/classes/account-cache/TokenCache.js +47 -0
  94. package/dist/errors.d.ts +13 -0
  95. package/dist/errors.d.ts.map +1 -0
  96. package/dist/errors.js +96 -0
  97. package/dist/functions.d.ts +514 -0
  98. package/dist/functions.d.ts.map +1 -0
  99. package/dist/functions.js +1636 -0
  100. package/dist/hawksight.d.ts +53 -0
  101. package/dist/hawksight.d.ts.map +1 -0
  102. package/dist/hawksight.js +328 -0
  103. package/dist/hsToMeteora.d.ts +31 -0
  104. package/dist/hsToMeteora.d.ts.map +1 -0
  105. package/dist/hsToMeteora.js +3175 -0
  106. package/dist/idl/iyf-extension-idl.d.ts +14583 -0
  107. package/dist/idl/iyf-extension-idl.d.ts.map +1 -0
  108. package/dist/idl/iyf-extension-idl.js +14578 -0
  109. package/dist/idl/iyf-extension-wrapper.d.ts +112 -0
  110. package/dist/idl/iyf-extension-wrapper.d.ts.map +1 -0
  111. package/dist/idl/iyf-extension-wrapper.js +2 -0
  112. package/dist/idl/iyf-main-idl.d.ts +12078 -0
  113. package/dist/idl/iyf-main-idl.d.ts.map +1 -0
  114. package/dist/idl/iyf-main-idl.js +12073 -0
  115. package/dist/idl/iyf-main-wrapper.d.ts +112 -0
  116. package/dist/idl/iyf-main-wrapper.d.ts.map +1 -0
  117. package/dist/idl/iyf-main-wrapper.js +2 -0
  118. package/dist/idl/jupiter-idl.d.ts +3063 -0
  119. package/dist/idl/jupiter-idl.d.ts.map +1 -0
  120. package/dist/idl/jupiter-idl.js +3061 -0
  121. package/dist/idl/meteora-idl.d.ts +7371 -0
  122. package/dist/idl/meteora-idl.d.ts.map +1 -0
  123. package/dist/idl/meteora-idl.js +7372 -0
  124. package/dist/idl/orca-idl.d.ts +3833 -0
  125. package/dist/idl/orca-idl.d.ts.map +1 -0
  126. package/dist/idl/orca-idl.js +3834 -0
  127. package/dist/idl/raydium-idl.d.ts +3054 -0
  128. package/dist/idl/raydium-idl.d.ts.map +1 -0
  129. package/dist/idl/raydium-idl.js +3055 -0
  130. package/dist/index.d.ts +9 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +31 -0
  133. package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts +126 -0
  134. package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts.map +1 -0
  135. package/dist/ixGenerator/IyfExtensionIxGenerator.js +467 -0
  136. package/dist/ixGenerator/IyfMainIxGenerator.d.ts +330 -0
  137. package/dist/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -0
  138. package/dist/ixGenerator/IyfMainIxGenerator.js +1239 -0
  139. package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts +685 -0
  140. package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -0
  141. package/dist/ixGenerator/MeteoraDlmmIxGenerator.js +3008 -0
  142. package/dist/ixGenerator/OrcaIxGenerator.d.ts +119 -0
  143. package/dist/ixGenerator/OrcaIxGenerator.d.ts.map +1 -0
  144. package/dist/ixGenerator/OrcaIxGenerator.js +438 -0
  145. package/dist/ixGenerator/RaydiumIxGenerator.d.ts +99 -0
  146. package/dist/ixGenerator/RaydiumIxGenerator.d.ts.map +1 -0
  147. package/dist/ixGenerator/RaydiumIxGenerator.js +558 -0
  148. package/dist/ixGenerator/UtilIxGenerator.d.ts +20 -0
  149. package/dist/ixGenerator/UtilIxGenerator.d.ts.map +1 -0
  150. package/dist/ixGenerator/UtilIxGenerator.js +25 -0
  151. package/dist/meteora/index.d.ts +2 -0
  152. package/dist/meteora/index.d.ts.map +1 -0
  153. package/dist/meteora/index.js +17 -0
  154. package/dist/meteora/liquidityStrategy.d.ts +408 -0
  155. package/dist/meteora/liquidityStrategy.d.ts.map +1 -0
  156. package/dist/meteora/liquidityStrategy.js +1325 -0
  157. package/dist/meteora.d.ts +669 -0
  158. package/dist/meteora.d.ts.map +1 -0
  159. package/dist/meteora.js +1932 -0
  160. package/dist/orca.d.ts +57 -0
  161. package/dist/orca.d.ts.map +1 -0
  162. package/dist/orca.js +123 -0
  163. package/dist/pdaGenerator/HawksightPdaGenerator.d.ts +29 -0
  164. package/dist/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -0
  165. package/dist/pdaGenerator/HawksightPdaGenerator.js +75 -0
  166. package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts +76 -0
  167. package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -0
  168. package/dist/pdaGenerator/MeteoraPdaGenerator.js +166 -0
  169. package/dist/pdaGenerator/OrcaPdaGenerator.d.ts +23 -0
  170. package/dist/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -0
  171. package/dist/pdaGenerator/OrcaPdaGenerator.js +68 -0
  172. package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts +49 -0
  173. package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts.map +1 -0
  174. package/dist/pdaGenerator/RaydiumPdaGenerator.js +114 -0
  175. package/dist/pdaGenerator/UtilPdaGenerator.d.ts +8 -0
  176. package/dist/pdaGenerator/UtilPdaGenerator.d.ts.map +1 -0
  177. package/dist/pdaGenerator/UtilPdaGenerator.js +51 -0
  178. package/dist/types.d.ts +1104 -0
  179. package/dist/types.d.ts.map +1 -0
  180. package/dist/types.js +95 -0
  181. package/package.json +6 -5
@@ -0,0 +1,408 @@
1
+ import BN from 'bn.js';
2
+ import { Distribution, HybridLiquidityDistribution } from '../types';
3
+ /**
4
+ * Liquidity strategy types matching Meteora DLMM SDK.
5
+ */
6
+ export declare enum StrategyType {
7
+ /** Uniform distribution - equal value per bin (adjusted for price) */
8
+ SPOT = 0,
9
+ /** Curve distribution - decreasing amounts away from active bin */
10
+ CURVE = 1,
11
+ /** Bid-Ask distribution - increasing amounts away from active bin */
12
+ BID_ASK = 2
13
+ }
14
+ /**
15
+ * Liquidity strategy parameters for rebalanceLiquidity instruction.
16
+ * These parameters define how liquidity is distributed across bins.
17
+ *
18
+ * For SPOT strategy: deltaX = 0, deltaY = 0 (uniform distribution)
19
+ * For CURVE strategy: deltaX < 0, deltaY < 0 (decreasing away from active)
20
+ * For BID_ASK strategy: deltaX > 0, deltaY > 0 (increasing away from active)
21
+ *
22
+ * Amount per bin is calculated as:
23
+ * - Ask side (X): amountX = (x0 + deltaX * deltaId) * price_weight
24
+ * - Bid side (Y): amountY = y0 + deltaY * distance_from_active
25
+ */
26
+ export interface LiquidityStrategyParameters {
27
+ /** Base amount for X token (ask side) */
28
+ x0: BN;
29
+ /** Base amount for Y token (bid side) */
30
+ y0: BN;
31
+ /** Delta change per bin for X (0 for SPOT, negative for CURVE, positive for BID_ASK) */
32
+ deltaX: BN;
33
+ /** Delta change per bin for Y (0 for SPOT, negative for CURVE, positive for BID_ASK) */
34
+ deltaY: BN;
35
+ }
36
+ export interface HybridStrategyResult extends LiquidityStrategyParameters {
37
+ /** Total X token amount allocated to this layer */
38
+ maxAmountX: BN;
39
+ /** Total Y token amount allocated to this layer */
40
+ maxAmountY: BN;
41
+ }
42
+ /**
43
+ * Represents a single chunk of a hybrid deposit with multiple layers.
44
+ * Each layer has its own strategy parameters adjusted for this chunk's bin range.
45
+ */
46
+ export interface ChunkedHybridDepositParameters {
47
+ /** Lower bin ID of this chunk (absolute bin ID) */
48
+ lowerBinId: number;
49
+ /** Upper bin ID of this chunk (absolute bin ID) */
50
+ upperBinId: number;
51
+ /** Minimum delta ID relative to active bin for this chunk */
52
+ minDeltaId: BN;
53
+ /** Maximum delta ID relative to active bin for this chunk */
54
+ maxDeltaId: BN;
55
+ /** Per-layer deposit parameters for this chunk */
56
+ layers: {
57
+ params: LiquidityStrategyParameters;
58
+ maxAmountX: BN;
59
+ maxAmountY: BN;
60
+ }[];
61
+ }
62
+ /**
63
+ * Chunks hybrid deposit parameters across a bin range.
64
+ *
65
+ * For each chunk of the bin range, applies resetUninvolvedLiquidityParams to each
66
+ * layer and calculates the per-chunk amounts per layer via toAmountIntoBins.
67
+ *
68
+ * @param layerResults - Array of HybridStrategyResult from distributionToHybridStrategy
69
+ * @param minDeltaId - Minimum delta ID (lowerBinId - activeId) for the full position
70
+ * @param maxDeltaId - Maximum delta ID (upperBinId - activeId) for the full position
71
+ * @param activeId - Current active bin ID
72
+ * @param binStep - Bin step in basis points
73
+ * @param chunkSize - Maximum bins per chunk
74
+ * @param favorXInActiveBin - Whether X is favored in the active bin
75
+ * @returns Array of chunked hybrid deposit parameters, one entry per chunk
76
+ */
77
+ export declare function chunkHybridDepositParameters(layerResults: HybridStrategyResult[], minDeltaId: BN, maxDeltaId: BN, activeId: BN, binStep: BN, chunkSize: number, favorXInActiveBin?: boolean): ChunkedHybridDepositParameters[];
78
+ /**
79
+ * Calculates the Q-price from a bin ID.
80
+ * Price = (1 + binStep/10000)^binId in Q64.64 format.
81
+ *
82
+ * Uses binary exponentiation matching Meteora SDK for precision.
83
+ *
84
+ * @param binId - The bin ID (can be negative)
85
+ * @param binStep - The bin step in basis points
86
+ * @returns Price in Q64.64 fixed-point format
87
+ */
88
+ export declare function getQPriceFromId(binId: BN, binStep: BN): BN;
89
+ /**
90
+ * Builds liquidity strategy parameters for SPOT (uniform) distribution.
91
+ *
92
+ * This function calculates x0 and y0 values that will distribute the given amounts
93
+ * uniformly across the specified bin range when used with the rebalanceLiquidity instruction.
94
+ *
95
+ * The function handles three cases:
96
+ * 1. Position entirely below active bin (bid side only) → only Y deposited
97
+ * 2. Position entirely above active bin (ask side only) → only X deposited
98
+ * 3. Position spans active bin → both X and Y deposited
99
+ *
100
+ * @param amountX - Total X amount to deposit
101
+ * @param amountY - Total Y amount to deposit
102
+ * @param minDeltaId - Minimum delta ID (lowerBinId - activeId)
103
+ * @param maxDeltaId - Maximum delta ID (upperBinId - activeId)
104
+ * @param binStep - The bin step in basis points
105
+ * @param activeId - The active bin ID
106
+ * @param favorXInActiveId - Whether X is favored in the active bin (affects bid/ask boundary)
107
+ * @returns Strategy parameters { x0, y0, deltaX, deltaY }
108
+ */
109
+ export declare function buildSpotStrategyParameters(amountX: BN, amountY: BN, minDeltaId: BN, maxDeltaId: BN, binStep: BN, activeId: BN, favorXInActiveId?: boolean): LiquidityStrategyParameters;
110
+ /**
111
+ * Resets strategy parameters for a chunk that may not span the full position range.
112
+ *
113
+ * When splitting a position into chunks, each chunk may only cover part of the range:
114
+ * - If chunk is entirely on bid side → zero out X parameters
115
+ * - If chunk is entirely on ask side → zero out Y parameters
116
+ * - If chunk spans active bin → keep both X and Y parameters
117
+ *
118
+ * @param minDeltaId - Chunk's minimum delta ID
119
+ * @param maxDeltaId - Chunk's maximum delta ID
120
+ * @param favorXInActiveId - Whether X is favored in the active bin
121
+ * @param params - Original strategy parameters from buildSpotStrategyParameters
122
+ * @returns Adjusted parameters for the chunk
123
+ */
124
+ export declare function resetUninvolvedLiquidityParams(minDeltaId: BN, maxDeltaId: BN, favorXInActiveId: boolean, params: LiquidityStrategyParameters): LiquidityStrategyParameters;
125
+ /**
126
+ * Calculates the actual X amount that will be deposited into a bin on the ask side.
127
+ *
128
+ * For SPOT strategy: amountX = x0 * price_weight
129
+ * where price_weight = (1 + binStep/10000)^(-(activeId + deltaId))
130
+ *
131
+ * @param x0 - Base X amount from strategy parameters
132
+ * @param deltaId - Delta ID relative to active bin
133
+ * @param binStep - The bin step in basis points
134
+ * @param activeId - The active bin ID
135
+ * @returns Amount of X for this bin
136
+ */
137
+ export declare function getAmountXForBin(x0: BN, deltaId: BN, binStep: BN, activeId: BN): BN;
138
+ /**
139
+ * Calculates the actual Y amount that will be deposited into a bin on the bid side.
140
+ *
141
+ * For SPOT strategy: amountY = y0 (constant per bin)
142
+ *
143
+ * @param y0 - Base Y amount from strategy parameters
144
+ * @returns Amount of Y for this bin
145
+ */
146
+ export declare function getAmountYForBin(y0: BN): BN;
147
+ /**
148
+ * Calculates total X and Y amounts for a chunk based on strategy parameters.
149
+ *
150
+ * This iterates through each bin in the chunk and sums up the amounts.
151
+ *
152
+ * @param activeId - The active bin ID
153
+ * @param minDeltaId - Chunk's minimum delta ID
154
+ * @param maxDeltaId - Chunk's maximum delta ID
155
+ * @param params - Strategy parameters (after resetUninvolvedLiquidityParams)
156
+ * @param binStep - The bin step in basis points
157
+ * @param favorXInActiveId - Whether X is favored in the active bin
158
+ * @returns Total X and Y amounts for the chunk
159
+ */
160
+ export declare function calculateChunkAmounts(activeId: BN, minDeltaId: BN, maxDeltaId: BN, params: LiquidityStrategyParameters, binStep: BN, favorXInActiveId: boolean): {
161
+ totalXAmount: BN;
162
+ totalYAmount: BN;
163
+ };
164
+ /**
165
+ * Builds liquidity strategy parameters for CURVE distribution.
166
+ *
167
+ * CURVE strategy concentrates liquidity near the active bin with amounts
168
+ * decreasing as you move away. This is achieved with negative deltaX/deltaY.
169
+ *
170
+ * @param amountX - Total X amount to deposit
171
+ * @param amountY - Total Y amount to deposit
172
+ * @param minDeltaId - Minimum delta ID (lowerBinId - activeId)
173
+ * @param maxDeltaId - Maximum delta ID (upperBinId - activeId)
174
+ * @param binStep - The bin step in basis points
175
+ * @param activeId - The active bin ID
176
+ * @param favorXInActiveId - Whether X is favored in the active bin
177
+ * @returns Strategy parameters { x0, y0, deltaX, deltaY }
178
+ */
179
+ export declare function buildCurveStrategyParameters(amountX: BN, amountY: BN, minDeltaId: BN, maxDeltaId: BN, binStep: BN, activeId: BN, favorXInActiveId?: boolean): LiquidityStrategyParameters;
180
+ /**
181
+ * Builds liquidity strategy parameters for BID_ASK distribution.
182
+ *
183
+ * BID_ASK strategy has liquidity increasing away from the active bin.
184
+ * This is achieved with positive deltaX/deltaY values.
185
+ *
186
+ * @param amountX - Total X amount to deposit
187
+ * @param amountY - Total Y amount to deposit
188
+ * @param minDeltaId - Minimum delta ID (lowerBinId - activeId)
189
+ * @param maxDeltaId - Maximum delta ID (upperBinId - activeId)
190
+ * @param binStep - The bin step in basis points
191
+ * @param activeId - The active bin ID
192
+ * @param favorXInActiveId - Whether X is favored in the active bin
193
+ * @returns Strategy parameters { x0, y0, deltaX, deltaY }
194
+ */
195
+ export declare function buildBidAskStrategyParameters(amountX: BN, amountY: BN, minDeltaId: BN, maxDeltaId: BN, binStep: BN, activeId: BN, favorXInActiveId?: boolean): LiquidityStrategyParameters;
196
+ /**
197
+ * Builds liquidity strategy parameters for the specified strategy type.
198
+ *
199
+ * This is the main entry point that dispatches to the appropriate strategy builder.
200
+ *
201
+ * @param strategyType - The type of strategy (SPOT, CURVE, or BID_ASK)
202
+ * @param amountX - Total X amount to deposit
203
+ * @param amountY - Total Y amount to deposit
204
+ * @param minDeltaId - Minimum delta ID (lowerBinId - activeId)
205
+ * @param maxDeltaId - Maximum delta ID (upperBinId - activeId)
206
+ * @param binStep - The bin step in basis points
207
+ * @param activeId - The active bin ID
208
+ * @param favorXInActiveId - Whether X is favored in the active bin
209
+ * @returns Strategy parameters { x0, y0, deltaX, deltaY }
210
+ */
211
+ export declare function buildStrategyParameters(strategyType: StrategyType, amountX: BN, amountY: BN, minDeltaId: BN, maxDeltaId: BN, binStep: BN, activeId: BN, favorXInActiveId?: boolean): LiquidityStrategyParameters;
212
+ /**
213
+ * Maps a Distribution string to a StrategyType enum.
214
+ * All variants of a base distribution (e.g. SPOT, SPOT-IMBALANCED, SPOT-ONE-SIDE)
215
+ * map to the same underlying StrategyType.
216
+ */
217
+ export declare function distributionToStrategyType(distribution: Distribution): StrategyType;
218
+ /**
219
+ * Converts an array of HybridLiquidityDistribution layers into strategy parameters.
220
+ *
221
+ * For each layer, applies the percentage split to the total X/Y amounts and delegates
222
+ * to buildHybridStrategyParameters. The last layer with a non-zero percentage on each
223
+ * side receives the full remaining amount (sweep), ensuring no dust is left behind
224
+ * due to integer division.
225
+ *
226
+ * Layers where both X and Y percentages are 0 are skipped.
227
+ *
228
+ * @param hybridDistribution - Array of layer distribution configs (1-3 layers)
229
+ * @param amountX - Total X token amount to distribute across layers
230
+ * @param amountY - Total Y token amount to distribute across layers
231
+ * @param minDeltaId - Lower bin bound relative to active bin (negative)
232
+ * @param maxDeltaId - Upper bin bound relative to active bin (positive)
233
+ * @param binStep - Bin step of the DLMM pool
234
+ * @param activeId - Current active bin ID
235
+ * @returns One LiquidityStrategyParameters per active layer
236
+ */
237
+ export declare function distributionToHybridStrategy({ amountY, amountX, hybridDistribution, minDeltaId, maxDeltaId, binStep, activeId, }: {
238
+ hybridDistribution: HybridLiquidityDistribution[];
239
+ amountX: BN;
240
+ amountY: BN;
241
+ minDeltaId: BN;
242
+ maxDeltaId: BN;
243
+ binStep: BN;
244
+ activeId: BN;
245
+ }): HybridStrategyResult[];
246
+ /**
247
+ * Builds liquidity strategy parameters for a hybrid distribution where X (ask)
248
+ * and Y (bid) sides use different strategy types (e.g. X=BID-ASK, Y=SPOT).
249
+ *
250
+ * Splits the bin range at the active bin and computes each side independently:
251
+ * - Left side (Y/bid): distributes amountY across [minDeltaId, 0] using strategyTypeY
252
+ * - Right side (X/ask): distributes amountX across [0, maxDeltaId] using strategyTypeX
253
+ *
254
+ * The active bin (deltaId=0) is included in both computations. The final result
255
+ * merges y0/deltaY from the left side with x0/deltaX from the right side, giving
256
+ * each token its own independent distribution curve.
257
+ *
258
+ * @param strategyTypeY - Distribution strategy for the Y (bid) side
259
+ * @param strategyTypeX - Distribution strategy for the X (ask) side
260
+ * @param amountX - Total X token amount to distribute
261
+ * @param amountY - Total Y token amount to distribute
262
+ * @param minDeltaId - Lower bin bound relative to active bin (negative)
263
+ * @param maxDeltaId - Upper bin bound relative to active bin (positive)
264
+ * @param binStep - Bin step of the DLMM pool
265
+ * @param activeId - Current active bin ID
266
+ * @returns Merged strategy parameters with independent X/Y distributions
267
+ */
268
+ export declare function buildHybridStrategyParameters({ strategyTypeY, strategyTypeX, amountY, amountX, minDeltaId, maxDeltaId, binStep, activeId, }: {
269
+ strategyTypeY: StrategyType;
270
+ strategyTypeX: StrategyType;
271
+ amountX: BN;
272
+ amountY: BN;
273
+ minDeltaId: BN;
274
+ maxDeltaId: BN;
275
+ binStep: BN;
276
+ activeId: BN;
277
+ }): LiquidityStrategyParameters;
278
+ /**
279
+ * Represents a bin range chunk with its calculated deposit amounts.
280
+ */
281
+ export interface ChunkedDepositParameters {
282
+ /** Lower bin ID of this chunk (absolute bin ID) */
283
+ lowerBinId: number;
284
+ /** Upper bin ID of this chunk (absolute bin ID) */
285
+ upperBinId: number;
286
+ /** Minimum delta ID relative to active bin */
287
+ minDeltaId: BN;
288
+ /** Maximum delta ID relative to active bin */
289
+ maxDeltaId: BN;
290
+ /** Strategy parameters adjusted for this chunk */
291
+ params: LiquidityStrategyParameters;
292
+ /** Maximum X amount to deposit in this chunk */
293
+ maxAmountX: BN;
294
+ /** Maximum Y amount to deposit in this chunk */
295
+ maxAmountY: BN;
296
+ }
297
+ /**
298
+ * Divides a bin range into chunks of specified size.
299
+ *
300
+ * This is similar to Meteora's `chunkBinRange` but with a configurable chunk size
301
+ * instead of a fixed 70-bin limit.
302
+ *
303
+ * @param minBinId - The starting bin ID of the range (absolute bin ID)
304
+ * @param maxBinId - The ending bin ID of the range (absolute bin ID)
305
+ * @param chunkSize - Maximum number of bins per chunk
306
+ * @returns Array of bin range chunks
307
+ */
308
+ export declare function chunkBinRange(minBinId: number, maxBinId: number, chunkSize: number): {
309
+ lowerBinId: number;
310
+ upperBinId: number;
311
+ }[];
312
+ /**
313
+ * Converts strategy parameters to on-chain format with bit flag for negative values.
314
+ *
315
+ * The Solana program uses unsigned integers, so negative values are stored as
316
+ * positive with a bit flag indicating the sign.
317
+ *
318
+ * Bit flags:
319
+ * - Bit 0 (0b0001): x0 is negative
320
+ * - Bit 1 (0b0010): y0 is negative
321
+ * - Bit 2 (0b0100): deltaX is negative
322
+ * - Bit 3 (0b1000): deltaY is negative
323
+ *
324
+ * @param x0 - Base X amount (may be negative)
325
+ * @param y0 - Base Y amount (may be negative)
326
+ * @param deltaX - Delta X per bin (may be negative)
327
+ * @param deltaY - Delta Y per bin (may be negative)
328
+ * @returns Parameters with absolute values and bit flag
329
+ */
330
+ export declare function buildBitFlagAndNegateStrategyParameters(x0: BN, y0: BN, deltaX: BN, deltaY: BN): {
331
+ bitFlag: number;
332
+ x0: BN;
333
+ y0: BN;
334
+ deltaX: BN;
335
+ deltaY: BN;
336
+ };
337
+ /**
338
+ * Calculates amounts for each bin in a range.
339
+ *
340
+ * This function iterates through all bins and calculates the X/Y amount
341
+ * for each bin based on the strategy parameters.
342
+ *
343
+ * @param activeId - The active bin ID
344
+ * @param minDeltaId - Minimum delta ID relative to active bin
345
+ * @param maxDeltaId - Maximum delta ID relative to active bin
346
+ * @param deltaX - Delta X per bin
347
+ * @param deltaY - Delta Y per bin
348
+ * @param x0 - Base X amount
349
+ * @param y0 - Base Y amount
350
+ * @param binStep - Bin step in basis points
351
+ * @param favorXInActiveBin - Whether X is favored in active bin
352
+ * @returns Array of { binId, amountX, amountY } for each bin
353
+ */
354
+ export declare function toAmountIntoBins(activeId: BN, minDeltaId: BN, maxDeltaId: BN, deltaX: BN, deltaY: BN, x0: BN, y0: BN, binStep: BN, favorXInActiveBin: boolean): {
355
+ binId: number;
356
+ amountX: BN;
357
+ amountY: BN;
358
+ }[];
359
+ /**
360
+ * Chunks a deposit into multiple transactions based on bin range.
361
+ *
362
+ * This function:
363
+ * 1. Takes pre-built strategy parameters for the entire position
364
+ * 2. Chunks the bin range into smaller ranges
365
+ * 3. For each chunk, adjusts params and calculates amounts
366
+ *
367
+ * @param params - Strategy parameters from buildStrategyParameters (for entire position)
368
+ * @param minDeltaId - Minimum delta ID (lowerBinId - activeId)
369
+ * @param maxDeltaId - Maximum delta ID (upperBinId - activeId)
370
+ * @param activeId - Current active bin ID
371
+ * @param binStep - Bin step in basis points
372
+ * @param chunkSize - Maximum bins per chunk
373
+ * @param favorXInActiveBin - Whether X is favored in active bin
374
+ * @returns Array of chunked deposit parameters
375
+ */
376
+ export declare function chunkDepositParameters(params: LiquidityStrategyParameters, minDeltaId: BN, maxDeltaId: BN, activeId: BN, binStep: BN, chunkSize: number, favorXInActiveBin?: boolean): ChunkedDepositParameters[];
377
+ /**
378
+ * Chunks a bin range with a custom initial chunk size and uniform subsequent chunk size.
379
+ *
380
+ * @param minBinId - The minimum bin ID of the range
381
+ * @param maxBinId - The maximum bin ID of the range
382
+ * @param initialChunkSize - Size of the first chunk (e.g., 150 bins)
383
+ * @param subsequentChunkSize - Size of subsequent chunks (e.g., 69 bins)
384
+ * @returns Array of chunk ranges with lowerBinId and upperBinId
385
+ */
386
+ export declare function chunkBinRangeWithInitialSize(minBinId: number, maxBinId: number, initialChunkSize: number, subsequentChunkSize: number): {
387
+ lowerBinId: number;
388
+ upperBinId: number;
389
+ }[];
390
+ /**
391
+ * Chunks deposit parameters with a custom initial chunk size.
392
+ *
393
+ * This is useful when the first deposit can accommodate a larger bin range
394
+ * (e.g., 150 bins for a fresh position) but subsequent deposits need smaller
395
+ * chunks due to compute limits.
396
+ *
397
+ * @param params - The liquidity strategy parameters
398
+ * @param minDeltaId - Minimum delta from active bin
399
+ * @param maxDeltaId - Maximum delta from active bin
400
+ * @param activeId - The current active bin ID
401
+ * @param binStep - The bin step of the pool
402
+ * @param initialChunkSize - Size of the first chunk (e.g., 150 bins)
403
+ * @param subsequentChunkSize - Size of subsequent chunks (e.g., 69 bins)
404
+ * @param favorXInActiveBin - Whether to favor token X in the active bin
405
+ * @returns Array of chunked deposit parameters
406
+ */
407
+ export declare function chunkDepositParametersWithInitialSize(params: LiquidityStrategyParameters, minDeltaId: BN, maxDeltaId: BN, activeId: BN, binStep: BN, initialChunkSize: number, subsequentChunkSize: number, favorXInActiveBin?: boolean): ChunkedDepositParameters[];
408
+ //# sourceMappingURL=liquidityStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquidityStrategy.d.ts","sourceRoot":"","sources":["../../src/meteora/liquidityStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,OAAO,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAErE;;GAEG;AACH,oBAAY,YAAY;IACtB,sEAAsE;IACtE,IAAI,IAAI;IACR,mEAAmE;IACnE,KAAK,IAAI;IACT,qEAAqE;IACrE,OAAO,IAAI;CACZ;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yCAAyC;IACzC,EAAE,EAAE,EAAE,CAAC;IACP,yCAAyC;IACzC,EAAE,EAAE,EAAE,CAAC;IACP,wFAAwF;IACxF,MAAM,EAAE,EAAE,CAAC;IACX,wFAAwF;IACxF,MAAM,EAAE,EAAE,CAAC;CACZ;AAED,MAAM,WAAW,oBAAqB,SAAQ,2BAA2B;IACvE,mDAAmD;IACnD,UAAU,EAAE,EAAE,CAAC;IACf,mDAAmD;IACnD,UAAU,EAAE,EAAE,CAAC;CAChB;AA2JD;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6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