-
-
Notifications
You must be signed in to change notification settings - Fork 261
chore(keyring-controller): fix new lint errors #7334
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
Conversation
7273f0b to
66b6c1d
Compare
| wallet = wallet ?? (await Wallet.fromV3(input, password, true)); | ||
| } | ||
| privateKey = bytesToHex(wallet.getPrivateKey()); | ||
| privateKey = bytesToHex(new Uint8Array(wallet.getPrivateKey())); |
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 like Buffer is not compatible with Uint8Array here for some reason?
| let privateKey; | ||
| switch (strategy) { | ||
| case AccountImportStrategy.privateKey: | ||
| case AccountImportStrategy.privateKey: { |
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.
Declare a block-scope now, since we're doing some local vars declarations, and that's not allowed without block-scopes!
| const candidates = await Promise.all( | ||
| this.#keyrings.map(async ({ keyring }) => { | ||
| return Promise.all([keyring, keyring.getAccounts()]); | ||
| return [keyring, await keyring.getAccounts()] as const; |
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.
Not sure why Promise.all was used here, but we effectively just need to await keyring.getAccounts() here.
I've also added the as const to properly type [..., ...] as a tuple.
| /** | ||
| * Keyring selector used for `withKeyring`. | ||
| */ |
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.
Added for consistency.
mathieuartu
left a comment
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!
Explanation
Fix existing lint errors (since the introduction of the new linting configuration).
Those are the bare minimum required to avoid having a failing CI for any new change to this controller.
References
N/A
Checklist
Note
Fixes lint/type issues across
KeyringController(explicit return types, nullish coalescing, tuple typing, safer conversions) and adds/exportKeyringBuildertype; updates changelog and ESLint suppressions.packages/keyring-controller/src/KeyringController.ts):createNewVaultAndKeychain,verifyPassword,signPersonalMessage, private helpers); use??instead of||; refine error variable names; ensureawaitordering and tuple typing (as const); adjust indices with?? 0.Keyringand add/export newKeyringBuildertype; updatekeyringBuilderFactoryto returnKeyringBuilderand typed builder function.bytesToHex(new Uint8Array(wallet.getPrivateKey())); minor logic cleanups in account import and keyring selection.KeyringBuildertype inpackages/keyring-controller/CHANGELOG.md.packages/keyring-controller/src/KeyringController.tsreflecting resolved lint errors.Written by Cursor Bugbot for commit 66b6c1d. This will update automatically on new commits. Configure here.