@magmaprotocol/magma-clmm-sdk 0.5.47 → 0.5.49
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 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2744,6 +2744,7 @@ declare class SplitSwap {
|
|
|
2744
2744
|
|
|
2745
2745
|
declare class BinMath {
|
|
2746
2746
|
static getPriceOfBinByBinId(binId: number, binStep: number, decimalsA: number, decimalsB: number): Decimal;
|
|
2747
|
+
static getBinIdFromPrice(price: string, binStep: number, decimalsA: number, decimalsB: number): number;
|
|
2747
2748
|
}
|
|
2748
2749
|
|
|
2749
2750
|
type FetchPosRewardParams = {
|
package/dist/index.js
CHANGED
|
@@ -2816,6 +2816,12 @@ var BinMath = class {
|
|
|
2816
2816
|
const price = new import_decimal9.default((0, import_calc_dlmm2.get_price_x128_from_real_id)(binId, binStep));
|
|
2817
2817
|
return price.div(twoDec.pow(128)).mul(import_decimal9.default.pow(10, decimalsA - decimalsB));
|
|
2818
2818
|
}
|
|
2819
|
+
static getBinIdFromPrice(price, binStep, decimalsA, decimalsB) {
|
|
2820
|
+
const twoDec = new import_decimal9.default(2);
|
|
2821
|
+
const tenDec = new import_decimal9.default(10);
|
|
2822
|
+
const realid = (0, import_calc_dlmm2.get_real_id_from_price_x128)(new import_decimal9.default(price).mul(tenDec.pow(decimalsB - decimalsA)).mul(twoDec.pow(128)).toDecimalPlaces(0).toString(), binStep);
|
|
2823
|
+
return realid;
|
|
2824
|
+
}
|
|
2819
2825
|
};
|
|
2820
2826
|
|
|
2821
2827
|
// src/utils/objects.ts
|