Skip to content

getUserPositions

Returns all user positions across Moonwell core and isolated markets.

Usage

example.ts
import { moonwellClient } from './client'
 
const positions = await moonwellClient.getUserPositions({ 
  userAddress: "0x0000000000000000000000000000000000000000",
});

Returns

Example
Loading example...
UserPosition[]

Parameters

userAddress

  • Type: Address

The address of the user.

const positions = await moonwellClient.getUserPositions({
  userAddress: "0x0000000000000000000000000000000000000000", 
});

chainId (optional)

  • Type: number

The chain ID to get the positions for.

const positions = await moonwellClient.getUserPositions({
  userAddress: "0x0000000000000000000000000000000000000000",
  chainId: 8453, 
});

network (optional)

  • Type: string

The network to filter the markets by.

import { base } from "@moonwell-fi/moonwell-sdk/environments";
 
const positions = await moonwellClient.getUserPositions<typeof base>({
  userAddress: "0x0000000000000000000000000000000000000000",
  network: "base"
})