-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor!: LedgerKeyring
implements Keyring
type
#194
base: main
Are you sure you want to change the base?
Conversation
async unlock(hdPath?: string, updateHdk = true): Promise<Hex> { | ||
if (this.isUnlocked() && !hdPath) { | ||
return 'already unlocked'; | ||
return this.#getChecksumHexAddress( | ||
ethUtil.publicToAddress(this.hdk.publicKey, true).toString('hex'), | ||
); |
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.
I'm not sure how to handle this case here. The original code returned already unlocked
if:
- there is already a
this.hdk
defined hdPath
is not passed to the function (i.e. the consumer callskeyring.unlock()
However, since we want this function to return a value of type Hex
we must return a valid address. Based on the lines below the actual publicKey
returned from this function comes from the device (payload.publicKey
) and it's used to construct an HDKey to be stored in this.hdk
. So, the new code assumes that we want to return the address derived from the public key stored in this.hdk.publicKey
Marking the PR as draft again because a new |
The
LedgerKeyring
is being overhauled to implement theKeyring
type from@metamask/utils
. Most of the changes are due to the addresses type that is nowHex
LedgerKeyring
class from@metamask/eth-ledger-bridge-keyring
should implement theKeyring
type #143