Skip to content
On this page

mine โ€‹

Mine a specified number of blocks.

Usage โ€‹

ts
import { testClient } from './client'

await testClient.mine({ 
  blocks: 1,
})
ts
import { createTestClient, http } from 'viem'
import { foundry } from 'viem/chains'

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

Parameters โ€‹

blocks โ€‹

  • Type: number

Number of blocks to mine.

ts
await testClient.mine({
  blocks: 1, 
})

interval (optional) โ€‹

  • Type: number
  • Default: 1

Interval between each block in seconds.

ts
await testClient.mine({
  blocks: 10,
  interval: 4 
})

Released under the MIT License.