Skip to content

Commit

Permalink
refactor!: make generateRandomMnemonic async (#222)
Browse files Browse the repository at this point in the history
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?

Are there any issues or other links reviewers should consult to
understand this pull request better? For instance:

* Fixes #12345
* See: #67890
-->

Our HD keyring [has been
updated](MetaMask/accounts#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.
  • Loading branch information
mikesposito authored Nov 26, 2024
1 parent 88f742a commit e45343b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ export type Keyring<State extends Json> = {
/**
* 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<void>;

/**
* Destroy the keyring.
Expand Down

0 comments on commit e45343b

Please sign in to comment.