reset
Resets the fork back to its original state.
Usage
ts
import { testClient } from './client'
await testClient.reset()
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(),
})
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'
})
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'
})
await testClient.reset({
blockNumber: 69420n,
jsonRpcUrl: 'https://mainnet.g.alchemy.com/v2'
})