@meteora-ag/dlmm 1.0.41-rc.0 → 1.0.41-rc.1
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/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -233,4 +233,4 @@ try {
|
|
|
233
233
|
| `claimAllRewards` | Claim swap fees and LM rewards for multiple positions owned by a specific owner | `Promise<Transaction[]>` |
|
|
234
234
|
| `syncWithMarketPrice` | Sync the pool current active bin to match nearest market price bin | `Promise<Transaction>` |
|
|
235
235
|
| `getPairPubkeyIfExists` | Get existing pool address given parameter, if not return null | `Promise<PublicKey \| null>` |
|
|
236
|
-
| `
|
|
236
|
+
| `getMaxPriceInBinArrays` | Get max price of the last bin that has liquidity given bin arrays | `Promise<string \| null>` |
|
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
|
-
|
|
5314
|
+
getMaxPriceInBinArrays(binArrayAccounts: BinArrayAccount[]): Promise<string>;
|
|
5315
5315
|
/** Private static method */
|
|
5316
5316
|
private static getBinArrays;
|
|
5317
5317
|
private static getClaimableLMReward;
|
package/dist/index.js
CHANGED
|
@@ -5838,15 +5838,16 @@ function extensionBitmapRange() {
|
|
|
5838
5838
|
}
|
|
5839
5839
|
function findSetBit(startIndex, endIndex, binArrayBitmapExtension) {
|
|
5840
5840
|
const getBinArrayOffset = (binArrayIndex) => {
|
|
5841
|
-
return binArrayIndex
|
|
5841
|
+
return binArrayIndex.gt(new (0, _anchor.BN)(0)) ? binArrayIndex.mod(BIN_ARRAY_BITMAP_SIZE) : binArrayIndex.add(new (0, _anchor.BN)(1)).neg().mod(BIN_ARRAY_BITMAP_SIZE);
|
|
5842
5842
|
};
|
|
5843
5843
|
const getBitmapOffset = (binArrayIndex) => {
|
|
5844
|
-
return binArrayIndex
|
|
5844
|
+
return binArrayIndex.gt(new (0, _anchor.BN)(0)) ? binArrayIndex.div(BIN_ARRAY_BITMAP_SIZE).sub(new (0, _anchor.BN)(1)) : binArrayIndex.add(new (0, _anchor.BN)(1)).neg().div(BIN_ARRAY_BITMAP_SIZE).sub(new (0, _anchor.BN)(1));
|
|
5845
5845
|
};
|
|
5846
|
+
console.log("here", binArrayBitmapExtension.positiveBinArrayBitmap);
|
|
5846
5847
|
if (startIndex <= endIndex) {
|
|
5847
5848
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
5848
|
-
const binArrayOffset = getBinArrayOffset(i);
|
|
5849
|
-
const bitmapOffset = getBitmapOffset(i);
|
|
5849
|
+
const binArrayOffset = getBinArrayOffset(new (0, _anchor.BN)(i)).toNumber();
|
|
5850
|
+
const bitmapOffset = getBitmapOffset(new (0, _anchor.BN)(i)).toNumber();
|
|
5850
5851
|
const bitmapChunks = i > 0 ? binArrayBitmapExtension.positiveBinArrayBitmap[bitmapOffset] : binArrayBitmapExtension.negativeBinArrayBitmap[bitmapOffset];
|
|
5851
5852
|
const bitmap = buildBitmapFromU64Arrays(bitmapChunks, 1 /* U512 */);
|
|
5852
5853
|
if (bitmap.testn(binArrayOffset)) {
|
|
@@ -5855,8 +5856,8 @@ function findSetBit(startIndex, endIndex, binArrayBitmapExtension) {
|
|
|
5855
5856
|
}
|
|
5856
5857
|
} else {
|
|
5857
5858
|
for (let i = startIndex; i >= endIndex; i--) {
|
|
5858
|
-
const binArrayOffset = getBinArrayOffset(i);
|
|
5859
|
-
const bitmapOffset = getBitmapOffset(i);
|
|
5859
|
+
const binArrayOffset = getBinArrayOffset(new (0, _anchor.BN)(i)).toNumber();
|
|
5860
|
+
const bitmapOffset = getBitmapOffset(new (0, _anchor.BN)(i)).toNumber();
|
|
5860
5861
|
const bitmapChunks = i > 0 ? binArrayBitmapExtension.positiveBinArrayBitmap[bitmapOffset] : binArrayBitmapExtension.negativeBinArrayBitmap[bitmapOffset];
|
|
5861
5862
|
const bitmap = buildBitmapFromU64Arrays(bitmapChunks, 1 /* U512 */);
|
|
5862
5863
|
if (bitmap.testn(binArrayOffset)) {
|
|
@@ -9898,9 +9899,8 @@ var DLMM = class {
|
|
|
9898
9899
|
lastValidBlockHeight
|
|
9899
9900
|
}).add(syncWithMarketPriceTx);
|
|
9900
9901
|
}
|
|
9901
|
-
async
|
|
9902
|
-
const
|
|
9903
|
-
const sortedBinArrays = binArrays.sort(
|
|
9902
|
+
async getMaxPriceInBinArrays(binArrayAccounts) {
|
|
9903
|
+
const sortedBinArrays = binArrayAccounts.sort(
|
|
9904
9904
|
({ account: { index: indexA } }, { account: { index: indexB } }) => indexA.toNumber() - indexB.toNumber()
|
|
9905
9905
|
);
|
|
9906
9906
|
let count = sortedBinArrays.length - 1;
|