Skip to content

deployContract

deploys a contract to the network from a smart account, given bytecode & constructor arguments.

Usage

example.ts
import { smartAccountClient, simpleSmartAccount } from "./smartAccountClient"
import { parseAbiItem, encodeFunctionData } from "viem"
import { pimlicoBundlerClient } from "./bundlerClient"
import { abi } from "./abi"
 
const hash = await smartAccountClient.deployContract({
    abi,
    bytecode: "0x606060405260008060146101..."
})

Returns

  • Type: Hash

The transaction hash of the mined userOperation

Parameters

abi

  • Type: Abi

The contract's ABI.

bytecode

  • Type: Hex

The contract's bytecode.

args (if required)

  • Type: Inferred from ABI.

Constructor arguments to call upon deployment.

account (optional)

  • Type: SmartAccount

The Account to deploy the contract from.