forked from visoftsolutions/noir_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Nicer API for instance deployment (AztecProtocol#4493)
Adds a `deployInstance` method to aztec.js.
- Loading branch information
1 parent
5fc02e7
commit 99c3fba
Showing
5 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { registerContractClass } from '../deployment/register_class.js'; | ||
export { broadcastPrivateFunction, broadcastUnconstrainedFunction } from '../deployment/broadcast_function.js'; | ||
export { deployInstance } from '../deployment/deploy_instance.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ContractInstanceWithAddress } from '@aztec/types/contracts'; | ||
|
||
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js'; | ||
import { Wallet } from '../wallet/index.js'; | ||
import { getDeployerContract } from './protocol_contracts.js'; | ||
|
||
/** | ||
* Sets up a call to the canonical deployer contract to publicly deploy a contract instance. | ||
* @param wallet - The wallet to use for the deployment. | ||
* @param instance - The instance to deploy. | ||
* @param opts - Additional options. | ||
*/ | ||
export function deployInstance( | ||
wallet: Wallet, | ||
instance: ContractInstanceWithAddress, | ||
opts: { /** Set to true to *not* mix in the deployer into the address. */ universalDeploy?: boolean } = {}, | ||
): ContractFunctionInteraction { | ||
const deployer = getDeployerContract(wallet); | ||
const { salt, contractClassId, portalContractAddress, publicKeysHash } = instance; | ||
return deployer.methods.deploy( | ||
salt, | ||
contractClassId, | ||
instance.initializationHash, | ||
portalContractAddress, | ||
publicKeysHash, | ||
!!opts.universalDeploy, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters