|
5 | 5 | * |
6 | 6 | * @packageDocumentation |
7 | 7 | */ |
8 | | -import type { PXE } from '@aztec/aztec.js'; |
| 8 | +import { AccountManager, type PXE } from '@aztec/aztec.js'; |
9 | 9 | import type { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet'; |
10 | 10 |
|
11 | 11 | import { |
@@ -47,22 +47,27 @@ export function getInitialTestAccounts(): Promise<InitialAccountData[]> { |
47 | 47 | ); |
48 | 48 | } |
49 | 49 |
|
| 50 | +/** |
| 51 | + * Gets a collection of account managers for the Aztec accounts that are initially stored in the test environment. |
| 52 | + * @param pxe - PXE instance. |
| 53 | + * @returns A set of AccountManager implementations for each of the initial accounts. |
| 54 | + */ |
| 55 | +export function getInitialTestAccountsManagers(pxe: PXE): Promise<AccountManager[]> { |
| 56 | + return Promise.all( |
| 57 | + INITIAL_TEST_SECRET_KEYS.map((encryptionKey, i) => |
| 58 | + getSchnorrAccount(pxe, encryptionKey!, INITIAL_TEST_SIGNING_KEYS[i]!, INITIAL_TEST_ACCOUNT_SALTS[i]), |
| 59 | + ), |
| 60 | + ); |
| 61 | +} |
| 62 | + |
50 | 63 | /** |
51 | 64 | * Gets a collection of wallets for the Aztec accounts that are initially stored in the test environment. |
52 | 65 | * @param pxe - PXE instance. |
53 | 66 | * @returns A set of AccountWallet implementations for each of the initial accounts. |
54 | 67 | */ |
55 | | -export function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]> { |
| 68 | +export async function getInitialTestAccountsWallets(pxe: PXE): Promise<AccountWalletWithSecretKey[]> { |
56 | 69 | return Promise.all( |
57 | | - INITIAL_TEST_SECRET_KEYS.map(async (encryptionKey, i) => { |
58 | | - const account = await getSchnorrAccount( |
59 | | - pxe, |
60 | | - encryptionKey!, |
61 | | - INITIAL_TEST_SIGNING_KEYS[i]!, |
62 | | - INITIAL_TEST_ACCOUNT_SALTS[i], |
63 | | - ); |
64 | | - return account.getWallet(); |
65 | | - }), |
| 70 | + (await Promise.all(await getInitialTestAccountsManagers(pxe))).map(accountManager => accountManager.getWallet()), |
66 | 71 | ); |
67 | 72 | } |
68 | 73 |
|
|
0 commit comments