Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.62 KB

File metadata and controls

61 lines (42 loc) · 1.62 KB

@tevm/actions


@tevm/actions / callHandler

Function: callHandler()

callHandler(client, options?): CallHandler

Defined in: packages/actions/src/Call/callHandler.js:57

Creates a tree-shakable instance of client.tevmCall action. This function is designed for use with TevmNode and the internal instance of TEVM, and it is distinct from the viem API tevmCall.

Note: This is the internal logic used by higher-level APIs such as tevmCall.

Parameters

Parameter Type Description
client TevmNode<"fork" | "normal", { }> -
options? { throwOnFail?: boolean; } -
options.throwOnFail? boolean -

Returns

CallHandler

Throws

If throwOnFail is true; otherwise returned in the result.

Example

import { createTevmNode } from 'tevm/node'
import { callHandler } from 'tevm/actions'

const client = createTevmNode()

const call = callHandler(client)

// Add transaction to mempool (requires mining later)
const res = await call({
  addToMempool: true,
  to: `0x${'69'.repeat(20)}`,
  value: 420n,
  skipBalance: true,
})
await client.tevmMine()

// Or add transaction to blockchain directly (automatically mines)
const autoMinedRes = await call({
  addToBlockchain: true,
  to: `0x${'69'.repeat(20)}`,
  value: 420n,
  skipBalance: true,
})