Skip to content

amm.getPool

Gets the reserves for a liquidity pool.

Usage

example.ts
import { Actions } from 'tempo.ts/wagmi'
import { config } from './wagmi.config'
 
const pool = await Actions.amm.getPool(config, {
  userToken: '0x20c0000000000000000000000000000000000000',
  validatorToken: '0x20c0000000000000000000000000000000000001',
})
 
console.log('User token reserve:', pool.reserveUserToken)
User token reserve: 1000000000000000000000n
console.log('Validator token reserve:', pool.reserveValidatorToken)
Validator token reserve: 1000000000000000000000n
console.log('Total supply:', pool.totalSupply)
Total supply: 1000000000000000000000n

Return Type

type ReturnType = {
  /** Reserve of user token */
  reserveUserToken: bigint
  /** Reserve of validator token */
  reserveValidatorToken: bigint
  /** Total supply of LP tokens */
  totalSupply: bigint
}

Parameters

userToken

  • Type: Address | bigint

Address or ID of the user token.

validatorToken

  • Type: Address | bigint

Address or ID of the 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.