@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/dist/index.d.cts
CHANGED
|
@@ -87,17 +87,10 @@ type SupplyAction = (typeof SupplyAction)[keyof typeof SupplyAction];
|
|
|
87
87
|
declare const OutflowType: {
|
|
88
88
|
readonly borrow: "borrow";
|
|
89
89
|
readonly feeClaim: "feeClaim";
|
|
90
|
-
readonly
|
|
90
|
+
readonly withdrawal: "withdrawal";
|
|
91
91
|
};
|
|
92
92
|
/** Outflow operation reported by the lending canister. */
|
|
93
93
|
type OutflowType = (typeof OutflowType)[keyof typeof OutflowType];
|
|
94
|
-
/** Inflow submit type expected by the SDK API. */
|
|
95
|
-
declare const InflowSubmitType: {
|
|
96
|
-
readonly DEPOSIT: "DEPOSIT";
|
|
97
|
-
readonly REPAY: "REPAY";
|
|
98
|
-
};
|
|
99
|
-
/** Inflow submit type expected by the SDK API. */
|
|
100
|
-
type InflowSubmitType = (typeof InflowSubmitType)[keyof typeof InflowSubmitType];
|
|
101
94
|
/** Wallet address and chain pair linked to a Liquidium profile. */
|
|
102
95
|
interface Wallet {
|
|
103
96
|
/** Chain where the wallet address is valid. */
|
|
@@ -205,12 +198,12 @@ interface SendBtcTransactionRequest {
|
|
|
205
198
|
* - `signMessage` - account creation, borrow, withdraw
|
|
206
199
|
* - `sendBtcTransaction` / `sendEthTransaction` - automated transfer-path supply
|
|
207
200
|
* - `sendEthTransaction` - contract-interaction supply and ETH native sends
|
|
208
|
-
* - `signPsbt` - reserved
|
|
201
|
+
* - `signPsbt` - reserved; no current SDK flow emits PSBT-signing actions
|
|
209
202
|
*/
|
|
210
203
|
interface WalletAdapter {
|
|
211
204
|
/** Signs an SDK plaintext message and returns the wallet signature. BTC adapters may return base64 BIP-322 or hex-encoded signature bytes. */
|
|
212
205
|
signMessage?: (request: SignMessageRequest) => Promise<string>;
|
|
213
|
-
/**
|
|
206
|
+
/** Reserved for future PSBT-signing flows; no current SDK method calls this. */
|
|
214
207
|
signPsbt?: (request: SignPsbtRequest) => Promise<string>;
|
|
215
208
|
/** Sends an EVM transaction and returns its transaction hash. */
|
|
216
209
|
sendEthTransaction?: (request: SendEthTransactionRequest) => Promise<string>;
|
|
@@ -239,7 +232,7 @@ interface SendEthTransactionSubmitRequest {
|
|
|
239
232
|
/** Prepared action that requires message signing before submit. */
|
|
240
233
|
interface SignMessageWalletAction<TData, TResult> {
|
|
241
234
|
/** Protocol action kind. */
|
|
242
|
-
kind:
|
|
235
|
+
kind: WalletActionKind;
|
|
243
236
|
/** Wallet capability required to execute the action. */
|
|
244
237
|
executionKind: typeof WalletExecutionKind.signMessage;
|
|
245
238
|
/** Adapter-facing action type. */
|
|
@@ -255,10 +248,10 @@ interface SignMessageWalletAction<TData, TResult> {
|
|
|
255
248
|
/** Submits the signature and resolves the protocol result. */
|
|
256
249
|
submit(signatureInfo: SignatureInfo): Promise<TResult>;
|
|
257
250
|
}
|
|
258
|
-
/**
|
|
251
|
+
/** Reserved prepared action for future BTC PSBT-signing flows. */
|
|
259
252
|
interface SignPsbtWalletAction<TResult> {
|
|
260
253
|
/** Protocol action kind. */
|
|
261
|
-
kind:
|
|
254
|
+
kind: WalletActionKind;
|
|
262
255
|
/** Wallet capability required to execute the action. */
|
|
263
256
|
executionKind: typeof WalletExecutionKind.signPsbt;
|
|
264
257
|
/** Adapter-facing action type. */
|
|
@@ -275,7 +268,7 @@ interface SignPsbtWalletAction<TResult> {
|
|
|
275
268
|
/** Prepared action that requires sending an ETH transaction before submit. */
|
|
276
269
|
interface SendEthTransactionWalletAction<TResult> {
|
|
277
270
|
/** Protocol action kind. */
|
|
278
|
-
kind:
|
|
271
|
+
kind: WalletActionKind;
|
|
279
272
|
/** Wallet capability required to execute the action. */
|
|
280
273
|
executionKind: typeof WalletExecutionKind.sendEthTransaction;
|
|
281
274
|
/** Adapter-facing action type. */
|
|
@@ -385,42 +378,30 @@ interface ApiClient {
|
|
|
385
378
|
post<TResponse, TBody>(path: string, body: TBody): Promise<TResponse>;
|
|
386
379
|
}
|
|
387
380
|
|
|
388
|
-
/**
|
|
381
|
+
/** Lifecycle operation represented by a Liquidium status. */
|
|
382
|
+
type LiquidiumOperation = "deposit" | "borrow" | "repayment" | "withdrawal" | "liquidation";
|
|
383
|
+
/** Lifecycle state represented by a Liquidium status. */
|
|
384
|
+
type LiquidiumState = "action_required" | "confirming" | "processing" | "active" | "completed" | "failed" | "expired";
|
|
385
|
+
/** Shared lifecycle status returned by SDK methods that expose flow state. */
|
|
386
|
+
interface LiquidiumStatus {
|
|
387
|
+
/** Operation currently represented by the status. */
|
|
388
|
+
operation: LiquidiumOperation;
|
|
389
|
+
/** Current lifecycle state for the operation. */
|
|
390
|
+
state: LiquidiumState;
|
|
391
|
+
/** Observed chain confirmations, or null when unavailable or not applicable. */
|
|
392
|
+
confirmations: number | null;
|
|
393
|
+
/** Required confirmations, or null when unavailable or not applicable. */
|
|
394
|
+
requiredConfirmations: number | null;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** Activity list lifecycle filter. */
|
|
389
398
|
declare const ActivityFilter: {
|
|
390
399
|
readonly active: "active";
|
|
391
400
|
readonly completed: "completed";
|
|
392
401
|
readonly all: "all";
|
|
393
402
|
};
|
|
394
|
-
/** Activity list
|
|
403
|
+
/** Activity list lifecycle filter. */
|
|
395
404
|
type ActivityFilter = (typeof ActivityFilter)[keyof typeof ActivityFilter];
|
|
396
|
-
/** Direction of value movement for an activity. */
|
|
397
|
-
declare const ActivityDirection: {
|
|
398
|
-
readonly inflow: "inflow";
|
|
399
|
-
readonly outflow: "outflow";
|
|
400
|
-
};
|
|
401
|
-
/** Direction of value movement for an activity. */
|
|
402
|
-
type ActivityDirection = (typeof ActivityDirection)[keyof typeof ActivityDirection];
|
|
403
|
-
/** Consumer-facing activity kind. */
|
|
404
|
-
declare const ActivityKind: {
|
|
405
|
-
readonly deposit: "deposit";
|
|
406
|
-
readonly repayment: "repayment";
|
|
407
|
-
readonly borrow: "borrow";
|
|
408
|
-
readonly withdraw: "withdraw";
|
|
409
|
-
};
|
|
410
|
-
/** Consumer-facing activity kind. */
|
|
411
|
-
type ActivityKind = (typeof ActivityKind)[keyof typeof ActivityKind];
|
|
412
|
-
/** Consumer-facing activity lifecycle status. */
|
|
413
|
-
declare const ActivityStatus: {
|
|
414
|
-
readonly requested: "requested";
|
|
415
|
-
readonly pending: "pending";
|
|
416
|
-
readonly detected: "detected";
|
|
417
|
-
readonly processing: "processing";
|
|
418
|
-
readonly sent: "sent";
|
|
419
|
-
readonly confirmed: "confirmed";
|
|
420
|
-
readonly failed: "failed";
|
|
421
|
-
};
|
|
422
|
-
/** Consumer-facing activity lifecycle status. */
|
|
423
|
-
type ActivityStatus = (typeof ActivityStatus)[keyof typeof ActivityStatus];
|
|
424
405
|
/** Fee top-up state for an inflow activity. */
|
|
425
406
|
interface ActivityTopUp {
|
|
426
407
|
/** Whether another transfer is needed before processing can continue. */
|
|
@@ -432,14 +413,16 @@ interface ActivityTopUp {
|
|
|
432
413
|
/** Additional amount needed before processing can start. */
|
|
433
414
|
shortfallAmount: bigint;
|
|
434
415
|
}
|
|
435
|
-
/**
|
|
436
|
-
type
|
|
437
|
-
/**
|
|
438
|
-
type
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
type OutflowActivityStatus =
|
|
416
|
+
/** Operation emitted by deposit or repayment inflows. */
|
|
417
|
+
type InflowActivityOperation = Extract<LiquidiumOperation, "deposit" | "repayment">;
|
|
418
|
+
/** Operation emitted by borrow or withdrawal outflows. */
|
|
419
|
+
type OutflowActivityOperation = Extract<LiquidiumOperation, "borrow" | "withdrawal">;
|
|
420
|
+
type InflowActivityStatus = LiquidiumStatus & {
|
|
421
|
+
operation: InflowActivityOperation;
|
|
422
|
+
};
|
|
423
|
+
type OutflowActivityStatus = LiquidiumStatus & {
|
|
424
|
+
operation: OutflowActivityOperation;
|
|
425
|
+
};
|
|
443
426
|
interface BaseActivity {
|
|
444
427
|
id: string;
|
|
445
428
|
poolId: string;
|
|
@@ -447,29 +430,19 @@ interface BaseActivity {
|
|
|
447
430
|
chain: Chain | null;
|
|
448
431
|
amount: bigint;
|
|
449
432
|
timestampMs: number;
|
|
450
|
-
|
|
433
|
+
/** Chain transaction ids associated with the activity when available. */
|
|
451
434
|
txids?: string[];
|
|
452
|
-
confirmations: number | null;
|
|
453
|
-
requiredConfirmations: number | null;
|
|
454
435
|
}
|
|
455
436
|
/** Deposit or repayment activity returned by the activity API. */
|
|
456
437
|
interface InflowActivity extends BaseActivity {
|
|
457
|
-
/**
|
|
458
|
-
direction: typeof ActivityDirection.inflow;
|
|
459
|
-
/** Deposit or repayment kind. */
|
|
460
|
-
kind: InflowActivityKind;
|
|
461
|
-
/** Single consumer-facing lifecycle status. */
|
|
438
|
+
/** Shared consumer-facing lifecycle status. */
|
|
462
439
|
status: InflowActivityStatus;
|
|
463
440
|
/** Fee top-up state when the inflow is below the current processing fee. */
|
|
464
441
|
topUp?: ActivityTopUp;
|
|
465
442
|
}
|
|
466
|
-
/** Borrow or
|
|
443
|
+
/** Borrow or withdrawal activity returned by the activity API. */
|
|
467
444
|
interface OutflowActivity extends BaseActivity {
|
|
468
|
-
/**
|
|
469
|
-
direction: typeof ActivityDirection.outflow;
|
|
470
|
-
/** Borrow or withdraw kind. */
|
|
471
|
-
kind: OutflowActivityKind;
|
|
472
|
-
/** Single consumer-facing lifecycle status. */
|
|
445
|
+
/** Shared consumer-facing lifecycle status. */
|
|
473
446
|
status: OutflowActivityStatus;
|
|
474
447
|
/** Outflows never carry top-up state. */
|
|
475
448
|
topUp?: never;
|
|
@@ -478,7 +451,7 @@ interface OutflowActivity extends BaseActivity {
|
|
|
478
451
|
type Activity = InflowActivity | OutflowActivity;
|
|
479
452
|
/** Shared request fields for listing activities. */
|
|
480
453
|
interface BaseListActivitiesRequest {
|
|
481
|
-
/** Optional
|
|
454
|
+
/** Optional lifecycle filter; defaults to `active`. */
|
|
482
455
|
filter?: ActivityFilter;
|
|
483
456
|
}
|
|
484
457
|
/** Activity list request scoped to a Liquidium profile. */
|
|
@@ -533,11 +506,11 @@ declare class ActivitiesModule {
|
|
|
533
506
|
private readonly canisterContext;
|
|
534
507
|
constructor(apiClient: ApiClient | undefined, canisterContext: CanisterContext);
|
|
535
508
|
/**
|
|
536
|
-
* Lists profile activities. Defaults to
|
|
509
|
+
* Lists profile activities. Defaults to active activities.
|
|
537
510
|
*
|
|
538
511
|
* Uses the Liquidium SDK API.
|
|
539
512
|
*
|
|
540
|
-
* @param request - Profile id or instant-loan short reference plus optional
|
|
513
|
+
* @param request - Profile id or instant-loan short reference plus optional lifecycle filter.
|
|
541
514
|
* @returns Activities owned by the resolved profile.
|
|
542
515
|
*/
|
|
543
516
|
list(request: ListActivitiesRequest): Promise<Activity[]>;
|
|
@@ -554,23 +527,12 @@ declare class ActivitiesModule {
|
|
|
554
527
|
private resolveProfileId;
|
|
555
528
|
}
|
|
556
529
|
|
|
557
|
-
/**
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
};
|
|
564
|
-
/** Consumer-facing status for profile transaction history entries. */
|
|
565
|
-
type UserHistoryStatus = (typeof UserHistoryStatus)[keyof typeof UserHistoryStatus];
|
|
566
|
-
/** Uppercase status value used by SDK API responses. */
|
|
567
|
-
type UserHistoryStatusApi = Uppercase<UserHistoryStatus>;
|
|
568
|
-
/** User transaction kinds returned by profile transaction history. */
|
|
569
|
-
type UserTransactionHistoryType = "supply" | "borrow" | "repay" | "withdraw";
|
|
570
|
-
/** User liquidation history kind. */
|
|
571
|
-
type UserLiquidationHistoryType = "liquidation";
|
|
572
|
-
/** Any user history kind returned by the history API. */
|
|
573
|
-
type UserHistoryType = UserTransactionHistoryType | UserLiquidationHistoryType;
|
|
530
|
+
/** User transaction operations returned by profile transaction history. */
|
|
531
|
+
type UserTransactionHistoryOperation = LiquidiumOperation;
|
|
532
|
+
/** Any user history operation returned by the history API. */
|
|
533
|
+
type UserHistoryOperation = UserTransactionHistoryOperation;
|
|
534
|
+
/** Lifecycle states accepted by profile transaction history filters. */
|
|
535
|
+
type UserTransactionHistoryState = Exclude<LiquidiumState, "active" | "expired">;
|
|
574
536
|
interface BaseUserHistoryEntry {
|
|
575
537
|
id: string;
|
|
576
538
|
amount: bigint;
|
|
@@ -578,19 +540,15 @@ interface BaseUserHistoryEntry {
|
|
|
578
540
|
timestamp: string;
|
|
579
541
|
txids?: string[];
|
|
580
542
|
}
|
|
581
|
-
/**
|
|
543
|
+
/** Deposit, borrow, repayment, withdrawal, or liquidation entry in user history. */
|
|
582
544
|
interface UserTransactionHistoryEntry extends BaseUserHistoryEntry {
|
|
583
|
-
/** Transaction history kind. */
|
|
584
|
-
type: UserTransactionHistoryType;
|
|
585
545
|
/** Current lifecycle status. */
|
|
586
|
-
status:
|
|
546
|
+
status: LiquidiumStatus;
|
|
587
547
|
}
|
|
588
548
|
/** Liquidation entry in user history. */
|
|
589
549
|
interface UserLiquidationHistoryEntry extends BaseUserHistoryEntry {
|
|
590
|
-
/**
|
|
591
|
-
|
|
592
|
-
/** Liquidations are only returned once confirmed. */
|
|
593
|
-
status: typeof UserHistoryStatus.confirmed;
|
|
550
|
+
/** Current lifecycle status. */
|
|
551
|
+
status: LiquidiumStatus;
|
|
594
552
|
}
|
|
595
553
|
/** Any consumer-facing profile history entry. */
|
|
596
554
|
type UserHistoryEntry = UserTransactionHistoryEntry | UserLiquidationHistoryEntry;
|
|
@@ -604,10 +562,10 @@ interface UserTransactionHistoryFilters {
|
|
|
604
562
|
market?: string;
|
|
605
563
|
/** Pool principal text filter. */
|
|
606
564
|
poolId?: string;
|
|
607
|
-
/** Transaction
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
|
|
565
|
+
/** Transaction operation filters. */
|
|
566
|
+
operations?: UserTransactionHistoryOperation[];
|
|
567
|
+
/** Lifecycle state filters. */
|
|
568
|
+
states?: UserTransactionHistoryState[];
|
|
611
569
|
/** Inclusive start timestamp filter accepted by the SDK API. */
|
|
612
570
|
from?: string;
|
|
613
571
|
/** Inclusive end timestamp filter accepted by the SDK API. */
|
|
@@ -628,131 +586,20 @@ interface UserLiquidationHistoryFilters {
|
|
|
628
586
|
/** Inclusive end timestamp filter accepted by the SDK API. */
|
|
629
587
|
to?: string;
|
|
630
588
|
}
|
|
631
|
-
/** Backwards-compatible alias for user transaction history filters. */
|
|
632
|
-
type ActivitiesRequest = UserTransactionHistoryFilters;
|
|
633
|
-
/** Time-window and pagination options for borrow APY history. */
|
|
634
|
-
interface BorrowApyHistoryRequest {
|
|
635
|
-
/** Pagination cursor from a previous response. */
|
|
636
|
-
cursor?: string;
|
|
637
|
-
/** Maximum number of samples to return. */
|
|
638
|
-
limit?: number;
|
|
639
|
-
/** Inclusive start timestamp filter accepted by the SDK API. */
|
|
640
|
-
from?: string;
|
|
641
|
-
/** Inclusive end timestamp filter accepted by the SDK API. */
|
|
642
|
-
to?: string;
|
|
643
|
-
}
|
|
644
|
-
/** Time-window and pagination options for pool rate history. */
|
|
645
|
-
type PoolHistoryRequest = BorrowApyHistoryRequest;
|
|
646
|
-
/** Borrow APY sample returned to SDK consumers. */
|
|
647
|
-
interface ApySample {
|
|
648
|
-
/** Sample date from the SDK API. */
|
|
649
|
-
date: string;
|
|
650
|
-
/** Decimal scale for `avgRate`. */
|
|
651
|
-
rateDecimals: bigint;
|
|
652
|
-
/** Average borrow rate for the sample, scaled by `rateDecimals`. */
|
|
653
|
-
avgRate: bigint;
|
|
654
|
-
}
|
|
655
589
|
/** Wire-format user history item returned by the SDK API. */
|
|
656
590
|
interface UserHistoryEntryApiItem {
|
|
657
591
|
id: string;
|
|
658
|
-
type: UserHistoryType;
|
|
659
592
|
amount: string;
|
|
660
593
|
poolId: string;
|
|
661
594
|
timestamp: string;
|
|
662
|
-
status:
|
|
595
|
+
status: LiquidiumStatus;
|
|
663
596
|
txids?: string[];
|
|
664
597
|
}
|
|
665
598
|
/** Wire-format user history page returned by the SDK API. */
|
|
666
599
|
interface UserHistoryResponse {
|
|
667
|
-
success: true;
|
|
668
600
|
items: UserHistoryEntryApiItem[];
|
|
669
601
|
nextCursor?: string;
|
|
670
602
|
}
|
|
671
|
-
/** Pool rate and utilization history entry returned to SDK consumers. */
|
|
672
|
-
interface PoolHistoryEntry {
|
|
673
|
-
/** Sample date from the SDK API. */
|
|
674
|
-
date: string;
|
|
675
|
-
/** Decimal scale for rate fields. */
|
|
676
|
-
rateDecimals: bigint;
|
|
677
|
-
/** Average borrow rate for the sample, scaled by `rateDecimals`. */
|
|
678
|
-
avgBorrowRate: bigint;
|
|
679
|
-
/** Average lend rate for the sample, scaled by `rateDecimals`. */
|
|
680
|
-
avgLendRate: bigint;
|
|
681
|
-
/** Average utilization rate for the sample, scaled by `rateDecimals`. */
|
|
682
|
-
avgUtilizationRate: bigint;
|
|
683
|
-
}
|
|
684
|
-
/** Wire-format pool rate history item returned by the SDK API. */
|
|
685
|
-
interface PoolHistoryEntryApiItem {
|
|
686
|
-
date: string;
|
|
687
|
-
rateDecimals: number;
|
|
688
|
-
avgBorrowRate: string;
|
|
689
|
-
avgLendRate: string;
|
|
690
|
-
avgUtilizationRate: string;
|
|
691
|
-
}
|
|
692
|
-
/** Wire-format pool rate history page returned by the SDK API. */
|
|
693
|
-
interface PoolHistoryResponse {
|
|
694
|
-
success: true;
|
|
695
|
-
items: PoolHistoryEntryApiItem[];
|
|
696
|
-
nextCursor?: string;
|
|
697
|
-
}
|
|
698
|
-
/** Pool configuration snapshot returned to SDK consumers. */
|
|
699
|
-
interface PoolConfigHistoryEntry {
|
|
700
|
-
type: "configuration_change";
|
|
701
|
-
poolId: string;
|
|
702
|
-
asset: string;
|
|
703
|
-
chain: string;
|
|
704
|
-
timestamp: string;
|
|
705
|
-
totalSupply: bigint;
|
|
706
|
-
totalDebt: bigint;
|
|
707
|
-
supplyCap?: bigint;
|
|
708
|
-
borrowCap?: bigint;
|
|
709
|
-
maxLtv: bigint;
|
|
710
|
-
liquidationThreshold: bigint;
|
|
711
|
-
liquidationBonus: bigint;
|
|
712
|
-
protocolLiquidationFee: bigint;
|
|
713
|
-
reserveFactor: bigint;
|
|
714
|
-
baseRate: bigint;
|
|
715
|
-
optimalUtilizationRate: bigint;
|
|
716
|
-
rateSlopeBefore: bigint;
|
|
717
|
-
rateSlopeAfter: bigint;
|
|
718
|
-
lendingIndex: bigint;
|
|
719
|
-
borrowIndex: bigint;
|
|
720
|
-
sameAssetBorrowing: boolean;
|
|
721
|
-
frozen: boolean;
|
|
722
|
-
}
|
|
723
|
-
/** Wire-format pool configuration history item returned by the SDK API. */
|
|
724
|
-
interface PoolConfigHistoryEntryApiItem {
|
|
725
|
-
type: "configuration_change";
|
|
726
|
-
poolId: string;
|
|
727
|
-
asset: string;
|
|
728
|
-
chain: string;
|
|
729
|
-
timestamp: string;
|
|
730
|
-
totalSupply: string;
|
|
731
|
-
totalDebt: string;
|
|
732
|
-
supplyCap?: string;
|
|
733
|
-
borrowCap?: string;
|
|
734
|
-
maxLtv: string;
|
|
735
|
-
liquidationThreshold: string;
|
|
736
|
-
liquidationBonus: string;
|
|
737
|
-
protocolLiquidationFee: string;
|
|
738
|
-
reserveFactor: string;
|
|
739
|
-
baseRate: string;
|
|
740
|
-
optimalUtilizationRate: string;
|
|
741
|
-
rateSlopeBefore: string;
|
|
742
|
-
rateSlopeAfter: string;
|
|
743
|
-
lendingIndex: string;
|
|
744
|
-
borrowIndex: string;
|
|
745
|
-
sameAssetBorrowing: boolean;
|
|
746
|
-
frozen: boolean;
|
|
747
|
-
}
|
|
748
|
-
/** Wire-format pool configuration history page returned by the SDK API. */
|
|
749
|
-
interface PoolConfigHistoryResponse {
|
|
750
|
-
success: true;
|
|
751
|
-
items: PoolConfigHistoryEntryApiItem[];
|
|
752
|
-
nextCursor?: string;
|
|
753
|
-
}
|
|
754
|
-
/** Any history entry returned by history module methods. */
|
|
755
|
-
type HistoryEntry = UserHistoryEntry | PoolHistoryEntry | PoolConfigHistoryEntry;
|
|
756
603
|
/** Generic SDK API paginated response. */
|
|
757
604
|
interface PaginatedResponse<T> {
|
|
758
605
|
/** Items in the current page. */
|
|
@@ -761,44 +608,19 @@ interface PaginatedResponse<T> {
|
|
|
761
608
|
nextCursor?: string;
|
|
762
609
|
}
|
|
763
610
|
|
|
764
|
-
/** Historical
|
|
611
|
+
/** Historical user transaction and liquidation data helpers. */
|
|
765
612
|
declare class HistoryModule {
|
|
766
613
|
private readonly apiClient;
|
|
767
614
|
constructor(apiClient: ApiClient | undefined);
|
|
768
615
|
private requireApi;
|
|
769
|
-
/**
|
|
770
|
-
* Returns paginated rate and utilization history for a pool.
|
|
771
|
-
*
|
|
772
|
-
* @param poolId - The pool principal text.
|
|
773
|
-
* @param window - Optional time window with from/to timestamps and limit.
|
|
774
|
-
* @returns A page of pool rate history entries and the next cursor when more results are available.
|
|
775
|
-
*/
|
|
776
|
-
getPoolHistory(poolId: string, window?: PoolHistoryRequest): Promise<PaginatedResponse<PoolHistoryEntry>>;
|
|
777
|
-
/**
|
|
778
|
-
* Returns paginated configuration change history for a pool.
|
|
779
|
-
*
|
|
780
|
-
* @param poolId - The pool principal text.
|
|
781
|
-
* @param cursor - An optional pagination cursor from a previous response.
|
|
782
|
-
* @returns A page of pool configuration changes and the next cursor when more results are available.
|
|
783
|
-
*/
|
|
784
|
-
getPoolConfigHistory(poolId: string, cursor?: string): Promise<PaginatedResponse<PoolConfigHistoryEntry>>;
|
|
785
|
-
/**
|
|
786
|
-
* Returns borrow rate history for a pool.
|
|
787
|
-
*
|
|
788
|
-
* @param poolId - The pool principal text.
|
|
789
|
-
* @param window - Optional time window with from/to timestamps and limit.
|
|
790
|
-
* @returns Paginated APY samples.
|
|
791
|
-
*/
|
|
792
|
-
getBorrowRateHistory(poolId: string, window?: BorrowApyHistoryRequest): Promise<PaginatedResponse<ApySample>>;
|
|
793
616
|
/**
|
|
794
617
|
* Returns transaction history for a user.
|
|
795
618
|
*
|
|
796
619
|
* @param user - The Liquidium profile principal text.
|
|
797
|
-
* @param filters - Optional pool,
|
|
620
|
+
* @param filters - Optional pool, operation, state, time range, and pagination filters.
|
|
798
621
|
* @returns Paginated user history entries.
|
|
799
622
|
*/
|
|
800
623
|
getUserTransactionHistory(user: string, filters?: UserTransactionHistoryFilters): Promise<PaginatedResponse<UserTransactionHistoryEntry>>;
|
|
801
|
-
getUserTransactionHistory(user: string, market?: string, filters?: UserTransactionHistoryFilters): Promise<PaginatedResponse<UserTransactionHistoryEntry>>;
|
|
802
624
|
/**
|
|
803
625
|
* Returns liquidation history for a user.
|
|
804
626
|
*
|
|
@@ -807,7 +629,6 @@ declare class HistoryModule {
|
|
|
807
629
|
* @returns Paginated liquidation history entries.
|
|
808
630
|
*/
|
|
809
631
|
getLiquidationHistory(user: string, filters?: UserLiquidationHistoryFilters): Promise<PaginatedResponse<UserLiquidationHistoryEntry>>;
|
|
810
|
-
getLiquidationHistory(user: string, market?: string, filters?: UserLiquidationHistoryFilters): Promise<PaginatedResponse<UserLiquidationHistoryEntry>>;
|
|
811
632
|
}
|
|
812
633
|
|
|
813
634
|
/** Wallet execution dependencies for borrow and withdraw convenience methods. */
|
|
@@ -868,7 +689,7 @@ interface IcrcOutflowReceiver {
|
|
|
868
689
|
account: string;
|
|
869
690
|
}
|
|
870
691
|
/**
|
|
871
|
-
* Receipt for a borrow or
|
|
692
|
+
* Receipt for a borrow or withdrawal outflow submitted to the lending canister.
|
|
872
693
|
*
|
|
873
694
|
* `id` is the outflow reference to show users immediately. `txid` may be unset until
|
|
874
695
|
* the protocol assigns a chain transaction id. `outflowRef` is an optional protocol reference.
|
|
@@ -876,7 +697,7 @@ interface IcrcOutflowReceiver {
|
|
|
876
697
|
interface OutflowDetails {
|
|
877
698
|
/** Protocol outflow id. */
|
|
878
699
|
id: string;
|
|
879
|
-
/** Borrow,
|
|
700
|
+
/** Borrow, withdrawal, or fee-claim discriminator. */
|
|
880
701
|
outflowType: OutflowType;
|
|
881
702
|
/** Optional protocol outflow reference. */
|
|
882
703
|
outflowRef?: string;
|
|
@@ -890,10 +711,14 @@ interface OutflowDetails {
|
|
|
890
711
|
/** Borrow receipt. */
|
|
891
712
|
type BorrowOutflowDetails = OutflowDetails & {
|
|
892
713
|
outflowType: "borrow";
|
|
714
|
+
/** Shared lifecycle status for the borrow outflow receipt. */
|
|
715
|
+
status: LiquidiumStatus;
|
|
893
716
|
};
|
|
894
717
|
/** Withdraw receipt. */
|
|
895
718
|
type WithdrawOutflowDetails = OutflowDetails & {
|
|
896
|
-
outflowType: "
|
|
719
|
+
outflowType: "withdrawal";
|
|
720
|
+
/** Shared lifecycle status for the withdraw outflow receipt. */
|
|
721
|
+
status: LiquidiumStatus;
|
|
897
722
|
};
|
|
898
723
|
/** Signature payload for submitting a prepared borrow action. */
|
|
899
724
|
interface BorrowSubmitSignatureInfo extends SignatureInfo {
|
|
@@ -1052,6 +877,8 @@ type SupplyFlowRequest = TransferSupplyFlowRequest | ContractInteractionSupplyFl
|
|
|
1052
877
|
* (wallet-adapter path). When undefined, the caller is expected to broadcast
|
|
1053
878
|
* themselves and call {@link SupplyFlow.submit} for flows that require txid
|
|
1054
879
|
* registration.
|
|
880
|
+
* - If post-broadcast inflow registration fails after the SDK broadcasts the
|
|
881
|
+
* transaction, `txid` is still returned so callers can track the transaction.
|
|
1055
882
|
* - `submit` registers a broadcast txid with the SDK API when needed. ETH
|
|
1056
883
|
* stablecoin deposit-address transfers are indexed from ERC-20 transfer logs,
|
|
1057
884
|
* so `submit` acknowledges the txid without posting it to the inflow endpoint.
|
|
@@ -1066,22 +893,27 @@ interface SupplyFlow {
|
|
|
1066
893
|
target: SupplyTarget;
|
|
1067
894
|
/** Transaction id when the SDK broadcast the transaction. */
|
|
1068
895
|
txid?: string;
|
|
896
|
+
/** Shared lifecycle status for the supply flow. */
|
|
897
|
+
status: LiquidiumStatus;
|
|
1069
898
|
/** Registers a broadcast transaction id when the flow requires an indexing hint. */
|
|
1070
|
-
submit(request:
|
|
899
|
+
submit(request: SubmitSupplyFlowInflowRequest): Promise<SubmitInflowResponse>;
|
|
1071
900
|
}
|
|
1072
|
-
/**
|
|
1073
|
-
|
|
901
|
+
/** Canonical inflow operation accepted by direct inflow submission. */
|
|
902
|
+
type InflowOperation = Extract<LiquidiumOperation, "deposit" | "repayment">;
|
|
903
|
+
/** Body for `SupplyFlow.submit`. The supply flow supplies the inflow operation. */
|
|
904
|
+
interface SubmitSupplyFlowInflowRequest {
|
|
1074
905
|
/** Broadcast transaction id or hash. */
|
|
1075
906
|
txid: string;
|
|
1076
907
|
/** Chain where the transaction was broadcast, when not implied by the flow. */
|
|
1077
908
|
chain?: Chain;
|
|
1078
|
-
|
|
1079
|
-
|
|
909
|
+
}
|
|
910
|
+
/** Body for direct `lending.submitInflow`. */
|
|
911
|
+
interface SubmitInflowRequest extends SubmitSupplyFlowInflowRequest {
|
|
912
|
+
/** Deposit or repayment operation represented by the transaction. */
|
|
913
|
+
operation: InflowOperation;
|
|
1080
914
|
}
|
|
1081
915
|
/** Acknowledgement from the SDK API after submitting an inflow hint. */
|
|
1082
916
|
interface SubmitInflowResponse {
|
|
1083
|
-
/** Indicates the submit request was accepted by the SDK API. */
|
|
1084
|
-
success: true;
|
|
1085
917
|
/** Transaction id accepted by the SDK API. */
|
|
1086
918
|
txid: string;
|
|
1087
919
|
}
|
|
@@ -1131,8 +963,6 @@ declare const EvmSupplyApprovalStrategy: {
|
|
|
1131
963
|
type EvmSupplyApprovalStrategy = (typeof EvmSupplyApprovalStrategy)[keyof typeof EvmSupplyApprovalStrategy];
|
|
1132
964
|
/** ERC-20 supply planning data returned by `lending.getEvmSupplyContext(...)`. */
|
|
1133
965
|
interface EvmSupplyContext {
|
|
1134
|
-
/** Indicates the context was computed successfully. */
|
|
1135
|
-
success: true;
|
|
1136
966
|
/** Liquidium profile principal text. */
|
|
1137
967
|
profileId: string;
|
|
1138
968
|
/** Pool principal text receiving the inflow. */
|
|
@@ -1235,7 +1065,6 @@ declare class LendingModule {
|
|
|
1235
1065
|
* @returns Locally computed {@link EvmSupplyContext} for approvals and deposit.
|
|
1236
1066
|
*/
|
|
1237
1067
|
getEvmSupplyContext(request: GetEvmSupplyContextRequest): Promise<EvmSupplyContext>;
|
|
1238
|
-
private getEvmSupplyContextForPool;
|
|
1239
1068
|
/**
|
|
1240
1069
|
* Returns the read-only deposit address for an ETH stablecoin inflow target.
|
|
1241
1070
|
*
|
|
@@ -1257,17 +1086,12 @@ declare class LendingModule {
|
|
|
1257
1086
|
*/
|
|
1258
1087
|
estimateInflowFee(request: EstimateInflowFeeRequest): Promise<InflowFeeEstimate>;
|
|
1259
1088
|
private estimateBtcInflowFee;
|
|
1260
|
-
private sendAndSubmitNativeSupplyInflow;
|
|
1261
|
-
private submitSupplyFlowInflow;
|
|
1262
|
-
private executeContractSupply;
|
|
1263
|
-
private sendNativeSupplyTransaction;
|
|
1264
|
-
private submitInflowWithRetry;
|
|
1265
1089
|
/**
|
|
1266
1090
|
* Submits an inflow transaction id for faster indexing.
|
|
1267
1091
|
*
|
|
1268
1092
|
* Uses the Liquidium SDK API.
|
|
1269
1093
|
*
|
|
1270
|
-
* @param request - Broadcast `txid` plus
|
|
1094
|
+
* @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
|
|
1271
1095
|
* @returns Acknowledgement including the submitted `txid`.
|
|
1272
1096
|
*/
|
|
1273
1097
|
submitInflow(request: SubmitInflowRequest): Promise<SubmitInflowResponse>;
|
|
@@ -1278,11 +1102,9 @@ declare class LendingModule {
|
|
|
1278
1102
|
*/
|
|
1279
1103
|
isBorrowingDisabled(): Promise<boolean>;
|
|
1280
1104
|
private requireApi;
|
|
1281
|
-
private
|
|
1105
|
+
private createSupplyFlowExecutor;
|
|
1282
1106
|
private getPoolById;
|
|
1283
1107
|
private normalizeOutflowReceiverAddress;
|
|
1284
|
-
private sendEthContractTransaction;
|
|
1285
|
-
private waitForExpectedAllowance;
|
|
1286
1108
|
}
|
|
1287
1109
|
|
|
1288
1110
|
/** Current protocol metadata and rate state for a lending pool. */
|
|
@@ -1369,9 +1191,11 @@ declare class MarketModule {
|
|
|
1369
1191
|
private readonly apiClient;
|
|
1370
1192
|
constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined);
|
|
1371
1193
|
/**
|
|
1372
|
-
* Lists
|
|
1194
|
+
* Lists SDK-supported pools with their current rates.
|
|
1195
|
+
*
|
|
1196
|
+
* Unsupported asset or chain variants returned by the canister are omitted.
|
|
1373
1197
|
*
|
|
1374
|
-
* @returns
|
|
1198
|
+
* @returns Supported lending pools enriched with their current rate data.
|
|
1375
1199
|
*/
|
|
1376
1200
|
listPools(): Promise<Pool[]>;
|
|
1377
1201
|
/**
|
|
@@ -1944,16 +1768,6 @@ interface InstantLoanPositionSummary {
|
|
|
1944
1768
|
/** Borrowed principal plus accrued interest in base units, before repayment buffer. */
|
|
1945
1769
|
totalDebtAmount: bigint;
|
|
1946
1770
|
}
|
|
1947
|
-
/** Simplified lifecycle status for consumer UIs. */
|
|
1948
|
-
declare const InstantLoanStatus: {
|
|
1949
|
-
readonly awaitingDeposit: "awaiting_deposit";
|
|
1950
|
-
readonly depositDetected: "deposit_detected";
|
|
1951
|
-
readonly active: "active";
|
|
1952
|
-
readonly settling: "settling";
|
|
1953
|
-
readonly closed: "closed";
|
|
1954
|
-
readonly expired: "expired";
|
|
1955
|
-
};
|
|
1956
|
-
type InstantLoanStatus = (typeof InstantLoanStatus)[keyof typeof InstantLoanStatus];
|
|
1957
1771
|
/** Immutable terms selected for an instant loan. */
|
|
1958
1772
|
interface InstantLoanTerms {
|
|
1959
1773
|
/** Maximum loan-to-value ratio in basis points. */
|
|
@@ -1995,8 +1809,8 @@ interface InstantLoan {
|
|
|
1995
1809
|
loanId: bigint;
|
|
1996
1810
|
/** Short user-facing reference derived from `loanId`. */
|
|
1997
1811
|
ref: string;
|
|
1998
|
-
/**
|
|
1999
|
-
status:
|
|
1812
|
+
/** Shared lifecycle status for display and flow control. */
|
|
1813
|
+
status: LiquidiumStatus;
|
|
2000
1814
|
/** Generated profile principal used by the instant loan. */
|
|
2001
1815
|
profileId: string;
|
|
2002
1816
|
/** Immutable loan terms. */
|
|
@@ -2019,9 +1833,10 @@ interface InstantLoan {
|
|
|
2019
1833
|
declare class InstantLoansModule {
|
|
2020
1834
|
private readonly canisterContext;
|
|
2021
1835
|
private readonly apiClient;
|
|
1836
|
+
private readonly activities;
|
|
2022
1837
|
private readonly lending;
|
|
2023
1838
|
private readonly positions;
|
|
2024
|
-
constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, lending: LendingModule, positions: PositionsModule);
|
|
1839
|
+
constructor(canisterContext: CanisterContext, apiClient: ApiClient | undefined, activities: ActivitiesModule, lending: LendingModule, positions: PositionsModule);
|
|
2025
1840
|
/**
|
|
2026
1841
|
* Creates a profileless instant loan and returns canonical canister state plus
|
|
2027
1842
|
* generated initial-deposit and repayment quote targets.
|
|
@@ -2407,7 +2222,7 @@ interface ExecuteWithOptions {
|
|
|
2407
2222
|
* Returns an async function that runs a {@link WalletAction} end-to-end.
|
|
2408
2223
|
*
|
|
2409
2224
|
* - `sign-message`: needs `walletAdapter.signMessage` and `options.chain`.
|
|
2410
|
-
* - `sign-psbt`:
|
|
2225
|
+
* - `sign-psbt`: reserved; no current SDK flow emits this action.
|
|
2411
2226
|
* - `send-eth-transaction`: needs `walletAdapter.sendEthTransaction`.
|
|
2412
2227
|
*
|
|
2413
2228
|
* @param options - Adapter and optional chain/account overrides.
|
|
@@ -2415,4 +2230,4 @@ interface ExecuteWithOptions {
|
|
|
2415
2230
|
*/
|
|
2416
2231
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2417
2232
|
|
|
2418
|
-
export { type AccountIdentifierAccount, type AccountIdentifierOutflowReceiver, AccountsModule, ActivitiesModule, type
|
|
2233
|
+
export { type AccountIdentifierAccount, type AccountIdentifierOutflowReceiver, AccountsModule, ActivitiesModule, type Activity, ActivityFilter, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, Asset, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, type BorrowAction, 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, HistoryModule, type IcrcAccount, type IcrcAccountSupplyTarget, type IcrcOutflowReceiver, type InflowActivity, type InflowActivityOperation, type InflowActivityStatus, type InflowFeeEstimate, type InflowOperation, 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, type InstantLoanStuckFundsWithdrawalRequestedEventType, type InstantLoanTerms, type InstantLoanWarmedProfile, InstantLoansModule, LendingModule, LiquidiumClient, type LiquidiumClientConfig, LiquidiumError, LiquidiumErrorCode, type LiquidiumErrorContext, type LiquidiumOperation, type LiquidiumState, type LiquidiumStatus, 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 NativeOutflowReceiver, type OutflowActivity, type OutflowActivityOperation, type OutflowActivityStatus, type OutflowDetails, type OutflowReceiver, OutflowType, type PaginatedResponse, type Pool, 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, type SubmitSupplyFlowInflowRequest, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, TransferMode, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UserHistoryEntry, type UserHistoryEntryApiItem, type UserHistoryOperation, type UserHistoryResponse, type UserLiquidationHistoryEntry, type UserLiquidationHistoryFilters, type UserPositionSummary, type UserReserve, type UserStats, type UserTransactionHistoryEntry, type UserTransactionHistoryFilters, type UserTransactionHistoryOperation, type UserTransactionHistoryState, type Wallet, type WalletAction, WalletActionKind, type WalletAdapter, WalletExecutionKind, type WalletExecutionParams, type WalletTransferSupplyFlowRequest, type WithdrawAction, type WithdrawOutflowDetails, type WithdrawSubmitSignatureInfo, createTransferErc20Transaction, executeWith, getMinimumBorrowAmount, intFromPublicId, publicIdFromInt };
|