The AbstractClient includes a deployContract method that can be used to deploy a smart contract from the connected Abstract Global Wallet. It extends the deployContract function from Viem to include options for contract deployment on Abstract.

Usage

Parameters

abi
Abi
required

The ABI of the contract to deploy.

bytecode
string
required

The bytecode of the contract to deploy.

account
Account
required

The account to deploy the contract from. Use the account from the AbstractClient to use the Abstract Global Wallet.

chain
Chain
required

The chain to deploy the contract on. e.g. abstractTestnet.

args
Inferred from ABI

Constructor arguments to call upon deployment.

deploymentType
'create' | 'create2' | 'createAccount' | 'create2Account'

Specifies the type of contract deployment. Defaults to create.

factoryDeps
Hex[]

An array of bytecodes of contracts that are dependencies for the contract being deployed. This is used for deploying contracts that depend on other contracts that are not yet deployed on the network.

Learn more on the Contract deployment page.

salt
Hash

Specifies a unique identifier for the contract deployment.

gasPerPubdata
bigint

The amount of gas for publishing one byte of data on Ethereum.

paymaster
Account | Address

Address of the paymaster smart contract that will pay the gas fees of the deployment transaction.

Must also provide a paymasterInput field.

paymasterInput
Hex

Input data to the paymaster.

Must also provide a paymaster field.

Returns

Returns the Hex hash of the transaction that deployed the contract.

Use waitForTransactionReceipt to get the transaction receipt from the hash.