diff --git a/yarn-project/aztec.js/src/account_manager/index.ts b/yarn-project/aztec.js/src/account_manager/index.ts index 002f98169aa..4402d4a4dee 100644 --- a/yarn-project/aztec.js/src/account_manager/index.ts +++ b/yarn-project/aztec.js/src/account_manager/index.ts @@ -104,12 +104,13 @@ export class AccountManager { * @returns A Wallet instance. */ public async register(opts: WaitOpts = DefaultWaitOpts): Promise { - await this.#register(); await this.pxe.registerContract({ artifact: this.accountContract.getContractArtifact(), instance: this.getInstance(), }); + await this.pxe.registerAccount(this.secretKey, this.getCompleteAddress().partialAddress); + await waitForAccountSynch(this.pxe, this.getCompleteAddress(), opts); return this.getWallet(); } @@ -127,7 +128,9 @@ export class AccountManager { `Account contract ${this.accountContract.getContractArtifact().name} does not require deployment.`, ); } - await this.#register(); + + await this.pxe.registerAccount(this.secretKey, this.getCompleteAddress().partialAddress); + const { chainId, protocolVersion } = await this.pxe.getNodeInfo(); const deployWallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion)); @@ -191,9 +194,4 @@ export class AccountManager { public isDeployable() { return this.accountContract.getDeploymentArgs() !== undefined; } - - async #register(): Promise { - const completeAddress = this.getCompleteAddress(); - await this.pxe.registerAccount(this.secretKey, completeAddress.partialAddress); - } }