1 - The loop inside createAccounts can be parallelized using Promise.all
await Promise.all(indicesToCreate.map(async (groupIndex) => { ... });
2 - Instead of#listAccounts() it could use an "index cache" and avoid deserializing the entire keyringAccounts blob
const keyringAccounts =
(await this.#state.getKey<UnencryptedStateValue['keyringAccounts']>(
'keyringAccounts',
)) ?? {};
for (const account of Object.values(keyringAccounts)) { ... }
1 - The loop inside
createAccountscan be parallelized usingPromise.all2 - Instead of
#listAccounts()it could use an "index cache" and avoid deserializing the entirekeyringAccountsblob