diff --git a/yarn-project/aztec.js/src/wallet/base_wallet.ts b/yarn-project/aztec.js/src/wallet/base_wallet.ts index bd1e5fd6e59..48199b08927 100644 --- a/yarn-project/aztec.js/src/wallet/base_wallet.ts +++ b/yarn-project/aztec.js/src/wallet/base_wallet.ts @@ -83,9 +83,6 @@ export abstract class BaseWallet implements Wallet { getRegisteredAccounts(): Promise { return this.pxe.getRegisteredAccounts(); } - getRegisteredAccount(address: AztecAddress): Promise { - return this.pxe.getRegisteredAccount(address); - } registerSender(address: AztecAddress): Promise { return this.pxe.registerSender(address); } diff --git a/yarn-project/aztec.js/src/wallet/index.ts b/yarn-project/aztec.js/src/wallet/index.ts index 08e8cb27c41..6479e8c50bb 100644 --- a/yarn-project/aztec.js/src/wallet/index.ts +++ b/yarn-project/aztec.js/src/wallet/index.ts @@ -21,7 +21,9 @@ export async function getWallet( address: AztecAddress, accountContract: AccountContract, ): Promise { - const completeAddress = await pxe.getRegisteredAccount(address); + const completeAddress = (await pxe.getRegisteredAccounts()).find(completeAddress => + completeAddress.address.equals(address), + ); if (!completeAddress) { throw new Error(`Account ${address} not found`); } diff --git a/yarn-project/circuit-types/src/interfaces/pxe.test.ts b/yarn-project/circuit-types/src/interfaces/pxe.test.ts index 35ca91421a2..ad3018dc8d6 100644 --- a/yarn-project/circuit-types/src/interfaces/pxe.test.ts +++ b/yarn-project/circuit-types/src/interfaces/pxe.test.ts @@ -113,11 +113,6 @@ describe('PXESchema', () => { expect(result).toEqual([expect.any(CompleteAddress)]); }); - it('getRegisteredAccount', async () => { - const result = await context.client.getRegisteredAccount(address); - expect(result).toBeInstanceOf(CompleteAddress); - }); - it('registerSender', async () => { const result = await context.client.registerSender(address); expect(result).toEqual(address); diff --git a/yarn-project/circuit-types/src/interfaces/pxe.ts b/yarn-project/circuit-types/src/interfaces/pxe.ts index 7aaa954f7df..d70216ef15c 100644 --- a/yarn-project/circuit-types/src/interfaces/pxe.ts +++ b/yarn-project/circuit-types/src/interfaces/pxe.ts @@ -105,15 +105,6 @@ export interface PXE { */ getRegisteredAccounts(): Promise; - /** - * Retrieves the complete address of the account corresponding to the provided aztec address. - * Complete addresses include the address, the partial address, and the encryption public key. - * - * @param address - The address of account. - * @returns The complete address of the requested account if found. - */ - getRegisteredAccount(address: AztecAddress): Promise; - /** * Registers a user contact in PXE. * @@ -463,10 +454,6 @@ export const PXESchema: ApiSchemaFor = { addCapsule: z.function().args(z.array(schemas.Fr)).returns(z.void()), registerAccount: z.function().args(schemas.Fr, schemas.Fr).returns(CompleteAddress.schema), getRegisteredAccounts: z.function().returns(z.array(CompleteAddress.schema)), - getRegisteredAccount: z - .function() - .args(schemas.AztecAddress) - .returns(z.union([CompleteAddress.schema, z.undefined()])), registerSender: z.function().args(schemas.AztecAddress).returns(schemas.AztecAddress), getSenders: z.function().returns(z.array(schemas.AztecAddress)), removeSender: z.function().args(schemas.AztecAddress).returns(z.void()), diff --git a/yarn-project/cli/src/cmds/pxe/get_account.ts b/yarn-project/cli/src/cmds/pxe/get_account.ts index 90e95b21130..29318485c64 100644 --- a/yarn-project/cli/src/cmds/pxe/get_account.ts +++ b/yarn-project/cli/src/cmds/pxe/get_account.ts @@ -4,7 +4,9 @@ import { type LogFn, type Logger } from '@aztec/foundation/log'; export async function getAccount(aztecAddress: AztecAddress, rpcUrl: string, debugLogger: Logger, log: LogFn) { const client = await createCompatibleClient(rpcUrl, debugLogger); - const account = await client.getRegisteredAccount(aztecAddress); + const account = (await client.getRegisteredAccounts()).find(completeAddress => + completeAddress.address.equals(aztecAddress), + ); if (!account) { log(`Unknown account ${aztecAddress.toString()}`); diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index 9db9bb12a59..4bf9f3bccf5 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -212,12 +212,6 @@ export class PXEService implements PXE { ); } - public async getRegisteredAccount(address: AztecAddress): Promise { - const result = await this.getRegisteredAccounts(); - const account = result.find(r => r.address.equals(address)); - return Promise.resolve(account); - } - public async registerContractClass(artifact: ContractArtifact): Promise { const contractClassId = computeContractClassId(getContractClassFromArtifact(artifact)); await this.db.addContractArtifact(contractClassId, artifact); @@ -876,7 +870,9 @@ export class PXEService implements PXE { const [keyPrefix, account] = await this.keyStore.getKeyPrefixAndAccount(vpk); let secretKey = await this.keyStore.getMasterSecretKey(vpk); if (keyPrefix === 'iv') { - const registeredAccount = await this.getRegisteredAccount(account); + const registeredAccount = (await this.getRegisteredAccounts()).find(completeAddress => + completeAddress.address.equals(account), + ); if (!registeredAccount) { throw new Error('No registered account'); } diff --git a/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts b/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts index 686c5b9f9a1..5bb9916eb5f 100644 --- a/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts +++ b/yarn-project/pxe/src/pxe_service/test/pxe_test_suite.ts @@ -24,10 +24,6 @@ export const pxeTestSuite = (testName: string, pxeSetup: () => Promise) => // Check that the account is correctly registered using the getAccounts and getRecipients methods const accounts = await pxe.getRegisteredAccounts(); expect(accounts).toContainEqual(completeAddress); - - // Check that the account is correctly registered using the getAccount and getRecipient methods - const account = await pxe.getRegisteredAccount(completeAddress.address); - expect(account).toEqual(completeAddress); }); it('does not throw when registering the same account twice (just ignores the second attempt)', async () => {