@meteora-ag/dlmm 1.0.39-rc.27 → 1.0.39-rc.28
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 +2 -2
- package/dist/index.js +20 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5311,7 +5311,7 @@ declare class DLMM {
|
|
|
5311
5311
|
* @returns {Promise<Transaction>}
|
|
5312
5312
|
*/
|
|
5313
5313
|
syncWithMarketPrice(marketPrice: number, owner: PublicKey): Promise<Transaction>;
|
|
5314
|
-
getMaxPrice(
|
|
5314
|
+
getMaxPrice(): Promise<string>;
|
|
5315
5315
|
/** Private static method */
|
|
5316
5316
|
private static getBinArrays;
|
|
5317
5317
|
private static getClaimableLMReward;
|
|
@@ -5357,7 +5357,7 @@ declare function getBinArrayLowerUpperBinId(binArrayIndex: BN): BN[];
|
|
|
5357
5357
|
declare function isBinIdWithinBinArray(activeId: BN, binArrayIndex: BN): boolean;
|
|
5358
5358
|
declare function getBinFromBinArray(binId: number, binArray: BinArray): Bin;
|
|
5359
5359
|
declare function findNextBinArrayIndexWithLiquidity(swapForY: boolean, activeId: BN, lbPairState: LbPair, binArrayBitmapExtension: BinArrayBitmapExtension | null): BN | null;
|
|
5360
|
-
declare function findNextBinArrayWithLiquidity(swapForY: boolean, activeBinId: BN, lbPairState: LbPair, binArrayBitmapExtension: BinArrayBitmapExtension, binArrays: BinArrayAccount[]): BinArrayAccount | null;
|
|
5360
|
+
declare function findNextBinArrayWithLiquidity(swapForY: boolean, activeBinId: BN, lbPairState: LbPair, binArrayBitmapExtension: BinArrayBitmapExtension | null, binArrays: BinArrayAccount[]): BinArrayAccount | null;
|
|
5361
5361
|
|
|
5362
5362
|
declare function getPriceOfBinByBinId(binId: number, binStep: number): Decimal;
|
|
5363
5363
|
/** private */
|
package/dist/index.js
CHANGED
|
@@ -9898,28 +9898,26 @@ var DLMM = class {
|
|
|
9898
9898
|
lastValidBlockHeight
|
|
9899
9899
|
}).add(syncWithMarketPriceTx);
|
|
9900
9900
|
}
|
|
9901
|
-
async getMaxPrice(
|
|
9902
|
-
const
|
|
9903
|
-
|
|
9904
|
-
(
|
|
9901
|
+
async getMaxPrice() {
|
|
9902
|
+
const binArrayIndex = findNextBinArrayIndexWithLiquidity(
|
|
9903
|
+
false,
|
|
9904
|
+
new (0, _anchor.BN)(this.lbPair.parameters.maxBinId),
|
|
9905
|
+
this.lbPair,
|
|
9906
|
+
_nullishCoalesce(_optionalChain([this, 'access', _67 => _67.binArrayBitmapExtension, 'optionalAccess', _68 => _68.account]), () => ( null))
|
|
9905
9907
|
);
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
count = -1;
|
|
9920
|
-
}
|
|
9921
|
-
}
|
|
9922
|
-
}
|
|
9908
|
+
const [binArrayPubkey] = deriveBinArray(
|
|
9909
|
+
this.pubkey,
|
|
9910
|
+
binArrayIndex,
|
|
9911
|
+
this.program.programId
|
|
9912
|
+
);
|
|
9913
|
+
const binArrayAccount = await this.program.account.binArray.fetch(
|
|
9914
|
+
binArrayPubkey
|
|
9915
|
+
);
|
|
9916
|
+
const { bins } = binArrayAccount;
|
|
9917
|
+
const lastBinWithLiquidityIndex = bins.findLastIndex(
|
|
9918
|
+
({ amountX }) => !amountX.isZero()
|
|
9919
|
+
);
|
|
9920
|
+
const binPriceWithLastLiquidity = bins[lastBinWithLiquidityIndex].price.toString();
|
|
9923
9921
|
return this.fromPricePerLamport(
|
|
9924
9922
|
Number(binPriceWithLastLiquidity) / (2 ** 64 - 1)
|
|
9925
9923
|
);
|
|
@@ -10520,7 +10518,7 @@ var DLMMError = class extends Error {
|
|
|
10520
10518
|
const anchorError = _anchor.AnchorError.parse(
|
|
10521
10519
|
JSON.parse(JSON.stringify(error)).logs
|
|
10522
10520
|
);
|
|
10523
|
-
if (_optionalChain([anchorError, 'optionalAccess',
|
|
10521
|
+
if (_optionalChain([anchorError, 'optionalAccess', _69 => _69.program, 'access', _70 => _70.toBase58, 'call', _71 => _71()]) === LBCLMM_PROGRAM_IDS["mainnet-beta"]) {
|
|
10524
10522
|
_errorCode = anchorError.error.errorCode.number;
|
|
10525
10523
|
_errorName = anchorError.error.errorCode.code;
|
|
10526
10524
|
_errorMessage = anchorError.error.errorMessage;
|