PositionsModule
@liquidium/client / PositionsModule
Class: PositionsModule
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:26
Profile position, health factor, and reserve valuation helpers.
Constructors
Constructor
new PositionsModule(
canisterContext,market):PositionsModule
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:27
Parameters
canisterContext
CanisterContext
market
Returns
PositionsModule
Properties
market
readonlymarket:MarketModule
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:29
Methods
getHealthFactor()
getHealthFactor(
profileId):Promise<HealthFactor>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:100
Returns the current health factor for a profile.
Parameters
profileId
string
The Liquidium profile principal text.
Returns
Promise<HealthFactor>
The current health factor for the requested profile.
getMaxRepayAmount()
getMaxRepayAmount(
profileId,poolId,bufferBps?):Promise<MaxRepayAmount>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:237
Returns the full repayment amount for a position, with a small buffer to account for interest that accrues between quote and submit.
Parameters
profileId
string
The Liquidium profile principal text.
poolId
string
The pool principal text.
bufferBps?
bigint = DEFAULT_REPAY_BUFFER_BPS
Optional buffer in basis points (default 10 = 0.1%).
Returns
Promise<MaxRepayAmount>
Buffered repayment amount in the borrowed asset's base units.
getPosition()
getPosition(
profileId,poolId):Promise<Position|null>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:39
Returns a single position for a profile and pool.
Parameters
profileId
string
The Liquidium profile principal text.
poolId
string
The pool principal text.
Returns
Promise<Position | null>
The position for the requested profile and pool, or null when no position exists.
getUserPositionSummary()
getUserPositionSummary(
profileId):Promise<UserPositionSummary>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:152
Returns an aggregate summary of a profile's position.
Single canister round-trip (get_health_factor). Derived fields:
availableBorrowsUsd = max(0, maxBorrowableUsd - debt),
netWorthUsd = collateral - debt (may be negative if underwater),
currentLtvBps = debt * 10_000 / collateral (0 when collateral is 0).
Parameters
profileId
string
The Liquidium profile principal text.
Returns
Promise<UserPositionSummary>
Derived position summary for the requested profile.
getUserReserves()
getUserReserves(
profileId):Promise<UserReserve[]>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:188
Returns the per-reserve breakdown of a profile's supplies and borrows, joined with pool metadata, rates, and current USD prices.
USD values are scaled to 27 decimals.
Parameters
profileId
string
The Liquidium profile principal text.
Returns
Promise<UserReserve[]>
Per-reserve position rows joined with pool metadata and USD values.
getUserStats()
getUserStats(
profileId):Promise<UserStats>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:125
Returns aggregate borrowing and collateral stats for a profile.
Parameters
profileId
string
The Liquidium profile principal text.
Returns
Promise<UserStats>
Aggregate debt, collateral, and borrowing power metrics for the requested profile.
listPositions()
listPositions(
profileId):Promise<Position[]>
Defined in: external/liquidium-sdk/packages/client/src/modules/positions/positions.ts:69
Lists all positions for a profile.
Parameters
profileId
string
The Liquidium profile principal text.
Returns
Promise<Position[]>
All positions currently associated with the requested profile.