Skip to main content

LendingModule

@liquidium/client


@liquidium/client / LendingModule

Class: LendingModule

Defined in: packages/client/src/modules/lending/lending.ts:113

Borrow, withdraw, supply, inflow reporting, and fee-estimation helpers.

Constructors

Constructor

new LendingModule(canisterContext, apiClient, evmReadClient): LendingModule

Defined in: packages/client/src/modules/lending/lending.ts:114

Parameters

canisterContext

CanisterContext

apiClient

ApiClient | undefined

evmReadClient

EvmReadClient | undefined

Returns

LendingModule

Methods

borrow()

borrow(params): Promise<BorrowOutflowDetails>

Defined in: packages/client/src/modules/lending/lending.ts:452

Creates a borrow outflow using the provided wallet adapter.

This is the convenience form of prepareBorrow(...) plus execution. Same-asset policy validation runs before the wallet is asked to sign.

Parameters

params

CreateBorrowRequest & WalletExecutionParams

Borrow request fields plus signerChain and signerWalletAdapter.

Returns

Promise<BorrowOutflowDetails>

The lending canister receipt as OutflowDetails.

Remarks

id is always present. txid may be missing on the first response; the SDK does not poll for it. Use history or app-level polling if you need the chain transaction id.


estimateInflowFee()

estimateInflowFee(request): Promise<InflowFeeEstimate>

Defined in: packages/client/src/modules/lending/lending.ts:546

Estimates the network/deposit fee for an inflow target.

ETH stablecoin deposit-address estimates are served by the deposit-address canister. BTC estimates include the ckBTC minter deposit fee and ledger fee. ICP-chain estimates return the corresponding ICRC ledger fee.

Parameters

request

AssetIdentifier

Asset and chain pair to estimate for.

Returns

Promise<InflowFeeEstimate>

Total fee estimate rounded up in the asset's base units.


getDepositAddress()

getDepositAddress(request): Promise<string>

Defined in: packages/client/src/modules/lending/lending.ts:505

Returns the read-only deposit address for an ETH stablecoin inflow target.

This is a query call that does not create or mutate state. Use it when you need the deposit address without hitting the authorization-gated update path.

Parameters

request

GetDepositAddressRequest

Profile, pool, asset, and supply action.

Returns

Promise<string>

The EVM deposit address for the derived account.


getEvmSupplyContext()

getEvmSupplyContext(request): Promise<EvmSupplyContext>

Defined in: packages/client/src/modules/lending/lending.ts:490

Fetches ERC-20 supply planning data with the configured EVM read client.

Requires evmRpcUrl or evmPublicClient on the client. Used internally by contract-interaction supply.

Parameters

request

GetEvmSupplyContextRequest

Profile, pool, wallet, amount (token base units), and action.

Returns

Promise<EvmSupplyContext>

Locally computed EvmSupplyContext for approvals and deposit.


isBorrowingDisabled()

isBorrowingDisabled(): Promise<boolean>

Defined in: packages/client/src/modules/lending/lending.ts:643

Returns whether borrowing is currently disabled by the protocol.

Returns

Promise<boolean>

true when the lending canister reports borrowing disabled.


prepareBorrow()

prepareBorrow(request): Promise<BorrowAction>

Defined in: packages/client/src/modules/lending/lending.ts:299

Prepares a borrow action that can be signed and submitted later.

Use this when you need explicit control over signing and submission. When the selected pool disables same-asset borrowing, preparation rejects profiles whose supplied balance in that pool is at or above its dust threshold.

Parameters

request

CreateBorrowRequest

Profile, pool, amount (borrow asset base units), outflow address, and signer wallet.

Returns

Promise<BorrowAction>

A signable BorrowAction with submit wired to the canister.


prepareWithdraw()

prepareWithdraw(request): Promise<WithdrawAction>

Defined in: packages/client/src/modules/lending/lending.ts:127

Prepares a withdraw action that can be signed and submitted later.

Use this when you need explicit control over signing and submission.

Parameters

request

CreateWithdrawRequest

Profile, pool, amount (pool asset base units), outflow address, and signer wallet.

Returns

Promise<WithdrawAction>

A signable WithdrawAction with submit wired to the canister.


submitInflow()

submitInflow(request): Promise<SubmitInflowResponse>

Defined in: packages/client/src/modules/lending/lending.ts:612

Submits an inflow transaction id for faster indexing.

Uses the Liquidium SDK API.

Parameters

request

SubmitInflowRequest

Broadcast txid plus inflow operation and optional chain.

Returns

Promise<SubmitInflowResponse>

Acknowledgement including the submitted txid.


supply()

supply(request): Promise<SupplyFlow>

Defined in: packages/client/src/modules/lending/lending.ts:477

Resolves a supply target for a deposit or repayment and optionally broadcasts it.

Transfer mode can return manual broadcast instructions when wallet fields are omitted. Contract-interaction mode always requires walletAdapter, account, and amount because it must prepare and submit approval/deposit calls.

The SDK does not poll for inflow status. When a txid is returned, it is the caller's responsibility to track confirmation state using their own polling.

Parameters

request

SupplyFlowRequest

Returns

Promise<SupplyFlow>

A SupplyFlow receipt with type, target, submit, and an optional txid present when the SDK broadcast for you.


withdraw()

withdraw(params): Promise<WithdrawOutflowDetails>

Defined in: packages/client/src/modules/lending/lending.ts:277

Creates a withdraw outflow using the provided wallet adapter.

This is the convenience form of prepareWithdraw(...) plus execution.

Parameters

params

CreateWithdrawRequest & WalletExecutionParams

Withdraw request fields plus signerChain and signerWalletAdapter.

Returns

Promise<WithdrawOutflowDetails>

The canister OutflowDetails for the completed withdraw.