@equilab/marginly-sdk
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -137,4 +137,6 @@ "use strict"; | ||
const { whole, fraction } = extractFractionAndWhole(price); | ||
const baseDecimalsNext = baseDecimal.sub(Math.max(fraction?.length || 0, 0)); | ||
const priceNext = ethers_1.BigNumber.from(`${whole}${fraction || ''}`); | ||
const baseDecimalsNext = fraction | ||
? ethers_1.BigNumber.from(Math.min(baseDecimal.sub(quoteDecimal).toNumber(), fraction.length)) | ||
: baseDecimal; | ||
const priceNext = ethers_1.BigNumber.from(fraction ? `${whole}${fraction.slice(0, baseDecimalsNext.toNumber())}` : price); | ||
const power = baseDecimalsNext.sub(quoteDecimal); | ||
@@ -141,0 +143,0 @@ return priceNext.mul(consts_1.FP96_ONE).div(ethers_1.BigNumber.from(10).pow(power)); |
{ | ||
"name": "@equilab/marginly-sdk", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
310482
4890