Skip to content
LogoLogo

Wait for Tempo Block in Zone

zone.waitForTempoBlock

Waits until a zone has imported a Tempo block.

Usage

import {  } from './zones.config'
 
const  = await ..({
  : 123456n,
})
 
.('Imported Tempo block:', .)
Imported Tempo block: 123456n

The action polls zone.getZoneInfo and resolves when the zone's tempoBlockNumber reaches the requested block.

Recipes

Show Settlement Progress at Checkout

Tighten pollingInterval and shorten timeout while a customer waits, treating a timeout as still settling rather than a failure.

import {  } from './zones.config'
 
try {
  await ..({
    : 500,
    : 123456n,
    : 15_000,
  })
  .('Deposit settled')
} catch {
  // Timed out: the zone has not imported the block yet.
  .('Still settling, check back shortly')
}

Gate a Balance Read on Deposit Import

Wait for the deposit's Mainnet block number before reading the balance with token.getBalance: the funds are spendable once the block imports.

import {  } from './zones.config'
 
// Block number from the Mainnet deposit receipt.
const  = 123456n
 
await ..({
  : ,
})
 
const  = await ..({
  : '0x20c0000000000000000000000000000000000001',
})
 
.('Zone balance:', .)
Zone balance: 100

Return Value

Actions.zone.getZoneInfo.ReturnType

Returns the same zone metadata as zone.getZoneInfo.

Parameters

pollingInterval (optional)

  • Type: number
  • Default: client.pollingInterval

Polling frequency in milliseconds.

tempoBlockNumber

  • Type: bigint

Tempo block number to wait for.

timeout (optional)

  • Type: number
  • Default: 60_000

Maximum time to wait in milliseconds. Set to 0 to disable the timeout.