Skip to content

Commit

Permalink
fix: publicly register class
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Dec 3, 2024
1 parent 123309c commit 54cdd17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yarn-project/aztec.js/src/contract/deploy_method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
* it returns a promise for an array instead of a function call directly.
*/
public async request(options: DeployOptions = {}): Promise<ExecutionRequestInit> {
const deployment = await this.getDeploymentFunctionCalls(options);

// NOTE: MEGA HACK. Remove with #10007
// register the contract after generating deployment function calls in order to publicly register the class and (optioanlly) emit its bytecode
//
// TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
// Note that we need to run this registerContract here so it's available when computeFeeOptionsFromEstimatedGas
// runs, since it needs the contract to have been registered in order to estimate gas for its initialization,
Expand All @@ -97,7 +102,6 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
// once this tx has gone through.
await this.wallet.registerContract({ artifact: this.artifact, instance: this.getInstance(options) });

const deployment = await this.getDeploymentFunctionCalls(options);
const bootstrap = await this.getInitializeFunctionCalls(options);

if (deployment.calls.length + bootstrap.calls.length === 0) {
Expand Down

0 comments on commit 54cdd17

Please sign in to comment.