Get Validator
validator.get
Gets validator information by address.
Usage
import { } from './viem.config'
const = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
})
.('Validator:', .)
Validator: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbbimport { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Alert When a Validator Leaves the Active Set
Poll active from a monitoring job and page the operator when the validator drops out of consensus.
import { } from './viem.config'
const { } = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
})
if (!) .('Validator dropped out of the active set')import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Audit a Node's Registered Endpoints
Compare the on-chain record against your ops inventory after an infrastructure migration, then repair drift with validator.update.
import { } from './viem.config'
const = 'validator-2.example.com:9000' // from your ops inventory
const { } = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
})
if ( !== )
.(`Stale endpoint: ${}, expected ${}`)import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type Validator = {
publicKey: Hex
active: boolean
index: bigint
validatorAddress: Address
inboundAddress: string
outboundAddress: string
}Validator information.
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.