@crypticdot/defituna-client 2.0.4 → 2.0.5

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.d.mts CHANGED
@@ -4350,6 +4350,8 @@ type IncreaseLiquidityQuoteResult = {
4350
4350
  swapInput: bigint;
4351
4351
  swapOutput: bigint;
4352
4352
  swapAToB: boolean;
4353
+ protocolFeeA: bigint;
4354
+ protocolFeeB: bigint;
4353
4355
  };
4354
4356
  declare function getLiquidityIncreaseQuote(args: IncreaseLiquidityQuoteArgs): IncreaseLiquidityQuoteResult;
4355
4357
  /**
package/dist/index.d.ts CHANGED
@@ -4350,6 +4350,8 @@ type IncreaseLiquidityQuoteResult = {
4350
4350
  swapInput: bigint;
4351
4351
  swapOutput: bigint;
4352
4352
  swapAToB: boolean;
4353
+ protocolFeeA: bigint;
4354
+ protocolFeeB: bigint;
4353
4355
  };
4354
4356
  declare function getLiquidityIncreaseQuote(args: IncreaseLiquidityQuoteArgs): IncreaseLiquidityQuoteResult;
4355
4357
  /**
package/dist/index.js CHANGED
@@ -6739,8 +6739,8 @@ function getLiquidityIncreaseQuote(args) {
6739
6739
  if (sqrtPrice <= lowerSqrtPrice) {
6740
6740
  throw new Error("sqrtPrice must be greater than lowerSqrtPrice if collateral A is computed.");
6741
6741
  } else if (sqrtPrice < upperSqrtPrice) {
6742
- const liquidity = (0, import_fusionamm_core2.tryGetLiquidityFromB)(collateralB + borrowB, lowerSqrtPrice, upperSqrtPrice);
6743
- const amountA = (0, import_fusionamm_core2.tryGetTokenAFromLiquidity)(liquidity, lowerSqrtPrice, upperSqrtPrice, false);
6742
+ const liquidity = (0, import_fusionamm_core2.tryGetLiquidityFromB)(collateralB + borrowB, lowerSqrtPrice, sqrtPrice);
6743
+ const amountA = (0, import_fusionamm_core2.tryGetTokenAFromLiquidity)(liquidity, sqrtPrice, upperSqrtPrice, false);
6744
6744
  collateralA = amountA * collateralB / (collateralB + borrowB);
6745
6745
  borrowA = amountA - collateralA;
6746
6746
  maxCollateralA = collateralA + collateralA * maxAmountSlippage / BigInt(HUNDRED_PERCENT);
@@ -6755,8 +6755,8 @@ function getLiquidityIncreaseQuote(args) {
6755
6755
  maxCollateralB = 0n;
6756
6756
  borrowB = 0n;
6757
6757
  } else if (sqrtPrice < upperSqrtPrice) {
6758
- const liquidity = (0, import_fusionamm_core2.tryGetLiquidityFromA)(collateralA + borrowA, lowerSqrtPrice, upperSqrtPrice);
6759
- const amountB = (0, import_fusionamm_core2.tryGetTokenBFromLiquidity)(liquidity, lowerSqrtPrice, upperSqrtPrice, false);
6758
+ const liquidity = (0, import_fusionamm_core2.tryGetLiquidityFromA)(collateralA + borrowA, sqrtPrice, upperSqrtPrice);
6759
+ const amountB = (0, import_fusionamm_core2.tryGetTokenBFromLiquidity)(liquidity, lowerSqrtPrice, sqrtPrice, false);
6760
6760
  collateralB = amountB * collateralA / (collateralA + borrowA);
6761
6761
  borrowB = amountB - collateralB;
6762
6762
  maxCollateralB = collateralB + collateralB * maxAmountSlippage / BigInt(HUNDRED_PERCENT);
@@ -6810,7 +6810,9 @@ function getLiquidityIncreaseQuote(args) {
6810
6810
  swapOutput,
6811
6811
  swapAToB,
6812
6812
  maxCollateralA,
6813
- maxCollateralB
6813
+ maxCollateralB,
6814
+ protocolFeeA,
6815
+ protocolFeeB
6814
6816
  };
6815
6817
  }
6816
6818
  function calculateProtocolFee(collateralAmount, borrowAmount, protocolFeeRateOnCollateral, protocolFeeRate) {
package/dist/index.mjs CHANGED
@@ -6834,8 +6834,8 @@ function getLiquidityIncreaseQuote(args) {
6834
6834
  if (sqrtPrice <= lowerSqrtPrice) {
6835
6835
  throw new Error("sqrtPrice must be greater than lowerSqrtPrice if collateral A is computed.");
6836
6836
  } else if (sqrtPrice < upperSqrtPrice) {
6837
- const liquidity = tryGetLiquidityFromB(collateralB + borrowB, lowerSqrtPrice, upperSqrtPrice);
6838
- const amountA = tryGetTokenAFromLiquidity(liquidity, lowerSqrtPrice, upperSqrtPrice, false);
6837
+ const liquidity = tryGetLiquidityFromB(collateralB + borrowB, lowerSqrtPrice, sqrtPrice);
6838
+ const amountA = tryGetTokenAFromLiquidity(liquidity, sqrtPrice, upperSqrtPrice, false);
6839
6839
  collateralA = amountA * collateralB / (collateralB + borrowB);
6840
6840
  borrowA = amountA - collateralA;
6841
6841
  maxCollateralA = collateralA + collateralA * maxAmountSlippage / BigInt(HUNDRED_PERCENT);
@@ -6850,8 +6850,8 @@ function getLiquidityIncreaseQuote(args) {
6850
6850
  maxCollateralB = 0n;
6851
6851
  borrowB = 0n;
6852
6852
  } else if (sqrtPrice < upperSqrtPrice) {
6853
- const liquidity = tryGetLiquidityFromA(collateralA + borrowA, lowerSqrtPrice, upperSqrtPrice);
6854
- const amountB = tryGetTokenBFromLiquidity(liquidity, lowerSqrtPrice, upperSqrtPrice, false);
6853
+ const liquidity = tryGetLiquidityFromA(collateralA + borrowA, sqrtPrice, upperSqrtPrice);
6854
+ const amountB = tryGetTokenBFromLiquidity(liquidity, lowerSqrtPrice, sqrtPrice, false);
6855
6855
  collateralB = amountB * collateralA / (collateralA + borrowA);
6856
6856
  borrowB = amountB - collateralB;
6857
6857
  maxCollateralB = collateralB + collateralB * maxAmountSlippage / BigInt(HUNDRED_PERCENT);
@@ -6905,7 +6905,9 @@ function getLiquidityIncreaseQuote(args) {
6905
6905
  swapOutput,
6906
6906
  swapAToB,
6907
6907
  maxCollateralA,
6908
- maxCollateralB
6908
+ maxCollateralB,
6909
+ protocolFeeA,
6910
+ protocolFeeB
6909
6911
  };
6910
6912
  }
6911
6913
  function calculateProtocolFee(collateralAmount, borrowAmount, protocolFeeRateOnCollateral, protocolFeeRate) {
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": "2.0.4",
4
+ "version": "2.0.5",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "main": "./dist/index.js",