Skip to content
On this page

setBlockTimestampInterval

Similar to increaseTime, but sets a block timestamp interval. The timestamp of future blocks will be computed as lastBlock_timestamp + interval.

Usage

ts
import { testClient } from './client'
 
await testClient.setBlockTimestampInterval({ 
  interval: 5
})
ts
import { createTestClient, http } from 'viem'
import { foundry } from 'viem/chains'

export const testClient = createTestClient({
  chain: foundry,
  mode: 'anvil',
  transport: http(), 
})

Parameters

interval

  • Type: number
ts
await testClient.setBlockTimestampInterval({
  interval: 1 
})

Released under the MIT License.