@crypticdot/defituna-client 3.1.9 → 3.1.10
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 +13 -18
- package/dist/index.mjs +13 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10448,24 +10448,19 @@ function getDecreaseSpotPositionQuote(args) {
|
|
|
10448
10448
|
swapInputAmount += increaseAmount;
|
|
10449
10449
|
nextSqrtPrice = (0, import_fusionamm_core4.swapQuoteByInputToken)(swapInputAmount, posTokenIsA, 0, fusionPool, tickArrays).nextSqrtPrice;
|
|
10450
10450
|
} else {
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
nextSqrtPrice = (0, import_fusionamm_core4.swapQuoteByInputToken)(swapInputAmount, posTokenIsA, 0, fusionPool, tickArrays).nextSqrtPrice;
|
|
10465
|
-
} else {
|
|
10466
|
-
collateral = increaseAmount;
|
|
10467
|
-
borrow = 0n;
|
|
10468
|
-
}
|
|
10451
|
+
const collateralInPositionToken = BigInt(Math.floor(Number(increaseAmount) / leverage));
|
|
10452
|
+
borrow = increaseAmount - collateralInPositionToken;
|
|
10453
|
+
collateral = BigInt(
|
|
10454
|
+
Math.floor(
|
|
10455
|
+
positionToken == 0 /* A */ ? Number(collateralInPositionToken) * price : Number(collateralInPositionToken) / price
|
|
10456
|
+
)
|
|
10457
|
+
);
|
|
10458
|
+
const borrowInNewPositionToken = BigInt(
|
|
10459
|
+
Math.floor(newPositionToken == 1 /* B */ ? Number(borrow) * price : Number(borrow) / price)
|
|
10460
|
+
);
|
|
10461
|
+
estimatedAmount = collateral + borrowInNewPositionToken;
|
|
10462
|
+
swapInputAmount = positionAmount + borrow;
|
|
10463
|
+
nextSqrtPrice = (0, import_fusionamm_core4.swapQuoteByInputToken)(swapInputAmount, posTokenIsA, 0, fusionPool, tickArrays).nextSqrtPrice;
|
|
10469
10464
|
}
|
|
10470
10465
|
}
|
|
10471
10466
|
const collateralExcludingFee = collateral;
|
package/dist/index.mjs
CHANGED
|
@@ -10617,24 +10617,19 @@ function getDecreaseSpotPositionQuote(args) {
|
|
|
10617
10617
|
swapInputAmount += increaseAmount;
|
|
10618
10618
|
nextSqrtPrice = swapQuoteByInputToken(swapInputAmount, posTokenIsA, 0, fusionPool, tickArrays).nextSqrtPrice;
|
|
10619
10619
|
} else {
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
nextSqrtPrice = swapQuoteByInputToken(swapInputAmount, posTokenIsA, 0, fusionPool, tickArrays).nextSqrtPrice;
|
|
10634
|
-
} else {
|
|
10635
|
-
collateral = increaseAmount;
|
|
10636
|
-
borrow = 0n;
|
|
10637
|
-
}
|
|
10620
|
+
const collateralInPositionToken = BigInt(Math.floor(Number(increaseAmount) / leverage));
|
|
10621
|
+
borrow = increaseAmount - collateralInPositionToken;
|
|
10622
|
+
collateral = BigInt(
|
|
10623
|
+
Math.floor(
|
|
10624
|
+
positionToken == 0 /* A */ ? Number(collateralInPositionToken) * price : Number(collateralInPositionToken) / price
|
|
10625
|
+
)
|
|
10626
|
+
);
|
|
10627
|
+
const borrowInNewPositionToken = BigInt(
|
|
10628
|
+
Math.floor(newPositionToken == 1 /* B */ ? Number(borrow) * price : Number(borrow) / price)
|
|
10629
|
+
);
|
|
10630
|
+
estimatedAmount = collateral + borrowInNewPositionToken;
|
|
10631
|
+
swapInputAmount = positionAmount + borrow;
|
|
10632
|
+
nextSqrtPrice = swapQuoteByInputToken(swapInputAmount, posTokenIsA, 0, fusionPool, tickArrays).nextSqrtPrice;
|
|
10638
10633
|
}
|
|
10639
10634
|
}
|
|
10640
10635
|
const collateralExcludingFee = collateral;
|
package/package.json
CHANGED