Instant Loans
Use instant loans for a checkout-style borrow flow. The SDK creates a generated Liquidium profile, returns transfer targets, and lets your app restore the loan from a short reference.
Flow
| Step | SDK call | Your app does |
|---|---|---|
| Load market data | client.market.listPools() and client.market.getAssetPrices() | Show supported collateral and borrow assets |
| Validate amounts | client.quote.calculateLtv(...) | Block invalid LTV or frozen-pool input before creation |
| Create loan | client.instantLoans.create(...) | Store loan.ref and show loan.depositTarget |
| Track loan | client.instantLoans.get({ ref }) and client.activities.list({ shortRef: ref }) | Reload state and monitor deposits, borrows, and repayments |
| Repay loan | Read loan.repayment | Ask the user to send loan.repayment.amount to loan.repayment.target |
Create Request
| Field | Description |
|---|---|
collateralPoolId | Pool that receives the collateral deposit |
borrowPoolId | Pool the loan borrows from |
collateralAsset | Collateral asset symbol, for example "BTC" |
borrowAsset | Borrow asset symbol, for example "USDC" |
collateralAmount | Collateral amount in base units |
borrowAmount | Borrow amount in base units |
ltvMaxBps | Maximum LTV in basis points, where 6_000n is 60% |
depositWindowSeconds | How long the user has to send collateral |
borrowDestination | External address that receives borrowed funds |
refundDestination | External address that receives collateral refunds |
borrowDestination and refundDestination can be address strings or account objects such as { type: "External", address: "bc1q..." }.
Restore State
Use the user-facing reference for refreshes, status pages, and support links:
const loan = await client.instantLoans.get({ ref: savedReference });
Use the numeric loan ID when your backend stores it:
const loan = await client.instantLoans.get({ loanId });
Use address recovery only when the user lost the reference:
const candidates = await client.instantLoans.findByAddress(address);
Candidates are lightweight. Load canonical state with client.instantLoans.get(...) before you show transfer targets or repayment amounts.