@crypticdot/defituna-client 3.1.9 → 3.1.11

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 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
- if (leverage > 1) {
10452
- const collateralInPositionToken = BigInt(Math.floor(Number(increaseAmount) / leverage));
10453
- borrow = increaseAmount - collateralInPositionToken;
10454
- collateral = BigInt(
10455
- Math.floor(
10456
- positionToken == 0 /* A */ ? Number(collateralInPositionToken) * price : Number(collateralInPositionToken) / price
10457
- )
10458
- );
10459
- const borrowInNewPositionToken = BigInt(
10460
- Math.floor(newPositionToken == 1 /* B */ ? Number(borrow) * price : Number(borrow) / price)
10461
- );
10462
- estimatedAmount = collateral + borrowInNewPositionToken;
10463
- swapInputAmount = positionAmount + borrow;
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
- if (leverage > 1) {
10621
- const collateralInPositionToken = BigInt(Math.floor(Number(increaseAmount) / leverage));
10622
- borrow = increaseAmount - collateralInPositionToken;
10623
- collateral = BigInt(
10624
- Math.floor(
10625
- positionToken == 0 /* A */ ? Number(collateralInPositionToken) * price : Number(collateralInPositionToken) / price
10626
- )
10627
- );
10628
- const borrowInNewPositionToken = BigInt(
10629
- Math.floor(newPositionToken == 1 /* B */ ? Number(borrow) * price : Number(borrow) / price)
10630
- );
10631
- estimatedAmount = collateral + borrowInNewPositionToken;
10632
- swapInputAmount = positionAmount + borrow;
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-client",
3
3
  "description": "Typescript client to interact with DefiTuna's on-chain program.",
4
- "version": "3.1.9",
4
+ "version": "3.1.11",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "main": "./dist/index.js",
@@ -17,11 +17,11 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@orca-so/whirlpools-core": "^2.0.0",
20
- "@orca-so/whirlpools-client": "^3.0.0",
21
- "@orca-so/whirlpools": "^3.0.0",
22
- "@crypticdot/fusionamm-core": "^1.0.63",
23
- "@crypticdot/fusionamm-client": "^1.0.63",
24
- "@crypticdot/fusionamm-sdk": "^1.0.63",
20
+ "@orca-so/whirlpools-client": "^4.0.1",
21
+ "@orca-so/whirlpools": "^4.0.0",
22
+ "@crypticdot/fusionamm-core": "^1.0.66",
23
+ "@crypticdot/fusionamm-client": "^1.0.66",
24
+ "@crypticdot/fusionamm-sdk": "^1.0.66",
25
25
  "@solana/kit": "^2.1.0",
26
26
  "@solana/sysvars": "^2.1.0",
27
27
  "@solana-program/compute-budget": "^0.7.0",