@liquidium/client 0.3.4 → 0.4.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/README.md CHANGED
@@ -160,6 +160,8 @@ Instant-loan integrations use this sequence:
160
160
 
161
161
  `client.instantLoans.create(...)` and `client.instantLoans.get(...)` return the generated Liquidium profile, current position state, an initial deposit quote with its transfer target, and a repayment quote with its transfer target. Repayment amount fields are zero when the loan has no debt. Users do not manage the generated profile.
162
162
 
163
+ `client.market.listPools()` returns only pools whose asset and chain variants are supported by this SDK version. Canister pools for unsupported variants such as `ICP` or `SOL` are omitted from the returned list.
164
+
163
165
  ## Core API
164
166
 
165
167
  ### `client.instantLoans.create(request)`
@@ -239,6 +241,18 @@ The SDK enforces product minimums before borrow creation:
239
241
 
240
242
  Use `getMinimumBorrowAmount(asset)` to display the same minimum that `client.quote.calculateLtv(...)`, `client.quote.getQuote(...)`, `client.instantLoans.create(...)`, and `client.lending.prepareBorrow(...)` enforce.
241
243
 
244
+ ### Withdraw minimums
245
+
246
+ The SDK enforces product minimums before withdraw creation:
247
+
248
+ | Asset | Minimum withdraw amount |
249
+ | --- | --- |
250
+ | BTC | `5_000n` sats |
251
+ | USDC | `1_000_000n` base units |
252
+ | USDT | `1_000_000n` base units |
253
+
254
+ Use `getMinimumWithdrawAmount(asset)` to display the same minimum that `client.lending.prepareWithdraw(...)` enforces.
255
+
242
256
  ### Profile full withdraw amounts
243
257
 
244
258
  For profile-based withdraw flows, call `client.positions.getFullWithdrawAmount(profileId, poolId)` before building the withdraw request. The helper returns `{ amount, decimals }`: pass `amount` to `client.lending.withdraw(...)` or `client.lending.prepareWithdraw(...)`, and use `decimals` for display formatting. Do not add `earnedInterest`; the returned amount already uses the current supplied balance.
@@ -250,7 +264,7 @@ Most instant-loan UIs show or store these fields:
250
264
  | Field | Use |
251
265
  | --- | --- |
252
266
  | `loan.ref` | Save and show this reference so the loan can be restored later |
253
- | `loan.status` | Show the lifecycle: `awaiting_deposit`, `deposit_detected`, `active`, `settling`, `closed`, or `expired` |
267
+ | `loan.status` | Shared lifecycle status: `{ operation, state, confirmations, requiredConfirmations }` |
254
268
  | `loan.initialDeposit.amount` | Fee-inclusive collateral amount to send after creation or restore |
255
269
  | `loan.initialDeposit.collateralAmount` | Intended credited collateral target used for LTV |
256
270
  | `loan.initialDeposit.target` | Address or ICRC account where the user sends collateral |
@@ -260,7 +274,7 @@ Most instant-loan UIs show or store these fields:
260
274
  | `loan.repayment.target` | Address or ICRC account where the user sends repayment |
261
275
  | `loan.position` | Current collateral, debt, and interest state for the generated profile |
262
276
 
263
- `client.instantLoans.find(...)` returns lightweight search matches with `loanId`, `ref`, `createdAt`, `profileId`, `collateral`, and `borrow`. Use `client.instantLoans.get(...)` to load full loan fields, and use `client.activities.list(...)` separately when you need deposit, borrow, repay, or withdraw activity.
277
+ `client.instantLoans.find(...)` returns lightweight search matches with `loanId`, `ref`, `createdAt`, `profileId`, `collateral`, and `borrow`. Use `client.instantLoans.get(...)` to load full loan fields, and use `client.activities.list(...)` separately when you need deposit, borrow, repayment, or withdrawal activity.
264
278
 
265
279
  ## Amounts
266
280
 
@@ -277,7 +291,22 @@ Use `Pool.decimals` from `client.market.listPools()` when converting user-entere
277
291
 
278
292
  Reload loans with `client.instantLoans.get({ ref })` when you need current state, transfer targets, or the latest repayment quote.
279
293
 
280
- Use activities to track collateral deposits, borrow outflows, repayment deposits, confirmations, and fee top-ups. The activities module accepts the saved instant-loan reference and resolves the generated profile for you:
294
+ Status-returning methods use the same `LiquidiumStatus` shape:
295
+
296
+ ```ts
297
+ type LiquidiumStatus = {
298
+ operation: "deposit" | "borrow" | "repayment" | "withdrawal" | "liquidation";
299
+ state: "action_required" | "confirming" | "processing" | "active" | "completed" | "failed" | "expired";
300
+ confirmations: number | null;
301
+ requiredConfirmations: number | null;
302
+ };
303
+ ```
304
+
305
+ `action_required` means the user or app must do something, such as sending funds. `confirming` means a tx is known but still needs confirmations. `processing` means confirmations are sufficient and Liquidium or the protocol is still processing. `active` means the loan is live and waiting for the next repayment action.
306
+
307
+ Use activities to track collateral deposits, borrow outflows, repayment deposits, confirmations, and fee top-ups. Activity confirmations are exposed on `activity.status`. Activity lists default to active items; pass `filter: "all"` when you need completed activity too. The activities module accepts the saved instant-loan reference and resolves the generated profile for you:
308
+
309
+ Activities expose chain transaction ids on `activity.txids` when ids are available.
281
310
 
282
311
  ```ts
283
312
  const activities = await client.activities.list({
@@ -310,12 +339,9 @@ Run the instant loan example:
310
339
  git clone https://github.com/Liquidium-Inc/liquidium-sdk.git
311
340
  cd liquidium-sdk
312
341
  pnpm install
313
- cp examples/instant-loans-flow/.env.example examples/instant-loans-flow/.env
314
342
  pnpm --filter @liquidium/example-instant-loans-flow dev
315
343
  ```
316
344
 
317
- Set `VITE_INFURA_API_KEY` when your flow needs Ethereum reads through Infura.
318
-
319
345
  ## Browser And Runtime Support
320
346
 
321
347
  Use the SDK in browser apps and modern TypeScript runtimes.