Skip to content
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!: TrezorKeyring implements Keyring type #195

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Feb 5, 2025

The TrezorKeyring is being overhauled to implement the Keyring type from @metamask/utils. Most of the changes are due to the addresses type that is now Hex

### Changed

- **BREAKING:** `TrezorKeyring` now implements the `Keyring<Json>` type ([#194](https://github.com/MetaMask/accounts/pull/194))
  - The class does not extend `EventEmitter` anymore.
  - The `TrezorKeyring.accounts` class variable is now a `readonly Hex[]` array.
  - The `addAccounts` method signature has been changed
    - An `amount` number parameter is now required to specify the number of accounts to add.
    - The method now returns a promise resolving to an array of `Hex` addresses.
  - The `deserialize` method now requires a `TrezorControllerOptions` object as a parameter.
  - The `unlock` method now returns `Promise<Hex>`
  - The `getAccounts` method now returns `Promise<Hex[]>`
  - The `signTransaction` method now accepts an `Hex` typed value as the `address` parameter
  - The `signMessage` method now accepts an `Hex` typed value as the `withAccount` parameter
  - The `signPersonalMessage` method now accepts an `Hex` typed value as the `withAccount` parameter
  - The `signTypedData` method now accepts an `Hex` typed value as the `withAccount` parameter
  - The `unlockAccountByAddress` method now accepts an `Hex` typed value as the `address` parameter

### Removed

- **BREAKING:** The `exportAccount` method has been removed

@mikesposito mikesposito marked this pull request as ready for review February 5, 2025 13:30
@mikesposito mikesposito requested a review from a team as a code owner February 5, 2025 13:30
@mikesposito mikesposito marked this pull request as draft February 5, 2025 15:49
@mikesposito
Copy link
Member Author

Marking the PR as draft again because a new @metamask/utils major version is being prepared for release, which will ship breaking changes to the Keyring type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TrezorKeyring class from @metamask/eth-trezor-keyring should implement the Keyring type
1 participant