Reading Market State
Read-only calls do not require a connected wallet. Use them to discover pools, inspect balances and rates, fetch oracle prices, and load user positions. All methods return values already unwrapped from Soroban's Result type and scaled where noted.
Market service
Accessed via client.market.
getMarketData
Fetch the full market snapshot in one call — all pools, computed APYs, global state, and oracle decimals.
const marketData = await client.market.getMarketData()Returns a MarketData object. This is the most efficient way to render a market overview, since it avoids per-pool round trips.
getAllPools
List every pool registered on the market.
const pools = await client.market.getAllPools()Returns an array of Pool entries.
getPoolData
Fetch a single pool with computed values (APYs, oracle price) for the given pool address.
const poolData = await client.market.getPoolData(poolAddress)| Parameter | Type | Description |
|---|---|---|
poolAddress | string | Target pool address |
Returns a Pool.
getPoolInfo
Fetch the raw stored pool record (balances, rates, configuration) without simulation-derived fields.
const pool = await client.market.getPoolInfo(poolAddress)Returns a Pool.
getPoolAssetOraclePrice
Fetch the current oracle price for a pool's asset, already scaled to a human-readable number using the market's oracle decimals.
const price = await client.market.getPoolAssetOraclePrice(poolAddress)| Parameter | Type | Description |
|---|---|---|
poolAddress | string | Target pool address |
Returns a number (returns 0 if the oracle has no price).
simulateWithdraw
Preview a withdrawal — the resulting amount and fees — without submitting a transaction. Use this to show users the actual amount they will receive before they commit.
const result = await client.market.simulateWithdraw(user, poolAddress, '500', assetDecimals)| Parameter | Type | Description |
|---|---|---|
user | ObligationKey | Obligation to withdraw from |
poolAddress | string | Target pool address |
amount | string | number | Human-readable amount to preview |
assetDecimals | number | Decimal precision of the pool's token |
Returns a WithdrawResult.
Obligation service
Accessed via client.obligation.
getUserObligation
Load a user's obligation — their deposits, borrows, and collateral positions.
import type { ObligationKey } from '@alula/market-sdk'
const user: ObligationKey = { user: 'GABC...', seed: undefined }
const obligation = await client.obligation.getUserObligation(user)| Parameter | Type | Description |
|---|---|---|
user | ObligationKey | Obligation to load |
Returns an Obligation. The seed inside the key selects which position type to read — see Concepts for how standard, earn, and multiply obligations differ.