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>(publicKeys, wallet, artifact, postDeployCtor, args?, constructorNameOrArtifact?): DeployMethod<TContract>

Type parameters

NameType
TContractextends ContractBase = Contract

Parameters

NameTypeDefault value
publicKeysPublicKeysundefined
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.


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>


publicKeys

Private publicKeys: PublicKeys


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


getDefaultFeeOptions

getDefaultFeeOptions(fee): Promise<FeeOptions>

Returns default fee options based on the user opts without running a simulation for gas estimation.

Parameters

NameTypeDescription
feeundefined | UserFeeOptionsUser-provided fee options.

Returns

Promise<FeeOptions>

Inherited from

BaseContractInteraction.getDefaultFeeOptions


getDeploymentFunctionCalls

getDeploymentFunctionCalls(options?): Promise<Pick<ExecutionRequestInit, "calls" | "authWitnesses" | "packedArguments">>

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

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<Pick<ExecutionRequestInit, "calls" | "authWitnesses" | "packedArguments">>

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


getFeeOptions

getFeeOptions(request): Promise<FeeOptions>

Return fee options based on the user opts, estimating tx gas if needed.

Parameters

NameTypeDescription
requestOmit<ExecutionRequestInit, "fee"> & { fee?: UserFeeOptions }Request to execute for this interaction.

Returns

Promise<FeeOptions>

Fee options for the actual transaction.

Inherited from

BaseContractInteraction.getFeeOptions


getInitializeFunctionCalls

getInitializeFunctionCalls(options): Promise<Pick<ExecutionRequestInit, "calls" | "authWitnesses" | "packedArguments">>

Returns the calls necessary to initialize the contract.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<Pick<ExecutionRequestInit, "calls" | "authWitnesses" | "packedArguments">>

  • 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<DeployProvenTx<TContract>>

Prove the request.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<DeployProvenTx<TContract>>

The proven tx.

Overrides

BaseContractInteraction.prove


proveInternal

proveInternal(options?): Promise<TxProvingResult>

Creates a transaction execution request, simulates and proves it. Differs from .prove in that its result does not include the wallet nor the composed tx object, but only the proving result. This object can then be used to either create a ProvenTx ready to be sent, or directly send the transaction.

Parameters

NameTypeDescription
optionsSendMethodOptionsoptional arguments to be used in the creation of the transaction

Returns

Promise<TxProvingResult>

The proving result.

Inherited from

BaseContractInteraction.proveInternal


register

register(options?): Promise<TContract>

Register this contract in the PXE and returns the Contract object.

Parameters

NameTypeDescription
optionsDeployOptionsDeployment options.

Returns

Promise<TContract>


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