@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / SomniaLendClient

Interface: SomniaLendClient

Defined in: packages/sdk/src/lend/client.ts:22

The SomniaLend client — reads over the deployed Aave-v3-fork contracts plus the Lender write factory, bound to one markets client's chain transport. Reached as client.lend.

Methods

listReserves()

listReserves(): Promise<LendReserve[]>

Defined in: packages/sdk/src/lend/client.ts:41

Every SomniaLend reserve — config, caps, live rates/indexes, liquidity, and the oracle price, in one aggregated eth_call. Chain read (current to head).

Details

Rates come back as ray bigints; convert for display with lendRayRateToApy. See LendReserve for the unit conventions.

Example (Displaying reserve APY)

ts
const reserves = await client.lend.listReserves();
for (const r of reserves) {
  console.log(r.symbol, `supply APY ${(lendRayRateToApy(r.liquidityRateRay) * 100).toFixed(2)}%`);
}

Returns

Promise<LendReserve[]>


getAccount()

getAccount(account): Promise<LendAccount>

Defined in: packages/sdk/src/lend/client.ts:46

A whole SomniaLend account: health factor, borrowing power, and every non-empty supplied/borrowed position. Chain read (current to head).

Parameters

account

`0x${string}`

Returns

Promise<LendAccount>


createLender()

createLender(config): Lender

Defined in: packages/sdk/src/lend/client.ts:52

Build a Lender bound to a signer — the write surface (supply / withdraw / borrow / repay, ERC-20 and native, auto-approving). Same signer doctrine as every SDK write factory (privateKey / local account / walletClient).

Parameters

config

OracleHubAdminConfig

Returns

Lender