@liquidium/client 0.2.0 → 0.3.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
@@ -226,6 +226,16 @@ interface SignatureInfo {
226
226
  /** Account that produced the signature, when different from the action default. */
227
227
  account?: string;
228
228
  }
229
+ /** Request submitted after a BTC PSBT has been signed. */
230
+ interface SignPsbtSubmitRequest {
231
+ /** Base64-encoded signed PSBT. */
232
+ signedPsbtBase64: string;
233
+ }
234
+ /** Request submitted after an ETH transaction has been sent. */
235
+ interface SendEthTransactionSubmitRequest {
236
+ /** EVM transaction hash returned by the wallet. */
237
+ txHash: string;
238
+ }
229
239
  /** Prepared action that requires message signing before submit. */
230
240
  interface SignMessageWalletAction<TData, TResult> {
231
241
  /** Protocol action kind. */
@@ -260,9 +270,7 @@ interface SignPsbtWalletAction<TResult> {
260
270
  /** Base64-encoded unsigned PSBT. */
261
271
  psbtBase64: string;
262
272
  /** Submits the signed PSBT and resolves the protocol result. */
263
- submit(request: {
264
- signedPsbtBase64: string;
265
- }): Promise<TResult>;
273
+ submit(request: SignPsbtSubmitRequest): Promise<TResult>;
266
274
  }
267
275
  /** Prepared action that requires sending an ETH transaction before submit. */
268
276
  interface SendEthTransactionWalletAction<TResult> {
@@ -279,16 +287,28 @@ interface SendEthTransactionWalletAction<TResult> {
279
287
  /** EVM transaction request to send. */
280
288
  transaction: EthTransactionRequest;
281
289
  /** Submits the transaction hash and resolves the protocol result. */
282
- submit(request: {
283
- txHash: string;
284
- }): Promise<TResult>;
290
+ submit(request: SendEthTransactionSubmitRequest): Promise<TResult>;
285
291
  }
286
292
  /** Any prepared action returned by SDK methods and executable by {@link executeWith}. */
287
293
  type WalletAction<TResult> = SignMessageWalletAction<unknown, TResult> | SignPsbtWalletAction<TResult> | SendEthTransactionWalletAction<TResult>;
288
294
 
295
+ /** Options for preparing a profile-creation action. */
296
+ interface PrepareCreateProfileOptions {
297
+ /** Wallet address that will own the new profile. */
298
+ account: string;
299
+ }
300
+ /** Parameters for creating a profile through a wallet adapter. */
301
+ interface CreateProfileParams {
302
+ /** Wallet address that will own the new profile. */
303
+ account: string;
304
+ /** Chain used to sign the profile-creation message. */
305
+ chain: Chain;
306
+ /** Wallet adapter used to sign the profile-creation message. */
307
+ walletAdapter: WalletAdapter;
308
+ }
289
309
  /** Data embedded in a prepared profile-creation action. */
290
310
  interface CreateAccountData {
291
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
311
+ /** Unix expiry timestamp in seconds, included in the signed message. */
292
312
  expiryTimestamp: bigint;
293
313
  }
294
314
  /** Sign-message action that can be submitted after wallet signing. */
@@ -311,14 +331,6 @@ interface CreateAccountRequest {
311
331
  signatureInfo: SignatureInfo;
312
332
  }
313
333
 
314
- type PrepareCreateProfileOptions = {
315
- account: string;
316
- };
317
- type CreateProfileParams = {
318
- account: string;
319
- chain: Chain;
320
- walletAdapter: WalletAdapter;
321
- };
322
334
  /** Profile lifecycle and linked-wallet helpers. */
323
335
  declare class AccountsModule {
324
336
  private readonly canisterContext;
@@ -464,32 +476,56 @@ interface OutflowActivity extends BaseActivity {
464
476
  }
465
477
  /** Any activity returned by `activities.list` or `activities.getStatus`. */
466
478
  type Activity = InflowActivity | OutflowActivity;
467
- /** Request for listing activities by profile id or instant-loan short reference. */
468
- type ListActivitiesRequest = {
479
+ /** Shared request fields for listing activities. */
480
+ interface BaseListActivitiesRequest {
469
481
  /** Optional state filter; defaults to `all`. */
470
482
  filter?: ActivityFilter;
471
- } & ({
483
+ }
484
+ /** Activity list request scoped to a Liquidium profile. */
485
+ interface ListActivitiesByProfileRequest extends BaseListActivitiesRequest {
486
+ /** Profile principal text to list activities for. */
472
487
  profileId: string;
473
- } | {
488
+ }
489
+ /** Activity list request scoped to an instant-loan short reference. */
490
+ interface ListActivitiesByShortRefRequest extends BaseListActivitiesRequest {
491
+ /** Instant-loan short reference to list activities for. */
474
492
  shortRef: string;
475
- });
476
- /** Request for fetching one activity by id and owner identifier. */
477
- type GetActivityStatusRequest = {
493
+ }
494
+ /** Request for listing activities by profile id or instant-loan short reference. */
495
+ type ListActivitiesRequest = ListActivitiesByProfileRequest | ListActivitiesByShortRefRequest;
496
+ /** Shared request fields for an activity status lookup. */
497
+ interface BaseGetActivityStatusRequest {
478
498
  /** Activity or receipt id to look up. */
479
499
  id: string;
480
- } & ({
500
+ }
501
+ /** Activity status lookup scoped to a Liquidium profile. */
502
+ interface GetActivityStatusByProfileRequest extends BaseGetActivityStatusRequest {
503
+ /** Profile principal text that owns the activity. */
481
504
  profileId: string;
482
- } | {
505
+ }
506
+ /** Activity status lookup scoped to an instant-loan short reference. */
507
+ interface GetActivityStatusByShortRefRequest extends BaseGetActivityStatusRequest {
508
+ /** Instant-loan short reference that owns the activity. */
483
509
  shortRef: string;
484
- });
485
- /** Result of an activity status lookup. */
486
- type GetActivityStatusResponse = {
510
+ }
511
+ /** Request for fetching one activity by id and owner identifier. */
512
+ type GetActivityStatusRequest = GetActivityStatusByProfileRequest | GetActivityStatusByShortRefRequest;
513
+ /** Successful activity status lookup result. */
514
+ interface ActivityStatusFoundResponse {
515
+ /** Indicates the activity was found. */
487
516
  found: true;
517
+ /** Matched activity. */
488
518
  activity: Activity;
489
- } | {
519
+ }
520
+ /** Missing activity status lookup result. */
521
+ interface ActivityStatusNotFoundResponse {
522
+ /** Indicates the activity was not found. */
490
523
  found: false;
524
+ /** Requested activity or receipt id. */
491
525
  id: string;
492
- };
526
+ }
527
+ /** Result of an activity status lookup. */
528
+ type GetActivityStatusResponse = ActivityStatusFoundResponse | ActivityStatusNotFoundResponse;
493
529
 
494
530
  /** Receipt-oriented activity list and status helpers. */
495
531
  declare class ActivitiesModule {
@@ -774,6 +810,29 @@ declare class HistoryModule {
774
810
  getLiquidationHistory(user: string, market?: string, filters?: UserLiquidationHistoryFilters): Promise<PaginatedResponse<UserLiquidationHistoryEntry>>;
775
811
  }
776
812
 
813
+ /** Wallet execution dependencies for borrow and withdraw convenience methods. */
814
+ interface WalletExecutionParams {
815
+ /** Chain used by the signing wallet. */
816
+ signerChain: Chain;
817
+ /** Wallet adapter used to execute the prepared action. */
818
+ signerWalletAdapter: WalletAdapter;
819
+ }
820
+ /** EVM transaction payload returned by lending transaction builders. */
821
+ interface EvmContractTransaction {
822
+ /** Contract address to call. */
823
+ to: string;
824
+ /** Hex-encoded calldata. */
825
+ data: string;
826
+ }
827
+ /** Parameters for an ERC-20 transfer transaction. */
828
+ interface CreateTransferErc20TransactionParams {
829
+ /** ERC-20 token contract address. */
830
+ tokenAddress: string;
831
+ /** Destination EVM address. */
832
+ recipientAddress: string;
833
+ /** Transfer amount in token base units. */
834
+ amount: bigint;
835
+ }
777
836
  /** Destination account for a completed outflow. */
778
837
  interface OutflowReceiver {
779
838
  /** Destination account type reported by the protocol. */
@@ -781,6 +840,13 @@ interface OutflowReceiver {
781
840
  /** Destination principal or external-chain address. */
782
841
  account: string;
783
842
  }
843
+ /** External-chain destination for a completed outflow. */
844
+ interface ExternalOutflowReceiver {
845
+ /** Destination account type reported by the protocol. */
846
+ type: "External";
847
+ /** External-chain destination address. */
848
+ account: string;
849
+ }
784
850
  /**
785
851
  * Receipt for a borrow or withdraw submitted to the lending canister.
786
852
  *
@@ -804,18 +870,12 @@ interface OutflowDetails {
804
870
  /** Borrow receipt with an external-chain receiver. */
805
871
  type BorrowOutflowDetails = OutflowDetails & {
806
872
  outflowType: "borrow";
807
- receiver: {
808
- type: "External";
809
- account: string;
810
- };
873
+ receiver: ExternalOutflowReceiver;
811
874
  };
812
875
  /** Withdraw receipt with an external-chain receiver. */
813
876
  type WithdrawOutflowDetails = OutflowDetails & {
814
877
  outflowType: "withdraw";
815
- receiver: {
816
- type: "External";
817
- account: string;
818
- };
878
+ receiver: ExternalOutflowReceiver;
819
879
  };
820
880
  /** Signature payload for submitting a prepared borrow action. */
821
881
  interface BorrowSubmitSignatureInfo extends SignatureInfo {
@@ -841,7 +901,7 @@ interface CreateBorrowRequest {
841
901
  }
842
902
  /** Prepared borrow request data embedded in the signable action. */
843
903
  interface CreateBorrowData extends CreateBorrowRequest {
844
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
904
+ /** Unix expiry timestamp in seconds, included in the signed message. */
845
905
  expiryTimestamp: bigint;
846
906
  }
847
907
  /** Prepared action for creating a borrow outflow. */
@@ -870,7 +930,7 @@ interface CreateWithdrawRequest {
870
930
  }
871
931
  /** Prepared withdraw request data embedded in the signable action. */
872
932
  interface CreateWithdrawData extends CreateWithdrawRequest {
873
- /** Expiry timestamp, in protocol nanoseconds, included in the signed message. */
933
+ /** Unix expiry timestamp in seconds, included in the signed message. */
874
934
  expiryTimestamp: bigint;
875
935
  }
876
936
  /** Prepared action for creating a withdraw outflow. */
@@ -1014,6 +1074,17 @@ interface EstimateInflowFeeRequest {
1014
1074
  /** Chain to estimate for. */
1015
1075
  chain: Chain;
1016
1076
  }
1077
+ /** Request for an ETH stablecoin deposit address. */
1078
+ interface GetDepositAddressRequest {
1079
+ /** Liquidium profile principal text. */
1080
+ profileId: string;
1081
+ /** Pool principal text receiving the inflow. */
1082
+ poolId: string;
1083
+ /** ETH stablecoin asset. */
1084
+ asset: string;
1085
+ /** Deposit or repayment action for the inflow. */
1086
+ action: SupplyAction;
1087
+ }
1017
1088
  /** Fee estimate for an inflow target, rounded up to the asset's fee unit. */
1018
1089
  interface InflowFeeEstimate {
1019
1090
  /** Estimated total fee rounded up in the asset's base units. */
@@ -1074,10 +1145,6 @@ interface EvmSupplyContext {
1074
1145
  approvalStrategy: EvmSupplyApprovalStrategy;
1075
1146
  }
1076
1147
 
1077
- type WalletExecutionParams = {
1078
- signerChain: Chain;
1079
- signerWalletAdapter: WalletAdapter;
1080
- };
1081
1148
  /** Borrow, withdraw, supply, inflow reporting, and fee-estimation helpers. */
1082
1149
  declare class LendingModule {
1083
1150
  private readonly canisterContext;
@@ -1160,12 +1227,7 @@ declare class LendingModule {
1160
1227
  * @param request - Profile, pool, asset, and supply action.
1161
1228
  * @returns The EVM deposit address for the derived account.
1162
1229
  */
1163
- getDepositAddress(request: {
1164
- profileId: string;
1165
- poolId: string;
1166
- asset: string;
1167
- action: SupplyAction;
1168
- }): Promise<string>;
1230
+ getDepositAddress(request: GetDepositAddressRequest): Promise<string>;
1169
1231
  /**
1170
1232
  * Estimates the network/deposit fee for an inflow target.
1171
1233
  *
@@ -1259,7 +1321,7 @@ interface Pool {
1259
1321
  borrowIndex: bigint;
1260
1322
  /** Whether borrowing the same asset as collateral is allowed. */
1261
1323
  sameAssetBorrowing: boolean;
1262
- /** Last pool update timestamp when available. */
1324
+ /** Unix timestamp in seconds of the last pool update when available. */
1263
1325
  lastUpdated?: bigint;
1264
1326
  }
1265
1327
  /** USD price map keyed by market asset symbol. */
@@ -1332,7 +1394,7 @@ interface Position {
1332
1394
  poolId: string;
1333
1395
  /** Pool asset symbol. */
1334
1396
  asset: MarketAsset;
1335
- /** Supplied principal in base units. */
1397
+ /** Current supplied amount in base units. */
1336
1398
  deposited: bigint;
1337
1399
  /** Decimal scale for supplied amounts. */
1338
1400
  depositedDecimals: bigint;
@@ -1344,7 +1406,7 @@ interface Position {
1344
1406
  earnedInterest: bigint;
1345
1407
  /** Accrued borrow interest in base units. */
1346
1408
  debtInterest: bigint;
1347
- /** Protocol timestamp of the last position update. */
1409
+ /** Unix timestamp in seconds of the last position update. */
1348
1410
  lastUpdate: bigint;
1349
1411
  }
1350
1412
  /** Aggregate borrowing capacity for a profile. */
@@ -1421,6 +1483,13 @@ interface MaxRepayAmount {
1421
1483
  /** Decimal scale for `amount`. */
1422
1484
  decimals: bigint;
1423
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
+ }
1424
1493
 
1425
1494
  /** Profile position, health factor, and reserve valuation helpers. */
1426
1495
  declare class PositionsModule {
@@ -1488,17 +1557,22 @@ declare class PositionsModule {
1488
1557
  * @returns Buffered repayment amount in the borrowed asset's base units.
1489
1558
  */
1490
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>;
1491
1572
  }
1492
1573
 
1493
1574
  /** Builds calldata for an ERC-20 `transfer(recipient, amount)` transaction. */
1494
- declare function createTransferErc20Transaction(params: {
1495
- tokenAddress: string;
1496
- recipientAddress: string;
1497
- amount: bigint;
1498
- }): {
1499
- to: string;
1500
- data: string;
1501
- };
1575
+ declare function createTransferErc20Transaction(params: CreateTransferErc20TransactionParams): EvmContractTransaction;
1502
1576
 
1503
1577
  /** Asset symbols supported by the instant-loans canister. */
1504
1578
  type InstantLoanAsset = "BTC" | "SOL" | "USDC" | "USDT";
@@ -1626,12 +1700,49 @@ interface CreateInstantLoanRequest {
1626
1700
  */
1627
1701
  refundDestination: string | ExternalAccount;
1628
1702
  }
1703
+ /** Lookup request for loading an instant loan by numeric canister id. */
1704
+ interface InstantLoanGetByIdRequest {
1705
+ /** Canister-assigned loan id. */
1706
+ loanId: bigint;
1707
+ }
1708
+ /** Lookup request for loading an instant loan by short user-facing reference. */
1709
+ interface InstantLoanGetByRefRequest {
1710
+ /** Short user-facing reference derived from `loanId`. */
1711
+ ref: string;
1712
+ }
1629
1713
  /** Lookup request for loading canonical instant-loan state. */
1630
- type InstantLoanGetRequest = {
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. */
1631
1734
  loanId: bigint;
1632
- } | {
1735
+ /** Short user-facing reference derived from `loanId`. */
1633
1736
  ref: string;
1634
- };
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
+ }
1635
1746
  /** Page request for direct instant-loan canister event queries. */
1636
1747
  interface InstantLoanListEventsRequest {
1637
1748
  /** Event id to start from. */
@@ -1655,6 +1766,7 @@ interface InstantLoanAuthorization {
1655
1766
  interface InstantLoanWarmedProfile {
1656
1767
  id: bigint;
1657
1768
  authorization: InstantLoanAuthorization;
1769
+ /** Unix creation timestamp in seconds. */
1658
1770
  createdAt: bigint;
1659
1771
  profileId: string;
1660
1772
  }
@@ -1662,13 +1774,14 @@ interface InstantLoanWarmedProfile {
1662
1774
  interface InstantLoanEvent {
1663
1775
  id: bigint;
1664
1776
  schemaVersion: number;
1777
+ /** Unix event timestamp in seconds. */
1665
1778
  timestamp: bigint;
1666
1779
  eventType: InstantLoanEventType;
1667
1780
  }
1668
1781
  /** Instant-loan leg used when stuck funds are withdrawn. */
1669
1782
  type InstantLoanLeg = "Lend" | "Borrow";
1670
- /** Direct canister event payload returned by instant-loans event queries. */
1671
- type InstantLoanEventType = {
1783
+ /** Loan-created instant-loan event payload. */
1784
+ interface InstantLoanCreatedEventType {
1672
1785
  type: "LoanCreated";
1673
1786
  loanId: bigint;
1674
1787
  borrowDestination: InstantLoanAccount;
@@ -1681,42 +1794,59 @@ type InstantLoanEventType = {
1681
1794
  profileId: string;
1682
1795
  borrowPoolId: string;
1683
1796
  borrowAsset: InstantLoanAsset;
1684
- } | {
1797
+ }
1798
+ /** Full collateral withdrawal request event payload. */
1799
+ interface InstantLoanFullLendWithdrawalRequestedEventType {
1685
1800
  type: "FullLendWithdrawalRequested";
1686
1801
  loanId: bigint;
1687
1802
  account: InstantLoanAccount;
1688
1803
  poolId: string;
1689
- } | {
1804
+ }
1805
+ /** Borrow request event payload. */
1806
+ interface InstantLoanBorrowRequestedEventType {
1690
1807
  type: "BorrowRequested";
1691
1808
  loanId: bigint;
1692
1809
  account: InstantLoanAccount;
1693
1810
  poolId: string;
1694
1811
  amount: bigint;
1695
- } | {
1812
+ }
1813
+ /** Deposit timer exceeded event payload. */
1814
+ interface InstantLoanDepositTimerExceededEventType {
1696
1815
  type: "DepositTimerExceeded";
1697
1816
  loanId: bigint;
1698
- } | {
1817
+ }
1818
+ /** Stuck funds withdrawal request event payload. */
1819
+ interface InstantLoanStuckFundsWithdrawalRequestedEventType {
1699
1820
  type: "StuckFundsWithdrawalRequested";
1700
1821
  leg: InstantLoanLeg;
1701
1822
  loanId: bigint;
1702
1823
  account: InstantLoanAccount;
1703
1824
  poolId: string;
1704
1825
  amount: bigint;
1705
- } | {
1826
+ }
1827
+ /** Profile-warmed event payload. */
1828
+ interface InstantLoanProfileWarmedEventType {
1706
1829
  type: "ProfileWarmed";
1707
1830
  derivationIndex: Uint8Array;
1708
1831
  warmedProfileId: bigint;
1709
1832
  ethAddress: string;
1710
1833
  profileId: string;
1711
- } | {
1834
+ }
1835
+ /** Repay-complete event payload. */
1836
+ interface InstantLoanRepayCompleteEventType {
1712
1837
  type: "RepayComplete";
1713
1838
  loanId: bigint;
1714
1839
  profileId: string;
1715
- } | {
1840
+ }
1841
+ /** Deposit timer started event payload. */
1842
+ interface InstantLoanDepositTimerStartedEventType {
1716
1843
  type: "DepositTimerStarted";
1717
1844
  loanId: bigint;
1845
+ /** Unix timestamp in seconds when the deposit timer started. */
1718
1846
  timestamp: bigint;
1719
- };
1847
+ }
1848
+ /** Direct canister event payload returned by instant-loans event queries. */
1849
+ type InstantLoanEventType = InstantLoanCreatedEventType | InstantLoanFullLendWithdrawalRequestedEventType | InstantLoanBorrowRequestedEventType | InstantLoanDepositTimerExceededEventType | InstantLoanStuckFundsWithdrawalRequestedEventType | InstantLoanProfileWarmedEventType | InstantLoanRepayCompleteEventType | InstantLoanDepositTimerStartedEventType;
1720
1850
  /** Current amount to send to the repayment target to close the debt. */
1721
1851
  interface InstantLoanRepayment {
1722
1852
  /** Full amount to send to the repayment target, including fee and interest buffer. */
@@ -1756,6 +1886,10 @@ interface InstantLoanInitialDeposit {
1756
1886
  chain: MarketChain;
1757
1887
  /** Address or ICRC account where the collateral should be sent. */
1758
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;
1759
1893
  }
1760
1894
  /** Current lending position backing the instant loan. */
1761
1895
  interface InstantLoanPositionSummary {
@@ -1827,7 +1961,7 @@ interface InstantLoan {
1827
1961
  ref: string;
1828
1962
  /** Simplified lifecycle status for display and flow control. */
1829
1963
  status: InstantLoanStatus;
1830
- /** Generated lending profile principal used by the instant loan. */
1964
+ /** Generated profile principal used by the instant loan. */
1831
1965
  profileId: string;
1832
1966
  /** Immutable loan terms. */
1833
1967
  terms: InstantLoanTerms;
@@ -1844,32 +1978,6 @@ interface InstantLoan {
1844
1978
  /** Current lending position state for the generated profile. */
1845
1979
  position: InstantLoanPositionSummary;
1846
1980
  }
1847
- /**
1848
- * Discovery result returned by address lookup.
1849
- *
1850
- * Candidates are intentionally lightweight; call `instantLoans.get(...)` with
1851
- * `loanId` or `ref` to load canonical canister state and transfer targets.
1852
- */
1853
- interface InstantLoanCandidate {
1854
- /** Canister-assigned loan id. */
1855
- loanId: bigint;
1856
- /** Short user-facing reference derived from `loanId`. */
1857
- ref: string;
1858
- /** Generated lending profile principal used by the instant loan. */
1859
- profileId: string;
1860
- /** API-observed creation time, if provided by the indexer. */
1861
- createdAt?: Date;
1862
- /** Principal text of the collateral pool. */
1863
- collateralPoolId: string;
1864
- /** Principal text of the borrow pool. */
1865
- borrowPoolId: string;
1866
- /** Collateral asset symbol. */
1867
- collateralAsset: MarketAsset;
1868
- /** Borrow asset symbol. */
1869
- borrowAsset: MarketAsset;
1870
- /** Collateral amount in base units. */
1871
- collateralAmount: bigint;
1872
- }
1873
1981
 
1874
1982
  /** Accountless instant-loan creation, lookup, recovery, and canister query helpers. */
1875
1983
  declare class InstantLoansModule {
@@ -1906,6 +2014,16 @@ declare class InstantLoansModule {
1906
2014
  * @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
1907
2015
  */
1908
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[]>;
1909
2027
  /**
1910
2028
  * Returns the active instant-loans canister config via direct query.
1911
2029
  *
@@ -1944,20 +2062,10 @@ declare class InstantLoansModule {
1944
2062
  * @returns Warmed profile records available for assignment.
1945
2063
  */
1946
2064
  listWarmedProfiles(): Promise<InstantLoanWarmedProfile[]>;
1947
- /**
1948
- * Finds candidate loans associated with an address through the Liquidium SDK
1949
- * API. Returns discovery candidates only; call `get(...)` to hydrate canister state.
1950
- *
1951
- * Candidates are useful for recovery flows where the user knows a borrow or
1952
- * refund address but not the loan reference.
1953
- *
1954
- * @param address - Borrow or refund address to search for.
1955
- * @returns Lightweight loan candidates associated with the address.
1956
- */
1957
- findByAddress(address: string): Promise<InstantLoanCandidate[]>;
2065
+ private findCandidateLoansByQuery;
2066
+ private getLoanRecord;
1958
2067
  private mapLoanRecord;
1959
2068
  private getCollateralAmountHint;
1960
- private mapLoanWire;
1961
2069
  private hydrateLoan;
1962
2070
  private createInitialDepositQuote;
1963
2071
  private estimateRepaymentInflowFee;
@@ -2146,6 +2254,20 @@ declare class LiquidiumClient {
2146
2254
  constructor(config?: LiquidiumClientConfig);
2147
2255
  }
2148
2256
 
2257
+ /** Minimum borrow amounts in each asset's base units. */
2258
+ declare const MIN_BORROW_AMOUNTS_BY_ASSET: {
2259
+ readonly BTC: 5100n;
2260
+ readonly USDC: 1000000n;
2261
+ readonly USDT: 1000000n;
2262
+ };
2263
+ type MinimumBorrowAsset = keyof typeof MIN_BORROW_AMOUNTS_BY_ASSET;
2264
+ /**
2265
+ * Returns the minimum borrow amount for an asset in base units.
2266
+ *
2267
+ * Assets without a configured product minimum return `0n`.
2268
+ */
2269
+ declare function getMinimumBorrowAmount(asset: string): bigint;
2270
+
2149
2271
  /**
2150
2272
  * Stable string codes for {@link LiquidiumError}. Use for branching in application code.
2151
2273
  */
@@ -2257,4 +2379,4 @@ interface ExecuteWithOptions {
2257
2379
  */
2258
2380
  declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
2259
2381
 
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 };
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 };