tevmDeploy
tevmDeploy(
client
,params
):Promise
<DeployResult
>
A tree-shakeable version of the tevmDeploy
action for viem.
Deploys a contract using TEVM.
This function deploys a contract by taking its ABI, bytecode, and constructor arguments. The deployed contract’s address is available in the result.createdAddress
. Note that the contract is not actually in the state until the transaction is mined. In manual mode, you must call client.mine()
before you can interact with the deployed contract.
As an alternative, the setAccount
action can be used to directly put contract bytecode into the state without deploying it via a transaction.
Parameters
• client: Client
<TevmTransport
<string
>, undefined
| Chain
, undefined
| Account
, undefined
, undefined
| object
>
The viem client configured with TEVM transport.
• params: DeployParams
<boolean
, Abi
, true
, readonly unknown
[]>
Parameters for the contract deployment, including ABI, bytecode, and constructor arguments.
Returns
Promise
<DeployResult
>
The result of the contract deployment, including the created contract address.
Examples
See
- DeployParams for options reference.
- DeployResult for return values reference.
- BaseCallParams for the base call parameters.
- TEVM Actions Guide
- SetAccount for putting contract bytecode into the state without deploying.
- TEVM Bundler Guide for using the TEVM bundler to deploy contracts.
Additionally, you can use the viem wallet action deploy
as a viable alternative. While it doesn’t offer the same advanced functionality such as account impersonation or tracing capabilities, it works great for simple use cases.