@meteora-ag/dlmm 1.0.21 → 1.0.22
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.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4941,8 +4941,8 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
4941
4941
|
totalWeightX = totalWeightX.add(weighPerPrice);
|
|
4942
4942
|
}
|
|
4943
4943
|
});
|
|
4944
|
-
const kx = new (0, _decimaljs2.default)(amountX.
|
|
4945
|
-
const ky = new (0, _decimaljs2.default)(amountY.
|
|
4944
|
+
const kx = new (0, _decimaljs2.default)(amountX.toString()).div(totalWeightX);
|
|
4945
|
+
const ky = new (0, _decimaljs2.default)(amountY.toString()).div(totalWeightY);
|
|
4946
4946
|
let k = kx.lessThan(ky) ? kx : ky;
|
|
4947
4947
|
return distributions.map((bin) => {
|
|
4948
4948
|
if (bin.binId < activeId) {
|
|
@@ -4950,7 +4950,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
4950
4950
|
return {
|
|
4951
4951
|
binId: bin.binId,
|
|
4952
4952
|
amountX: new (0, _anchor.BN)(0),
|
|
4953
|
-
amountY: new (0, _anchor.BN)(
|
|
4953
|
+
amountY: new (0, _anchor.BN)(amount.floor().toString())
|
|
4954
4954
|
};
|
|
4955
4955
|
}
|
|
4956
4956
|
if (bin.binId > activeId) {
|
|
@@ -4959,7 +4959,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
4959
4959
|
const amount = k.mul(weighPerPrice);
|
|
4960
4960
|
return {
|
|
4961
4961
|
binId: bin.binId,
|
|
4962
|
-
amountX: new (0, _anchor.BN)(
|
|
4962
|
+
amountX: new (0, _anchor.BN)(amount.floor().toString()),
|
|
4963
4963
|
amountY: new (0, _anchor.BN)(0)
|
|
4964
4964
|
};
|
|
4965
4965
|
}
|
|
@@ -4967,8 +4967,8 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
4967
4967
|
const amountYActiveBin = k.mul(wy0);
|
|
4968
4968
|
return {
|
|
4969
4969
|
binId: bin.binId,
|
|
4970
|
-
amountX: new (0, _anchor.BN)(
|
|
4971
|
-
amountY: new (0, _anchor.BN)(
|
|
4970
|
+
amountX: new (0, _anchor.BN)(amountXActiveBin.floor().toString()),
|
|
4971
|
+
amountY: new (0, _anchor.BN)(amountYActiveBin.floor().toString())
|
|
4972
4972
|
};
|
|
4973
4973
|
});
|
|
4974
4974
|
} else {
|
|
@@ -4983,8 +4983,8 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
4983
4983
|
totalWeightX = totalWeightX.add(weighPerPrice);
|
|
4984
4984
|
}
|
|
4985
4985
|
});
|
|
4986
|
-
let kx = new (0, _decimaljs2.default)(amountX.
|
|
4987
|
-
let ky = new (0, _decimaljs2.default)(amountY.
|
|
4986
|
+
let kx = new (0, _decimaljs2.default)(amountX.toString()).div(totalWeightX);
|
|
4987
|
+
let ky = new (0, _decimaljs2.default)(amountY.toString()).div(totalWeightY);
|
|
4988
4988
|
let k = kx.lessThan(ky) ? kx : ky;
|
|
4989
4989
|
return distributions.map((bin) => {
|
|
4990
4990
|
if (bin.binId < activeId) {
|
|
@@ -4992,7 +4992,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
4992
4992
|
return {
|
|
4993
4993
|
binId: bin.binId,
|
|
4994
4994
|
amountX: new (0, _anchor.BN)(0),
|
|
4995
|
-
amountY: new (0, _anchor.BN)(
|
|
4995
|
+
amountY: new (0, _anchor.BN)(amount.floor().toString())
|
|
4996
4996
|
};
|
|
4997
4997
|
} else {
|
|
4998
4998
|
let price = getPriceOfBinByBinId(bin.binId, binStep);
|
|
@@ -5000,7 +5000,7 @@ function toAmountBothSide(activeId, binStep, amountX, amountY, amountXInActiveBi
|
|
|
5000
5000
|
const amount = k.mul(weighPerPrice);
|
|
5001
5001
|
return {
|
|
5002
5002
|
binId: bin.binId,
|
|
5003
|
-
amountX: new (0, _anchor.BN)(
|
|
5003
|
+
amountX: new (0, _anchor.BN)(amount.floor().toString()),
|
|
5004
5004
|
amountY: new (0, _anchor.BN)(0)
|
|
5005
5005
|
};
|
|
5006
5006
|
}
|
|
@@ -5122,7 +5122,7 @@ function autoFillXByWeight(activeId, binStep, amountY, amountXInActiveBin, amoun
|
|
|
5122
5122
|
totalWeightX = totalWeightX.add(weighPerPrice);
|
|
5123
5123
|
}
|
|
5124
5124
|
});
|
|
5125
|
-
const ky = totalWeightY.isZero() ? new (0, _decimaljs2.default)(1) : new (0, _decimaljs2.default)(amountY.
|
|
5125
|
+
const ky = totalWeightY.isZero() ? new (0, _decimaljs2.default)(1) : new (0, _decimaljs2.default)(amountY.toString()).div(totalWeightY);
|
|
5126
5126
|
const amountX = ky.mul(totalWeightX);
|
|
5127
5127
|
return new (0, _anchor.BN)(amountX.floor().toString());
|
|
5128
5128
|
}
|