Get Validator Fee Token
fee.getValidatorToken
Gets a validator's preferred fee token.
Returns null when the fee manager contract reports the zero address. Validators with no preference set resolve to pathUSD at the node level.
Usage
import { } from './viem.config'
const = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
})
.('Fee token:', )
Fee token: { address: '0x20c0000000000000000000000000000000000001', id: 1n }import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Resolve the Effective Fee Token
Treat null as pathUSD when you need the token a validator actually gets paid in: unset preferences resolve to pathUSD at the node level.
import { } from './viem.config'
const = '0x20c0000000000000000000000000000000000000'
const = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
})
const = ??
.('Validator is paid in:', )
Validator is paid in: 0x20c0000000000000000000000000000000000000import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Survey Preferences Across a Validator Set
Read several validators in parallel to decide which stablecoins to stock before providing Fee AMM liquidity.
import { } from './viem.config'
const = [
'0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
'0x8ba1f109551bD432803012645Ac136ddd64DBA72',
] as
const = await .(
.(() =>
..({ }),
),
)
.()import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = {
/** Fee token contract address. */
address: Address
/** Fee token id. */
id: bigint
} | nullThe validator's fee token address and id, or null if the contract reports the zero address.
Parameters
validator
- Type:
Address
Validator 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.