@meteora-ag/dlmm 1.7.3-rc.0 → 1.7.5-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -2
- package/dist/index.js +59 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -13786,27 +13786,22 @@ async function chunkDepositWithRebalanceEndpoint(dlmm, strategy, slippagePercent
|
|
|
13786
13786
|
}
|
|
13787
13787
|
const minDeltaId = new BN18(chunkMinBinId - dlmm.lbPair.activeId);
|
|
13788
13788
|
const maxDeltaId = new BN18(chunkMaxBinId - dlmm.lbPair.activeId);
|
|
13789
|
-
const { bitFlag, ...baseAndDelta } = buildBitFlagAndNegateStrategyParameters(
|
|
13790
|
-
liquidityStrategyParameters.x0,
|
|
13791
|
-
liquidityStrategyParameters.y0,
|
|
13792
|
-
liquidityStrategyParameters.deltaX,
|
|
13793
|
-
liquidityStrategyParameters.deltaY
|
|
13794
|
-
);
|
|
13795
13789
|
const { deltaX, deltaY, x0, y0 } = resetUninvolvedLiquidityParams(
|
|
13796
13790
|
minDeltaId,
|
|
13797
13791
|
maxDeltaId,
|
|
13798
13792
|
strategy.singleSidedX,
|
|
13799
13793
|
{
|
|
13800
|
-
...
|
|
13794
|
+
...liquidityStrategyParameters
|
|
13801
13795
|
}
|
|
13802
13796
|
);
|
|
13797
|
+
const { bitFlag, ...baseAndDelta } = buildBitFlagAndNegateStrategyParameters(x0, y0, deltaX, deltaY);
|
|
13803
13798
|
const addParam = {
|
|
13804
13799
|
minDeltaId: minDeltaId.toNumber(),
|
|
13805
13800
|
maxDeltaId: maxDeltaId.toNumber(),
|
|
13806
|
-
x0,
|
|
13807
|
-
y0,
|
|
13808
|
-
deltaX,
|
|
13809
|
-
deltaY,
|
|
13801
|
+
x0: baseAndDelta.x0,
|
|
13802
|
+
y0: baseAndDelta.y0,
|
|
13803
|
+
deltaX: baseAndDelta.deltaX,
|
|
13804
|
+
deltaY: baseAndDelta.deltaY,
|
|
13810
13805
|
bitFlag,
|
|
13811
13806
|
favorXInActiveId: strategy.singleSidedX,
|
|
13812
13807
|
padding: Array(36).fill(0)
|
|
@@ -14137,59 +14132,54 @@ var DLMM = class {
|
|
|
14137
14132
|
*/
|
|
14138
14133
|
static async getPairPubkeyIfExists(connection, tokenX, tokenY, binStep, baseFactor, baseFeePowerFactor, opt) {
|
|
14139
14134
|
const program = createProgram(connection, opt);
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14135
|
+
const [lbPair2Key] = deriveLbPair2(
|
|
14136
|
+
tokenX,
|
|
14137
|
+
tokenY,
|
|
14138
|
+
binStep,
|
|
14139
|
+
baseFactor,
|
|
14140
|
+
program.programId
|
|
14141
|
+
);
|
|
14142
|
+
const account2 = await program.account.lbPair.fetchNullable(lbPair2Key);
|
|
14143
|
+
if (account2 && account2.parameters.baseFeePowerFactor == baseFeePowerFactor.toNumber()) {
|
|
14144
|
+
return lbPair2Key;
|
|
14145
|
+
}
|
|
14146
|
+
const [lbPairKey] = deriveLbPair(
|
|
14147
|
+
tokenX,
|
|
14148
|
+
tokenY,
|
|
14149
|
+
binStep,
|
|
14150
|
+
program.programId
|
|
14151
|
+
);
|
|
14152
|
+
const account = await program.account.lbPair.fetchNullable(lbPairKey);
|
|
14153
|
+
if (account && account.parameters.baseFactor === baseFactor.toNumber() && account.parameters.baseFeePowerFactor === baseFeePowerFactor.toNumber()) {
|
|
14154
|
+
return lbPairKey;
|
|
14155
|
+
}
|
|
14156
|
+
const presetParametersWithIndex = await program.account.presetParameter2.all([
|
|
14157
|
+
presetParameter2BinStepFilter(binStep),
|
|
14158
|
+
presetParameter2BaseFactorFilter(baseFactor),
|
|
14159
|
+
presetParameter2BaseFeePowerFactor(baseFeePowerFactor)
|
|
14160
|
+
]);
|
|
14161
|
+
if (presetParametersWithIndex.length > 0) {
|
|
14162
|
+
const possibleLbPairKeys = presetParametersWithIndex.map((account3) => {
|
|
14163
|
+
return deriveLbPairWithPresetParamWithIndexKey(
|
|
14164
|
+
account3.publicKey,
|
|
14165
|
+
tokenX,
|
|
14166
|
+
tokenY,
|
|
14167
|
+
program.programId
|
|
14168
|
+
)[0];
|
|
14169
|
+
});
|
|
14170
|
+
const accounts = await chunkedGetMultipleAccountInfos(
|
|
14171
|
+
program.provider.connection,
|
|
14172
|
+
possibleLbPairKeys
|
|
14157
14173
|
);
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
presetParameter2BinStepFilter(binStep),
|
|
14164
|
-
presetParameter2BaseFactorFilter(baseFactor),
|
|
14165
|
-
presetParameter2BaseFeePowerFactor(baseFeePowerFactor)
|
|
14166
|
-
]);
|
|
14167
|
-
if (presetParametersWithIndex.length > 0) {
|
|
14168
|
-
const possibleLbPairKeys = presetParametersWithIndex.map((account3) => {
|
|
14169
|
-
return deriveLbPairWithPresetParamWithIndexKey(
|
|
14170
|
-
account3.publicKey,
|
|
14171
|
-
tokenX,
|
|
14172
|
-
tokenY,
|
|
14173
|
-
program.programId
|
|
14174
|
-
)[0];
|
|
14175
|
-
});
|
|
14176
|
-
const accounts = await chunkedGetMultipleAccountInfos(
|
|
14177
|
-
program.provider.connection,
|
|
14178
|
-
possibleLbPairKeys
|
|
14179
|
-
);
|
|
14180
|
-
for (let i = 0; i < possibleLbPairKeys.length; i++) {
|
|
14181
|
-
const pairKey = possibleLbPairKeys[i];
|
|
14182
|
-
const account3 = accounts[i];
|
|
14183
|
-
if (account3) {
|
|
14184
|
-
return pairKey;
|
|
14185
|
-
}
|
|
14174
|
+
for (let i = 0; i < possibleLbPairKeys.length; i++) {
|
|
14175
|
+
const pairKey = possibleLbPairKeys[i];
|
|
14176
|
+
const account3 = accounts[i];
|
|
14177
|
+
if (account3) {
|
|
14178
|
+
return pairKey;
|
|
14186
14179
|
}
|
|
14187
14180
|
}
|
|
14188
|
-
return null;
|
|
14189
|
-
} catch (error) {
|
|
14190
|
-
console.error(error);
|
|
14191
|
-
return null;
|
|
14192
14181
|
}
|
|
14182
|
+
return null;
|
|
14193
14183
|
}
|
|
14194
14184
|
static async getCustomizablePermissionlessLbPairIfExists(connection, tokenX, tokenY, opt) {
|
|
14195
14185
|
const program = createProgram(connection, opt);
|
|
@@ -15143,7 +15133,7 @@ var DLMM = class {
|
|
|
15143
15133
|
tokenY,
|
|
15144
15134
|
new BN21(presetParameterState.binStep),
|
|
15145
15135
|
new BN21(presetParameterState.baseFactor),
|
|
15146
|
-
new BN21(presetParameterState.
|
|
15136
|
+
new BN21(presetParameterState.baseFeePowerFactor),
|
|
15147
15137
|
{
|
|
15148
15138
|
cluster: opt?.cluster,
|
|
15149
15139
|
programId: opt?.programId
|
|
@@ -20011,6 +20001,7 @@ export {
|
|
|
20011
20001
|
autoFillXByWeight,
|
|
20012
20002
|
autoFillYByStrategy,
|
|
20013
20003
|
autoFillYByWeight,
|
|
20004
|
+
binArrayLbPairFilter,
|
|
20014
20005
|
binIdToBinArrayIndex,
|
|
20015
20006
|
buildBitFlagAndNegateStrategyParameters,
|
|
20016
20007
|
buildLiquidityStrategyParameters,
|
|
@@ -20095,6 +20086,12 @@ export {
|
|
|
20095
20086
|
isPositionNoFee,
|
|
20096
20087
|
isPositionNoReward,
|
|
20097
20088
|
parseLogs,
|
|
20089
|
+
positionLbPairFilter,
|
|
20090
|
+
positionOwnerFilter,
|
|
20091
|
+
positionV2Filter,
|
|
20092
|
+
presetParameter2BaseFactorFilter,
|
|
20093
|
+
presetParameter2BaseFeePowerFactor,
|
|
20094
|
+
presetParameter2BinStepFilter,
|
|
20098
20095
|
range,
|
|
20099
20096
|
resetUninvolvedLiquidityParams,
|
|
20100
20097
|
suggestBalancedXParametersFromY,
|