From e45343bcbfe8bd6d5237d973984b0983e5c34838 Mon Sep 17 00:00:00 2001 From: Michele Esposito <34438276+mikesposito@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:50:33 +0100 Subject: [PATCH] refactor!: make `generateRandomMnemonic` async (#222) Our HD keyring [has been updated](https://github.com/MetaMask/accounts/pull/100) to support different kinds of cryptographic functions to randomly generate a mnemonic, which may be an asynchronous operation in some cases. This PR updates the `generateRandomMnemonic` on the `Keyring` type accordingly, even though `eth-hd-keyring` does not implement the type yet, because `KeyringController` uses it as keyring interface. --- src/keyring.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/keyring.ts b/src/keyring.ts index c433ac142..ece365016 100644 --- a/src/keyring.ts +++ b/src/keyring.ts @@ -256,8 +256,10 @@ export type Keyring = { /** * Generates the properties for the keyring based on the given * BIP39-compliant mnemonic. + * + * @returns A promise resolving when the keyring has generated the properties. */ - generateRandomMnemonic?(): void; + generateRandomMnemonic?(): Promise; /** * Destroy the keyring.