@liquidium/client 0.8.2 → 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/dist/index.d.cts CHANGED
@@ -417,6 +417,8 @@ declare class AccountsModule {
417
417
  *
418
418
  * @param options - `account` is the wallet address that will own the new profile.
419
419
  * @returns A signable {@link CreateAccountAction} with `submit` wired to the canister.
420
+ * @throws {@link LiquidiumError} If account validation or protocol
421
+ * preparation fails.
420
422
  */
421
423
  prepareCreateProfile(options: PrepareCreateProfileOptions): Promise<CreateAccountAction>;
422
424
  /**
@@ -426,6 +428,9 @@ declare class AccountsModule {
426
428
  *
427
429
  * @param params - Wallet `account`, signing `chain`, and `walletAdapter` with `signMessage`.
428
430
  * @returns The new profile principal as text.
431
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
432
+ * fails.
433
+ * @throws `Error` If the wallet adapter rejects message signing.
429
434
  */
430
435
  createProfile(params: CreateProfileParams): Promise<string>;
431
436
  /**
@@ -1087,6 +1092,8 @@ declare class LendingModule {
1087
1092
  * Use this when you need explicit control over signing and submission.
1088
1093
  * @param request - Profile, pool, amount (pool asset base units), outflow address, and signer wallet.
1089
1094
  * @returns A signable {@link WithdrawAction} with `submit` wired to the canister.
1095
+ * @throws {@link LiquidiumError} If request validation, destination
1096
+ * validation, or protocol preparation fails.
1090
1097
  */
1091
1098
  prepareWithdraw(request: CreateWithdrawRequest): Promise<WithdrawAction>;
1092
1099
  private submitWithdraw;
@@ -1097,6 +1104,9 @@ declare class LendingModule {
1097
1104
  *
1098
1105
  * @param params - Withdraw request fields plus `signerChain` and `signerWalletAdapter`.
1099
1106
  * @returns The canister {@link OutflowDetails} for the completed withdraw.
1107
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
1108
+ * fails.
1109
+ * @throws `Error` If the wallet adapter rejects message signing.
1100
1110
  */
1101
1111
  withdraw(params: CreateWithdrawRequest & WalletExecutionParams): Promise<WithdrawOutflowDetails>;
1102
1112
  /**
@@ -1108,6 +1118,8 @@ declare class LendingModule {
1108
1118
  *
1109
1119
  * @param request - Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.
1110
1120
  * @returns A signable {@link BorrowAction} with `submit` wired to the canister.
1121
+ * @throws {@link LiquidiumError} If request validation, destination
1122
+ * validation, or protocol preparation fails.
1111
1123
  */
1112
1124
  prepareBorrow(request: CreateBorrowRequest): Promise<BorrowAction>;
1113
1125
  private submitBorrow;
@@ -1119,6 +1131,9 @@ declare class LendingModule {
1119
1131
  *
1120
1132
  * @param params - Borrow request fields plus `signerChain` and `signerWalletAdapter`.
1121
1133
  * @returns The lending canister receipt as {@link OutflowDetails}.
1134
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
1135
+ * fails.
1136
+ * @throws `Error` If the wallet adapter rejects message signing.
1122
1137
  *
1123
1138
  * @remarks
1124
1139
  * `id` is always present. `txid` may be missing on the first response; the SDK does not
@@ -1137,6 +1152,10 @@ declare class LendingModule {
1137
1152
  *
1138
1153
  * @returns A {@link SupplyFlow} receipt with `type`, `target`, `submit`, and
1139
1154
  * an optional `txid` present when the SDK broadcast for you.
1155
+ * @throws {@link LiquidiumError} If validation, transfer planning, or
1156
+ * protocol submission fails.
1157
+ * @throws `Error` If the wallet adapter rejects or fails to broadcast a
1158
+ * transaction.
1140
1159
  */
1141
1160
  supply(request: SupplyFlowRequest): Promise<SupplyFlow>;
1142
1161
  /**
@@ -1179,6 +1198,8 @@ declare class LendingModule {
1179
1198
  *
1180
1199
  * @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
1181
1200
  * @returns Acknowledgement including the submitted `txid`.
1201
+ * @throws {@link LiquidiumError} If the chain is unsupported or the API
1202
+ * request fails.
1182
1203
  */
1183
1204
  submitInflow(request: SubmitInflowRequest): Promise<SubmitInflowResponse>;
1184
1205
  /**
@@ -1226,6 +1247,8 @@ interface Pool {
1226
1247
  protocolLiquidationFee: bigint;
1227
1248
  /** Reserve factor in basis points. */
1228
1249
  reserveFactor: bigint;
1250
+ /** Borrow activation fee in basis points; zero on canisters without this field. */
1251
+ activationFee: bigint;
1229
1252
  /** Decimal scale used by APR and utilization fields. */
1230
1253
  rateDecimals: bigint;
1231
1254
  /** Current supply APR, scaled by `rateDecimals`. */
@@ -1593,7 +1616,7 @@ declare enum QuoteWarningCode {
1593
1616
  interface QuoteResult {
1594
1617
  /** Requested borrow amount in borrow asset base units. */
1595
1618
  borrowAmount: bigint;
1596
- /** Borrow value in internal USD units. */
1619
+ /** Opening debt value, including the activation fee, in internal USD units. */
1597
1620
  borrowUsd: bigint;
1598
1621
  /** Required collateral amount in collateral asset base units. */
1599
1622
  requiredCollateralAmount: bigint;
@@ -1622,7 +1645,7 @@ interface LtvCalculation {
1622
1645
  borrowAmount: bigint;
1623
1646
  /** Collateral amount in collateral asset base units. */
1624
1647
  collateralAmount: bigint;
1625
- /** Borrow value in internal USD units. */
1648
+ /** Opening debt value, including the activation fee, in internal USD units. */
1626
1649
  borrowUsd: bigint;
1627
1650
  /** Collateral value in internal USD units. */
1628
1651
  collateralUsd: bigint;
@@ -1813,7 +1836,7 @@ interface CreateSimpleLoanRequest {
1813
1836
  * Maximum allowed loan-to-value ratio in basis points.
1814
1837
  *
1815
1838
  * `6_000n` means 60%. Use `client.quote.calculateLtv(...)` to calculate the
1816
- * implied LTV for the selected amounts and pass the policy value your app is
1839
+ * fee-inclusive LTV for the selected amounts and pass the policy value your app is
1817
1840
  * willing to accept. Creation is rejected if the requested borrow would exceed
1818
1841
  * this limit.
1819
1842
  */
@@ -2156,6 +2179,10 @@ declare class SimpleLoansModule {
2156
2179
  *
2157
2180
  * @param request - Collateral, borrow, refund, LTV limit, timeout, and inflow options.
2158
2181
  * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
2182
+ * @throws {@link LiquidiumError} If request validation, API transport, or
2183
+ * protocol validation fails before creation.
2184
+ * @throws {@link SimpleLoanCreatedError} If the remote loan is created but
2185
+ * the SDK cannot load its hydrated state.
2159
2186
  */
2160
2187
  create(request: CreateSimpleLoanRequest): Promise<SimpleLoan>;
2161
2188
  /**
@@ -2449,6 +2476,10 @@ interface ExecuteWithOptions {
2449
2476
  *
2450
2477
  * @param options - Adapter and optional chain/account overrides.
2451
2478
  * @returns A function that accepts a `WalletAction` and resolves with its submit result.
2479
+ * @throws {@link LiquidiumError} with code `LiquidiumErrorCode.VALIDATION_ERROR`
2480
+ * if a required wallet capability or signing chain is missing, or if
2481
+ * `action.executionKind` is unsupported.
2482
+ * @throws `Error` If the wallet adapter or action submission fails.
2452
2483
  */
2453
2484
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2454
2485
 
package/dist/index.d.ts CHANGED
@@ -417,6 +417,8 @@ declare class AccountsModule {
417
417
  *
418
418
  * @param options - `account` is the wallet address that will own the new profile.
419
419
  * @returns A signable {@link CreateAccountAction} with `submit` wired to the canister.
420
+ * @throws {@link LiquidiumError} If account validation or protocol
421
+ * preparation fails.
420
422
  */
421
423
  prepareCreateProfile(options: PrepareCreateProfileOptions): Promise<CreateAccountAction>;
422
424
  /**
@@ -426,6 +428,9 @@ declare class AccountsModule {
426
428
  *
427
429
  * @param params - Wallet `account`, signing `chain`, and `walletAdapter` with `signMessage`.
428
430
  * @returns The new profile principal as text.
431
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
432
+ * fails.
433
+ * @throws `Error` If the wallet adapter rejects message signing.
429
434
  */
430
435
  createProfile(params: CreateProfileParams): Promise<string>;
431
436
  /**
@@ -1087,6 +1092,8 @@ declare class LendingModule {
1087
1092
  * Use this when you need explicit control over signing and submission.
1088
1093
  * @param request - Profile, pool, amount (pool asset base units), outflow address, and signer wallet.
1089
1094
  * @returns A signable {@link WithdrawAction} with `submit` wired to the canister.
1095
+ * @throws {@link LiquidiumError} If request validation, destination
1096
+ * validation, or protocol preparation fails.
1090
1097
  */
1091
1098
  prepareWithdraw(request: CreateWithdrawRequest): Promise<WithdrawAction>;
1092
1099
  private submitWithdraw;
@@ -1097,6 +1104,9 @@ declare class LendingModule {
1097
1104
  *
1098
1105
  * @param params - Withdraw request fields plus `signerChain` and `signerWalletAdapter`.
1099
1106
  * @returns The canister {@link OutflowDetails} for the completed withdraw.
1107
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
1108
+ * fails.
1109
+ * @throws `Error` If the wallet adapter rejects message signing.
1100
1110
  */
1101
1111
  withdraw(params: CreateWithdrawRequest & WalletExecutionParams): Promise<WithdrawOutflowDetails>;
1102
1112
  /**
@@ -1108,6 +1118,8 @@ declare class LendingModule {
1108
1118
  *
1109
1119
  * @param request - Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.
1110
1120
  * @returns A signable {@link BorrowAction} with `submit` wired to the canister.
1121
+ * @throws {@link LiquidiumError} If request validation, destination
1122
+ * validation, or protocol preparation fails.
1111
1123
  */
1112
1124
  prepareBorrow(request: CreateBorrowRequest): Promise<BorrowAction>;
1113
1125
  private submitBorrow;
@@ -1119,6 +1131,9 @@ declare class LendingModule {
1119
1131
  *
1120
1132
  * @param params - Borrow request fields plus `signerChain` and `signerWalletAdapter`.
1121
1133
  * @returns The lending canister receipt as {@link OutflowDetails}.
1134
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
1135
+ * fails.
1136
+ * @throws `Error` If the wallet adapter rejects message signing.
1122
1137
  *
1123
1138
  * @remarks
1124
1139
  * `id` is always present. `txid` may be missing on the first response; the SDK does not
@@ -1137,6 +1152,10 @@ declare class LendingModule {
1137
1152
  *
1138
1153
  * @returns A {@link SupplyFlow} receipt with `type`, `target`, `submit`, and
1139
1154
  * an optional `txid` present when the SDK broadcast for you.
1155
+ * @throws {@link LiquidiumError} If validation, transfer planning, or
1156
+ * protocol submission fails.
1157
+ * @throws `Error` If the wallet adapter rejects or fails to broadcast a
1158
+ * transaction.
1140
1159
  */
1141
1160
  supply(request: SupplyFlowRequest): Promise<SupplyFlow>;
1142
1161
  /**
@@ -1179,6 +1198,8 @@ declare class LendingModule {
1179
1198
  *
1180
1199
  * @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
1181
1200
  * @returns Acknowledgement including the submitted `txid`.
1201
+ * @throws {@link LiquidiumError} If the chain is unsupported or the API
1202
+ * request fails.
1182
1203
  */
1183
1204
  submitInflow(request: SubmitInflowRequest): Promise<SubmitInflowResponse>;
1184
1205
  /**
@@ -1226,6 +1247,8 @@ interface Pool {
1226
1247
  protocolLiquidationFee: bigint;
1227
1248
  /** Reserve factor in basis points. */
1228
1249
  reserveFactor: bigint;
1250
+ /** Borrow activation fee in basis points; zero on canisters without this field. */
1251
+ activationFee: bigint;
1229
1252
  /** Decimal scale used by APR and utilization fields. */
1230
1253
  rateDecimals: bigint;
1231
1254
  /** Current supply APR, scaled by `rateDecimals`. */
@@ -1593,7 +1616,7 @@ declare enum QuoteWarningCode {
1593
1616
  interface QuoteResult {
1594
1617
  /** Requested borrow amount in borrow asset base units. */
1595
1618
  borrowAmount: bigint;
1596
- /** Borrow value in internal USD units. */
1619
+ /** Opening debt value, including the activation fee, in internal USD units. */
1597
1620
  borrowUsd: bigint;
1598
1621
  /** Required collateral amount in collateral asset base units. */
1599
1622
  requiredCollateralAmount: bigint;
@@ -1622,7 +1645,7 @@ interface LtvCalculation {
1622
1645
  borrowAmount: bigint;
1623
1646
  /** Collateral amount in collateral asset base units. */
1624
1647
  collateralAmount: bigint;
1625
- /** Borrow value in internal USD units. */
1648
+ /** Opening debt value, including the activation fee, in internal USD units. */
1626
1649
  borrowUsd: bigint;
1627
1650
  /** Collateral value in internal USD units. */
1628
1651
  collateralUsd: bigint;
@@ -1813,7 +1836,7 @@ interface CreateSimpleLoanRequest {
1813
1836
  * Maximum allowed loan-to-value ratio in basis points.
1814
1837
  *
1815
1838
  * `6_000n` means 60%. Use `client.quote.calculateLtv(...)` to calculate the
1816
- * implied LTV for the selected amounts and pass the policy value your app is
1839
+ * fee-inclusive LTV for the selected amounts and pass the policy value your app is
1817
1840
  * willing to accept. Creation is rejected if the requested borrow would exceed
1818
1841
  * this limit.
1819
1842
  */
@@ -2156,6 +2179,10 @@ declare class SimpleLoansModule {
2156
2179
  *
2157
2180
  * @param request - Collateral, borrow, refund, LTV limit, timeout, and inflow options.
2158
2181
  * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
2182
+ * @throws {@link LiquidiumError} If request validation, API transport, or
2183
+ * protocol validation fails before creation.
2184
+ * @throws {@link SimpleLoanCreatedError} If the remote loan is created but
2185
+ * the SDK cannot load its hydrated state.
2159
2186
  */
2160
2187
  create(request: CreateSimpleLoanRequest): Promise<SimpleLoan>;
2161
2188
  /**
@@ -2449,6 +2476,10 @@ interface ExecuteWithOptions {
2449
2476
  *
2450
2477
  * @param options - Adapter and optional chain/account overrides.
2451
2478
  * @returns A function that accepts a `WalletAction` and resolves with its submit result.
2479
+ * @throws {@link LiquidiumError} with code `LiquidiumErrorCode.VALIDATION_ERROR`
2480
+ * if a required wallet capability or signing chain is missing, or if
2481
+ * `action.executionKind` is unsupported.
2482
+ * @throws `Error` If the wallet adapter or action submission fails.
2452
2483
  */
2453
2484
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2454
2485
 
package/dist/index.js CHANGED
@@ -1263,6 +1263,8 @@ var AccountsModule = class {
1263
1263
  *
1264
1264
  * @param options - `account` is the wallet address that will own the new profile.
1265
1265
  * @returns A signable {@link CreateAccountAction} with `submit` wired to the canister.
1266
+ * @throws {@link LiquidiumError} If account validation or protocol
1267
+ * preparation fails.
1266
1268
  */
1267
1269
  async prepareCreateProfile(options) {
1268
1270
  return await this.buildCreateProfileAction(options.account);
@@ -1274,6 +1276,9 @@ var AccountsModule = class {
1274
1276
  *
1275
1277
  * @param params - Wallet `account`, signing `chain`, and `walletAdapter` with `signMessage`.
1276
1278
  * @returns The new profile principal as text.
1279
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
1280
+ * fails.
1281
+ * @throws `Error` If the wallet adapter rejects message signing.
1277
1282
  */
1278
1283
  async createProfile(params) {
1279
1284
  const account = normalizeProfileAccount(params.account);
@@ -1558,6 +1563,7 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
1558
1563
  });
1559
1564
  const SimpleLoansError = IDL.Variant({
1560
1565
  BorrowAmountRequired: IDL.Null,
1566
+ AnonymousPrincipalNotAllowed: IDL.Null,
1561
1567
  NoCollateralPosition: IDL.Record({ loan_id: IDL.Nat }),
1562
1568
  LtvTimerOutOfRange: IDL.Record({ max: IDL.Nat64 }),
1563
1569
  LtvMaxExceeded: IDL.Record({
@@ -1571,6 +1577,11 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
1571
1577
  CallRejected: IDL.Record({ method: IDL.Text, reason: IDL.Text }),
1572
1578
  DecodeFailed: IDL.Record({ method: IDL.Text, reason: IDL.Text })
1573
1579
  }),
1580
+ PoolNotFound: IDL.Record({ pool_id: IDL.Principal }),
1581
+ LendingCanisterImmutable: IDL.Record({
1582
+ requested: IDL.Principal,
1583
+ configured: IDL.Principal
1584
+ }),
1574
1585
  LtvMaxOutOfRange: IDL.Record({ max: IDL.Nat64 }),
1575
1586
  AccountRequired: IDL.Record({ label: IDL.Text }),
1576
1587
  DepositTimerExceeded: IDL.Record({ loan_id: IDL.Nat }),
@@ -1583,8 +1594,14 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
1583
1594
  DepositAlreadyProcessed: IDL.Record({ loan_id: IDL.Nat }),
1584
1595
  MissingPrice: IDL.Record({ symbol: IDL.Text }),
1585
1596
  InvalidLtvTimerS: IDL.Null,
1597
+ PoolLendingDisabled: IDL.Record({ pool_id: IDL.Principal }),
1586
1598
  DebtNotFullyRepaid: IDL.Record({ loan_id: IDL.Nat }),
1587
1599
  EmptyCollateralPosition: IDL.Null,
1600
+ PoolAssetMismatch: IDL.Record({
1601
+ configured_asset: IDL.Unknown,
1602
+ requested_asset: IDL.Unknown,
1603
+ pool_id: IDL.Principal
1604
+ }),
1588
1605
  SigningFailed: IDL.Record({ reason: IDL.Text })
1589
1606
  });
1590
1607
  const CreateLoanRequest = IDL.Record({
@@ -3190,7 +3207,8 @@ var flexibleLendingIdlFactory = ({ IDL }) => {
3190
3207
  same_asset_borrowing: IDL.Opt(IDL.Bool),
3191
3208
  same_asset_borrowing_dust_threshold: IDL.Nat,
3192
3209
  frozen: IDL.Bool,
3193
- last_updated: IDL.Opt(IDL.Nat64)
3210
+ last_updated: IDL.Opt(IDL.Nat64),
3211
+ activation_fee: IDL.Opt(IDL.Nat64)
3194
3212
  });
3195
3213
  const BorrowingPowerRecord = IDL.Record({
3196
3214
  max_borrowable_usd: IDL.Nat,
@@ -3296,7 +3314,8 @@ function decodeFlexiblePool(pool) {
3296
3314
  same_asset_borrowing: pool.same_asset_borrowing,
3297
3315
  same_asset_borrowing_dust_threshold: pool.same_asset_borrowing_dust_threshold,
3298
3316
  frozen: pool.frozen,
3299
- last_updated: pool.last_updated
3317
+ last_updated: pool.last_updated,
3318
+ activation_fee: pool.activation_fee ?? []
3300
3319
  };
3301
3320
  }
3302
3321
  function decodeFlexiblePosition(position) {
@@ -4791,6 +4810,8 @@ var LendingModule = class {
4791
4810
  * Use this when you need explicit control over signing and submission.
4792
4811
  * @param request - Profile, pool, amount (pool asset base units), outflow address, and signer wallet.
4793
4812
  * @returns A signable {@link WithdrawAction} with `submit` wired to the canister.
4813
+ * @throws {@link LiquidiumError} If request validation, destination
4814
+ * validation, or protocol preparation fails.
4794
4815
  */
4795
4816
  async prepareWithdraw(request) {
4796
4817
  const destination = resolveOutflowDestinationInput({
@@ -4943,6 +4964,9 @@ var LendingModule = class {
4943
4964
  *
4944
4965
  * @param params - Withdraw request fields plus `signerChain` and `signerWalletAdapter`.
4945
4966
  * @returns The canister {@link OutflowDetails} for the completed withdraw.
4967
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
4968
+ * fails.
4969
+ * @throws `Error` If the wallet adapter rejects message signing.
4946
4970
  */
4947
4971
  async withdraw(params) {
4948
4972
  const action = await this.prepareWithdraw(params);
@@ -4961,6 +4985,8 @@ var LendingModule = class {
4961
4985
  *
4962
4986
  * @param request - Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.
4963
4987
  * @returns A signable {@link BorrowAction} with `submit` wired to the canister.
4988
+ * @throws {@link LiquidiumError} If request validation, destination
4989
+ * validation, or protocol preparation fails.
4964
4990
  */
4965
4991
  async prepareBorrow(request) {
4966
4992
  const destination = resolveOutflowDestinationInput({
@@ -5114,6 +5140,9 @@ var LendingModule = class {
5114
5140
  *
5115
5141
  * @param params - Borrow request fields plus `signerChain` and `signerWalletAdapter`.
5116
5142
  * @returns The lending canister receipt as {@link OutflowDetails}.
5143
+ * @throws {@link LiquidiumError} If SDK validation or protocol submission
5144
+ * fails.
5145
+ * @throws `Error` If the wallet adapter rejects message signing.
5117
5146
  *
5118
5147
  * @remarks
5119
5148
  * `id` is always present. `txid` may be missing on the first response; the SDK does not
@@ -5139,6 +5168,10 @@ var LendingModule = class {
5139
5168
  *
5140
5169
  * @returns A {@link SupplyFlow} receipt with `type`, `target`, `submit`, and
5141
5170
  * an optional `txid` present when the SDK broadcast for you.
5171
+ * @throws {@link LiquidiumError} If validation, transfer planning, or
5172
+ * protocol submission fails.
5173
+ * @throws `Error` If the wallet adapter rejects or fails to broadcast a
5174
+ * transaction.
5142
5175
  */
5143
5176
  async supply(request) {
5144
5177
  return await this.createSupplyFlowExecutor().create(request);
@@ -5263,6 +5296,8 @@ var LendingModule = class {
5263
5296
  *
5264
5297
  * @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
5265
5298
  * @returns Acknowledgement including the submitted `txid`.
5299
+ * @throws {@link LiquidiumError} If the chain is unsupported or the API
5300
+ * request fails.
5266
5301
  */
5267
5302
  async submitInflow(request) {
5268
5303
  if (request.chain !== void 0 && request.chain !== Chain.BTC && request.chain !== Chain.ETH) {
@@ -5508,6 +5543,7 @@ function mapDecodedPoolToPool(pool, rate) {
5508
5543
  liquidationBonus: pool.liquidation_bonus,
5509
5544
  protocolLiquidationFee: pool.protocol_liquidation_fee,
5510
5545
  reserveFactor: pool.reserve_factor,
5546
+ activationFee: pool.activation_fee[0] ?? 0n,
5511
5547
  rateDecimals: RATE_DECIMALS,
5512
5548
  lendingRate: rate[1],
5513
5549
  estimatedLendingApy: estimateSupplyApy(rate[1]),
@@ -6154,7 +6190,7 @@ var QuoteModule = class {
6154
6190
  });
6155
6191
  }
6156
6192
  const borrowUsd = computeUsdInternalFromBaseUnits({
6157
- amountBaseUnits: request.borrowAmount,
6193
+ amountBaseUnits: getOpeningDebt(request.borrowAmount, borrowPool),
6158
6194
  priceScaled: scalePriceUsdToBigint(borrowPrice),
6159
6195
  assetDecimalPlaces: getPoolDecimalPlaces(borrowPool)
6160
6196
  });
@@ -6311,7 +6347,7 @@ var QuoteModule = class {
6311
6347
  collateralPrice
6312
6348
  );
6313
6349
  const borrowUsdInternal = computeUsdInternalFromBaseUnits({
6314
- amountBaseUnits: borrowAmount,
6350
+ amountBaseUnits: getOpeningDebt(borrowAmount, borrowPool),
6315
6351
  priceScaled: borrowPriceScaled,
6316
6352
  assetDecimalPlaces: borrowAssetDecimals
6317
6353
  });
@@ -6359,6 +6395,9 @@ var QuoteModule = class {
6359
6395
  });
6360
6396
  }
6361
6397
  };
6398
+ function getOpeningDebt(borrowAmount, borrowPool) {
6399
+ return borrowAmount + borrowAmount * borrowPool.activationFee / BASIS_POINTS_DENOMINATOR;
6400
+ }
6362
6401
  function createLtvCalculation(params) {
6363
6402
  return {
6364
6403
  borrowAmount: params.request.borrowAmount,
@@ -6569,6 +6608,10 @@ var SimpleLoansModule = class {
6569
6608
  *
6570
6609
  * @param request - Collateral, borrow, refund, LTV limit, timeout, and inflow options.
6571
6610
  * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
6611
+ * @throws {@link LiquidiumError} If request validation, API transport, or
6612
+ * protocol validation fails before creation.
6613
+ * @throws {@link SimpleLoanCreatedError} If the remote loan is created but
6614
+ * the SDK cannot load its hydrated state.
6572
6615
  */
6573
6616
  async create(request) {
6574
6617
  validateCreateRequest(request);