@liquidium/client 0.8.2 → 0.8.3
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.cjs +37 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -417,6 +417,8 @@ declare class AccountsModule {
|
|
|
417
417
|
*
|
|
418
418
|
* @param options - `account` is the wallet address that will own the new profile.
|
|
419
419
|
* @returns A signable {@link CreateAccountAction} with `submit` wired to the canister.
|
|
420
|
+
* @throws {@link LiquidiumError} If account validation or protocol
|
|
421
|
+
* preparation fails.
|
|
420
422
|
*/
|
|
421
423
|
prepareCreateProfile(options: PrepareCreateProfileOptions): Promise<CreateAccountAction>;
|
|
422
424
|
/**
|
|
@@ -426,6 +428,9 @@ declare class AccountsModule {
|
|
|
426
428
|
*
|
|
427
429
|
* @param params - Wallet `account`, signing `chain`, and `walletAdapter` with `signMessage`.
|
|
428
430
|
* @returns The new profile principal as text.
|
|
431
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
432
|
+
* fails.
|
|
433
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
429
434
|
*/
|
|
430
435
|
createProfile(params: CreateProfileParams): Promise<string>;
|
|
431
436
|
/**
|
|
@@ -1087,6 +1092,8 @@ declare class LendingModule {
|
|
|
1087
1092
|
* Use this when you need explicit control over signing and submission.
|
|
1088
1093
|
* @param request - Profile, pool, amount (pool asset base units), outflow address, and signer wallet.
|
|
1089
1094
|
* @returns A signable {@link WithdrawAction} with `submit` wired to the canister.
|
|
1095
|
+
* @throws {@link LiquidiumError} If request validation, destination
|
|
1096
|
+
* validation, or protocol preparation fails.
|
|
1090
1097
|
*/
|
|
1091
1098
|
prepareWithdraw(request: CreateWithdrawRequest): Promise<WithdrawAction>;
|
|
1092
1099
|
private submitWithdraw;
|
|
@@ -1097,6 +1104,9 @@ declare class LendingModule {
|
|
|
1097
1104
|
*
|
|
1098
1105
|
* @param params - Withdraw request fields plus `signerChain` and `signerWalletAdapter`.
|
|
1099
1106
|
* @returns The canister {@link OutflowDetails} for the completed withdraw.
|
|
1107
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
1108
|
+
* fails.
|
|
1109
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
1100
1110
|
*/
|
|
1101
1111
|
withdraw(params: CreateWithdrawRequest & WalletExecutionParams): Promise<WithdrawOutflowDetails>;
|
|
1102
1112
|
/**
|
|
@@ -1108,6 +1118,8 @@ declare class LendingModule {
|
|
|
1108
1118
|
*
|
|
1109
1119
|
* @param request - Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.
|
|
1110
1120
|
* @returns A signable {@link BorrowAction} with `submit` wired to the canister.
|
|
1121
|
+
* @throws {@link LiquidiumError} If request validation, destination
|
|
1122
|
+
* validation, or protocol preparation fails.
|
|
1111
1123
|
*/
|
|
1112
1124
|
prepareBorrow(request: CreateBorrowRequest): Promise<BorrowAction>;
|
|
1113
1125
|
private submitBorrow;
|
|
@@ -1119,6 +1131,9 @@ declare class LendingModule {
|
|
|
1119
1131
|
*
|
|
1120
1132
|
* @param params - Borrow request fields plus `signerChain` and `signerWalletAdapter`.
|
|
1121
1133
|
* @returns The lending canister receipt as {@link OutflowDetails}.
|
|
1134
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
1135
|
+
* fails.
|
|
1136
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
1122
1137
|
*
|
|
1123
1138
|
* @remarks
|
|
1124
1139
|
* `id` is always present. `txid` may be missing on the first response; the SDK does not
|
|
@@ -1137,6 +1152,10 @@ declare class LendingModule {
|
|
|
1137
1152
|
*
|
|
1138
1153
|
* @returns A {@link SupplyFlow} receipt with `type`, `target`, `submit`, and
|
|
1139
1154
|
* an optional `txid` present when the SDK broadcast for you.
|
|
1155
|
+
* @throws {@link LiquidiumError} If validation, transfer planning, or
|
|
1156
|
+
* protocol submission fails.
|
|
1157
|
+
* @throws `Error` If the wallet adapter rejects or fails to broadcast a
|
|
1158
|
+
* transaction.
|
|
1140
1159
|
*/
|
|
1141
1160
|
supply(request: SupplyFlowRequest): Promise<SupplyFlow>;
|
|
1142
1161
|
/**
|
|
@@ -1179,6 +1198,8 @@ declare class LendingModule {
|
|
|
1179
1198
|
*
|
|
1180
1199
|
* @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
|
|
1181
1200
|
* @returns Acknowledgement including the submitted `txid`.
|
|
1201
|
+
* @throws {@link LiquidiumError} If the chain is unsupported or the API
|
|
1202
|
+
* request fails.
|
|
1182
1203
|
*/
|
|
1183
1204
|
submitInflow(request: SubmitInflowRequest): Promise<SubmitInflowResponse>;
|
|
1184
1205
|
/**
|
|
@@ -2156,6 +2177,10 @@ declare class SimpleLoansModule {
|
|
|
2156
2177
|
*
|
|
2157
2178
|
* @param request - Collateral, borrow, refund, LTV limit, timeout, and inflow options.
|
|
2158
2179
|
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
2180
|
+
* @throws {@link LiquidiumError} If request validation, API transport, or
|
|
2181
|
+
* protocol validation fails before creation.
|
|
2182
|
+
* @throws {@link SimpleLoanCreatedError} If the remote loan is created but
|
|
2183
|
+
* the SDK cannot load its hydrated state.
|
|
2159
2184
|
*/
|
|
2160
2185
|
create(request: CreateSimpleLoanRequest): Promise<SimpleLoan>;
|
|
2161
2186
|
/**
|
|
@@ -2449,6 +2474,10 @@ interface ExecuteWithOptions {
|
|
|
2449
2474
|
*
|
|
2450
2475
|
* @param options - Adapter and optional chain/account overrides.
|
|
2451
2476
|
* @returns A function that accepts a `WalletAction` and resolves with its submit result.
|
|
2477
|
+
* @throws {@link LiquidiumError} with code `LiquidiumErrorCode.VALIDATION_ERROR`
|
|
2478
|
+
* if a required wallet capability or signing chain is missing, or if
|
|
2479
|
+
* `action.executionKind` is unsupported.
|
|
2480
|
+
* @throws `Error` If the wallet adapter or action submission fails.
|
|
2452
2481
|
*/
|
|
2453
2482
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2454
2483
|
|
package/dist/index.d.ts
CHANGED
|
@@ -417,6 +417,8 @@ declare class AccountsModule {
|
|
|
417
417
|
*
|
|
418
418
|
* @param options - `account` is the wallet address that will own the new profile.
|
|
419
419
|
* @returns A signable {@link CreateAccountAction} with `submit` wired to the canister.
|
|
420
|
+
* @throws {@link LiquidiumError} If account validation or protocol
|
|
421
|
+
* preparation fails.
|
|
420
422
|
*/
|
|
421
423
|
prepareCreateProfile(options: PrepareCreateProfileOptions): Promise<CreateAccountAction>;
|
|
422
424
|
/**
|
|
@@ -426,6 +428,9 @@ declare class AccountsModule {
|
|
|
426
428
|
*
|
|
427
429
|
* @param params - Wallet `account`, signing `chain`, and `walletAdapter` with `signMessage`.
|
|
428
430
|
* @returns The new profile principal as text.
|
|
431
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
432
|
+
* fails.
|
|
433
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
429
434
|
*/
|
|
430
435
|
createProfile(params: CreateProfileParams): Promise<string>;
|
|
431
436
|
/**
|
|
@@ -1087,6 +1092,8 @@ declare class LendingModule {
|
|
|
1087
1092
|
* Use this when you need explicit control over signing and submission.
|
|
1088
1093
|
* @param request - Profile, pool, amount (pool asset base units), outflow address, and signer wallet.
|
|
1089
1094
|
* @returns A signable {@link WithdrawAction} with `submit` wired to the canister.
|
|
1095
|
+
* @throws {@link LiquidiumError} If request validation, destination
|
|
1096
|
+
* validation, or protocol preparation fails.
|
|
1090
1097
|
*/
|
|
1091
1098
|
prepareWithdraw(request: CreateWithdrawRequest): Promise<WithdrawAction>;
|
|
1092
1099
|
private submitWithdraw;
|
|
@@ -1097,6 +1104,9 @@ declare class LendingModule {
|
|
|
1097
1104
|
*
|
|
1098
1105
|
* @param params - Withdraw request fields plus `signerChain` and `signerWalletAdapter`.
|
|
1099
1106
|
* @returns The canister {@link OutflowDetails} for the completed withdraw.
|
|
1107
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
1108
|
+
* fails.
|
|
1109
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
1100
1110
|
*/
|
|
1101
1111
|
withdraw(params: CreateWithdrawRequest & WalletExecutionParams): Promise<WithdrawOutflowDetails>;
|
|
1102
1112
|
/**
|
|
@@ -1108,6 +1118,8 @@ declare class LendingModule {
|
|
|
1108
1118
|
*
|
|
1109
1119
|
* @param request - Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.
|
|
1110
1120
|
* @returns A signable {@link BorrowAction} with `submit` wired to the canister.
|
|
1121
|
+
* @throws {@link LiquidiumError} If request validation, destination
|
|
1122
|
+
* validation, or protocol preparation fails.
|
|
1111
1123
|
*/
|
|
1112
1124
|
prepareBorrow(request: CreateBorrowRequest): Promise<BorrowAction>;
|
|
1113
1125
|
private submitBorrow;
|
|
@@ -1119,6 +1131,9 @@ declare class LendingModule {
|
|
|
1119
1131
|
*
|
|
1120
1132
|
* @param params - Borrow request fields plus `signerChain` and `signerWalletAdapter`.
|
|
1121
1133
|
* @returns The lending canister receipt as {@link OutflowDetails}.
|
|
1134
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
1135
|
+
* fails.
|
|
1136
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
1122
1137
|
*
|
|
1123
1138
|
* @remarks
|
|
1124
1139
|
* `id` is always present. `txid` may be missing on the first response; the SDK does not
|
|
@@ -1137,6 +1152,10 @@ declare class LendingModule {
|
|
|
1137
1152
|
*
|
|
1138
1153
|
* @returns A {@link SupplyFlow} receipt with `type`, `target`, `submit`, and
|
|
1139
1154
|
* an optional `txid` present when the SDK broadcast for you.
|
|
1155
|
+
* @throws {@link LiquidiumError} If validation, transfer planning, or
|
|
1156
|
+
* protocol submission fails.
|
|
1157
|
+
* @throws `Error` If the wallet adapter rejects or fails to broadcast a
|
|
1158
|
+
* transaction.
|
|
1140
1159
|
*/
|
|
1141
1160
|
supply(request: SupplyFlowRequest): Promise<SupplyFlow>;
|
|
1142
1161
|
/**
|
|
@@ -1179,6 +1198,8 @@ declare class LendingModule {
|
|
|
1179
1198
|
*
|
|
1180
1199
|
* @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
|
|
1181
1200
|
* @returns Acknowledgement including the submitted `txid`.
|
|
1201
|
+
* @throws {@link LiquidiumError} If the chain is unsupported or the API
|
|
1202
|
+
* request fails.
|
|
1182
1203
|
*/
|
|
1183
1204
|
submitInflow(request: SubmitInflowRequest): Promise<SubmitInflowResponse>;
|
|
1184
1205
|
/**
|
|
@@ -2156,6 +2177,10 @@ declare class SimpleLoansModule {
|
|
|
2156
2177
|
*
|
|
2157
2178
|
* @param request - Collateral, borrow, refund, LTV limit, timeout, and inflow options.
|
|
2158
2179
|
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
2180
|
+
* @throws {@link LiquidiumError} If request validation, API transport, or
|
|
2181
|
+
* protocol validation fails before creation.
|
|
2182
|
+
* @throws {@link SimpleLoanCreatedError} If the remote loan is created but
|
|
2183
|
+
* the SDK cannot load its hydrated state.
|
|
2159
2184
|
*/
|
|
2160
2185
|
create(request: CreateSimpleLoanRequest): Promise<SimpleLoan>;
|
|
2161
2186
|
/**
|
|
@@ -2449,6 +2474,10 @@ interface ExecuteWithOptions {
|
|
|
2449
2474
|
*
|
|
2450
2475
|
* @param options - Adapter and optional chain/account overrides.
|
|
2451
2476
|
* @returns A function that accepts a `WalletAction` and resolves with its submit result.
|
|
2477
|
+
* @throws {@link LiquidiumError} with code `LiquidiumErrorCode.VALIDATION_ERROR`
|
|
2478
|
+
* if a required wallet capability or signing chain is missing, or if
|
|
2479
|
+
* `action.executionKind` is unsupported.
|
|
2480
|
+
* @throws `Error` If the wallet adapter or action submission fails.
|
|
2452
2481
|
*/
|
|
2453
2482
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2454
2483
|
|
package/dist/index.js
CHANGED
|
@@ -1263,6 +1263,8 @@ var AccountsModule = class {
|
|
|
1263
1263
|
*
|
|
1264
1264
|
* @param options - `account` is the wallet address that will own the new profile.
|
|
1265
1265
|
* @returns A signable {@link CreateAccountAction} with `submit` wired to the canister.
|
|
1266
|
+
* @throws {@link LiquidiumError} If account validation or protocol
|
|
1267
|
+
* preparation fails.
|
|
1266
1268
|
*/
|
|
1267
1269
|
async prepareCreateProfile(options) {
|
|
1268
1270
|
return await this.buildCreateProfileAction(options.account);
|
|
@@ -1274,6 +1276,9 @@ var AccountsModule = class {
|
|
|
1274
1276
|
*
|
|
1275
1277
|
* @param params - Wallet `account`, signing `chain`, and `walletAdapter` with `signMessage`.
|
|
1276
1278
|
* @returns The new profile principal as text.
|
|
1279
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
1280
|
+
* fails.
|
|
1281
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
1277
1282
|
*/
|
|
1278
1283
|
async createProfile(params) {
|
|
1279
1284
|
const account = normalizeProfileAccount(params.account);
|
|
@@ -1558,6 +1563,7 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
|
|
|
1558
1563
|
});
|
|
1559
1564
|
const SimpleLoansError = IDL.Variant({
|
|
1560
1565
|
BorrowAmountRequired: IDL.Null,
|
|
1566
|
+
AnonymousPrincipalNotAllowed: IDL.Null,
|
|
1561
1567
|
NoCollateralPosition: IDL.Record({ loan_id: IDL.Nat }),
|
|
1562
1568
|
LtvTimerOutOfRange: IDL.Record({ max: IDL.Nat64 }),
|
|
1563
1569
|
LtvMaxExceeded: IDL.Record({
|
|
@@ -1571,6 +1577,11 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
|
|
|
1571
1577
|
CallRejected: IDL.Record({ method: IDL.Text, reason: IDL.Text }),
|
|
1572
1578
|
DecodeFailed: IDL.Record({ method: IDL.Text, reason: IDL.Text })
|
|
1573
1579
|
}),
|
|
1580
|
+
PoolNotFound: IDL.Record({ pool_id: IDL.Principal }),
|
|
1581
|
+
LendingCanisterImmutable: IDL.Record({
|
|
1582
|
+
requested: IDL.Principal,
|
|
1583
|
+
configured: IDL.Principal
|
|
1584
|
+
}),
|
|
1574
1585
|
LtvMaxOutOfRange: IDL.Record({ max: IDL.Nat64 }),
|
|
1575
1586
|
AccountRequired: IDL.Record({ label: IDL.Text }),
|
|
1576
1587
|
DepositTimerExceeded: IDL.Record({ loan_id: IDL.Nat }),
|
|
@@ -1583,8 +1594,14 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
|
|
|
1583
1594
|
DepositAlreadyProcessed: IDL.Record({ loan_id: IDL.Nat }),
|
|
1584
1595
|
MissingPrice: IDL.Record({ symbol: IDL.Text }),
|
|
1585
1596
|
InvalidLtvTimerS: IDL.Null,
|
|
1597
|
+
PoolLendingDisabled: IDL.Record({ pool_id: IDL.Principal }),
|
|
1586
1598
|
DebtNotFullyRepaid: IDL.Record({ loan_id: IDL.Nat }),
|
|
1587
1599
|
EmptyCollateralPosition: IDL.Null,
|
|
1600
|
+
PoolAssetMismatch: IDL.Record({
|
|
1601
|
+
configured_asset: IDL.Unknown,
|
|
1602
|
+
requested_asset: IDL.Unknown,
|
|
1603
|
+
pool_id: IDL.Principal
|
|
1604
|
+
}),
|
|
1588
1605
|
SigningFailed: IDL.Record({ reason: IDL.Text })
|
|
1589
1606
|
});
|
|
1590
1607
|
const CreateLoanRequest = IDL.Record({
|
|
@@ -4791,6 +4808,8 @@ var LendingModule = class {
|
|
|
4791
4808
|
* Use this when you need explicit control over signing and submission.
|
|
4792
4809
|
* @param request - Profile, pool, amount (pool asset base units), outflow address, and signer wallet.
|
|
4793
4810
|
* @returns A signable {@link WithdrawAction} with `submit` wired to the canister.
|
|
4811
|
+
* @throws {@link LiquidiumError} If request validation, destination
|
|
4812
|
+
* validation, or protocol preparation fails.
|
|
4794
4813
|
*/
|
|
4795
4814
|
async prepareWithdraw(request) {
|
|
4796
4815
|
const destination = resolveOutflowDestinationInput({
|
|
@@ -4943,6 +4962,9 @@ var LendingModule = class {
|
|
|
4943
4962
|
*
|
|
4944
4963
|
* @param params - Withdraw request fields plus `signerChain` and `signerWalletAdapter`.
|
|
4945
4964
|
* @returns The canister {@link OutflowDetails} for the completed withdraw.
|
|
4965
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
4966
|
+
* fails.
|
|
4967
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
4946
4968
|
*/
|
|
4947
4969
|
async withdraw(params) {
|
|
4948
4970
|
const action = await this.prepareWithdraw(params);
|
|
@@ -4961,6 +4983,8 @@ var LendingModule = class {
|
|
|
4961
4983
|
*
|
|
4962
4984
|
* @param request - Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.
|
|
4963
4985
|
* @returns A signable {@link BorrowAction} with `submit` wired to the canister.
|
|
4986
|
+
* @throws {@link LiquidiumError} If request validation, destination
|
|
4987
|
+
* validation, or protocol preparation fails.
|
|
4964
4988
|
*/
|
|
4965
4989
|
async prepareBorrow(request) {
|
|
4966
4990
|
const destination = resolveOutflowDestinationInput({
|
|
@@ -5114,6 +5138,9 @@ var LendingModule = class {
|
|
|
5114
5138
|
*
|
|
5115
5139
|
* @param params - Borrow request fields plus `signerChain` and `signerWalletAdapter`.
|
|
5116
5140
|
* @returns The lending canister receipt as {@link OutflowDetails}.
|
|
5141
|
+
* @throws {@link LiquidiumError} If SDK validation or protocol submission
|
|
5142
|
+
* fails.
|
|
5143
|
+
* @throws `Error` If the wallet adapter rejects message signing.
|
|
5117
5144
|
*
|
|
5118
5145
|
* @remarks
|
|
5119
5146
|
* `id` is always present. `txid` may be missing on the first response; the SDK does not
|
|
@@ -5139,6 +5166,10 @@ var LendingModule = class {
|
|
|
5139
5166
|
*
|
|
5140
5167
|
* @returns A {@link SupplyFlow} receipt with `type`, `target`, `submit`, and
|
|
5141
5168
|
* an optional `txid` present when the SDK broadcast for you.
|
|
5169
|
+
* @throws {@link LiquidiumError} If validation, transfer planning, or
|
|
5170
|
+
* protocol submission fails.
|
|
5171
|
+
* @throws `Error` If the wallet adapter rejects or fails to broadcast a
|
|
5172
|
+
* transaction.
|
|
5142
5173
|
*/
|
|
5143
5174
|
async supply(request) {
|
|
5144
5175
|
return await this.createSupplyFlowExecutor().create(request);
|
|
@@ -5263,6 +5294,8 @@ var LendingModule = class {
|
|
|
5263
5294
|
*
|
|
5264
5295
|
* @param request - Broadcast `txid` plus inflow `operation` and optional `chain`.
|
|
5265
5296
|
* @returns Acknowledgement including the submitted `txid`.
|
|
5297
|
+
* @throws {@link LiquidiumError} If the chain is unsupported or the API
|
|
5298
|
+
* request fails.
|
|
5266
5299
|
*/
|
|
5267
5300
|
async submitInflow(request) {
|
|
5268
5301
|
if (request.chain !== void 0 && request.chain !== Chain.BTC && request.chain !== Chain.ETH) {
|
|
@@ -6569,6 +6602,10 @@ var SimpleLoansModule = class {
|
|
|
6569
6602
|
*
|
|
6570
6603
|
* @param request - Collateral, borrow, refund, LTV limit, timeout, and inflow options.
|
|
6571
6604
|
* @returns Hydrated loan state plus generated initial-deposit and repayment quote targets.
|
|
6605
|
+
* @throws {@link LiquidiumError} If request validation, API transport, or
|
|
6606
|
+
* protocol validation fails before creation.
|
|
6607
|
+
* @throws {@link SimpleLoanCreatedError} If the remote loan is created but
|
|
6608
|
+
* the SDK cannot load its hydrated state.
|
|
6572
6609
|
*/
|
|
6573
6610
|
async create(request) {
|
|
6574
6611
|
validateCreateRequest(request);
|