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
Name | Type |
---|---|
TContract | extends ContractBase = Contract |
Hierarchy
-
BaseContractInteraction
↳
DeployMethod
Constructors
constructor
• new DeployMethod<TContract
>(publicKeys
, wallet
, artifact
, postDeployCtor
, args?
, constructorNameOrArtifact?
): DeployMethod
<TContract
>
Type parameters
Name | Type |
---|---|
TContract | extends ContractBase = Contract |
Parameters
Name | Type | Default value |
---|---|---|
publicKeys | PublicKeys | undefined |
wallet | Wallet | undefined |
artifact | ContractArtifact | undefined |
postDeployCtor | (address : AztecAddress , wallet : Wallet ) => Promise <TContract > | undefined |
args | any [] | [] |
constructorNameOrArtifact? | string | FunctionArtifact | undefined |
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
Name | Type |
---|---|
address | AztecAddress |
wallet | Wallet |
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
Name | Type | Description |
---|---|---|
options | DeployOptions | An 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
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
options | DeployOptions | Deployment 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
Name | Type | Description |
---|---|---|
request | ExecutionRequestInit | Request 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
Name | Type | Description |
---|---|---|
options | DeployOptions | Deployment options. |
Returns
Promise
<ExecutionRequestInit
>
- An array of function calls.
getInstance
▸ getInstance(options?
): ContractInstanceWithAddress
Builds the contract instance to be deployed and returns it.
Parameters
Name | Type | Description |
---|---|---|
options | DeployOptions | An object containing various deployment options. |
Returns
ContractInstanceWithAddress
An instance object.
prove
▸ prove(options
): Promise
<DeployProvenTx
<TContract
>>
Prove the request.
Parameters
Name | Type | Description |
---|---|---|
options | DeployOptions | Deployment 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
Name | Type | Description |
---|---|---|
options | SendMethodOptions | optional 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
Name | Type | Description |
---|---|---|
options | DeployOptions | Deployment 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
Name | Type | Description |
---|---|---|
options | DeployOptions | Deployment 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
Name | Type | Description |
---|---|---|
options | DeployOptions | An 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