CallParams <TThrowOnFail
>: BaseCallParams
<TThrowOnFail
> & object
TEVM parameters to execute a call on the VM.
Call
is the lowest level method to interact with the VM, and other methods such as contract
and script
use call
under the hood.
Type declaration
code?
readonly
optional
code : Hex
The encoded code to deploy with for a deployless call. Code is encoded with constructor arguments, unlike deployedBytecode
.
Examples
import { createClient } from ' viem '
import { createTevmTransport, tevmCall, encodeDeployData } from ' tevm '
import { optimism } from ' tevm/common '
const client = createClient ( {
transport: createTevmTransport ( {} ) ,
await tevmCall (client, callParams)
Code is also automatically created if using TEVM contracts via the script
method.
import { createClient } from ' viem '
import { createTevmTransport, tevmContract } from ' tevm '
import { optimism } from ' tevm/common '
import { SimpleContract } from ' tevm/contracts '
const client = createClient ( {
transport: createTevmTransport ( {} ) ,
const script = SimpleContract . script ( { constructorArgs: [ 420 n ] } )
await tevmContract (client, script . read . get ()) // 420n
data?
readonly
optional
data : Hex
The input data for the call.
deployedBytecode?
readonly
optional
deployedBytecode : Hex
The code to put into the state before executing the call. If you wish to call the constructor, use code
instead.
Example
import { createClient } from ' viem '
import { createTevmTransport, tevmCall } from ' tevm '
import { optimism } from ' tevm/common '
const client = createClient ( {
transport: createTevmTransport ( {} ) ,
deployedBytecode: ' 0x... ' ,
await tevmCall (client, callParams)
salt?
readonly
optional
salt : Hex
An optional CREATE2 salt.
Example
import { createClient } from ' viem '
import { createTevmTransport, tevmCall } from ' tevm '
import { optimism } from ' tevm/common '
const client = createClient ( {
transport: createTevmTransport ( {} ) ,
await tevmCall (client, callParams)
See
CREATE2
Type Parameters
• TThrowOnFail extends boolean
= boolean
Example
import { createClient } from ' viem '
import { createTevmTransport, tevmCall } from ' tevm '
import { optimism } from ' tevm/common '
const client = createClient ( {
transport: createTevmTransport ( {} ) ,
await tevmCall (client, callParams)
See
Defined in
packages/actions/src/Call/CallParams.ts:31