@tevm/actions / CallParams
CallParams<
TThrowOnFail> =BaseCallParams<TThrowOnFail> &object
Defined in: packages/actions/src/Call/CallParams.ts:31
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.
readonlyoptionalcode:Hex
The encoded code to deploy with for a deployless call. Code is encoded with constructor arguments, unlike deployedBytecode.
import { createClient } from 'viem'
import { createTevmTransport, tevmCall, encodeDeployData } from 'tevm'
import { optimism } from 'tevm/common'
const client = createClient({
transport: createTevmTransport({}),
chain: optimism,
})
const callParams = {
createTransaction: true,
data: encodeDeployData({
bytecode: '0x...',
data: '0x...',
abi: [{...}],
args: [1, 2, 3],
})
}
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({}),
chain: optimism,
})
const script = SimpleContract.script({ constructorArgs: [420n] })
await tevmContract(client, script.read.get()) // 420n
readonlyoptionaldata:Hex
The input data for the call.
readonlyoptionaldeployedBytecode:Hex
The code to put into the state before executing the call. If you wish to call the constructor, use code instead.
import { createClient } from 'viem'
import { createTevmTransport, tevmCall } from 'tevm'
import { optimism } from 'tevm/common'
const client = createClient({
transport: createTevmTransport({}),
chain: optimism,
})
const callParams = {
data: '0x...',
deployedBytecode: '0x...',
}
await tevmCall(client, callParams)
readonlyoptionalsalt:Hex
An optional CREATE2 salt.
import { createClient } from 'viem'
import { createTevmTransport, tevmCall } from 'tevm'
import { optimism } from 'tevm/common'
const client = createClient({
transport: createTevmTransport({}),
chain: optimism,
})
const callParams = {
data: '0x...',
bytecode: '0x...',
gasLimit: 420n,
salt: '0x1234...',
}
await tevmCall(client, callParams)TThrowOnFail extends boolean = boolean
import { createClient } from 'viem'
import { createTevmTransport, tevmCall } from 'tevm'
import { optimism } from 'tevm/common'
const client = createClient({
transport: createTevmTransport({}),
chain: optimism,
})
const callParams = {
data: '0x...',
bytecode: '0x...',
gasLimit: 420n,
}
await tevmCall(client, callParams)