@liquidium/client 0.8.3 → 0.9.0

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/README.md CHANGED
@@ -75,7 +75,7 @@ See the [quick start](https://liquidium-inc.github.io/liquidium-sdk/getting-star
75
75
 
76
76
  ## Development
77
77
 
78
- Requires Node.js 20+ and pnpm 11+.
78
+ Requires Node.js 22.12+ in the 22.x line, 24.x, or 26+, and pnpm 11+.
79
79
 
80
80
  ```bash
81
81
  pnpm install
package/dist/index.cjs CHANGED
@@ -3209,7 +3209,8 @@ var flexibleLendingIdlFactory = ({ IDL }) => {
3209
3209
  same_asset_borrowing: IDL.Opt(IDL.Bool),
3210
3210
  same_asset_borrowing_dust_threshold: IDL.Nat,
3211
3211
  frozen: IDL.Bool,
3212
- last_updated: IDL.Opt(IDL.Nat64)
3212
+ last_updated: IDL.Opt(IDL.Nat64),
3213
+ activation_fee: IDL.Opt(IDL.Nat64)
3213
3214
  });
3214
3215
  const BorrowingPowerRecord = IDL.Record({
3215
3216
  max_borrowable_usd: IDL.Nat,
@@ -3315,7 +3316,8 @@ function decodeFlexiblePool(pool) {
3315
3316
  same_asset_borrowing: pool.same_asset_borrowing,
3316
3317
  same_asset_borrowing_dust_threshold: pool.same_asset_borrowing_dust_threshold,
3317
3318
  frozen: pool.frozen,
3318
- last_updated: pool.last_updated
3319
+ last_updated: pool.last_updated,
3320
+ activation_fee: pool.activation_fee ?? []
3319
3321
  };
3320
3322
  }
3321
3323
  function decodeFlexiblePosition(position) {
@@ -5543,6 +5545,7 @@ function mapDecodedPoolToPool(pool, rate) {
5543
5545
  liquidationBonus: pool.liquidation_bonus,
5544
5546
  protocolLiquidationFee: pool.protocol_liquidation_fee,
5545
5547
  reserveFactor: pool.reserve_factor,
5548
+ activationFee: pool.activation_fee[0] ?? 0n,
5546
5549
  rateDecimals: RATE_DECIMALS,
5547
5550
  lendingRate: rate[1],
5548
5551
  estimatedLendingApy: estimateSupplyApy(rate[1]),
@@ -6189,7 +6192,7 @@ var QuoteModule = class {
6189
6192
  });
6190
6193
  }
6191
6194
  const borrowUsd = computeUsdInternalFromBaseUnits({
6192
- amountBaseUnits: request.borrowAmount,
6195
+ amountBaseUnits: getOpeningDebt(request.borrowAmount, borrowPool),
6193
6196
  priceScaled: scalePriceUsdToBigint(borrowPrice),
6194
6197
  assetDecimalPlaces: getPoolDecimalPlaces(borrowPool)
6195
6198
  });
@@ -6346,7 +6349,7 @@ var QuoteModule = class {
6346
6349
  collateralPrice
6347
6350
  );
6348
6351
  const borrowUsdInternal = computeUsdInternalFromBaseUnits({
6349
- amountBaseUnits: borrowAmount,
6352
+ amountBaseUnits: getOpeningDebt(borrowAmount, borrowPool),
6350
6353
  priceScaled: borrowPriceScaled,
6351
6354
  assetDecimalPlaces: borrowAssetDecimals
6352
6355
  });
@@ -6394,6 +6397,9 @@ var QuoteModule = class {
6394
6397
  });
6395
6398
  }
6396
6399
  };
6400
+ function getOpeningDebt(borrowAmount, borrowPool) {
6401
+ return borrowAmount + borrowAmount * borrowPool.activationFee / BASIS_POINTS_DENOMINATOR;
6402
+ }
6397
6403
  function createLtvCalculation(params) {
6398
6404
  return {
6399
6405
  borrowAmount: params.request.borrowAmount,