@meteora-ag/dlmm 1.7.3-rc.0 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +45 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14137,59 +14137,54 @@ var DLMM = class {
|
|
|
14137
14137
|
*/
|
|
14138
14138
|
static async getPairPubkeyIfExists(connection, tokenX, tokenY, binStep, baseFactor, baseFeePowerFactor, opt) {
|
|
14139
14139
|
const program = createProgram(connection, opt);
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14140
|
+
const [lbPair2Key] = deriveLbPair2(
|
|
14141
|
+
tokenX,
|
|
14142
|
+
tokenY,
|
|
14143
|
+
binStep,
|
|
14144
|
+
baseFactor,
|
|
14145
|
+
program.programId
|
|
14146
|
+
);
|
|
14147
|
+
const account2 = await program.account.lbPair.fetchNullable(lbPair2Key);
|
|
14148
|
+
if (account2 && account2.parameters.baseFeePowerFactor == baseFeePowerFactor.toNumber()) {
|
|
14149
|
+
return lbPair2Key;
|
|
14150
|
+
}
|
|
14151
|
+
const [lbPairKey] = deriveLbPair(
|
|
14152
|
+
tokenX,
|
|
14153
|
+
tokenY,
|
|
14154
|
+
binStep,
|
|
14155
|
+
program.programId
|
|
14156
|
+
);
|
|
14157
|
+
const account = await program.account.lbPair.fetchNullable(lbPairKey);
|
|
14158
|
+
if (account && account.parameters.baseFactor === baseFactor.toNumber() && account.parameters.baseFeePowerFactor === baseFeePowerFactor.toNumber()) {
|
|
14159
|
+
return lbPairKey;
|
|
14160
|
+
}
|
|
14161
|
+
const presetParametersWithIndex = await program.account.presetParameter2.all([
|
|
14162
|
+
presetParameter2BinStepFilter(binStep),
|
|
14163
|
+
presetParameter2BaseFactorFilter(baseFactor),
|
|
14164
|
+
presetParameter2BaseFeePowerFactor(baseFeePowerFactor)
|
|
14165
|
+
]);
|
|
14166
|
+
if (presetParametersWithIndex.length > 0) {
|
|
14167
|
+
const possibleLbPairKeys = presetParametersWithIndex.map((account3) => {
|
|
14168
|
+
return deriveLbPairWithPresetParamWithIndexKey(
|
|
14169
|
+
account3.publicKey,
|
|
14170
|
+
tokenX,
|
|
14171
|
+
tokenY,
|
|
14172
|
+
program.programId
|
|
14173
|
+
)[0];
|
|
14174
|
+
});
|
|
14175
|
+
const accounts = await chunkedGetMultipleAccountInfos(
|
|
14176
|
+
program.provider.connection,
|
|
14177
|
+
possibleLbPairKeys
|
|
14157
14178
|
);
|
|
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
|
-
}
|
|
14179
|
+
for (let i = 0; i < possibleLbPairKeys.length; i++) {
|
|
14180
|
+
const pairKey = possibleLbPairKeys[i];
|
|
14181
|
+
const account3 = accounts[i];
|
|
14182
|
+
if (account3) {
|
|
14183
|
+
return pairKey;
|
|
14186
14184
|
}
|
|
14187
14185
|
}
|
|
14188
|
-
return null;
|
|
14189
|
-
} catch (error) {
|
|
14190
|
-
console.error(error);
|
|
14191
|
-
return null;
|
|
14192
14186
|
}
|
|
14187
|
+
return null;
|
|
14193
14188
|
}
|
|
14194
14189
|
static async getCustomizablePermissionlessLbPairIfExists(connection, tokenX, tokenY, opt) {
|
|
14195
14190
|
const program = createProgram(connection, opt);
|
|
@@ -15143,7 +15138,7 @@ var DLMM = class {
|
|
|
15143
15138
|
tokenY,
|
|
15144
15139
|
new (0, _anchor.BN)(presetParameterState.binStep),
|
|
15145
15140
|
new (0, _anchor.BN)(presetParameterState.baseFactor),
|
|
15146
|
-
new (0, _anchor.BN)(presetParameterState.
|
|
15141
|
+
new (0, _anchor.BN)(presetParameterState.baseFeePowerFactor),
|
|
15147
15142
|
{
|
|
15148
15143
|
cluster: _optionalChain([opt, 'optionalAccess', _69 => _69.cluster]),
|
|
15149
15144
|
programId: _optionalChain([opt, 'optionalAccess', _70 => _70.programId])
|