Skip to main content

SimpleLoansModule

@liquidium/client


@liquidium/client / SimpleLoansModule

Class: SimpleLoansModule

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:319

Accountless Simple Loans creation, lookup, recovery, and canister query helpers.

Constructors​

Constructor​

new SimpleLoansModule(canisterContext, apiClient, activities, lending, positions): SimpleLoansModule

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:320

Parameters​

canisterContext​

CanisterContext

apiClient​

ApiClient | undefined

activities​

ActivitiesModule

lending​

LendingModule

positions​

PositionsModule

Returns​

SimpleLoansModule

Methods​

countWarmedProfiles()​

countWarmedProfiles(): Promise<bigint>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:537

Returns the current size of the warmed-profile pool via direct query.

Returns​

Promise<bigint>

Number of warmed profiles available on the canister.


create()​

create(request): Promise<SimpleLoan>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:350

Creates a profileless simple loan and returns canonical canister state plus generated initial-deposit and repayment quote targets.

Choose collateralPoolId and borrowPoolId from client.market.listPools(), convert UI amounts to base units with the selected pool decimals, and call client.quote.calculateLtv(...) before creation to block invalid LTV input.

borrow.destination receives the borrowed asset after the loan starts. refund.destination receives collateral refunds or withdrawals. Use depositWindowSeconds for the user-facing collateral deposit timeout; the SDK maps it to the canister's internal ltv_timer_s field. Pool assets and same-asset borrowing policy are validated before creation.

Parameters​

request​

CreateSimpleLoanRequest

Collateral, borrow, refund, LTV limit, timeout, and inflow options.

Returns​

Promise<SimpleLoan>

Hydrated loan state plus generated initial-deposit and repayment quote targets.

Throws​

LiquidiumError If request validation, API transport, or protocol validation fails before creation.

Throws​

SimpleLoanCreatedError If the remote loan is created but the SDK cannot load its hydrated state.


find()​

find(query): Promise<SimpleLoanFindResult[]>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:437

Finds simple loans by short reference, numeric loan id string, address, or transaction id.

Search returns lightweight matches. Call get({ loanId }) or get({ ref }) when the user selects a match and you need hydrated loan state.

Parameters​

query​

string

Short reference, address, transaction id/hash, or numeric loan id string.

Returns​

Promise<SimpleLoanFindResult[]>

Matching loan ids and references from the search index.


get()​

get(request): Promise<SimpleLoan>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:418

Resolves canonical canister state by loan id or short reference.

References are decoded locally, then the corresponding loan id is loaded from the Simple Loans canister.

Parameters​

request​

SimpleLoanGetRequest

Canister loan id or short public reference.

Returns​

Promise<SimpleLoan>

Hydrated loan state plus generated initial-deposit and repayment quote targets.


getConfig()​

getConfig(): Promise<SimpleLoanConfig>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:456

Returns the active Simple Loans canister config via direct query.

Returns​

Promise<SimpleLoanConfig>

Active canister configuration.


getEvent()​

getEvent(eventId): Promise<SimpleLoanEvent | null>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:476

Returns a single canister event by id via direct query.

Parameters​

eventId​

bigint

Event id to load.

Returns​

Promise<SimpleLoanEvent | null>

The event when found, otherwise null.


listAccessList()​

listAccessList(): Promise<string[]>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:520

Returns principals authorized for protected update callbacks.

Returns​

Promise<string[]>

Principal text values on the canister access list.


listEvents()​

listEvents(request): Promise<SimpleLoanEvent[]>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:498

Returns a page of canister events via direct query.

Parameters​

request​

SimpleLoanListEventsRequest

Start event id and maximum number of events to return.

Returns​

Promise<SimpleLoanEvent[]>

Canister events in ascending id order.


listWarmedProfiles()​

listWarmedProfiles(): Promise<SimpleLoanWarmedProfile[]>

Defined in: packages/client/src/modules/simple-loans/simple-loans.ts:555

Returns warmed profiles currently available for future simple loans.

Returns​

Promise<SimpleLoanWarmedProfile[]>

Warmed profile records available for assignment.