@liquidium/client 0.6.0-rc.1 → 0.6.0-rc.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 +33 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -16
- package/dist/index.d.ts +39 -16
- package/dist/index.js +33 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -92,35 +92,53 @@ declare const Chain: {
|
|
|
92
92
|
type Chain = (typeof Chain)[keyof typeof Chain];
|
|
93
93
|
/** Chains whose wallets can authorize Liquidium protocol actions. */
|
|
94
94
|
type SigningChain = typeof Chain.BTC | typeof Chain.ETH;
|
|
95
|
-
/**
|
|
96
|
-
|
|
95
|
+
/** BTC transferred on the Bitcoin chain. */
|
|
96
|
+
interface BtcOnBtcAssetIdentifier {
|
|
97
97
|
chain: typeof Chain.BTC;
|
|
98
98
|
asset: typeof Asset.BTC;
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
|
+
/** ETH transferred on the Ethereum chain. */
|
|
101
|
+
interface EthOnEthAssetIdentifier {
|
|
100
102
|
chain: typeof Chain.ETH;
|
|
101
103
|
asset: typeof Asset.ETH;
|
|
102
|
-
}
|
|
104
|
+
}
|
|
105
|
+
/** USDC transferred on the Ethereum chain. */
|
|
106
|
+
interface UsdcOnEthAssetIdentifier {
|
|
103
107
|
chain: typeof Chain.ETH;
|
|
104
108
|
asset: typeof Asset.USDC;
|
|
105
|
-
}
|
|
109
|
+
}
|
|
110
|
+
/** USDT transferred on the Ethereum chain. */
|
|
111
|
+
interface UsdtOnEthAssetIdentifier {
|
|
106
112
|
chain: typeof Chain.ETH;
|
|
107
113
|
asset: typeof Asset.USDT;
|
|
108
|
-
}
|
|
114
|
+
}
|
|
115
|
+
/** BTC transferred on the Internet Computer chain. */
|
|
116
|
+
interface BtcOnIcpAssetIdentifier {
|
|
109
117
|
chain: typeof Chain.ICP;
|
|
110
118
|
asset: typeof Asset.BTC;
|
|
111
|
-
}
|
|
119
|
+
}
|
|
120
|
+
/** ETH transferred on the Internet Computer chain. */
|
|
121
|
+
interface EthOnIcpAssetIdentifier {
|
|
112
122
|
chain: typeof Chain.ICP;
|
|
113
123
|
asset: typeof Asset.ETH;
|
|
114
|
-
}
|
|
124
|
+
}
|
|
125
|
+
/** ICP transferred on the Internet Computer chain. */
|
|
126
|
+
interface IcpOnIcpAssetIdentifier {
|
|
115
127
|
chain: typeof Chain.ICP;
|
|
116
128
|
asset: typeof Asset.ICP;
|
|
117
|
-
}
|
|
129
|
+
}
|
|
130
|
+
/** USDC transferred on the Internet Computer chain. */
|
|
131
|
+
interface UsdcOnIcpAssetIdentifier {
|
|
118
132
|
chain: typeof Chain.ICP;
|
|
119
133
|
asset: typeof Asset.USDC;
|
|
120
|
-
}
|
|
134
|
+
}
|
|
135
|
+
/** USDT transferred on the Internet Computer chain. */
|
|
136
|
+
interface UsdtOnIcpAssetIdentifier {
|
|
121
137
|
chain: typeof Chain.ICP;
|
|
122
138
|
asset: typeof Asset.USDT;
|
|
123
|
-
}
|
|
139
|
+
}
|
|
140
|
+
/** Supported asset and transfer-chain combinations. */
|
|
141
|
+
type AssetIdentifier = BtcOnBtcAssetIdentifier | EthOnEthAssetIdentifier | UsdcOnEthAssetIdentifier | UsdtOnEthAssetIdentifier | BtcOnIcpAssetIdentifier | EthOnIcpAssetIdentifier | IcpOnIcpAssetIdentifier | UsdcOnIcpAssetIdentifier | UsdtOnIcpAssetIdentifier;
|
|
124
142
|
/** Returns whether an asset and chain form a supported SDK identifier. */
|
|
125
143
|
declare function isAssetIdentifier(identifier: {
|
|
126
144
|
chain: string;
|
|
@@ -440,9 +458,9 @@ interface LiquidiumStatus {
|
|
|
440
458
|
operation: LiquidiumOperation;
|
|
441
459
|
/** Current lifecycle state for the operation. */
|
|
442
460
|
state: LiquidiumState;
|
|
443
|
-
/**
|
|
461
|
+
/** Confirmation progress while confirming, capped at the required count. */
|
|
444
462
|
confirmations: number | null;
|
|
445
|
-
/** Required confirmations,
|
|
463
|
+
/** Required confirmations while confirming, otherwise null. */
|
|
446
464
|
requiredConfirmations: number | null;
|
|
447
465
|
}
|
|
448
466
|
|
|
@@ -1346,10 +1364,11 @@ declare class PositionsModule {
|
|
|
1346
1364
|
*/
|
|
1347
1365
|
getPosition(profileId: string, poolId: string): Promise<Position | null>;
|
|
1348
1366
|
/**
|
|
1349
|
-
* Lists
|
|
1367
|
+
* Lists visible positions for a profile. Supply balances below their pool's
|
|
1368
|
+
* same-asset dust threshold are hidden without removing active debt.
|
|
1350
1369
|
*
|
|
1351
1370
|
* @param profileId - The Liquidium profile principal text.
|
|
1352
|
-
* @returns
|
|
1371
|
+
* @returns Visible positions currently associated with the requested profile.
|
|
1353
1372
|
*/
|
|
1354
1373
|
listPositions(profileId: string): Promise<Position[]>;
|
|
1355
1374
|
/**
|
|
@@ -1382,6 +1401,10 @@ declare class PositionsModule {
|
|
|
1382
1401
|
* Returns the per-reserve breakdown of a profile's supplies and borrows,
|
|
1383
1402
|
* joined with pool metadata, rates, and current USD prices.
|
|
1384
1403
|
*
|
|
1404
|
+
* Supplied-only reserves below their pool's same-asset dust threshold are
|
|
1405
|
+
* omitted. Reserves with active debt remain, with their supplied amount and
|
|
1406
|
+
* earned interest set to zero when the supplied balance is below the threshold.
|
|
1407
|
+
*
|
|
1385
1408
|
* USD values are scaled to 27 decimals.
|
|
1386
1409
|
*
|
|
1387
1410
|
* @param profileId - The Liquidium profile principal text.
|
|
@@ -2269,4 +2292,4 @@ interface ExecuteWithOptions {
|
|
|
2269
2292
|
*/
|
|
2270
2293
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2271
2294
|
|
|
2272
|
-
export { AccountsModule, ActivitiesModule, type Activity, ActivityFilter, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, Asset, type AssetIdentifier, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, type BorrowAction, type BorrowOutflowDetails, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIdOverrides, type CanisterIds, Chain, type ChainAddressAccount, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateProfileParams, type CreateSimpleLoanBorrow, type CreateSimpleLoanCollateral, type CreateSimpleLoanRefund, type CreateSimpleLoanRequest, type CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type FindPoolQuery, type FullWithdrawAmount, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, type GetEvmSupplyContextRequest, type HealthFactor, HistoryModule, type IcPrincipalAccount, type IcpAccountIdentifierAccount, type IcrcAccount, type IcrcTransferDetails, type InflowActivity, type InflowActivityOperation, type InflowActivityStatus, type InflowFeeEstimate, type InflowOperation, LendingModule, type LiquidiumAccount, type LiquidiumAccountInput, type LiquidiumAccountReference, LiquidiumAccountType, 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, MIN_DEPOSIT_AMOUNTS_BY_ASSET, MIN_WITHDRAW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, type MinimumDepositAsset, type MinimumWithdrawAsset, type OutflowActivity, type OutflowActivityOperation, type OutflowActivityStatus, type OutflowDetails, OutflowType, type PaginatedResponse, type Pool, type PoolCanisterIds, 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 SendIcrcTransferRequest, type SignMessageRequest, type SignMessageWalletAction, type SignatureInfo, type SigningChain, type SimpleLoan, type SimpleLoanAccount, type SimpleLoanAsset, type SimpleLoanAuthorization, type SimpleLoanBorrow, type SimpleLoanBorrowRequestedEventType, type SimpleLoanCollateral, type SimpleLoanConfig, SimpleLoanCreatedError, type SimpleLoanCreatedEventType, type SimpleLoanDepositTimerExceededEventType, type SimpleLoanDepositTimerStartedEventType, type SimpleLoanDestination, type SimpleLoanEvent, type SimpleLoanEventType, type SimpleLoanFindBorrow, type SimpleLoanFindCollateral, type SimpleLoanFindResult, type SimpleLoanFullLendWithdrawalRequestedEventType, type SimpleLoanGetByIdRequest, type SimpleLoanGetByRefRequest, type SimpleLoanGetRequest, type SimpleLoanInitialDeposit, type SimpleLoanInitialDepositTargetQuote, type SimpleLoanLeg, type SimpleLoanListEventsRequest, type SimpleLoanPositionSummary, type SimpleLoanProfileWarmedEventType, type SimpleLoanRepayCompleteEventType, type SimpleLoanRepayment, type SimpleLoanRepaymentTargetQuote, type SimpleLoanStuckFundsWithdrawalRequestedEventType, type SimpleLoanTerms, type SimpleLoanWarmedProfile, SimpleLoansModule, type SubmitInflowRequest, type SubmitInflowResponse, type SubmitSupplyFlowInflowRequest, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, 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, createTransferErc20Transaction, executeWith, getMinimumBorrowAmount, getMinimumDepositAmount, getMinimumWithdrawAmount, intFromPublicId, isAssetIdentifier, publicIdFromInt };
|
|
2295
|
+
export { AccountsModule, ActivitiesModule, type Activity, ActivityFilter, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, Asset, type AssetIdentifier, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, type BorrowAction, type BorrowOutflowDetails, type BorrowingPower, type BtcOnBtcAssetIdentifier, type BtcOnIcpAssetIdentifier, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIdOverrides, type CanisterIds, Chain, type ChainAddressAccount, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateProfileParams, type CreateSimpleLoanBorrow, type CreateSimpleLoanCollateral, type CreateSimpleLoanRefund, type CreateSimpleLoanRequest, type CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthOnEthAssetIdentifier, type EthOnIcpAssetIdentifier, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type FindPoolQuery, type FullWithdrawAmount, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, type GetEvmSupplyContextRequest, type HealthFactor, HistoryModule, type IcPrincipalAccount, type IcpAccountIdentifierAccount, type IcpOnIcpAssetIdentifier, type IcrcAccount, type IcrcTransferDetails, type InflowActivity, type InflowActivityOperation, type InflowActivityStatus, type InflowFeeEstimate, type InflowOperation, LendingModule, type LiquidiumAccount, type LiquidiumAccountInput, type LiquidiumAccountReference, LiquidiumAccountType, 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, MIN_DEPOSIT_AMOUNTS_BY_ASSET, MIN_WITHDRAW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, type MinimumDepositAsset, type MinimumWithdrawAsset, type OutflowActivity, type OutflowActivityOperation, type OutflowActivityStatus, type OutflowDetails, OutflowType, type PaginatedResponse, type Pool, type PoolCanisterIds, 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 SendIcrcTransferRequest, type SignMessageRequest, type SignMessageWalletAction, type SignatureInfo, type SigningChain, type SimpleLoan, type SimpleLoanAccount, type SimpleLoanAsset, type SimpleLoanAuthorization, type SimpleLoanBorrow, type SimpleLoanBorrowRequestedEventType, type SimpleLoanCollateral, type SimpleLoanConfig, SimpleLoanCreatedError, type SimpleLoanCreatedEventType, type SimpleLoanDepositTimerExceededEventType, type SimpleLoanDepositTimerStartedEventType, type SimpleLoanDestination, type SimpleLoanEvent, type SimpleLoanEventType, type SimpleLoanFindBorrow, type SimpleLoanFindCollateral, type SimpleLoanFindResult, type SimpleLoanFullLendWithdrawalRequestedEventType, type SimpleLoanGetByIdRequest, type SimpleLoanGetByRefRequest, type SimpleLoanGetRequest, type SimpleLoanInitialDeposit, type SimpleLoanInitialDepositTargetQuote, type SimpleLoanLeg, type SimpleLoanListEventsRequest, type SimpleLoanPositionSummary, type SimpleLoanProfileWarmedEventType, type SimpleLoanRepayCompleteEventType, type SimpleLoanRepayment, type SimpleLoanRepaymentTargetQuote, type SimpleLoanStuckFundsWithdrawalRequestedEventType, type SimpleLoanTerms, type SimpleLoanWarmedProfile, SimpleLoansModule, type SubmitInflowRequest, type SubmitInflowResponse, type SubmitSupplyFlowInflowRequest, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UsdcOnEthAssetIdentifier, type UsdcOnIcpAssetIdentifier, type UsdtOnEthAssetIdentifier, type UsdtOnIcpAssetIdentifier, 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, createTransferErc20Transaction, executeWith, getMinimumBorrowAmount, getMinimumDepositAmount, getMinimumWithdrawAmount, intFromPublicId, isAssetIdentifier, publicIdFromInt };
|
package/dist/index.d.ts
CHANGED
|
@@ -92,35 +92,53 @@ declare const Chain: {
|
|
|
92
92
|
type Chain = (typeof Chain)[keyof typeof Chain];
|
|
93
93
|
/** Chains whose wallets can authorize Liquidium protocol actions. */
|
|
94
94
|
type SigningChain = typeof Chain.BTC | typeof Chain.ETH;
|
|
95
|
-
/**
|
|
96
|
-
|
|
95
|
+
/** BTC transferred on the Bitcoin chain. */
|
|
96
|
+
interface BtcOnBtcAssetIdentifier {
|
|
97
97
|
chain: typeof Chain.BTC;
|
|
98
98
|
asset: typeof Asset.BTC;
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
|
+
/** ETH transferred on the Ethereum chain. */
|
|
101
|
+
interface EthOnEthAssetIdentifier {
|
|
100
102
|
chain: typeof Chain.ETH;
|
|
101
103
|
asset: typeof Asset.ETH;
|
|
102
|
-
}
|
|
104
|
+
}
|
|
105
|
+
/** USDC transferred on the Ethereum chain. */
|
|
106
|
+
interface UsdcOnEthAssetIdentifier {
|
|
103
107
|
chain: typeof Chain.ETH;
|
|
104
108
|
asset: typeof Asset.USDC;
|
|
105
|
-
}
|
|
109
|
+
}
|
|
110
|
+
/** USDT transferred on the Ethereum chain. */
|
|
111
|
+
interface UsdtOnEthAssetIdentifier {
|
|
106
112
|
chain: typeof Chain.ETH;
|
|
107
113
|
asset: typeof Asset.USDT;
|
|
108
|
-
}
|
|
114
|
+
}
|
|
115
|
+
/** BTC transferred on the Internet Computer chain. */
|
|
116
|
+
interface BtcOnIcpAssetIdentifier {
|
|
109
117
|
chain: typeof Chain.ICP;
|
|
110
118
|
asset: typeof Asset.BTC;
|
|
111
|
-
}
|
|
119
|
+
}
|
|
120
|
+
/** ETH transferred on the Internet Computer chain. */
|
|
121
|
+
interface EthOnIcpAssetIdentifier {
|
|
112
122
|
chain: typeof Chain.ICP;
|
|
113
123
|
asset: typeof Asset.ETH;
|
|
114
|
-
}
|
|
124
|
+
}
|
|
125
|
+
/** ICP transferred on the Internet Computer chain. */
|
|
126
|
+
interface IcpOnIcpAssetIdentifier {
|
|
115
127
|
chain: typeof Chain.ICP;
|
|
116
128
|
asset: typeof Asset.ICP;
|
|
117
|
-
}
|
|
129
|
+
}
|
|
130
|
+
/** USDC transferred on the Internet Computer chain. */
|
|
131
|
+
interface UsdcOnIcpAssetIdentifier {
|
|
118
132
|
chain: typeof Chain.ICP;
|
|
119
133
|
asset: typeof Asset.USDC;
|
|
120
|
-
}
|
|
134
|
+
}
|
|
135
|
+
/** USDT transferred on the Internet Computer chain. */
|
|
136
|
+
interface UsdtOnIcpAssetIdentifier {
|
|
121
137
|
chain: typeof Chain.ICP;
|
|
122
138
|
asset: typeof Asset.USDT;
|
|
123
|
-
}
|
|
139
|
+
}
|
|
140
|
+
/** Supported asset and transfer-chain combinations. */
|
|
141
|
+
type AssetIdentifier = BtcOnBtcAssetIdentifier | EthOnEthAssetIdentifier | UsdcOnEthAssetIdentifier | UsdtOnEthAssetIdentifier | BtcOnIcpAssetIdentifier | EthOnIcpAssetIdentifier | IcpOnIcpAssetIdentifier | UsdcOnIcpAssetIdentifier | UsdtOnIcpAssetIdentifier;
|
|
124
142
|
/** Returns whether an asset and chain form a supported SDK identifier. */
|
|
125
143
|
declare function isAssetIdentifier(identifier: {
|
|
126
144
|
chain: string;
|
|
@@ -440,9 +458,9 @@ interface LiquidiumStatus {
|
|
|
440
458
|
operation: LiquidiumOperation;
|
|
441
459
|
/** Current lifecycle state for the operation. */
|
|
442
460
|
state: LiquidiumState;
|
|
443
|
-
/**
|
|
461
|
+
/** Confirmation progress while confirming, capped at the required count. */
|
|
444
462
|
confirmations: number | null;
|
|
445
|
-
/** Required confirmations,
|
|
463
|
+
/** Required confirmations while confirming, otherwise null. */
|
|
446
464
|
requiredConfirmations: number | null;
|
|
447
465
|
}
|
|
448
466
|
|
|
@@ -1346,10 +1364,11 @@ declare class PositionsModule {
|
|
|
1346
1364
|
*/
|
|
1347
1365
|
getPosition(profileId: string, poolId: string): Promise<Position | null>;
|
|
1348
1366
|
/**
|
|
1349
|
-
* Lists
|
|
1367
|
+
* Lists visible positions for a profile. Supply balances below their pool's
|
|
1368
|
+
* same-asset dust threshold are hidden without removing active debt.
|
|
1350
1369
|
*
|
|
1351
1370
|
* @param profileId - The Liquidium profile principal text.
|
|
1352
|
-
* @returns
|
|
1371
|
+
* @returns Visible positions currently associated with the requested profile.
|
|
1353
1372
|
*/
|
|
1354
1373
|
listPositions(profileId: string): Promise<Position[]>;
|
|
1355
1374
|
/**
|
|
@@ -1382,6 +1401,10 @@ declare class PositionsModule {
|
|
|
1382
1401
|
* Returns the per-reserve breakdown of a profile's supplies and borrows,
|
|
1383
1402
|
* joined with pool metadata, rates, and current USD prices.
|
|
1384
1403
|
*
|
|
1404
|
+
* Supplied-only reserves below their pool's same-asset dust threshold are
|
|
1405
|
+
* omitted. Reserves with active debt remain, with their supplied amount and
|
|
1406
|
+
* earned interest set to zero when the supplied balance is below the threshold.
|
|
1407
|
+
*
|
|
1385
1408
|
* USD values are scaled to 27 decimals.
|
|
1386
1409
|
*
|
|
1387
1410
|
* @param profileId - The Liquidium profile principal text.
|
|
@@ -2269,4 +2292,4 @@ interface ExecuteWithOptions {
|
|
|
2269
2292
|
*/
|
|
2270
2293
|
declare function executeWith(options: ExecuteWithOptions): <TResult>(action: WalletAction<TResult>) => Promise<TResult>;
|
|
2271
2294
|
|
|
2272
|
-
export { AccountsModule, ActivitiesModule, type Activity, ActivityFilter, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, Asset, type AssetIdentifier, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, type BorrowAction, type BorrowOutflowDetails, type BorrowingPower, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIdOverrides, type CanisterIds, Chain, type ChainAddressAccount, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateProfileParams, type CreateSimpleLoanBorrow, type CreateSimpleLoanCollateral, type CreateSimpleLoanRefund, type CreateSimpleLoanRequest, type CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type FindPoolQuery, type FullWithdrawAmount, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, type GetEvmSupplyContextRequest, type HealthFactor, HistoryModule, type IcPrincipalAccount, type IcpAccountIdentifierAccount, type IcrcAccount, type IcrcTransferDetails, type InflowActivity, type InflowActivityOperation, type InflowActivityStatus, type InflowFeeEstimate, type InflowOperation, LendingModule, type LiquidiumAccount, type LiquidiumAccountInput, type LiquidiumAccountReference, LiquidiumAccountType, 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, MIN_DEPOSIT_AMOUNTS_BY_ASSET, MIN_WITHDRAW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, type MinimumDepositAsset, type MinimumWithdrawAsset, type OutflowActivity, type OutflowActivityOperation, type OutflowActivityStatus, type OutflowDetails, OutflowType, type PaginatedResponse, type Pool, type PoolCanisterIds, 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 SendIcrcTransferRequest, type SignMessageRequest, type SignMessageWalletAction, type SignatureInfo, type SigningChain, type SimpleLoan, type SimpleLoanAccount, type SimpleLoanAsset, type SimpleLoanAuthorization, type SimpleLoanBorrow, type SimpleLoanBorrowRequestedEventType, type SimpleLoanCollateral, type SimpleLoanConfig, SimpleLoanCreatedError, type SimpleLoanCreatedEventType, type SimpleLoanDepositTimerExceededEventType, type SimpleLoanDepositTimerStartedEventType, type SimpleLoanDestination, type SimpleLoanEvent, type SimpleLoanEventType, type SimpleLoanFindBorrow, type SimpleLoanFindCollateral, type SimpleLoanFindResult, type SimpleLoanFullLendWithdrawalRequestedEventType, type SimpleLoanGetByIdRequest, type SimpleLoanGetByRefRequest, type SimpleLoanGetRequest, type SimpleLoanInitialDeposit, type SimpleLoanInitialDepositTargetQuote, type SimpleLoanLeg, type SimpleLoanListEventsRequest, type SimpleLoanPositionSummary, type SimpleLoanProfileWarmedEventType, type SimpleLoanRepayCompleteEventType, type SimpleLoanRepayment, type SimpleLoanRepaymentTargetQuote, type SimpleLoanStuckFundsWithdrawalRequestedEventType, type SimpleLoanTerms, type SimpleLoanWarmedProfile, SimpleLoansModule, type SubmitInflowRequest, type SubmitInflowResponse, type SubmitSupplyFlowInflowRequest, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, 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, createTransferErc20Transaction, executeWith, getMinimumBorrowAmount, getMinimumDepositAmount, getMinimumWithdrawAmount, intFromPublicId, isAssetIdentifier, publicIdFromInt };
|
|
2295
|
+
export { AccountsModule, ActivitiesModule, type Activity, ActivityFilter, type ActivityStatusFoundResponse, type ActivityStatusNotFoundResponse, type ActivityTopUp, Asset, type AssetIdentifier, type AssetPrices, type BaseGetActivityStatusRequest, type BaseListActivitiesRequest, type BorrowAction, type BorrowOutflowDetails, type BorrowingPower, type BtcOnBtcAssetIdentifier, type BtcOnIcpAssetIdentifier, CK_ETH_DEPOSIT_CONTRACT_ADDRESS, type CalculateLtvRequest, type CanisterIdOverrides, type CanisterIds, Chain, type ChainAddressAccount, type ContractInteractionSupplyFlowRequest, type CreateAccountAction, type CreateAccountData, type CreateAccountRequest, type CreateBorrowData, type CreateBorrowRequest, type CreateProfileParams, type CreateSimpleLoanBorrow, type CreateSimpleLoanCollateral, type CreateSimpleLoanRefund, type CreateSimpleLoanRequest, type CreateTransferErc20TransactionParams, type CreateWithdrawData, type CreateWithdrawRequest, Environment, type EstimateInflowFeeRequest, type EthOnEthAssetIdentifier, type EthOnIcpAssetIdentifier, type EthTransactionRequest, type EvmContractTransaction, type EvmReadClient, EvmSupplyApprovalStrategy, type EvmSupplyContext, type ExecuteWithOptions, type FindPoolQuery, type FullWithdrawAmount, type GetActivityStatusByProfileRequest, type GetActivityStatusByShortRefRequest, type GetActivityStatusRequest, type GetActivityStatusResponse, type GetDepositAddressRequest, type GetEvmSupplyContextRequest, type HealthFactor, HistoryModule, type IcPrincipalAccount, type IcpAccountIdentifierAccount, type IcpOnIcpAssetIdentifier, type IcrcAccount, type IcrcTransferDetails, type InflowActivity, type InflowActivityOperation, type InflowActivityStatus, type InflowFeeEstimate, type InflowOperation, LendingModule, type LiquidiumAccount, type LiquidiumAccountInput, type LiquidiumAccountReference, LiquidiumAccountType, 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, MIN_DEPOSIT_AMOUNTS_BY_ASSET, MIN_WITHDRAW_AMOUNTS_BY_ASSET, type ManualTransferSupplyFlowRequest, MarketModule, type MaxRepayAmount, type MinimumBorrowAsset, type MinimumDepositAsset, type MinimumWithdrawAsset, type OutflowActivity, type OutflowActivityOperation, type OutflowActivityStatus, type OutflowDetails, OutflowType, type PaginatedResponse, type Pool, type PoolCanisterIds, 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 SendIcrcTransferRequest, type SignMessageRequest, type SignMessageWalletAction, type SignatureInfo, type SigningChain, type SimpleLoan, type SimpleLoanAccount, type SimpleLoanAsset, type SimpleLoanAuthorization, type SimpleLoanBorrow, type SimpleLoanBorrowRequestedEventType, type SimpleLoanCollateral, type SimpleLoanConfig, SimpleLoanCreatedError, type SimpleLoanCreatedEventType, type SimpleLoanDepositTimerExceededEventType, type SimpleLoanDepositTimerStartedEventType, type SimpleLoanDestination, type SimpleLoanEvent, type SimpleLoanEventType, type SimpleLoanFindBorrow, type SimpleLoanFindCollateral, type SimpleLoanFindResult, type SimpleLoanFullLendWithdrawalRequestedEventType, type SimpleLoanGetByIdRequest, type SimpleLoanGetByRefRequest, type SimpleLoanGetRequest, type SimpleLoanInitialDeposit, type SimpleLoanInitialDepositTargetQuote, type SimpleLoanLeg, type SimpleLoanListEventsRequest, type SimpleLoanPositionSummary, type SimpleLoanProfileWarmedEventType, type SimpleLoanRepayCompleteEventType, type SimpleLoanRepayment, type SimpleLoanRepaymentTargetQuote, type SimpleLoanStuckFundsWithdrawalRequestedEventType, type SimpleLoanTerms, type SimpleLoanWarmedProfile, SimpleLoansModule, type SubmitInflowRequest, type SubmitInflowResponse, type SubmitSupplyFlowInflowRequest, SupplyAction, type SupplyFlow, type SupplyFlowRequest, SupplyPlanType, type SupplyTarget, type TransferSupplyFlowRequest, USDC_CONTRACT_ADDRESS, USDT_CONTRACT_ADDRESS, type UsdcOnEthAssetIdentifier, type UsdcOnIcpAssetIdentifier, type UsdtOnEthAssetIdentifier, type UsdtOnIcpAssetIdentifier, 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, createTransferErc20Transaction, executeWith, getMinimumBorrowAmount, getMinimumDepositAmount, getMinimumWithdrawAmount, intFromPublicId, isAssetIdentifier, publicIdFromInt };
|
package/dist/index.js
CHANGED
|
@@ -5475,23 +5475,38 @@ var PositionsModule = class {
|
|
|
5475
5475
|
}
|
|
5476
5476
|
}
|
|
5477
5477
|
/**
|
|
5478
|
-
* Lists
|
|
5478
|
+
* Lists visible positions for a profile. Supply balances below their pool's
|
|
5479
|
+
* same-asset dust threshold are hidden without removing active debt.
|
|
5479
5480
|
*
|
|
5480
5481
|
* @param profileId - The Liquidium profile principal text.
|
|
5481
|
-
* @returns
|
|
5482
|
+
* @returns Visible positions currently associated with the requested profile.
|
|
5482
5483
|
*/
|
|
5483
5484
|
async listPositions(profileId) {
|
|
5484
5485
|
try {
|
|
5485
5486
|
const actor = createFlexibleLendingActor(this.canisterContext);
|
|
5486
5487
|
const profilePrincipal = Principal.fromText(profileId);
|
|
5487
|
-
const stats = await
|
|
5488
|
+
const [stats, pools] = await Promise.all([
|
|
5489
|
+
actor.get_profile_stats(profilePrincipal),
|
|
5490
|
+
actor.list_pools()
|
|
5491
|
+
]);
|
|
5488
5492
|
const decodedStats = decodeFlexibleUserStats(stats);
|
|
5493
|
+
const dustThresholdsByPoolId = new Map(
|
|
5494
|
+
pools.map((pool) => [
|
|
5495
|
+
pool.principal.toText(),
|
|
5496
|
+
pool.same_asset_borrowing_dust_threshold
|
|
5497
|
+
])
|
|
5498
|
+
);
|
|
5489
5499
|
const positionViews = await Promise.all(
|
|
5490
5500
|
decodedStats.positions.map(
|
|
5491
5501
|
(position) => actor.get_position(profilePrincipal, position.pool_id)
|
|
5492
5502
|
)
|
|
5493
5503
|
);
|
|
5494
|
-
return positionViews.map((result) => result[0]).filter((view) => view !== void 0).map(decodeFlexiblePositionView).filter((view) => view !== null).map(mapDecodedPositionViewToPosition)
|
|
5504
|
+
return positionViews.map((result) => result[0]).filter((view) => view !== void 0).map(decodeFlexiblePositionView).filter((view) => view !== null).map(mapDecodedPositionViewToPosition).map(
|
|
5505
|
+
(position) => getPositionWithSuppliedDustHidden(
|
|
5506
|
+
position,
|
|
5507
|
+
dustThresholdsByPoolId.get(position.poolId)
|
|
5508
|
+
)
|
|
5509
|
+
).filter((position) => position !== null);
|
|
5495
5510
|
} catch (error) {
|
|
5496
5511
|
if (error instanceof LiquidiumError) {
|
|
5497
5512
|
throw error;
|
|
@@ -5577,6 +5592,10 @@ var PositionsModule = class {
|
|
|
5577
5592
|
* Returns the per-reserve breakdown of a profile's supplies and borrows,
|
|
5578
5593
|
* joined with pool metadata, rates, and current USD prices.
|
|
5579
5594
|
*
|
|
5595
|
+
* Supplied-only reserves below their pool's same-asset dust threshold are
|
|
5596
|
+
* omitted. Reserves with active debt remain, with their supplied amount and
|
|
5597
|
+
* earned interest set to zero when the supplied balance is below the threshold.
|
|
5598
|
+
*
|
|
5580
5599
|
* USD values are scaled to 27 decimals.
|
|
5581
5600
|
*
|
|
5582
5601
|
* @param profileId - The Liquidium profile principal text.
|
|
@@ -5657,6 +5676,16 @@ var PositionsModule = class {
|
|
|
5657
5676
|
return { amount: position.deposited, decimals: position.depositedDecimals };
|
|
5658
5677
|
}
|
|
5659
5678
|
};
|
|
5679
|
+
function getPositionWithSuppliedDustHidden(position, dustThreshold) {
|
|
5680
|
+
if (dustThreshold === void 0 || position.deposited >= dustThreshold) {
|
|
5681
|
+
return position;
|
|
5682
|
+
}
|
|
5683
|
+
const hasDebt = position.borrowed > 0n || position.debtInterest > 0n;
|
|
5684
|
+
if (!hasDebt) {
|
|
5685
|
+
return null;
|
|
5686
|
+
}
|
|
5687
|
+
return { ...position, deposited: 0n, earnedInterest: 0n };
|
|
5688
|
+
}
|
|
5660
5689
|
function nativeAmountToUsdScaled(amount, nativeDecimals, priceUsd) {
|
|
5661
5690
|
if (amount <= 0n || priceUsd <= 0) {
|
|
5662
5691
|
return 0n;
|