Skip to content

getUserBalances

Returns all token balances for a specific user across Moonwell core and isolated markets.

Usage

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

Returns

Example
Loading example...
UserBalance[]

Parameters

userAddress

  • Type: Address

The address of the user.

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

chainId (optional)

  • Type: number

The chain ID to get the balances for.

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

network (optional)

  • Type: string

The network to filter the markets by.

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