-
-
Notifications
You must be signed in to change notification settings - Fork 134
feat!: create new vault with any keyring #329
Conversation
password: string, | ||
seedPhrase: Uint8Array | string | number[], | ||
keyring: { | ||
type: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there now better way we can type the options here? I see in the tests we are using KeyringType?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we default to HD if one is not passed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there now better way we can type the options here? I see in the tests we are using KeyringType?
No, some keyrings are passed from the outside (QRKeyring
, LedgerLeyring
, SnapKeyring
, etc) and there isn't a way to know what they would be unless we enforce it and I'm not sure if that's the right decision since other projects can be using this package with keyrings that are unknown to us, for the moment having them as string
and unknown
and letting the keyring itself handle it is the best choice.
should we default to HD if one is not passed in?
I don't see the benefit of it at least inside this package, the clients should handle it
@gantunesr Do you think we can get in #314 and release #304 prior to merging this? Seems desirable to sync the branches and get the fixes out separately from this breaking feature? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Question: will this be done in @metamask/keyring-controller
too?
@mikesposito Yes! I'll have this done in @metamask/keyring-controller too |
2a19483
to
8db383b
Compare
Description
This change updates the logic inside the
eth-keyring-controller
to allow the creation of a vault with any keyring. This removes the hardcoded HD Keyring from the code and allow the client to pass the parameters to instantiate any keyring that is accepted by the controller.Changes
createNewVaultAndKeychain
andcreateNewVaultAndRestore
into new methodcreateNewVaultWithKeyring
.createNewVaultWithKeyring
accepts a password and a keyring object provided by the client and returns theKeyringControllerState
References
No references
Checklist