@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 +1 -1
- package/dist/index.cjs +10 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1247,6 +1247,8 @@ interface Pool {
|
|
|
1247
1247
|
protocolLiquidationFee: bigint;
|
|
1248
1248
|
/** Reserve factor in basis points. */
|
|
1249
1249
|
reserveFactor: bigint;
|
|
1250
|
+
/** Borrow activation fee in basis points; zero on canisters without this field. */
|
|
1251
|
+
activationFee: bigint;
|
|
1250
1252
|
/** Decimal scale used by APR and utilization fields. */
|
|
1251
1253
|
rateDecimals: bigint;
|
|
1252
1254
|
/** Current supply APR, scaled by `rateDecimals`. */
|
|
@@ -1614,7 +1616,7 @@ declare enum QuoteWarningCode {
|
|
|
1614
1616
|
interface QuoteResult {
|
|
1615
1617
|
/** Requested borrow amount in borrow asset base units. */
|
|
1616
1618
|
borrowAmount: bigint;
|
|
1617
|
-
/**
|
|
1619
|
+
/** Opening debt value, including the activation fee, in internal USD units. */
|
|
1618
1620
|
borrowUsd: bigint;
|
|
1619
1621
|
/** Required collateral amount in collateral asset base units. */
|
|
1620
1622
|
requiredCollateralAmount: bigint;
|
|
@@ -1643,7 +1645,7 @@ interface LtvCalculation {
|
|
|
1643
1645
|
borrowAmount: bigint;
|
|
1644
1646
|
/** Collateral amount in collateral asset base units. */
|
|
1645
1647
|
collateralAmount: bigint;
|
|
1646
|
-
/**
|
|
1648
|
+
/** Opening debt value, including the activation fee, in internal USD units. */
|
|
1647
1649
|
borrowUsd: bigint;
|
|
1648
1650
|
/** Collateral value in internal USD units. */
|
|
1649
1651
|
collateralUsd: bigint;
|
|
@@ -1834,7 +1836,7 @@ interface CreateSimpleLoanRequest {
|
|
|
1834
1836
|
* Maximum allowed loan-to-value ratio in basis points.
|
|
1835
1837
|
*
|
|
1836
1838
|
* `6_000n` means 60%. Use `client.quote.calculateLtv(...)` to calculate the
|
|
1837
|
-
*
|
|
1839
|
+
* fee-inclusive LTV for the selected amounts and pass the policy value your app is
|
|
1838
1840
|
* willing to accept. Creation is rejected if the requested borrow would exceed
|
|
1839
1841
|
* this limit.
|
|
1840
1842
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1247,6 +1247,8 @@ interface Pool {
|
|
|
1247
1247
|
protocolLiquidationFee: bigint;
|
|
1248
1248
|
/** Reserve factor in basis points. */
|
|
1249
1249
|
reserveFactor: bigint;
|
|
1250
|
+
/** Borrow activation fee in basis points; zero on canisters without this field. */
|
|
1251
|
+
activationFee: bigint;
|
|
1250
1252
|
/** Decimal scale used by APR and utilization fields. */
|
|
1251
1253
|
rateDecimals: bigint;
|
|
1252
1254
|
/** Current supply APR, scaled by `rateDecimals`. */
|
|
@@ -1614,7 +1616,7 @@ declare enum QuoteWarningCode {
|
|
|
1614
1616
|
interface QuoteResult {
|
|
1615
1617
|
/** Requested borrow amount in borrow asset base units. */
|
|
1616
1618
|
borrowAmount: bigint;
|
|
1617
|
-
/**
|
|
1619
|
+
/** Opening debt value, including the activation fee, in internal USD units. */
|
|
1618
1620
|
borrowUsd: bigint;
|
|
1619
1621
|
/** Required collateral amount in collateral asset base units. */
|
|
1620
1622
|
requiredCollateralAmount: bigint;
|
|
@@ -1643,7 +1645,7 @@ interface LtvCalculation {
|
|
|
1643
1645
|
borrowAmount: bigint;
|
|
1644
1646
|
/** Collateral amount in collateral asset base units. */
|
|
1645
1647
|
collateralAmount: bigint;
|
|
1646
|
-
/**
|
|
1648
|
+
/** Opening debt value, including the activation fee, in internal USD units. */
|
|
1647
1649
|
borrowUsd: bigint;
|
|
1648
1650
|
/** Collateral value in internal USD units. */
|
|
1649
1651
|
collateralUsd: bigint;
|
|
@@ -1834,7 +1836,7 @@ interface CreateSimpleLoanRequest {
|
|
|
1834
1836
|
* Maximum allowed loan-to-value ratio in basis points.
|
|
1835
1837
|
*
|
|
1836
1838
|
* `6_000n` means 60%. Use `client.quote.calculateLtv(...)` to calculate the
|
|
1837
|
-
*
|
|
1839
|
+
* fee-inclusive LTV for the selected amounts and pass the policy value your app is
|
|
1838
1840
|
* willing to accept. Creation is rejected if the requested borrow would exceed
|
|
1839
1841
|
* this limit.
|
|
1840
1842
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3207,7 +3207,8 @@ var flexibleLendingIdlFactory = ({ IDL }) => {
|
|
|
3207
3207
|
same_asset_borrowing: IDL.Opt(IDL.Bool),
|
|
3208
3208
|
same_asset_borrowing_dust_threshold: IDL.Nat,
|
|
3209
3209
|
frozen: IDL.Bool,
|
|
3210
|
-
last_updated: IDL.Opt(IDL.Nat64)
|
|
3210
|
+
last_updated: IDL.Opt(IDL.Nat64),
|
|
3211
|
+
activation_fee: IDL.Opt(IDL.Nat64)
|
|
3211
3212
|
});
|
|
3212
3213
|
const BorrowingPowerRecord = IDL.Record({
|
|
3213
3214
|
max_borrowable_usd: IDL.Nat,
|
|
@@ -3313,7 +3314,8 @@ function decodeFlexiblePool(pool) {
|
|
|
3313
3314
|
same_asset_borrowing: pool.same_asset_borrowing,
|
|
3314
3315
|
same_asset_borrowing_dust_threshold: pool.same_asset_borrowing_dust_threshold,
|
|
3315
3316
|
frozen: pool.frozen,
|
|
3316
|
-
last_updated: pool.last_updated
|
|
3317
|
+
last_updated: pool.last_updated,
|
|
3318
|
+
activation_fee: pool.activation_fee ?? []
|
|
3317
3319
|
};
|
|
3318
3320
|
}
|
|
3319
3321
|
function decodeFlexiblePosition(position) {
|
|
@@ -5541,6 +5543,7 @@ function mapDecodedPoolToPool(pool, rate) {
|
|
|
5541
5543
|
liquidationBonus: pool.liquidation_bonus,
|
|
5542
5544
|
protocolLiquidationFee: pool.protocol_liquidation_fee,
|
|
5543
5545
|
reserveFactor: pool.reserve_factor,
|
|
5546
|
+
activationFee: pool.activation_fee[0] ?? 0n,
|
|
5544
5547
|
rateDecimals: RATE_DECIMALS,
|
|
5545
5548
|
lendingRate: rate[1],
|
|
5546
5549
|
estimatedLendingApy: estimateSupplyApy(rate[1]),
|
|
@@ -6187,7 +6190,7 @@ var QuoteModule = class {
|
|
|
6187
6190
|
});
|
|
6188
6191
|
}
|
|
6189
6192
|
const borrowUsd = computeUsdInternalFromBaseUnits({
|
|
6190
|
-
amountBaseUnits: request.borrowAmount,
|
|
6193
|
+
amountBaseUnits: getOpeningDebt(request.borrowAmount, borrowPool),
|
|
6191
6194
|
priceScaled: scalePriceUsdToBigint(borrowPrice),
|
|
6192
6195
|
assetDecimalPlaces: getPoolDecimalPlaces(borrowPool)
|
|
6193
6196
|
});
|
|
@@ -6344,7 +6347,7 @@ var QuoteModule = class {
|
|
|
6344
6347
|
collateralPrice
|
|
6345
6348
|
);
|
|
6346
6349
|
const borrowUsdInternal = computeUsdInternalFromBaseUnits({
|
|
6347
|
-
amountBaseUnits: borrowAmount,
|
|
6350
|
+
amountBaseUnits: getOpeningDebt(borrowAmount, borrowPool),
|
|
6348
6351
|
priceScaled: borrowPriceScaled,
|
|
6349
6352
|
assetDecimalPlaces: borrowAssetDecimals
|
|
6350
6353
|
});
|
|
@@ -6392,6 +6395,9 @@ var QuoteModule = class {
|
|
|
6392
6395
|
});
|
|
6393
6396
|
}
|
|
6394
6397
|
};
|
|
6398
|
+
function getOpeningDebt(borrowAmount, borrowPool) {
|
|
6399
|
+
return borrowAmount + borrowAmount * borrowPool.activationFee / BASIS_POINTS_DENOMINATOR;
|
|
6400
|
+
}
|
|
6395
6401
|
function createLtvCalculation(params) {
|
|
6396
6402
|
return {
|
|
6397
6403
|
borrowAmount: params.request.borrowAmount,
|