@liquidium/client 0.2.1 → 0.3.1

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
@@ -308,7 +308,7 @@ interface CreateProfileParams {
308
308
  }
309
309
  /** Data embedded in a prepared profile-creation action. */
310
310
  interface CreateAccountData {
311
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
311
+ /** Unix expiry timestamp in seconds, included in the signed message. */
312
312
  expiryTimestamp: bigint;
313
313
  }
314
314
  /** Sign-message action that can be submitted after wallet signing. */
@@ -901,7 +901,7 @@ interface CreateBorrowRequest {
901
901
  }
902
902
  /** Prepared borrow request data embedded in the signable action. */
903
903
  interface CreateBorrowData extends CreateBorrowRequest {
904
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
904
+ /** Unix expiry timestamp in seconds, included in the signed message. */
905
905
  expiryTimestamp: bigint;
906
906
  }
907
907
  /** Prepared action for creating a borrow outflow. */
@@ -930,7 +930,7 @@ interface CreateWithdrawRequest {
930
930
  }
931
931
  /** Prepared withdraw request data embedded in the signable action. */
932
932
  interface CreateWithdrawData extends CreateWithdrawRequest {
933
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
933
+ /** Unix expiry timestamp in seconds, included in the signed message. */
934
934
  expiryTimestamp: bigint;
935
935
  }
936
936
  /** Prepared action for creating a withdraw outflow. */
@@ -1321,7 +1321,7 @@ interface Pool {
1321
1321
  borrowIndex: bigint;
1322
1322
  /** Whether borrowing the same asset as collateral is allowed. */
1323
1323
  sameAssetBorrowing: boolean;
1324
- /** Last pool update timestamp when available. */
1324
+ /** Unix timestamp in seconds of the last pool update when available. */
1325
1325
  lastUpdated?: bigint;
1326
1326
  }
1327
1327
  /** USD price map keyed by market asset symbol. */
