@crypticdot/defituna-client 3.1.8 → 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 +14 -19
- package/dist/index.mjs +14 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10439,7 +10439,7 @@ function getDecreaseSpotPositionQuote(args) {
|
|
|
10439
10439
|
estimatedAmount = BigInt(
|
|
10440
10440
|
Math.floor(posTokenIsA ? Number(increaseAmount) * price : Number(increaseAmount) / price)
|
|
10441
10441
|
);
|
|
10442
|
-
collateral =
|
|
10442
|
+
collateral = BigInt(Math.floor(Number(increaseAmount) / leverage));
|
|
10443
10443
|
borrow = increaseAmount - collateral;
|
|
10444
10444
|
if (positionDebt > 0) {
|
|
10445
10445
|
const swapQuote = (0, import_fusionamm_core4.swapQuoteByOutputToken)(positionDebt, !posTokenIsA, 0, fusionPool, tickArrays);
|
|
@@ -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
|
@@ -10608,7 +10608,7 @@ function getDecreaseSpotPositionQuote(args) {
|
|
|
10608
10608
|
estimatedAmount = BigInt(
|
|
10609
10609
|
Math.floor(posTokenIsA ? Number(increaseAmount) * price : Number(increaseAmount) / price)
|
|
10610
10610
|
);
|
|
10611
|
-
collateral =
|
|
10611
|
+
collateral = BigInt(Math.floor(Number(increaseAmount) / leverage));
|
|
10612
10612
|
borrow = increaseAmount - collateral;
|
|
10613
10613
|
if (positionDebt > 0) {
|
|
10614
10614
|
const swapQuote = swapQuoteByOutputToken(positionDebt, !posTokenIsA, 0, fusionPool, tickArrays);
|
|
@@ -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