loadStateHandler
loadStateHandler(
client
,options
?):LoadStateHandler
Creates a handler for loading a previously dumped state into the VM.
Parameters
• client: TevmNode
<"fork"
| "normal"
, object
>
The base client instance.
• options? = {}
Optional configuration.
• options.throwOnFail?: undefined
| boolean
Whether to throw an error when a failure occurs.
Returns
- The handler function.
Example
import { createClient } from 'tevm'import { loadStateHandler } from 'tevm/actions'import fs from 'fs'
const client = createClient()const loadState = loadStateHandler(client)
const state = JSON.parse(fs.readFileSync('state.json'))const result = await loadState({ state })if (result.errors) { console.error('Failed to load state:', result.errors)}