From 865cff8f87bdd22533d0619d11b5e1be1ca9bbc6 Mon Sep 17 00:00:00 2001 From: Charly Chevalier Date: Mon, 6 Jan 2025 16:59:08 +0100 Subject: [PATCH] fix(keyring-controller): await generateRandomMnemonic explicitly --- packages/keyring-controller/src/KeyringController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/keyring-controller/src/KeyringController.ts b/packages/keyring-controller/src/KeyringController.ts index 5bef998de1..59cd32bfa5 100644 --- a/packages/keyring-controller/src/KeyringController.ts +++ b/packages/keyring-controller/src/KeyringController.ts @@ -2199,7 +2199,10 @@ export class KeyringController extends BaseController< ); } - keyring.generateRandomMnemonic(); + // NOTE: Not all keyrings implement this method in a asynchronous-way. Using `await` for + // non-thenable will still be valid (despite not being really useful). It allows us to cover both + // cases and allow retro-compatibility too. + await keyring.generateRandomMnemonic(); await keyring.addAccounts(1); }