@liquidium/client 0.3.4 → 0.4.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/README.md +20 -3
- package/dist/index.cjs +1114 -1206
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -277
- package/dist/index.d.ts +92 -277
- package/dist/index.js +1113 -1200
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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)`
|
|
@@ -250,7 +252,7 @@ Most instant-loan UIs show or store these fields:
|
|
|
250
252
|
| Field | Use |
|
|
251
253
|
| --- | --- |
|
|
252
254
|
| `loan.ref` | Save and show this reference so the loan can be restored later |
|
|
253
|
-
| `loan.status` |
|
|
255
|
+
| `loan.status` | Shared lifecycle status: `{ operation, state, confirmations, requiredConfirmations }` |
|
|
254
256
|
| `loan.initialDeposit.amount` | Fee-inclusive collateral amount to send after creation or restore |
|
|
255
257
|
| `loan.initialDeposit.collateralAmount` | Intended credited collateral target used for LTV |
|
|
256
258
|
| `loan.initialDeposit.target` | Address or ICRC account where the user sends collateral |
|
|
@@ -260,7 +262,7 @@ Most instant-loan UIs show or store these fields:
|
|
|
260
262
|
| `loan.repayment.target` | Address or ICRC account where the user sends repayment |
|
|
261
263
|
| `loan.position` | Current collateral, debt, and interest state for the generated profile |
|
|
262
264
|
|
|
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,
|
|
265
|
+
`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
266
|
|
|
265
267
|
## Amounts
|
|
266
268
|
|
|
@@ -277,7 +279,22 @@ Use `Pool.decimals` from `client.market.listPools()` when converting user-entere
|
|
|
277
279
|
|
|
278
280
|
Reload loans with `client.instantLoans.get({ ref })` when you need current state, transfer targets, or the latest repayment quote.
|
|
279
281
|
|
|
280
|
-
|
|
282
|
+
Status-returning methods use the same `LiquidiumStatus` shape:
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
type LiquidiumStatus = {
|
|
286
|
+
operation: "deposit" | "borrow" | "repayment" | "withdrawal" | "liquidation";
|
|
287
|
+
state: "action_required" | "confirming" | "processing" | "active" | "completed" | "failed" | "expired";
|
|
288
|
+
confirmations: number | null;
|
|
289
|
+
requiredConfirmations: number | null;
|
|
290
|
+
};
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
`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.
|
|
294
|
+
|
|
295
|
+
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:
|
|
296
|
+
|
|
297
|
+
Activities expose chain transaction ids on `activity.txids` when ids are available.
|
|
281
298
|
|
|
282
299
|
```ts
|
|
283
300
|
const activities = await client.activities.list({
|