@meteora-ag/cp-amm-sdk 1.2.3 → 1.2.4
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.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8064,6 +8064,7 @@ function getUserRewardPending(poolState, positionState, rewardIndex, currentTime
|
|
|
8064
8064
|
}
|
|
8065
8065
|
|
|
8066
8066
|
// src/helpers/accountFilters.ts
|
|
8067
|
+
import { PublicKey as PublicKey5 } from "@solana/web3.js";
|
|
8067
8068
|
var positionByPoolFilter = (pool) => {
|
|
8068
8069
|
return {
|
|
8069
8070
|
memcmp: {
|
|
@@ -8080,6 +8081,18 @@ var vestingByPositionFilter = (position) => {
|
|
|
8080
8081
|
}
|
|
8081
8082
|
};
|
|
8082
8083
|
};
|
|
8084
|
+
function offsetBasedFilter(value, offset) {
|
|
8085
|
+
const valueKey = typeof value === "string" ? new PublicKey5(value) : value;
|
|
8086
|
+
return [
|
|
8087
|
+
{
|
|
8088
|
+
memcmp: {
|
|
8089
|
+
offset,
|
|
8090
|
+
bytes: valueKey.toBase58(),
|
|
8091
|
+
encoding: "base58"
|
|
8092
|
+
}
|
|
8093
|
+
}
|
|
8094
|
+
];
|
|
8095
|
+
}
|
|
8083
8096
|
|
|
8084
8097
|
// src/helpers/token2022.ts
|
|
8085
8098
|
import { BN as BN3 } from "@coral-xyz/anchor";
|
|
@@ -9808,11 +9821,11 @@ function validateFeeFraction(numerator, denominator) {
|
|
|
9808
9821
|
}
|
|
9809
9822
|
|
|
9810
9823
|
// src/helpers/common.ts
|
|
9811
|
-
import { PublicKey as
|
|
9824
|
+
import { PublicKey as PublicKey6 } from "@solana/web3.js";
|
|
9812
9825
|
import BN15 from "bn.js";
|
|
9813
9826
|
import Decimal4 from "decimal.js";
|
|
9814
9827
|
function hasPartner(poolState) {
|
|
9815
|
-
return !poolState.partner.equals(
|
|
9828
|
+
return !poolState.partner.equals(PublicKey6.default);
|
|
9816
9829
|
}
|
|
9817
9830
|
function getCurrentPoint(connection, activationType) {
|
|
9818
9831
|
return __async(this, null, function* () {
|
|
@@ -10551,6 +10564,18 @@ var CpAmm = class {
|
|
|
10551
10564
|
return poolState;
|
|
10552
10565
|
});
|
|
10553
10566
|
}
|
|
10567
|
+
/**
|
|
10568
|
+
* Fetches all Pool states by tokenAMint.
|
|
10569
|
+
* @param tokenAMint - Public key of the tokenA mint.
|
|
10570
|
+
* @returns Array of matched pool accounts and their state.
|
|
10571
|
+
*/
|
|
10572
|
+
fetchPoolStatesByTokenAMint(tokenAMint) {
|
|
10573
|
+
return __async(this, null, function* () {
|
|
10574
|
+
const filters = offsetBasedFilter(tokenAMint, 168);
|
|
10575
|
+
const pools = yield this._program.account.pool.all(filters);
|
|
10576
|
+
return pools;
|
|
10577
|
+
});
|
|
10578
|
+
}
|
|
10554
10579
|
/**
|
|
10555
10580
|
* Fetches the Position state.
|
|
10556
10581
|
* @param position - Public key of the position.
|
|
@@ -12831,6 +12856,7 @@ export {
|
|
|
12831
12856
|
isVestingComplete,
|
|
12832
12857
|
isZeroRateLimiter,
|
|
12833
12858
|
mulDiv,
|
|
12859
|
+
offsetBasedFilter,
|
|
12834
12860
|
parseFeeSchedulerSecondFactor,
|
|
12835
12861
|
parseRateLimiterSecondFactor,
|
|
12836
12862
|
positionByPoolFilter,
|