Skip to content

amm.getLiquidityBalance

Gets the liquidity balance for an address in a specific pool.

Usage

example.ts
import { client } from './viem.config'
 
const balance = await client.amm.getLiquidityBalance({
  address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  userToken: '0x20c0000000000000000000000000000000000000',
  validatorToken: '0x20c0000000000000000000000000000000000001',
})
 
console.log('Liquidity balance:', balance)
Liquidity balance: 10500000000000000000n

Return Type

type ReturnType = bigint // Liquidity balance

Parameters

address

  • Type: Address

Address to check balance for.

poolId (optional)

  • Type: Hex

Pool ID.

userToken (optional)

  • Type: Address | bigint

User token.

validatorToken (optional)

  • Type: Address | bigint

Validator token.

account (optional)

  • Type: Account | Address

Account that will be used to send the transaction.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.