Skip to main content

Class: DeployMethod<TContract>

contract.DeployMethod

Contract interaction for deployment. Handles class registration, public instance deployment, and initialization of the contract. Extends the BaseContractInteraction class.

Type parameters

NameType
TContractextends ContractBase = Contract

Hierarchy

  • BaseContractInteraction

    DeployMethod

Constructors

constructor

new DeployMethod<TContract>(publicKeysHash, wallet, artifact, postDeployCtor, args?, constructorNameOrArtifact?): DeployMethod<TContract>

Type parameters

NameType
TContractextends ContractBase = Contract

Parameters

NameTypeDefault value
publicKeysHashFrundefined
walletWalletundefined
artifactContractArtifactundefined
postDeployCtor(address: AztecAddress, wallet: Wallet) => Promise<TContract>undefined
argsany[][]
constructorNameOrArtifact?string | FunctionArtifactundefined

Returns

DeployMethod<TContract>

Overrides

BaseContractInteraction.constructor

Properties

args

Private args: any[] = []


artifact

Private artifact: ContractArtifact


constructorArtifact

Private constructorArtifact: undefined | FunctionArtifact

Constructor function to call.


functionCalls

Private Optional functionCalls: ExecutionRequestInit

Cached call to request()


instance

Private Optional instance: ContractInstanceWithAddress = undefined

The contract instance to be deployed.


log

Protected log: Logger

Inherited from

BaseContractInteraction.log


postDeployCtor

Private postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>

Type declaration

▸ (address, wallet): Promise<TContract>

Parameters
NameType
addressAztecAddress
walletWallet
Returns

Promise<TContract>


publicKeysHash

Private publicKeysHash: Fr


tx

Protected Optional tx: Tx

Inherited from

BaseContractInteraction.tx


txRequest

Protected Optional txRequest: TxExecutionRequest

Inherited from

BaseContractInteraction.txRequest


wallet

Protected wallet: Wallet

Inherited from

BaseContractInteraction.wallet

Accessors

address

get address(): undefined | AztecAddress

Return this deployment address.

Returns

undefined | AztecAddress


partialAddress

get partialAddress(): undefined | Fr

Returns the partial address for this deployment.

Returns

undefined | Fr

Methods

create

create(options?): Promise<TxExecutionRequest>

Create a contract deployment transaction, given the deployment options. This function internally calls request() and sign() methods to prepare the transaction for deployment. The resulting signed transaction can be later sent using the send() method.

Parameters

NameTypeDescription
optionsDeployOptionsAn object containing optional deployment settings, contractAddressSalt, and from.

Returns

Promise<TxExecutionRequest>

A Promise resolving to an object containing the signed transaction data and other relevant information.

Overrides

BaseContractInteraction.create


estimateGas

estimateGas(options?): Promise<Pick<GasSettings, "gasLimits" | "teardownGasLimits">>

Estimates gas cost for this deployment operation.

Parameters

NameTypeDescription
options?Omit<DeployOptions, "estimateGas" | "skipPublicSimulation">Options.

Returns

Promise<Pick<GasSettings, "gasLimits" | "teardownGasLimits">>

Overrides

BaseContractInteraction.estimateGas


getDeploymentFunctionCalls

getDeploymentFunctionCalls(options?): Promise<ExecutionRequestInit>

Returns calls for registration of the class and deployment of the instance, depending on the provided options.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<ExecutionRequestInit>

A function call array with potentially requests to the class registerer and instance deployer.


getFeeOptionsFromEstimatedGas

getFeeOptionsFromEstimatedGas(request): Promise<undefined | { gasSettings: GasSettings ; paymentMethod: FeePaymentMethod }>

Helper method to return fee options based on the user opts, estimating tx gas if needed.

Parameters

NameTypeDescription
requestExecutionRequestInitRequest to execute for this interaction.

Returns

Promise<undefined | { gasSettings: GasSettings ; paymentMethod: FeePaymentMethod }>

Fee options for the actual transaction.

Inherited from

BaseContractInteraction.getFeeOptionsFromEstimatedGas


getInitializeFunctionCalls

getInitializeFunctionCalls(options): Promise<ExecutionRequestInit>

Returns the calls necessary to initialize the contract.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<ExecutionRequestInit>

  • An array of function calls.

getInstance

getInstance(options?): ContractInstanceWithAddress

Builds the contract instance to be deployed and returns it.

Parameters

NameTypeDescription
optionsDeployOptionsAn object containing various deployment options.

Returns

ContractInstanceWithAddress

An instance object.


prove

prove(options): Promise<Tx>

Prove the request.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<Tx>

The proven tx.

Overrides

BaseContractInteraction.prove


request

request(options?): Promise<ExecutionRequestInit>

Returns an array of function calls that represent this operation. Useful as a building block for constructing batch requests.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<ExecutionRequestInit>

An array of function calls.

Remarks

This method does not have the same return type as the request in the ContractInteraction object, it returns a promise for an array instead of a function call directly.


send

send(options?): DeploySentTx<TContract>

Send the contract deployment transaction using the provided options. This function extends the 'send' method from the ContractFunctionInteraction class, allowing us to send a transaction specifically for contract deployment.

Parameters

NameTypeDescription
optionsDeployOptionsAn object containing various deployment options such as contractAddressSalt and from.

Returns

DeploySentTx<TContract>

A SentTx object that returns the receipt and the deployed contract instance.

Overrides

BaseContractInteraction.send