Skip to content
LogoLogo

earn.getFeeState

Gets a vault's active fee configuration, pending fees, and fee baselines.

Usage

import { client } from './viem.config'
 
const fees = await client.earn.getFeeState({
  vault: '0x0000000000000000000000000000000000000001',
})
{
//   config: { excess: { ... }, fixedFees: [...] },
//   configId: 1n,
//   feesActive: true,
//   highWaterMark: 1_000_000_000_000_000_000n,
//   preview: { totalFeeAssets: 10_000n, totalFeeShares: 9_950n, ... },
//   targetBase: 1_000_000_000_000_000_000n,
// }

Include Claimable Shares

Pass a fee recipient to include its currently claimable vault shares.

import { client } from './viem.config'
 
const fees = await client.earn.getFeeState({
  recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  vault: '0x0000000000000000000000000000000000000001',
})
{ claimableShares: 9_950n, ... }

Return Value

type ReturnValue = {
  /** Claimable fee shares for `recipient`. */
  claimableShares?: bigint | undefined
  /** Active fee configuration. */
  config: FeeConfig
  /** Active fee configuration id. */
  configId: bigint
  /** Whether fees are active. */
  feesActive: boolean
  /** Post-fee high-water mark per vault share. */
  highWaterMark: bigint
  /** Pending fee amounts. */
  preview: FeePreview
  /** Excess-return fee target per vault share. */
  targetBase: bigint
}
 
type FeeConfig = {
  excess: {
    account: Address
    annualTargetRate: bigint
    enabled: boolean
    excessFeeRate: bigint
  }
  fixedFees: readonly { account: Address; rate: bigint }[]
}
 
type FeePreview = {
  activeAssets: bigint
  allocations: readonly {
    account: Address
    feeAssets: bigint
    feeShares: bigint
  }[]
  excessFeeAssets: bigint
  fixedFeeAssets: bigint
  positiveAccrualAssets: bigint
  postFeeValuePerShare: bigint
  preFeeValuePerShare: bigint
  targetValuePerShare: bigint
  totalFeeAssets: bigint
  totalFeeShares: bigint
}

Parameters

recipient (optional)

  • Type: Address

Fee recipient whose claimable vault shares are included.

vault

  • Type: Address

Vault address.

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.