Skip to content
On this page

reset โ€‹

Resets the fork back to its original state.

Usage โ€‹

ts
import { testClient } from './client'

await testClient.reset() 
ts
import { createTestClient, http } from 'viem'
import { foundry } from 'viem/chains'

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

Parameters โ€‹

blockNumber (optional) โ€‹

  • Type: bigint

Resets the fork to a given block number.

ts
await testClient.reset({
  blockNumber: 69420n, 
  jsonRpcUrl: 'https://mainnet.g.alchemy.com/v2'
})

jsonRpcUrl (optional) โ€‹

  • Type: string

Resets the fork with a given JSON RPC URL.

ts
await testClient.reset({
  blockNumber: 69420n,
  jsonRpcUrl: 'https://mainnet.g.alchemy.com/v2' 
})

Released under the MIT License.