getMarkets
Retrieves a list of all markets available on Moonwell. Each market contains detailed information about the asset, including supply and borrow rates, total liquidity, collateral factor, and other key metrics.
Usage
example.ts
import { moonwellClient } from './client'
const allMarkets = await moonwellClient.getMarkets();
// Get markets for a specific chain with liquid staking rewards
const marketsWithRewards = await moonwellClient.getMarkets({
chainId: 8453,
includeLiquidStakingRewards: true
});
Returns
Returns an array of Market objects containing detailed information about each available market.
Example
Loading example...
Market[]
- Type:
Market[]
- Description: An array of market objects, each containing:
- Asset information (symbol, name, decimals)
- Current market rates (supply APY, borrow APY)
- Market size (total supply, total borrow)
- Risk parameters (collateral factor, liquidation threshold)
- Protocol fees and reserves
Parameters
includeLiquidStakingRewards (optional)
- Type:
boolean
- Default:
false
- Description: When set to
true
, includes additional information about liquid staking rewards available for each market.
Whether to include liquid staking rewards in the response.
const markets = await moonwellClient.getMarkets({
includeLiquidStakingRewards: true
})
chainId (optional)
- Type:
number
The chain ID to filter the markets by.
const markets = await moonwellClient.getMarkets({
chainId: 8453
})
network (optional)
- Type:
string
The network to filter the markets by.
import { base } from "@moonwell-fi/moonwell-sdk/environments";
const markets = await moonwellClient.getMarkets<typeof base>({
network: "base"
})