getUserPosition
Returns a user's lending and borrowing position in a specific Moonwell market, including their supplied assets, borrowed amounts, and account health information.
Usage
example.ts
import { moonwellClient } from './client'
const position = await moonwellClient.getUserPosition({
userAddress: "0x0000000000000000000000000000000000000000",
chainId: 8453,
marketAddress: "0x628ff693426583D9a7FB391E54366292F509D457",
});
Returns
Example
Loading example...
UserPosition | undefined
- Type:
UserPosition
Parameters
userAddress
- Type:
Address
The address of the user.
const position = await moonwellClient.getUserPosition({
userAddress: "0x0000000000000000000000000000000000000000",
chainId: 8453,
marketAddress: "0x628ff693426583D9a7FB391E54366292F509D457",
});
chainId
- Type:
number
The chain ID to get the position for.
const position = await moonwellClient.getUserPosition({
userAddress: "0x0000000000000000000000000000000000000000",
chainId: 8453,
marketAddress: "0x628ff693426583D9a7FB391E54366292F509D457",
});
marketAddress
- Type:
Address
The address of the market.
const position = await moonwellClient.getUserPosition({
userAddress: "0x0000000000000000000000000000000000000000",
chainId: 8453,
marketAddress: "0x628ff693426583D9a7FB391E54366292F509D457",
});
network
- Type:
string
The network where the market is located.
import { base } from "@moonwell-fi/moonwell-sdk/environments";
const position = await moonwellClient.getUserPosition<typeof base>({
userAddress: "0x0000000000000000000000000000000000000000",
network: "base",
market: "MOONWELL_ETH",
});
market
- Type:
string
The name of the market.
import { base } from "@moonwell-fi/moonwell-sdk/environments";
const position = await moonwellClient.getUserPosition<typeof base>({
userAddress: "0x0000000000000000000000000000000000000000",
network: "base",
market: "MOONWELL_ETH",
});