@@ -1394,7 +1394,7 @@ interface Position {
1394
1394
  poolId: string;
1395
1395
  /** Pool asset symbol. */
1396
1396
  asset: MarketAsset;
1397
- /** Supplied principal in base units. */
1397
+ /** Current supplied amount in base units. */
1398
1398
  deposited: bigint;
1399
1399
  /** Decimal scale for supplied amounts. */
1400
1400
  depositedDecimals: bigint;
@@ -1406,7 +1406,7 @@ interface Position {
1406
1406
  earnedInterest: bigint;
1407
1407
  /** Accrued borrow interest in base units. */
1408
1408
  debtInterest: bigint;
1409
- /** Protocol timestamp of the last position update. */
1409
+ /** Unix timestamp in seconds of the last position update. */
1410
1410
  lastUpdate: bigint;
1411
1411
  }
1412
1412
  /** Aggregate borrowing capacity for a profile. */
@@ -1483,6 +1483,13 @@ interface MaxRepayAmount {
1483
1483
  /** Decimal scale for `amount`. */
1484
1484
  decimals: bigint;
1485
1485
  }
1486
+ /** Full withdraw amount for a position. */
1487
+ interface FullWithdrawAmount {
1488
+ /** Amount to withdraw in the supplied asset's base units. */
1489
+ amount: bigint;
1490
+ /** Decimal scale for `amount`. */
1491
+ decimals: bigint;
1492
+ }
1486
1493
 
1487
1494
  /** Profile position, health factor, and reserve valuation helpers. */
1488
1495
  declare class PositionsModule {
@@ -1550,6 +1557,18 @@ declare class PositionsModule {
1550
1557
  * @returns Buffered repayment amount in the borrowed asset's base units.
1551
1558
  */
1552
1559
  getMaxRepayAmount(profileId: string, poolId: string, bufferBps?: bigint): Promise<MaxRepayAmount>;
1560
+ /**
1561
+ * Returns the current full withdraw amount for a position.
1562
+ *
1563
+ * `Position.deposited` already reflects the current supplied balance at the
1564
+ * latest lending index; do not add `earnedInterest` to this amount.
1565
+ * Pass `amount` to withdraw calls and use `decimals` for display formatting.
1566
+ *
1567
+ * @param profileId - The Liquidium profile principal text.
1568
+ * @param poolId - The pool principal text.
1569
+ * @returns Full withdraw amount in the supplied asset's base units.
1570
+ */
1571
+ getFullWithdrawAmount(profileId: string, poolId: string): Promise<FullWithdrawAmount>;
1553
1572
  }
1554
1573
 
1555
1574
  /** Builds calldata for an ERC-20 `transfer(recipient, amount)` transaction. */
@@ -1693,6 +1712,37 @@ interface InstantLoanGetByRefRequest {
1693
1712
  }
1694
1713
  /** Lookup request for loading canonical instant-loan state. */
1695
1714
  type InstantLoanGetRequest = InstantLoanGetByIdRequest | InstantLoanGetByRefRequest;
1715
+ /** Collateral leg returned by instant-loan search. */
1716
+ interface InstantLoanFindCollateral {
1717
+ /** Principal text of the collateral pool. */
1718
+ poolId: string;
1719
+ /** Asset the user deposits as collateral. */
1720
+ asset: InstantLoanAsset;
1721
+ /** Intended credited collateral amount in base units, before inflow fees. */
1722
+ amount: bigint;
1723
+ }
1724
+ /** Borrow leg returned by instant-loan search. */
1725
+ interface InstantLoanFindBorrow {
1726
+ /** Principal text of the borrow pool. */
1727
+ poolId: string;
1728
+ /** Asset the user borrows. */
1729
+ asset: InstantLoanAsset;
1730
+ }
1731
+ /** Lightweight search result for an instant loan match. */
1732
+ interface InstantLoanFindResult {
1733
+ /** Canister-assigned loan id. Use this with `client.instantLoans.get({ loanId })` to load full loan state. */
1734
+ loanId: bigint;
1735
+ /** Short user-facing reference derived from `loanId`. */
1736
+ ref: string;
1737
+ /** Unix creation timestamp in seconds. */
1738
+ createdAt: bigint;
1739
+ /** Collateral-side pool, asset, and requested credited amount. */
1740
+ collateral: InstantLoanFindCollateral;
1741
+ /** Borrow-side pool and asset. */
1742
+ borrow: InstantLoanFindBorrow;
1743
+ /** Generated profile principal from the search index. */
1744
+ profileId: string;
1745
+ }
1696
1746
  /** Page request for direct instant-loan canister event queries. */
1697
1747
  interface InstantLoanListEventsRequest {
1698
1748
  /** Event id to start from. */
@@ -1716,6 +1766,7 @@ interface InstantLoanAuthorization {
1716
1766
  interface InstantLoanWarmedProfile {
1717
1767
  id: bigint;
1718
1768
  authorization: InstantLoanAuthorization;
1769
+ /** Unix creation timestamp in seconds. */
1719
1770
  createdAt: bigint;
1720
1771
  profileId: string;
1721
1772
  }
@@ -1723,6 +1774,7 @@ interface InstantLoanWarmedProfile {
1723
1774
  interface InstantLoanEvent {
1724
1775
  id: bigint;
1725
1776
  schemaVersion: number;
1777
+ /** Unix event timestamp in seconds. */
1726
1778
  timestamp: bigint;
1727
1779
  eventType: InstantLoanEventType;
1728
1780
  }
@@ -1790,6 +1842,7 @@ interface InstantLoanRepayCompleteEventType {
1790
1842
  interface InstantLoanDepositTimerStartedEventType {
1791
1843
  type: "DepositTimerStarted";
1792
1844
  loanId: bigint;
1845
+ /** Unix timestamp in seconds when the deposit timer started. */
1793
1846
  timestamp: bigint;
1794
1847
  }
1795
1848
  /** Direct canister event payload returned by instant-loans event queries. */
@@ -1833,6 +1886,10 @@ interface InstantLoanInitialDeposit {
1833
1886
  chain: MarketChain;
1834
1887
  /** Address or ICRC account where the collateral should be sent. */
1835
1888
  target: SupplyTarget;
1889
+ /** Unix timestamp in seconds when the collateral deposit was detected, or null before detection. */
1890
+ detectedTimestamp: bigint | null;
1891
+ /** Unix timestamp in seconds when the collateral deposit window expires, or null before detection when unavailable. */
1892
+ expiryTimestamp: bigint | null;
1836
1893
  }
1837
1894
  /** Current lending position backing the instant loan. */
1838
1895
  interface InstantLoanPositionSummary {
@@ -1904,7 +1961,7 @@ interface InstantLoan {
1904
1961
  ref: string;
1905
1962
  /** Simplified lifecycle status for display and flow control. */
1906
1963
  status: InstantLoanStatus;
1907
- /** Generated lending profile principal used by the instant loan. */
1964
+ /** Generated profile principal used by the instant loan. */
1908
1965
  profileId: string;
1909
1966
  /** Immutable loan terms. */
1910
1967
  terms: InstantLoanTerms;
@@ -1921,32 +1978,6 @@ interface InstantLoan {
1921
1978
  /** Current lending position state for the generated profile. */
1922
1979
  position: InstantLoanPositionSummary;
1923
1980
  }
1924
- /**
1925
- * Discovery result returned by address lookup.
1926
- *
1927
- * Candidates are intentionally lightweight; call `instantLoans.get(...)` with
1928
- * `loanId` or `ref` to load canonical canister state and transfer targets.
1929
- */
1930
- interface InstantLoanCandidate {
1931
- /** Canister-assigned loan id. */
1932
- loanId: bigint;
1933
- /** Short user-facing reference derived from `loanId`. */
1934
- ref: string;
1935
- /** Generated lending profile principal used by the instant loan. */
1936
- profileId: string;
1937
- /** API-observed creation time, if provided by the indexer. */
1938
- createdAt?: Date;
1939
- /** Principal text of the collateral pool. */
1940
- collateralPoolId: string;
1941
- /** Principal text of the borrow pool. */
1942
- borrowPoolId: string;
1943
- /** Collateral asset symbol. */
1944
- collateralAsset: MarketAsset;
1945
- /** Borrow asset symbol. */
1946
- borrowAsset: MarketAsset;
1947
- /** Collateral amount in base units. */
1948
- collateralAmount: bigint;
1949
- }
1950
1981
 
1951
1982
  /** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
1952
1983
  declare class InstantLoansModule {
@@ -1983,6 +2014,16 @@ declare class InstantLoansModule {
1983
2014
  * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1984
2015
  */
1985
2016
  get(request: InstantLoanGetRequest): Promise<InstantLoan>;
2017
+ /**
2018
+ * Finds instant loans by short reference, numeric loan id string, address, or transaction id.
2019
+ *
2020
+ * Search returns lightweight matches. Call `get({ loanId })` or `get({ ref })`
2021
+ * when the user selects a match and you need hydrated loan state.
2022
+ *
2023
+ * @param query - Short reference, address, transaction id/hash, or numeric loan id string.
2024
+ * @returns Matching loan ids and references from the search index.
2025
+ */
2026
+ find(query: string): Promise<InstantLoanFindResult[]>;
1986
2027
  /**
1987
2028
  * Returns the active instant-loans canister config via direct query.
1988
2029
  *
@@ -2021,20 +2062,10 @@ declare class InstantLoansModule {
2021
2062
  * @returns Warmed profile records available for assignment.
2022
2063
  */
2023
2064
  listWarmedProfiles(): Promise<InstantLoanWarmedProfile[]>;
2024
- /**
2025
- * Finds candidate loans associated with an address through the Liquidium SDK
2026
- * API. Returns discovery candidates only; call `get(...)` to hydrate canister state.
2027
- *
2028
- * Candidates are useful for recovery flows where the user knows a borrow or
2029
- * refund address but not the loan reference.
2030
- *
2031
- * @param address - Borrow or refund address to search for.
2032
- * @returns Lightweight loan candidates associated with the address.
2033
- */
2034
- findByAddress(address: string): Promise<InstantLoanCandidate[]>;
2065
+ private findCandidateLoansByQuery;
2066
+ private getLoanRecord;
2035
2067
  private mapLoanRecord;
2036
2068
  private getCollateralAmountHint;
2037
- private mapLoanWire;
2038
2069
  private hydrateLoan;
2039
2070
  private createInitialDepositQuote;
2040
2071
  private estimateRepaymentInflowFee;
@@ -2348,4 +2379,4 @@ interface ExecuteWithOptions {
2348
2379
  */
2349
2380
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2350
2381
 
2351
- export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, 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 CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type ExternalOutflowReceiver, type FindPoolQuery, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, 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 InstantLoanBorrowRequestedEventType, type InstantLoanCandidate, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanCreatedEventType, type InstantLoanDepositTimerExceededEventType, type InstantLoanDepositTimerStartedEventType, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanFullLendWithdrawalRequestedEventType, type InstantLoanGetByIdRequest, type InstantLoanGetByRefRequest, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanProfileWarmedEventType, type InstantLoanRepayCompleteEventType, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanStuckFundsWithdrawalRequestedEventType, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesByProfileRequest, type ListActivitiesByShortRefRequest, type ListActivitiesRequest, type LtvCalculation, MIN_BORROW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, 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 SendEthTransactionSubmitRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtSubmitRequest, 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, getMinimumBorrowAmount, intFromPublicId, publicIdFromInt };
2382
+ export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, 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 CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type ExternalOutflowReceiver, type FindPoolQuery, type FullWithdrawAmount, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, 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 InstantLoanBorrowRequestedEventType, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanCreatedEventType, type InstantLoanDepositTimerExceededEventType, type InstantLoanDepositTimerStartedEventType, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanFindBorrow, type InstantLoanFindCollateral, type InstantLoanFindResult, type InstantLoanFullLendWithdrawalRequestedEventType, type InstantLoanGetByIdRequest, type InstantLoanGetByRefRequest, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanProfileWarmedEventType, type InstantLoanRepayCompleteEventType, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanStuckFundsWithdrawalRequestedEventType, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesByProfileRequest, type ListActivitiesByShortRefRequest, type ListActivitiesRequest, type LtvCalculation, MIN_BORROW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, 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 SendEthTransactionSubmitRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtSubmitRequest, 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, getMinimumBorrowAmount, intFromPublicId, publicIdFromInt };
package/dist/index.d.ts CHANGED
@@ -308,7 +308,7 @@ interface CreateProfileParams {
308
308
  }
309
309
  /** Data embedded in a prepared profile-creation action. */
310
310
  interface CreateAccountData {
311
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
311
+ /** Unix expiry timestamp in seconds, included in the signed message. */
312
312
  expiryTimestamp: bigint;
313
313
  }
314
314
  /** Sign-message action that can be submitted after wallet signing. */
@@ -901,7 +901,7 @@ interface CreateBorrowRequest {
901
901
  }
902
902
  /** Prepared borrow request data embedded in the signable action. */
903
903
  interface CreateBorrowData extends CreateBorrowRequest {
904
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
904
+ /** Unix expiry timestamp in seconds, included in the signed message. */
905
905
  expiryTimestamp: bigint;
906
906
  }
907
907
  /** Prepared action for creating a borrow outflow. */
@@ -930,7 +930,7 @@ interface CreateWithdrawRequest {
930
930
  }
931
931
  /** Prepared withdraw request data embedded in the signable action. */
932
932
  interface CreateWithdrawData extends CreateWithdrawRequest {
933
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
933
+ /** Unix expiry timestamp in seconds, included in the signed message. */
934
934
  expiryTimestamp: bigint;
935
935
  }
936
936
  /** Prepared action for creating a withdraw outflow. */
@@ -1321,7 +1321,7 @@ interface Pool {
1321
1321
  borrowIndex: bigint;
1322
1322
  /** Whether borrowing the same asset as collateral is allowed. */
1323
1323
  sameAssetBorrowing: boolean;
1324
- /** Last pool update timestamp when available. */
1324
+ /** Unix timestamp in seconds of the last pool update when available. */
1325
1325
  lastUpdated?: bigint;
1326
1326
  }
1327
1327
  /** USD price map keyed by market asset symbol. */
@@ -1394,7 +1394,7 @@ interface Position {
1394
1394
  poolId: string;
1395
1395
  /** Pool asset symbol. */
1396
1396
  asset: MarketAsset;
1397
- /** Supplied principal in base units. */
1397
+ /** Current supplied amount in base units. */
1398
1398
  deposited: bigint;
1399
1399
  /** Decimal scale for supplied amounts. */
1400
1400
  depositedDecimals: bigint;
@@ -1406,7 +1406,7 @@ interface Position {
1406
1406
  earnedInterest: bigint;
1407
1407
  /** Accrued borrow interest in base units. */
1408
1408
  debtInterest: bigint;
1409
- /** Protocol timestamp of the last position update. */
1409
+ /** Unix timestamp in seconds of the last position update. */
1410
1410
  lastUpdate: bigint;
1411
1411
  }
1412
1412
  /** Aggregate borrowing capacity for a profile. */
@@ -1483,6 +1483,13 @@ interface MaxRepayAmount {
1483
1483
  /** Decimal scale for `amount`. */
1484
1484
  decimals: bigint;
1485
1485
  }
1486
+ /** Full withdraw amount for a position. */
1487
+ interface FullWithdrawAmount {
1488
+ /** Amount to withdraw in the supplied asset's base units. */
1489
+ amount: bigint;
1490
+ /** Decimal scale for `amount`. */
1491
+ decimals: bigint;
1492
+ }
1486
1493
 
1487
1494
  /** Profile position, health factor, and reserve valuation helpers. */
1488
1495
  declare class PositionsModule {
@@ -1550,6 +1557,18 @@ declare class PositionsModule {
1550
1557
  * @returns Buffered repayment amount in the borrowed asset's base units.
1551
1558
  */
1552
1559
  getMaxRepayAmount(profileId: string, poolId: string, bufferBps?: bigint): Promise<MaxRepayAmount>;
1560
+ /**
1561
+ * Returns the current full withdraw amount for a position.
1562
+ *
1563
+ * `Position.deposited` already reflects the current supplied balance at the
1564
+ * latest lending index; do not add `earnedInterest` to this amount.
1565
+ * Pass `amount` to withdraw calls and use `decimals` for display formatting.
1566
+ *
1567
+ * @param profileId - The Liquidium profile principal text.
1568
+ * @param poolId - The pool principal text.
1569
+ * @returns Full withdraw amount in the supplied asset's base units.
1570
+ */
1571
+ getFullWithdrawAmount(profileId: string, poolId: string): Promise<FullWithdrawAmount>;
1553
1572
  }
1554
1573
 
1555
1574
  /** Builds calldata for an ERC-20 `transfer(recipient, amount)` transaction. */
@@ -1693,6 +1712,37 @@ interface InstantLoanGetByRefRequest {
1693
1712
  }
1694
1713
  /** Lookup request for loading canonical instant-loan state. */
1695
1714
  type InstantLoanGetRequest = InstantLoanGetByIdRequest | InstantLoanGetByRefRequest;
1715
+ /** Collateral leg returned by instant-loan search. */
1716
+ interface InstantLoanFindCollateral {
1717
+ /** Principal text of the collateral pool. */
1718
+ poolId: string;
1719
+ /** Asset the user deposits as collateral. */
1720
+ asset: InstantLoanAsset;
1721
+ /** Intended credited collateral amount in base units, before inflow fees. */
1722
+ amount: bigint;
1723
+ }
1724
+ /** Borrow leg returned by instant-loan search. */
1725
+ interface InstantLoanFindBorrow {
1726
+ /** Principal text of the borrow pool. */
1727
+ poolId: string;
1728
+ /** Asset the user borrows. */
1729
+ asset: InstantLoanAsset;
1730
+ }
1731
+ /** Lightweight search result for an instant loan match. */
1732
+ interface InstantLoanFindResult {
1733
+ /** Canister-assigned loan id. Use this with `client.instantLoans.get({ loanId })` to load full loan state. */
1734
+ loanId: bigint;
1735
+ /** Short user-facing reference derived from `loanId`. */
1736
+ ref: string;
1737
+ /** Unix creation timestamp in seconds. */
1738
+ createdAt: bigint;
1739
+ /** Collateral-side pool, asset, and requested credited amount. */
1740
+ collateral: InstantLoanFindCollateral;
1741
+ /** Borrow-side pool and asset. */
1742
+ borrow: InstantLoanFindBorrow;
1743
+ /** Generated profile principal from the search index. */
1744
+ profileId: string;
1745
+ }
1696
1746
  /** Page request for direct instant-loan canister event queries. */
1697
1747
  interface InstantLoanListEventsRequest {
1698
1748
  /** Event id to start from. */
@@ -1716,6 +1766,7 @@ interface InstantLoanAuthorization {
1716
1766
  interface InstantLoanWarmedProfile {
1717
1767
  id: bigint;
1718
1768
  authorization: InstantLoanAuthorization;
1769
+ /** Unix creation timestamp in seconds. */
1719
1770
  createdAt: bigint;
1720
1771
  profileId: string;
1721
1772
  }
@@ -1723,6 +1774,7 @@ interface InstantLoanWarmedProfile {
1723
1774
  interface InstantLoanEvent {
1724
1775
  id: bigint;
1725
1776
  schemaVersion: number;
1777
+ /** Unix event timestamp in seconds. */
1726
1778
  timestamp: bigint;
1727
1779
  eventType: InstantLoanEventType;
1728
1780
  }
@@ -1790,6 +1842,7 @@ interface InstantLoanRepayCompleteEventType {
1790
1842
  interface InstantLoanDepositTimerStartedEventType {
1791
1843
  type: "DepositTimerStarted";
1792
1844
  loanId: bigint;
1845
+ /** Unix timestamp in seconds when the deposit timer started. */
1793
1846
  timestamp: bigint;
1794
1847
  }
1795
1848
  /** Direct canister event payload returned by instant-loans event queries. */
@@ -1833,6 +1886,10 @@ interface InstantLoanInitialDeposit {
1833
1886
  chain: MarketChain;
1834
1887
  /** Address or ICRC account where the collateral should be sent. */
1835
1888
  target: SupplyTarget;
1889
+ /** Unix timestamp in seconds when the collateral deposit was detected, or null before detection. */
1890
+ detectedTimestamp: bigint | null;
1891
+ /** Unix timestamp in seconds when the collateral deposit window expires, or null before detection when unavailable. */
1892
+ expiryTimestamp: bigint | null;
1836
1893
  }
1837
1894
  /** Current lending position backing the instant loan. */
1838
1895
  interface InstantLoanPositionSummary {
@@ -1904,7 +1961,7 @@ interface InstantLoan {
1904
1961
  ref: string;
1905
1962
  /** Simplified lifecycle status for display and flow control. */
1906
1963
  status: InstantLoanStatus;
1907
- /** Generated lending profile principal used by the instant loan. */
1964
+ /** Generated profile principal used by the instant loan. */
1908
1965
  profileId: string;
1909
1966
  /** Immutable loan terms. */
1910
1967
  terms: InstantLoanTerms;
@@ -1921,32 +1978,6 @@ interface InstantLoan {
1921
1978
  /** Current lending position state for the generated profile. */
1922
1979
  position: InstantLoanPositionSummary;
1923
1980
  }
1924
- /**
1925
- * Discovery result returned by address lookup.
1926
- *
1927
- * Candidates are intentionally lightweight; call `instantLoans.get(...)` with
1928
- * `loanId` or `ref` to load canonical canister state and transfer targets.
1929
- */
1930
- interface InstantLoanCandidate {
1931
- /** Canister-assigned loan id. */
1932
- loanId: bigint;
1933
- /** Short user-facing reference derived from `loanId`. */
1934
- ref: string;
1935
- /** Generated lending profile principal used by the instant loan. */
1936
- profileId: string;
1937
- /** API-observed creation time, if provided by the indexer. */
1938
- createdAt?: Date;
1939
- /** Principal text of the collateral pool. */
1940
- collateralPoolId: string;
1941
- /** Principal text of the borrow pool. */
1942
- borrowPoolId: string;
1943
- /** Collateral asset symbol. */
1944
- collateralAsset: MarketAsset;
1945
- /** Borrow asset symbol. */
1946
- borrowAsset: MarketAsset;
1947
- /** Collateral amount in base units. */
1948
- collateralAmount: bigint;
1949
- }
1950
1981
 
1951
1982
  /** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
1952
1983
  declare class InstantLoansModule {
@@ -1983,6 +2014,16 @@ declare class InstantLoansModule {
1983
2014
  * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1984
2015
  */
1985
2016
  get(request: InstantLoanGetRequest): Promise<InstantLoan>;
2017
+ /**
2018
+ * Finds instant loans by short reference, numeric loan id string, address, or transaction id.
2019
+ *
2020
+ * Search returns lightweight matches. Call `get({ loanId })` or `get({ ref })`
2021
+ * when the user selects a match and you need hydrated loan state.
2022
+ *
2023
+ * @param query - Short reference, address, transaction id/hash, or numeric loan id string.
2024
+ * @returns Matching loan ids and references from the search index.
2025
+ */
2026
+ find(query: string): Promise<InstantLoanFindResult[]>;
1986
2027
  /**
1987
2028
  * Returns the active instant-loans canister config via direct query.
1988
2029
  *
@@ -2021,20 +2062,10 @@ declare class InstantLoansModule {
2021
2062
  * @returns Warmed profile records available for assignment.
2022
2063
  */
2023
2064
  listWarmedProfiles(): Promise<InstantLoanWarmedProfile[]>;
2024
- /**
2025
- * Finds candidate loans associated with an address through the Liquidium SDK
2026
- * API. Returns discovery candidates only; call `get(...)` to hydrate canister state.
2027
- *
2028
- * Candidates are useful for recovery flows where the user knows a borrow or
2029
- * refund address but not the loan reference.
2030
- *
2031
- * @param address - Borrow or refund address to search for.
2032
- * @returns Lightweight loan candidates associated with the address.
2033
- */
2034
- findByAddress(address: string): Promise<InstantLoanCandidate[]>;
2065
+ private findCandidateLoansByQuery;
2066
+ private getLoanRecord;
2035
2067
  private mapLoanRecord;
2036
2068
  private getCollateralAmountHint;
2037
- private mapLoanWire;
2038
2069
  private hydrateLoan;
2039
2070
  private createInitialDepositQuote;
2040
2071
  private estimateRepaymentInflowFee;
@@ -2348,4 +2379,4 @@ interface ExecuteWithOptions {
2348
2379
  */
2349
2380
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2350
2381
 
2351
- export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, 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 CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type ExternalOutflowReceiver, type FindPoolQuery, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, 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 InstantLoanBorrowRequestedEventType, type InstantLoanCandidate, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanCreatedEventType, type InstantLoanDepositTimerExceededEventType, type InstantLoanDepositTimerStartedEventType, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanFullLendWithdrawalRequestedEventType, type InstantLoanGetByIdRequest, type InstantLoanGetByRefRequest, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanProfileWarmedEventType, type InstantLoanRepayCompleteEventType, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanStuckFundsWithdrawalRequestedEventType, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesByProfileRequest, type ListActivitiesByShortRefRequest, type ListActivitiesRequest, type LtvCalculation, MIN_BORROW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, 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 SendEthTransactionSubmitRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtSubmitRequest, 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, getMinimumBorrowAmount, intFromPublicId, publicIdFromInt };
2382
+ export { AccountsModule, ActivitiesModule, type ActivitiesRequest, type Activity, ActivityDirection, ActivityFilter, ActivityKind, ActivityStatus, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, type ApySample, Asset, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, 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 CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type ExternalAccount, type ExternalOutflowReceiver, type FindPoolQuery, type FullWithdrawAmount, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, 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 InstantLoanBorrowRequestedEventType, type InstantLoanCollateral, type InstantLoanConfig, type InstantLoanCreatedEventType, type InstantLoanDepositTimerExceededEventType, type InstantLoanDepositTimerStartedEventType, type InstantLoanEvent, type InstantLoanEventType, type InstantLoanFindBorrow, type InstantLoanFindCollateral, type InstantLoanFindResult, type InstantLoanFullLendWithdrawalRequestedEventType, type InstantLoanGetByIdRequest, type InstantLoanGetByRefRequest, type InstantLoanGetRequest, type InstantLoanInitialDeposit, type InstantLoanLeg, type InstantLoanListEventsRequest, type InstantLoanPositionSummary, type InstantLoanProfileWarmedEventType, type InstantLoanRepayCompleteEventType, type InstantLoanRepayment, InstantLoanStatus, type InstantLoanStuckFundsWithdrawalRequestedEventType, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type ListActivitiesByProfileRequest, type ListActivitiesByShortRefRequest, type ListActivitiesRequest, type LtvCalculation, MIN_BORROW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, type MarketAsset, type MarketChain, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, 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 SendEthTransactionSubmitRequest, type SendEthTransactionWalletAction, type SignMessageRequest, type SignMessageWalletAction, type SignPsbtRequest, type SignPsbtSubmitRequest, 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, getMinimumBorrowAmount, intFromPublicId, publicIdFromInt };