@meteora-ag/dlmm 1.0.39-rc.1 → 1.0.39-rc.10
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 +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5316,7 +5316,7 @@ declare class DLMM {
|
|
|
5316
5316
|
* @returns {Promise<Transaction>}
|
|
5317
5317
|
*/
|
|
5318
5318
|
syncWithMarketPrice(marketPrice: number, owner: PublicKey): Promise<Transaction>;
|
|
5319
|
-
getLastPrice(): Promise<
|
|
5319
|
+
getLastPrice(minPrice: string): Promise<number>;
|
|
5320
5320
|
/** Private static method */
|
|
5321
5321
|
private static getBinArrays;
|
|
5322
5322
|
private static getClaimableLMReward;
|
package/dist/index.js
CHANGED
|
@@ -9090,6 +9090,7 @@ var DLMM = class {
|
|
|
9090
9090
|
_optionalChain([this, 'access', _58 => _58.binArrayBitmapExtension, 'optionalAccess', _59 => _59.account]),
|
|
9091
9091
|
binArrays
|
|
9092
9092
|
);
|
|
9093
|
+
console.log("\u{1F680} ~ DLMM ~ binArrayAccountToSwap:", binArrayAccountToSwap);
|
|
9093
9094
|
if (binArrayAccountToSwap == null) {
|
|
9094
9095
|
throw new Error("Insufficient liquidity");
|
|
9095
9096
|
}
|
|
@@ -9903,11 +9904,10 @@ var DLMM = class {
|
|
|
9903
9904
|
lastValidBlockHeight
|
|
9904
9905
|
}).add(syncWithMarketPriceTx);
|
|
9905
9906
|
}
|
|
9906
|
-
async getLastPrice() {
|
|
9907
|
-
const { pricePerToken } = await this.getActiveBin();
|
|
9907
|
+
async getLastPrice(minPrice) {
|
|
9908
9908
|
const binArrays = await this.getBinArrays();
|
|
9909
9909
|
let count = 0;
|
|
9910
|
-
let binPriceWithLastLiquidity =
|
|
9910
|
+
let binPriceWithLastLiquidity = minPrice;
|
|
9911
9911
|
while (count <= binArrays.length - 1) {
|
|
9912
9912
|
const binArray = binArrays[count];
|
|
9913
9913
|
if (binArray) {
|
|
@@ -9918,14 +9918,16 @@ var DLMM = class {
|
|
|
9918
9918
|
const lastBinWithLiquidityIndex = bins.findIndex(
|
|
9919
9919
|
({ liquiditySupply }) => liquiditySupply.isZero()
|
|
9920
9920
|
);
|
|
9921
|
-
|
|
9922
|
-
bins[lastBinWithLiquidityIndex - 1].
|
|
9921
|
+
console.log(
|
|
9922
|
+
bins[lastBinWithLiquidityIndex - 1].amountX.toString(),
|
|
9923
|
+
bins[lastBinWithLiquidityIndex - 1].amountY.toString()
|
|
9923
9924
|
);
|
|
9925
|
+
binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex - 1].price.toString();
|
|
9924
9926
|
count = binArrays.length;
|
|
9925
9927
|
}
|
|
9926
9928
|
}
|
|
9927
9929
|
}
|
|
9928
|
-
return binPriceWithLastLiquidity;
|
|
9930
|
+
return Number(binPriceWithLastLiquidity) / (2 ** 64 - 1);
|
|
9929
9931
|
}
|
|
9930
9932
|
/** Private static method */
|
|
9931
9933
|
static async getBinArrays(program, lbPairPubkey) {
|