@liquidium/client 0.1.1 → 0.2.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
@@ -321,7 +321,7 @@ type CreateProfileParams = {
321
321
  };
322
322
  /** Profile lifecycle and linked-wallet helpers. */
323
323
  declare class AccountsModule {
324
- readonly canisterContext: CanisterContext;
324
+ private readonly canisterContext;
325
325
  constructor(canisterContext: CanisterContext);
326
326
  /**
327
327
  * Prepares a profile-creation action that can be signed and submitted later.
@@ -493,8 +493,8 @@ type GetActivityStatusResponse = {
493
493
 
494
494
  /** Receipt-oriented activity list and status helpers. */
495
495
  declare class ActivitiesModule {
496
- readonly apiClient: ApiClient | undefined;
497
- readonly canisterContext: CanisterContext;
496
+ private readonly apiClient;
497
+ private readonly canisterContext;
498
498
  constructor(apiClient: ApiClient | undefined, canisterContext: CanisterContext);
499
499
  /**
500
500
  * Lists profile activities. Defaults to all activities.
@@ -727,7 +727,7 @@ interface PaginatedResponse<T> {
727
727
 
728
728
  /** Historical pool, rate, user transaction, and liquidation data helpers. */
729
729
  declare class HistoryModule {
730
- readonly apiClient: ApiClient | undefined;
730
+ private readonly apiClient;
731
731
  constructor(apiClient: ApiClient | undefined);
732
732
  private requireApi;
733
733
  /**
@@ -834,7 +834,7 @@ interface CreateBorrowRequest {
834
834
  poolId: string;
835
835
  /** Amount to borrow in the borrow asset's base units. */
836
836
  amount: bigint;
837
- /** External-chain address that receives the borrowed asset. */
837
+ /** External-chain address that receives the borrowed asset. Must match the borrow pool chain. */
838
838
  receiverAddress: string;
839
839
  /** Wallet address that signs the borrow authorization. */
840
840
  signerWalletAddress: string;
@@ -863,7 +863,7 @@ interface CreateWithdrawRequest {
863
863
  poolId: string;
864
864
  /** Amount to withdraw in the pool asset's base units. */
865
865
  amount: bigint;
866
- /** External-chain address that receives the withdrawn asset. */
866
+ /** External-chain address that receives the withdrawn asset. Must match the pool chain. */
867
867
  receiverAddress: string;
868
868
  /** Wallet address that signs the withdraw authorization. */
869
869
  signerWalletAddress: string;
@@ -1014,9 +1014,9 @@ interface EstimateInflowFeeRequest {
1014
1014
  /** Chain to estimate for. */
1015
1015
  chain: Chain;
1016
1016
  }
1017
- /** Fee estimate for an inflow target. */
1017
+ /** Fee estimate for an inflow target, rounded up to the asset's fee unit. */
1018
1018
  interface InflowFeeEstimate {
1019
- /** Estimated total fee in the asset's base units. */
1019
+ /** Estimated total fee rounded up in the asset's base units. */
1020
1020
  totalFee: bigint;
1021
1021
  }
1022
1022
  /** Request for ERC-20 approval and deposit planning. */
@@ -1080,9 +1080,9 @@ type WalletExecutionParams = {
1080
1080
  };
1081
1081
  /** Borrow, withdraw, supply, inflow reporting, and fee-estimation helpers. */
1082
1082
  declare class LendingModule {
1083
- readonly canisterContext: CanisterContext;
1084
- readonly apiClient: ApiClient | undefined;
1085
- readonly evmReadClient: EvmReadClient | undefined;
1083
+ private readonly canisterContext;
1084
+ private readonly apiClient;
1085
+ private readonly evmReadClient;
1086
1086
  constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, evmReadClient: EvmReadClient | undefined);
1087
1087
  /**
1088
1088
  * Prepares a withdraw action that can be signed and submitted later.
@@ -1170,12 +1170,13 @@ declare class LendingModule {
1170
1170
  * Estimates the network/deposit fee for an inflow target.
1171
1171
  *
1172
1172
  * ETH stablecoin deposit-address estimates are served by the deposit-address
1173
- * canister. BTC estimates are not exposed by this SDK yet and return zero.
1173
+ * canister. BTC estimates include the ckBTC minter deposit fee and ledger fee.
1174
1174
  *
1175
1175
  * @param request - Asset and chain pair to estimate for.
1176
- * @returns Total fee estimate in the asset's base units.
1176
+ * @returns Total fee estimate rounded up in the asset's base units.
1177
1177
  */
1178
1178
  estimateInflowFee(request: EstimateInflowFeeRequest): Promise<InflowFeeEstimate>;
1179
+ private estimateBtcInflowFee;
1179
1180
  private sendAndSubmitNativeSupplyInflow;
1180
1181
  private submitSupplyFlowInflow;
1181
1182
  private executeContractSupply;
@@ -1199,6 +1200,7 @@ declare class LendingModule {
1199
1200
  private requireApi;
1200
1201
  private requireEvmReadClient;
1201
1202
  private getPoolById;
1203
+ private normalizeOutflowReceiverAddress;
1202
1204
  private sendEthContractTransaction;
1203
1205
  private waitForExpectedAllowance;
1204
1206
  }
@@ -1283,8 +1285,8 @@ interface PoolRate {
1283
1285
 
1284
1286
  /** Pool metadata, prices, and current rate helpers. */
1285
1287
  declare class MarketModule {
1286
- readonly canisterContext: CanisterContext;
1287
- readonly apiClient: ApiClient | undefined;
1288
+ private readonly canisterContext;
1289
+ private readonly apiClient;
1288
1290
  constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined);
1289
1291
  /**
1290
1292
  * Lists all pools with their current rates.
@@ -1422,7 +1424,7 @@ interface MaxRepayAmount {
1422
1424
 
1423
1425
  /** Profile position, health factor, and reserve valuation helpers. */
1424
1426
  declare class PositionsModule {
1425
- readonly canisterContext: CanisterContext;
1427
+ private readonly canisterContext;
1426
1428
  readonly market: MarketModule;
1427
1429
  constructor(canisterContext: CanisterContext, market: MarketModule);
1428
1430
  /**
@@ -1470,7 +1472,7 @@ declare class PositionsModule {
1470
1472
  * Returns the per-reserve breakdown of a profile's supplies and borrows,
1471
1473
  * joined with pool metadata, rates, and current USD prices.
1472
1474
  *
1473
- * USD values are scaled to {@link USD_VALUE_SCALE_DECIMALS} (27).
1475
+ * USD values are scaled to 27 decimals.
1474
1476
  *
1475
1477
  * @param profileId - The Liquidium profile principal text.
1476
1478
  * @returns Per-reserve position rows joined with pool metadata and USD values.
@@ -1574,11 +1576,13 @@ interface CreateInstantLoanRequest {
1574
1576
  */
1575
1577
  borrowAsset: InstantLoanAsset;
1576
1578
  /**
1577
- * Amount the user is expected to deposit as collateral, in base units.
1579
+ * Intended credited collateral amount, in base units.
1578
1580
  *
1579
- * This is used to validate LTV and initialize the loan record. For BTC, pass
1580
- * satoshis. For token assets, convert the UI amount using the selected pool's
1581
- * `decimals` value.
1581
+ * This is used to validate LTV and initialize the loan record before
1582
+ * deposit/inflow fees are deducted. For BTC, pass satoshis. For token assets,
1583
+ * convert the UI amount using the selected pool's `decimals` value. After
1584
+ * creation, use `loan.initialDeposit.amount` as the fee-inclusive transfer
1585
+ * amount to send to `loan.initialDeposit.target`.
1582
1586
  */
1583
1587
  collateralAmount: bigint;
1584
1588
  /**
@@ -1736,6 +1740,23 @@ interface InstantLoanRepayment {
1736
1740
  /** Address or ICRC account where the repayment should be sent. */
1737
1741
  target: SupplyTarget;
1738
1742
  }
1743
+ /** Initial collateral deposit quote returned when an instant loan is created. */
1744
+ interface InstantLoanInitialDeposit {
1745
+ /** Full amount to send to the deposit target, including the estimated inflow fee. */
1746
+ amount: bigint;
1747
+ /** Decimal scale for `amount`, `collateralAmount`, and `inflowFeeAmount`. */
1748
+ decimals: bigint;
1749
+ /** Intended credited collateral amount in base units, before inflow fees. */
1750
+ collateralAmount: bigint;
1751
+ /** Inflow fee amount in base units added to the transfer amount. */
1752
+ inflowFeeAmount: bigint;
1753
+ /** Collateral asset to deposit. */
1754
+ asset: MarketAsset;
1755
+ /** Chain used for the collateral deposit. */
1756
+ chain: MarketChain;
1757
+ /** Address or ICRC account where the collateral should be sent. */
1758
+ target: SupplyTarget;
1759
+ }
1739
1760
  /** Current lending position backing the instant loan. */
1740
1761
  interface InstantLoanPositionSummary {
1741
1762
  /** Current collateral amount in the collateral asset's base units. */
@@ -1760,9 +1781,45 @@ declare const InstantLoanStatus: {
1760
1781
  readonly active: "active";
1761
1782
  readonly settling: "settling";
1762
1783
  readonly closed: "closed";
1784
+ readonly expired: "expired";
1763
1785
  };
1764
1786
  type InstantLoanStatus = (typeof InstantLoanStatus)[keyof typeof InstantLoanStatus];
1765
- /** Hydrated instant-loan state plus generated deposit and repayment targets. */
1787
+ /** Immutable terms selected for an instant loan. */
1788
+ interface InstantLoanTerms {
1789
+ /** Maximum loan-to-value ratio in basis points. */
1790
+ ltvMaxBps: bigint;
1791
+ /** Seconds allowed for the collateral deposit before timeout. */
1792
+ depositWindowSeconds: bigint;
1793
+ }
1794
+ /** Collateral leg selected for an instant loan. */
1795
+ interface InstantLoanCollateral {
1796
+ /** Principal text of the collateral pool. */
1797
+ poolId: string;
1798
+ /** Collateral asset symbol. */
1799
+ asset: MarketAsset;
1800
+ /** Chain used for collateral deposits. */
1801
+ chain: MarketChain;
1802
+ /** Decimal scale for collateral amounts. */
1803
+ decimals: bigint;
1804
+ /** Intended credited collateral amount in base units, before inflow fees. */
1805
+ amount: bigint;
1806
+ }
1807
+ /** Borrow leg selected for an instant loan. */
1808
+ interface InstantLoanBorrow {
1809
+ /** Principal text of the borrow pool. */
1810
+ poolId: string;
1811
+ /** Borrow asset symbol. */
1812
+ asset: MarketAsset;
1813
+ /** Chain used for repayment. */
1814
+ chain: MarketChain;
1815
+ /** Decimal scale for borrow and debt amounts. */
1816
+ decimals: bigint;
1817
+ /** Requested borrow amount in base units. */
1818
+ amount: bigint;
1819
+ /** Destination that receives the borrowed asset. */
1820
+ destination: InstantLoanAccount;
1821
+ }
1822
+ /** Hydrated instant-loan state plus generated quote targets. */
1766
1823
  interface InstantLoan {
1767
1824
  /** Canister-assigned loan id. */
1768
1825
  loanId: bigint;
@@ -1772,32 +1829,17 @@ interface InstantLoan {
1772
1829
  status: InstantLoanStatus;
1773
1830
  /** Generated lending profile principal used by the instant loan. */
1774
1831
  profileId: string;
1775
- /** Maximum loan-to-value ratio in basis points. */
1776
- ltvMaxBps: bigint;
1777
- /** Seconds allowed for the collateral deposit before timeout. */
1778
- depositWindowSeconds: bigint;
1779
- /** Collateral-side pool, asset, chain, and current or requested collateral amount. */
1780
- collateral: {
1781
- poolId: string;
1782
- asset: MarketAsset;
1783
- chain: MarketChain;
1784
- amount: bigint;
1785
- };
1786
- /** Borrow-side pool, asset, chain, requested amount, and destination. */
1787
- borrow: {
1788
- poolId: string;
1789
- asset: MarketAsset;
1790
- chain: MarketChain;
1791
- amount: bigint;
1792
- destination: InstantLoanAccount;
1793
- };
1832
+ /** Immutable loan terms. */
1833
+ terms: InstantLoanTerms;
1834
+ /** Collateral-side pool, asset, chain, decimals, and requested credited amount. */
1835
+ collateral: InstantLoanCollateral;
1836
+ /** Borrow-side pool, asset, chain, decimals, requested amount, and destination. */
1837
+ borrow: InstantLoanBorrow;
1794
1838
  /** Destination used for collateral refunds or withdrawals. */
1795
1839
  refundDestination: InstantLoanAccount;
1796
- /** Address or ICRC account where the user deposits collateral. */
1797
- depositTarget: SupplyTarget;
1798
- /** Address or ICRC account where the user repays debt. */
1799
- repayTarget: SupplyTarget;
1800
- /** Current actionable repayment quote. */
1840
+ /** Current actionable initial collateral deposit quote. */
1841
+ initialDeposit: InstantLoanInitialDeposit;
1842
+ /** Current repayment quote. Amount fields are zero when the loan has no debt. */
1801
1843
  repayment: InstantLoanRepayment;
1802
1844
  /** Current lending position state for the generated profile. */
1803
1845
  position: InstantLoanPositionSummary;
@@ -1825,20 +1867,20 @@ interface InstantLoanCandidate {
1825
1867
  collateralAsset: MarketAsset;
1826
1868
  /** Borrow asset symbol. */
1827
1869
  borrowAsset: MarketAsset;
1828
- /** Collateral amount hint in base units. */
1829
- collateralAmountHint: bigint;
1870
+ /** Collateral amount in base units. */
1871
+ collateralAmount: bigint;
1830
1872
  }
1831
1873
 
1832
1874
  /** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
1833
1875
  declare class InstantLoansModule {
1834
- readonly canisterContext: CanisterContext;
1835
- readonly apiClient: ApiClient | undefined;
1836
- readonly lending: LendingModule;
1837
- readonly positions: PositionsModule;
1876
+ private readonly canisterContext;
1877
+ private readonly apiClient;
1878
+ private readonly lending;
1879
+ private readonly positions;
1838
1880
  constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, lending: LendingModule, positions: PositionsModule);
1839
1881
  /**
1840
1882
  * Creates a profileless instant loan and returns canonical canister state plus
1841
- * deposit/repay targets for the generated lending profile.
1883
+ * generated initial-deposit and repayment quote targets.
1842
1884
  *
1843
1885
  * Choose `collateralPoolId` and `borrowPoolId` from
1844
1886
  * `client.market.listPools()`, convert UI amounts to base units with the
@@ -1851,7 +1893,7 @@ declare class InstantLoansModule {
1851
1893
  * SDK maps it to the canister's internal `ltv_timer_s` field.
1852
1894
  *
1853
1895
  * @param request - Pool ids, assets, base-unit amounts, LTV limit, timeout, and destinations.
1854
- * @returns Hydrated loan state plus generated deposit and repayment targets.
1896
+ * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1855
1897
  */
1856
1898
  create(request: CreateInstantLoanRequest): Promise<InstantLoan>;
1857
1899
  /**
@@ -1861,7 +1903,7 @@ declare class InstantLoansModule {
1861
1903
  * from the instant-loans canister.
1862
1904
  *
1863
1905
  * @param request - Canister loan id or short public reference.
1864
- * @returns Hydrated loan state plus generated deposit and repayment targets.
1906
+ * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1865
1907
  */
1866
1908
  get(request: InstantLoanGetRequest): Promise<InstantLoan>;
1867
1909
  /**
@@ -1914,8 +1956,10 @@ declare class InstantLoansModule {
1914
1956
  */
1915
1957
  findByAddress(address: string): Promise<InstantLoanCandidate[]>;
1916
1958
  private mapLoanRecord;
1959
+ private getCollateralAmountHint;
1917
1960
  private mapLoanWire;
1918
1961
  private hydrateLoan;
1962
+ private createInitialDepositQuote;
1919
1963
  private estimateRepaymentInflowFee;
1920
1964
  private requireApi;
1921
1965
  private validateInstantLoanLtvPolicy;
@@ -2213,4 +2257,4 @@ interface ExecuteWithOptions {
2213
2257
  */
2214
2258
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2215
2259
 
2216
- export { type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanCandidate, type InstantLoanGetRequest, InstantLoanStatus, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type ListActivitiesRequest, type LtvCalculation, type MarketAsset, type MarketChain, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
2260
+ export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateProfileParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type FindPoolQuery, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, HistoryModule, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanAuthorization, type InstantLoanBorrow, type InstantLoanCandidate, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesRequest, type LtvCalculation, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, PositionsModule, type PrepareCreateProfileOptions, QuoteModule, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendBtcTransactionRequest, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
package/dist/index.d.ts CHANGED
@@ -321,7 +321,7 @@ type CreateProfileParams = {
321
321
  };
322
322
  /** Profile lifecycle and linked-wallet helpers. */
323
323
  declare class AccountsModule {
324
- readonly canisterContext: CanisterContext;
324
+ private readonly canisterContext;
325
325
  constructor(canisterContext: CanisterContext);
326
326
  /**
327
327
  * Prepares a profile-creation action that can be signed and submitted later.
@@ -493,8 +493,8 @@ type GetActivityStatusResponse = {
493
493
 
494
494
  /** Receipt-oriented activity list and status helpers. */
495
495
  declare class ActivitiesModule {
496
- readonly apiClient: ApiClient | undefined;
497
- readonly canisterContext: CanisterContext;
496
+ private readonly apiClient;
497
+ private readonly canisterContext;
498
498
  constructor(apiClient: ApiClient | undefined, canisterContext: CanisterContext);
499
499
  /**
500
500
  * Lists profile activities. Defaults to all activities.
@@ -727,7 +727,7 @@ interface PaginatedResponse<T> {
727
727
 
728
728
  /** Historical pool, rate, user transaction, and liquidation data helpers. */
729
729
  declare class HistoryModule {
730
- readonly apiClient: ApiClient | undefined;
730
+ private readonly apiClient;
731
731
  constructor(apiClient: ApiClient | undefined);
732
732
  private requireApi;
733
733
  /**
@@ -834,7 +834,7 @@ interface CreateBorrowRequest {
834
834
  poolId: string;
835
835
  /** Amount to borrow in the borrow asset's base units. */
836
836
  amount: bigint;
837
- /** External-chain address that receives the borrowed asset. */
837
+ /** External-chain address that receives the borrowed asset. Must match the borrow pool chain. */
838
838
  receiverAddress: string;
839
839
  /** Wallet address that signs the borrow authorization. */
840
840
  signerWalletAddress: string;
@@ -863,7 +863,7 @@ interface CreateWithdrawRequest {
863
863
  poolId: string;
864
864
  /** Amount to withdraw in the pool asset's base units. */
865
865
  amount: bigint;
866
- /** External-chain address that receives the withdrawn asset. */
866
+ /** External-chain address that receives the withdrawn asset. Must match the pool chain. */
867
867
  receiverAddress: string;
868
868
  /** Wallet address that signs the withdraw authorization. */
869
869
  signerWalletAddress: string;
@@ -1014,9 +1014,9 @@ interface EstimateInflowFeeRequest {
1014
1014
  /** Chain to estimate for. */
1015
1015
  chain: Chain;
1016
1016
  }
1017
- /** Fee estimate for an inflow target. */
1017
+ /** Fee estimate for an inflow target, rounded up to the asset's fee unit. */
1018
1018
  interface InflowFeeEstimate {
1019
- /** Estimated total fee in the asset's base units. */
1019
+ /** Estimated total fee rounded up in the asset's base units. */
1020
1020
  totalFee: bigint;
1021
1021
  }
1022
1022
  /** Request for ERC-20 approval and deposit planning. */
@@ -1080,9 +1080,9 @@ type WalletExecutionParams = {
1080
1080
  };
1081
1081
  /** Borrow, withdraw, supply, inflow reporting, and fee-estimation helpers. */
1082
1082
  declare class LendingModule {
1083
- readonly canisterContext: CanisterContext;
1084
- readonly apiClient: ApiClient | undefined;
1085
- readonly evmReadClient: EvmReadClient | undefined;
1083
+ private readonly canisterContext;
1084
+ private readonly apiClient;
1085
+ private readonly evmReadClient;
1086
1086
  constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, evmReadClient: EvmReadClient | undefined);
1087
1087
  /**
1088
1088
  * Prepares a withdraw action that can be signed and submitted later.
@@ -1170,12 +1170,13 @@ declare class LendingModule {
1170
1170
  * Estimates the network/deposit fee for an inflow target.
1171
1171
  *
1172
1172
  * ETH stablecoin deposit-address estimates are served by the deposit-address
1173
- * canister. BTC estimates are not exposed by this SDK yet and return zero.
1173
+ * canister. BTC estimates include the ckBTC minter deposit fee and ledger fee.
1174
1174
  *
1175
1175
  * @param request - Asset and chain pair to estimate for.
1176
- * @returns Total fee estimate in the asset's base units.
1176
+ * @returns Total fee estimate rounded up in the asset's base units.
1177
1177
  */
1178
1178
  estimateInflowFee(request: EstimateInflowFeeRequest): Promise<InflowFeeEstimate>;
1179
+ private estimateBtcInflowFee;
1179
1180
  private sendAndSubmitNativeSupplyInflow;
1180
1181
  private submitSupplyFlowInflow;
1181
1182
  private executeContractSupply;
@@ -1199,6 +1200,7 @@ declare class LendingModule {
1199
1200
  private requireApi;
1200
1201
  private requireEvmReadClient;
1201
1202
  private getPoolById;
1203
+ private normalizeOutflowReceiverAddress;
1202
1204
  private sendEthContractTransaction;
1203
1205
  private waitForExpectedAllowance;
1204
1206
  }
@@ -1283,8 +1285,8 @@ interface PoolRate {
1283
1285
 
1284
1286
  /** Pool metadata, prices, and current rate helpers. */
1285
1287
  declare class MarketModule {
1286
- readonly canisterContext: CanisterContext;
1287
- readonly apiClient: ApiClient | undefined;
1288
+ private readonly canisterContext;
1289
+ private readonly apiClient;
1288
1290
  constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined);
1289
1291
  /**
1290
1292
  * Lists all pools with their current rates.
@@ -1422,7 +1424,7 @@ interface MaxRepayAmount {
1422
1424
 
1423
1425
  /** Profile position, health factor, and reserve valuation helpers. */
1424
1426
  declare class PositionsModule {
1425
- readonly canisterContext: CanisterContext;
1427
+ private readonly canisterContext;
1426
1428
  readonly market: MarketModule;
1427
1429
  constructor(canisterContext: CanisterContext, market: MarketModule);
1428
1430
  /**
@@ -1470,7 +1472,7 @@ declare class PositionsModule {
1470
1472
  * Returns the per-reserve breakdown of a profile's supplies and borrows,
1471
1473
  * joined with pool metadata, rates, and current USD prices.
1472
1474
  *
1473
- * USD values are scaled to {@link USD_VALUE_SCALE_DECIMALS} (27).
1475
+ * USD values are scaled to 27 decimals.
1474
1476
  *
1475
1477
  * @param profileId - The Liquidium profile principal text.
1476
1478
  * @returns Per-reserve position rows joined with pool metadata and USD values.
@@ -1574,11 +1576,13 @@ interface CreateInstantLoanRequest {
1574
1576
  */
1575
1577
  borrowAsset: InstantLoanAsset;
1576
1578
  /**
1577
- * Amount the user is expected to deposit as collateral, in base units.
1579
+ * Intended credited collateral amount, in base units.
1578
1580
  *
1579
- * This is used to validate LTV and initialize the loan record. For BTC, pass
1580
- * satoshis. For token assets, convert the UI amount using the selected pool's
1581
- * `decimals` value.
1581
+ * This is used to validate LTV and initialize the loan record before
1582
+ * deposit/inflow fees are deducted. For BTC, pass satoshis. For token assets,
1583
+ * convert the UI amount using the selected pool's `decimals` value. After
1584
+ * creation, use `loan.initialDeposit.amount` as the fee-inclusive transfer
1585
+ * amount to send to `loan.initialDeposit.target`.
1582
1586
  */
1583
1587
  collateralAmount: bigint;
1584
1588
  /**
@@ -1736,6 +1740,23 @@ interface InstantLoanRepayment {
1736
1740
  /** Address or ICRC account where the repayment should be sent. */
1737
1741
  target: SupplyTarget;
1738
1742
  }
1743
+ /** Initial collateral deposit quote returned when an instant loan is created. */
1744
+ interface InstantLoanInitialDeposit {
1745
+ /** Full amount to send to the deposit target, including the estimated inflow fee. */
1746
+ amount: bigint;
1747
+ /** Decimal scale for `amount`, `collateralAmount`, and `inflowFeeAmount`. */
1748
+ decimals: bigint;
1749
+ /** Intended credited collateral amount in base units, before inflow fees. */
1750
+ collateralAmount: bigint;
1751
+ /** Inflow fee amount in base units added to the transfer amount. */
1752
+ inflowFeeAmount: bigint;
1753
+ /** Collateral asset to deposit. */
1754
+ asset: MarketAsset;
1755
+ /** Chain used for the collateral deposit. */
1756
+ chain: MarketChain;
1757
+ /** Address or ICRC account where the collateral should be sent. */
1758
+ target: SupplyTarget;
1759
+ }
1739
1760
  /** Current lending position backing the instant loan. */
1740
1761
  interface InstantLoanPositionSummary {
1741
1762
  /** Current collateral amount in the collateral asset's base units. */
@@ -1760,9 +1781,45 @@ declare const InstantLoanStatus: {
1760
1781
  readonly active: "active";
1761
1782
  readonly settling: "settling";
1762
1783
  readonly closed: "closed";
1784
+ readonly expired: "expired";
1763
1785
  };
1764
1786
  type InstantLoanStatus = (typeof InstantLoanStatus)[keyof typeof InstantLoanStatus];
1765
- /** Hydrated instant-loan state plus generated deposit and repayment targets. */
1787
+ /** Immutable terms selected for an instant loan. */
1788
+ interface InstantLoanTerms {
1789
+ /** Maximum loan-to-value ratio in basis points. */
1790
+ ltvMaxBps: bigint;
1791
+ /** Seconds allowed for the collateral deposit before timeout. */
1792
+ depositWindowSeconds: bigint;
1793
+ }
1794
+ /** Collateral leg selected for an instant loan. */
1795
+ interface InstantLoanCollateral {
1796
+ /** Principal text of the collateral pool. */
1797
+ poolId: string;
1798
+ /** Collateral asset symbol. */
1799
+ asset: MarketAsset;
1800
+ /** Chain used for collateral deposits. */
1801
+ chain: MarketChain;
1802
+ /** Decimal scale for collateral amounts. */
1803
+ decimals: bigint;
1804
+ /** Intended credited collateral amount in base units, before inflow fees. */
1805
+ amount: bigint;
1806
+ }
1807
+ /** Borrow leg selected for an instant loan. */
1808
+ interface InstantLoanBorrow {
1809
+ /** Principal text of the borrow pool. */
1810
+ poolId: string;
1811
+ /** Borrow asset symbol. */
1812
+ asset: MarketAsset;
1813
+ /** Chain used for repayment. */
1814
+ chain: MarketChain;
1815
+ /** Decimal scale for borrow and debt amounts. */
1816
+ decimals: bigint;
1817
+ /** Requested borrow amount in base units. */
1818
+ amount: bigint;
1819
+ /** Destination that receives the borrowed asset. */
1820
+ destination: InstantLoanAccount;
1821
+ }
1822
+ /** Hydrated instant-loan state plus generated quote targets. */
1766
1823
  interface InstantLoan {
1767
1824
  /** Canister-assigned loan id. */
1768
1825
  loanId: bigint;
@@ -1772,32 +1829,17 @@ interface InstantLoan {
1772
1829
  status: InstantLoanStatus;
1773
1830
  /** Generated lending profile principal used by the instant loan. */
1774
1831
  profileId: string;
1775
- /** Maximum loan-to-value ratio in basis points. */
1776
- ltvMaxBps: bigint;
1777
- /** Seconds allowed for the collateral deposit before timeout. */
1778
- depositWindowSeconds: bigint;
1779
- /** Collateral-side pool, asset, chain, and current or requested collateral amount. */
1780
- collateral: {
1781
- poolId: string;
1782
- asset: MarketAsset;
1783
- chain: MarketChain;
1784
- amount: bigint;
1785
- };
1786
- /** Borrow-side pool, asset, chain, requested amount, and destination. */
1787
- borrow: {
1788
- poolId: string;
1789
- asset: MarketAsset;
1790
- chain: MarketChain;
1791
- amount: bigint;
1792
- destination: InstantLoanAccount;
1793
- };
1832
+ /** Immutable loan terms. */
1833
+ terms: InstantLoanTerms;
1834
+ /** Collateral-side pool, asset, chain, decimals, and requested credited amount. */
1835
+ collateral: InstantLoanCollateral;
1836
+ /** Borrow-side pool, asset, chain, decimals, requested amount, and destination. */
1837
+ borrow: InstantLoanBorrow;
1794
1838
  /** Destination used for collateral refunds or withdrawals. */
1795
1839
  refundDestination: InstantLoanAccount;
1796
- /** Address or ICRC account where the user deposits collateral. */
1797
- depositTarget: SupplyTarget;
1798
- /** Address or ICRC account where the user repays debt. */
1799
- repayTarget: SupplyTarget;
1800
- /** Current actionable repayment quote. */
1840
+ /** Current actionable initial collateral deposit quote. */
1841
+ initialDeposit: InstantLoanInitialDeposit;
1842
+ /** Current repayment quote. Amount fields are zero when the loan has no debt. */
1801
1843
  repayment: InstantLoanRepayment;
1802
1844
  /** Current lending position state for the generated profile. */
1803
1845
  position: InstantLoanPositionSummary;
@@ -1825,20 +1867,20 @@ interface InstantLoanCandidate {
1825
1867
  collateralAsset: MarketAsset;
1826
1868
  /** Borrow asset symbol. */
1827
1869
  borrowAsset: MarketAsset;
1828
- /** Collateral amount hint in base units. */
1829
- collateralAmountHint: bigint;
1870
+ /** Collateral amount in base units. */
1871
+ collateralAmount: bigint;
1830
1872
  }
1831
1873
 
1832
1874
  /** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
1833
1875
  declare class InstantLoansModule {
1834
- readonly canisterContext: CanisterContext;
1835
- readonly apiClient: ApiClient | undefined;
1836
- readonly lending: LendingModule;
1837
- readonly positions: PositionsModule;
1876
+ private readonly canisterContext;
1877
+ private readonly apiClient;
1878
+ private readonly lending;
1879
+ private readonly positions;
1838
1880
  constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, lending: LendingModule, positions: PositionsModule);
1839
1881
  /**
1840
1882
  * Creates a profileless instant loan and returns canonical canister state plus
1841
- * deposit/repay targets for the generated lending profile.
1883
+ * generated initial-deposit and repayment quote targets.
1842
1884
  *
1843
1885
  * Choose `collateralPoolId` and `borrowPoolId` from
1844
1886
  * `client.market.listPools()`, convert UI amounts to base units with the
@@ -1851,7 +1893,7 @@ declare class InstantLoansModule {
1851
1893
  * SDK maps it to the canister's internal `ltv_timer_s` field.
1852
1894
  *
1853
1895
  * @param request - Pool ids, assets, base-unit amounts, LTV limit, timeout, and destinations.
1854
- * @returns Hydrated loan state plus generated deposit and repayment targets.
1896
+ * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1855
1897
  */
1856
1898
  create(request: CreateInstantLoanRequest): Promise<InstantLoan>;
1857
1899
  /**
@@ -1861,7 +1903,7 @@ declare class InstantLoansModule {
1861
1903
  * from the instant-loans canister.
1862
1904
  *
1863
1905
  * @param request - Canister loan id or short public reference.
1864
- * @returns Hydrated loan state plus generated deposit and repayment targets.
1906
+ * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1865
1907
  */
1866
1908
  get(request: InstantLoanGetRequest): Promise<InstantLoan>;
1867
1909
  /**
@@ -1914,8 +1956,10 @@ declare class InstantLoansModule {
1914
1956
  */
1915
1957
  findByAddress(address: string): Promise<InstantLoanCandidate[]>;
1916
1958
  private mapLoanRecord;
1959
+ private getCollateralAmountHint;
1917
1960
  private mapLoanWire;
1918
1961
  private hydrateLoan;
1962
+ private createInitialDepositQuote;
1919
1963
  private estimateRepaymentInflowFee;
1920
1964
  private requireApi;
1921
1965
  private validateInstantLoanLtvPolicy;
@@ -2213,4 +2257,4 @@ interface ExecuteWithOptions {
2213
2257
  */
2214
2258
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2215
2259
 
2216
- export { type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanCandidate, type InstantLoanGetRequest, InstantLoanStatus, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type ListActivitiesRequest, type LtvCalculation, type MarketAsset, type MarketChain, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };
2260
+ export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BorrowAction, type BorrowApyHistoryRequest, type BorrowOutflowDetails, type BorrowSubmitSignatureInfo, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIds, Chain, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateInstantLoanRequest, type CreateProfileParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type FindPoolQuery, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetEvmSupplyContextRequest, type HealthFactor, type HistoryEntry, HistoryModule, type IcrcAccountSupplyTarget, type InflowActivity, type InflowActivityKind, type InflowActivityStatus, type InflowFeeEstimate, InflowSubmitType, type InstantLoan, type InstantLoanAccount, type InstantLoanAsset, type InstantLoanAuthorization, type InstantLoanBorrow, type InstantLoanCandidate, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesRequest, type LtvCalculation, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type NativeAccount, type NativeAddressSupplyTarget, type OutflowActivity, type OutflowActivityKind, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, type PoolConfigHistoryEntry, type PoolConfigHistoryEntryApiItem, type PoolConfigHistoryResponse, type PoolHistoryEntry, type PoolHistoryEntryApiItem, type PoolHistoryRequest, type PoolHistoryResponse, type PoolRate, type Position, PositionsModule, type PrepareCreateProfileOptions, QuoteModule, type QuoteRequest, type QuoteResult, type QuoteValidationError, QuoteValidationErrorCode, type QuoteWarning, QuoteWarningCode, RATE_DECIMALS, RATE_SCALE, type SendBtcTransactionRequest, type SendEthTransactionRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtWalletAction, type SignableAction, type SignatureInfo, type SubmitInflowRequest, type SubmitInflowResponse, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryResponse, UserHistoryStatus, type UserHistoryStatusApi, type UserHistoryType, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserLiquidationHistoryType, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryType, type Wallet, type WalletAction, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, intFromPublicId, publicIdFromInt };