Get Zone Info
zone.getZoneInfo
Returns metadata about the current zone.
Usage
import { } from './zones.config'
const = await ..()
.('Zone ID:', .)
.('Chain ID:', .)
.('Sequencers:', .)
.('Tempo block number:', .)
Zone ID: 7Chain ID: 1337Sequencers: ['0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb']Tempo block number: 1234nimport { , } from 'viem/tempo'
import { , } from 'viem/tempo/zones'
export const = .({
: .('0x...'),
: (7),
: (),
})Recipes
Confirm a Token Is Enabled in the Zone
Check zoneTokens before bridging funds with zone.deposit, so you only submit deposits the zone can credit.
import { } from './zones.config'
const = '0x20c0000000000000000000000000000000000001'
const = await ..()
if (!..())
throw new (`Token ${} is not enabled in zone ${.}.`)import { , } from 'viem/tempo'
import { , } from 'viem/tempo/zones'
export const = .({
: .('0x...'),
: (7),
: (),
})Alert When the Zone Falls Behind Tempo
Compare tempoBlockNumber with the Mainnet block number from block.getNumber to monitor import lag before it delays deposit settlement.
import { as } from './viem.config'
import { } from './zones.config'
const [, ] = await .([
..(),
..(),
])
const = - .
if ( > 10n) .(`Zone import lag: ${} blocks`)import { , } from 'viem/tempo'
import { , } from 'viem/tempo/zones'
export const = .({
: .('0x...'),
: (7),
: (),
})import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = {
/** Zone chain ID. */
chainId: number
/** Active sequencer addresses. */
sequencers: readonly Address[]
/** Latest Tempo block imported by the zone. */
tempoBlockNumber: bigint
/** Zone ID. */
zoneId: number
/** Tokens registered in the zone. */
zoneTokens: readonly Address[]
}The zone metadata.