All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- BREAKING:
addNewKeyringmethod now returnsPromise<KeyringMetadata>instead ofPromise<unknown>(#5372)- Consumers can use the returned
KeyringMetadata.idto access the created keyring instance viawithKeyring.
- Consumers can use the returned
- BREAKING:
withKeyringmethod now requires a callback argument of type({ keyring: SelectedKeyring; metadata: KeyringMetadata }) => Promise<CallbackResult>(#5372) - Bump
@metamask/keyring-api"from^17.0.0to^17.2.0(#5366) - Bump
@metamask/keyring-internal-apifrom^4.0.1to^4.0.3(#5356), (#5366)
- Ensure authorization contract address is provided (#5353)
- Add
signEip7702AuthorizationtoKeyringController(#5301) - Add
KeyringController:withKeyringaction (#5332)- The action can be used to consume the
withKeyringmethod of theKeyringControllerclass
- The action can be used to consume the
- Support keyring metadata in KeyringController (#5112)
- Add new keyring type for OneKey (#5216)
- A specific error message is thrown when any operation is attempted while the controller is locked (#5172)
- Bump
@metamask/base-controllerfrom^7.1.1to^8.0.0(#5305) - Bump
@metamask/message-managerfrom^12.0.0to^12.0.1(#5305)
- Bump
@metamask/keyring-api"from^16.1.0to^17.0.0(#5280) - Bump
@metamask/utilsfrom^11.0.1to^11.1.0(#5223)
- Bump
@metamask/keyring-apifrom^13.0.0to^14.0.0(#5177) - Bump
@metamask/keyring-internal-apifrom^2.0.0to^2.0.1(#5177) - Bump
@metamask/message-managerfrom^12.0.0to^11.0.3(#5169)
- Bump
@metamask/base-controllerfrom^7.0.0to^7.1.1(#5079), (#5135) - Bump
@metamask/keyring-apifrom^12.0.0to^13.0.0(#5066) - Bump
@metamask/keyring-internal-apifrom^1.0.0to^2.0.0(#5066), (#5136) - Bump
@metamask/utilsto^11.0.1(#5080) - Bump
@metamask/rpc-errorsto^7.0.2(#5080)
- Make
verifySeedPhrasemutually exclusive (#5077)
- Remove use of
@metamask/keyring-api(#4695)@metamask/providersandwebextension-polyfillpeer depedencies are no longer required.
- Use new
@metamask/keyring-internal-api@^1.0.0(#4695)- This package has been split out from the Keyring API. Its types are compatible with the
@metamask/keyring-apipackage used previously.
- This package has been split out from the Keyring API. Its types are compatible with the
- Bump
@metamask/message-managerfrom^11.0.2to^11.0.3(#5048)
- Bump
@metamask/message-managerfrom^11.0.1to^11.0.2(#5012)
- Make implicit peer dependencies explicit (#4974)
- Add the following packages as peer dependencies of this package to satisfy peer dependency requirements from other dependencies:
@metamask/providers^18.1.0(required by@metamask/keyring-api)webextension-polyfill^0.10.0 || ^0.11.0 || ^0.12.0(required by@metamask/providers)
- These dependencies really should be present in projects that consume this package (e.g. MetaMask clients), and this change ensures that they now are.
- Furthermore, we are assuming that clients already use these dependencies, since otherwise it would be impossible to consume this package in its entirety or even create a working build. Hence, the addition of these peer dependencies is really a formality and should not be breaking.
- Add the following packages as peer dependencies of this package to satisfy peer dependency requirements from other dependencies:
- Correct ESM-compatible build so that imports of the following packages that re-export other modules via
export *are no longer corrupted: (#5011)@metamask/eth-hd-keyring@metamask/eth-simple-keyring@ethereumjs/utilethereumjs-wallet
- BREAKING: Bump
@metamask/keyring-apifrom^8.1.3to^10.1.0(#4948)- If you are depending on
@metamask/providersdirectly, you will need to upgrade to 18.1.0.
- If you are depending on
- BREAKING Remove
addNewAccountWithoutUpdatemethod (#4845)
- Bump
@metamask/base-controllerfrom^7.0.1to^7.0.2(#4862) - Bump
@metamask/utilsfrom^9.1.0to^10.0.0(#4831) - Bump
@metamask/eth-sig-utilfrom^7.0.1to^8.0.0(#4830)
- Bump
@metamask/message-managerfrom^10.1.1to^11.0.0(#4805)
- Bump accounts related packages (#4713), (#4728)
- Those packages are now built slightly differently and are part of the accounts monorepo.
- Bump
@metamask/keyring-apifrom^8.1.0to^8.1.4 - Bump
@metamask/eth-hd-keyringfrom^7.0.1to^7.0.4 - Bump
@metamask/eth-simple-keyringfrom^6.0.1to^6.0.5
- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files (#4648)
- Previously, this package shipped with only one variant of type declaration
files, and these files were only CommonJS-compatible, and the
exportsfield inpackage.jsonlinked to these files. This is an anti-pattern and was rightfully flagged by the "Are the Types Wrong?" tool as "masquerading as CJS". All of the ATTW checks now pass.
- Previously, this package shipped with only one variant of type declaration
files, and these files were only CommonJS-compatible, and the
- Remove chunk files (#4648).
- Previously, the build tool we used to generate JavaScript files extracted common code to "chunk" files. While this was intended to make this package more tree-shakeable, it also made debugging more difficult for our development teams. These chunk files are no longer present.
- Add
KeyringController:addNewAccountmessenger action (#4565)- Add and export
KeyringControllerAddNewAccountActiontype. - Widen
KeyringControllerActionsto includeKeyringControllerAddNewAccountActiontype. KeyringControllerMessengermust allowKeyringControllerAddNewAccountActiontype.
- Add and export
- Bump
@metamask/base-controllerfrom^6.0.2to^7.0.0(#4625, #4643) - Bump
@metamask/keyring-apifrom^8.0.1to^8.1.0(#4594) - Bump
@metamask/message-managerfrom^10.0.2to^10.0.3(#4643) - Bump
typescriptfrom~5.0.4to~5.2.2(#4576, #4584)
- Upgrade TypeScript version to
~5.0.4and setmoduleResolutionoption toNode16(#3645) - Bump
@metamask/base-controllerfrom^6.0.0to^6.0.2(#4517, #4544) - Bump
@metamask/keyring-apifrom^8.0.0to^8.0.1(#3645) - Bump
@metamask/utilsfrom^9.0.0to^9.1.0(#4529) - Bump
@metamask/message-managerfrom^10.0.1to^10.0.2(#4548)
- Bump
@metamask/utilsto^9.0.0,@metamask/rpc-errorsto^6.3.1(#4516)
- Clear encryption salt and key in
setLockedand#createNewVaultWithKeyringto ensure that encryption key is always generated with the latest password (#4514)
- Add support for overwriting built-in keyring builders for the Simple and HD keyring (#4362)
- Deprecate QR keyring methods (#4365)
cancelQRSignRequestcancelQRSynchronizationconnectQRHardwareforgetQRDevicegetOrAddQRKeyringgetQRKeyringgetQRKeyringStateresetQRKeyringStaterestoreQRKeyringsubmitQRCryptoHDKeysubmitQRCryptoAccountsubmitQRSignatureunlockQRHardwareWalletAccount
- BREAKING: Bump minimum Node version to 18.18 (#3611)
- Bump
@metamask/base-controllerto^6.0.0(#4352) - Bump
@metamask/message-managerto^10.0.0(#4352)
- Add
changePasswordmethod (#4279)- This method can be used to change the password used to encrypt the vault.
- Add support for non-EVM account addresses to most methods (#4282)
- Previously, all addresses were assumed to be Ethereum addresses and normalized, but now only Ethereum addresses are treated as such.
- Relax type of
accountargument onremoveAccountfromHextostring
- Bump
@metamask/keyring-apito^6.1.1(#4262) - Bump
@keystonehq/metamask-airgapped-keyringto^0.14.1(#4277) - Bump
async-mutexto^0.5.0(#4335) - Bump
@metamask/message-managerto^9.0.0(#4342)
- Fix QR keyrings so that they are not initialized with invalid state (#4256)
- Added
withKeyringmethod (#4197)- Consumers can now use
withKeyringto atomically select a keyring by address or type and execute a callback with the it as argument. - This method can be used instead of
getKeyringForAccount,getKeyringsByTypeandpersistAllKeyrings, as the vault will be updated automatically after the callback execution, or rolled back in case of errors
- Consumers can now use
- BREAKING: Change various
KeyringControllermethods so they no longer return the controller state (#4199)- Changed
addNewAccountreturn type toPromise<string> - Changed
addNewAccountWithoutUpdatereturn type toPromise<string> - Changed
createNewVaultAndKeychainreturn type toPromise<void> - Changed
createNewVaultAndRestorereturn type toPromise<void> - Changed
importAccountWithStrategyreturn type toPromise<string> - Changed
removeAccountreturn type toPromise<void> - Changed
setLockedreturn type toPromise<void> - Changed
submitEncryptionKeyreturn type toPromise<void> - Changed
submitPasswordreturn type toPromise<void>
- Changed
- Bump
@metamask/keyring-apito^6.0.0(#4193) - Bump
@metamask/base-controllerto^5.0.2(#4232) - Bump
@metamask/message-managerto^8.0.2(#4234)
- Method calls that change controller state are now atomic (#4192)
- Each method will roll back keyring instances in case of errors
- Method calls that change controller state are now mutually exclusive (#4182)
- Check presence of
HDKeyringwhen updating the vault (#4168) - Update state in single call when persisting or unlocking (#4154)
- BREAKING use getAccounts on HD Keyring when calling addNewAccount (#4158)
- Pass CAIP-2 scope to execution context (#4090)
- Allow gas limits to be changed during #addPaymasterData (#3942)
- Fix
typesfield inpackage.json(#4047)
- BREAKING: Add ESM build (#3998)
- It's no longer possible to import files from
./distdirectly.
- It's no longer possible to import files from
- BREAKING: Bump
@metamask/base-controllerto^5.0.0(#4039)- This version has a number of breaking changes. See the changelog for more.
- Bump
@metamask/message-managerto^8.0.0(#4039)
- BREAKING: Narrow
KeyringControllerMessengertype parametersAllowedActionandAllowedEventfromstringtonever(#4031)- Allowlisting or using any external actions or events will now produce a type error.
- Add
isCustodyKeyringfunction (#3899) - Add
keyringBuilderFactoryutility function (#3830) - Add
GenericEncryptor,ExportableKeyEncryptor, andSerializedKeyringtypes (#3830)
- Replace
ethereumjs-utilwith@ethereumjs/util(#3943) - Bump
@metamask/message-managerto^7.3.9(#4007)
- BREAKING: Remove callbacks
updateIdentities,syncIdentities,setSelectedAddress,setAccountLabelfrom constructor options of theKeyringControllerclass. These were previously used to updatePreferencesControllerstate, but are now replaced withPreferencesController's subscription to theKeyringController:stateChangeevent. (#3853)- Methods
addNewAccount,addNewAccountForKeyring,createNewVaultAndRestore,createNewVaultAndKeychain,importAccountWithStrategy,restoreQRKeyring,unlockQRHardwareWalletAccount, andforgetQRDeviceno longer directly updatePreferencesControllerstate by calling theupdateIdentitiescallback. - Method
submitPasswordno longer directly updatesPreferencesControllerstate by calling thesyncIdentitiescallback. - Method
unlockQRHardwareWalletAccountno longer directly updatesPreferencesControllerstate by calling thesetAccountLabelorsetSelectedAddresscallbacks.
- Methods
- Remove
@metamask/eth-keyring-controllerdependency, and transfer dependencies to this package instead (#3830)@metamask/eth-hd-keyring@metamask/eth-simple-keyring@metamask/eth-sig-util@metamask/browser-passworder
- Add
getDefaultKeyringStatefunction (#3799)
- Remove
peerDependencyanddevDependencyupon@metamask/preferences-controller(#3799)- This dependency was just used to access the types of four methods. Those types are now inlined instead.
- Add methods to support ERC-4337 accounts (#3602)
- Bump
@metamask/keyring-apito ^3.0.0 (#3747) - Bump @metamask/eth-keyring-controller from 17.0.0 to 17.0.1 (#3805)
- Bump
@metamask/utilsto^8.3.0(#3769)
- Fix custody keyring name (#3803)
- BREAKING: Bump
@metamask/preferences-controllerto ^6.0.0
- BREAKING: Bump
@metamask/preferences-controllerpeer dependency from^5.0.0to^5.0.1(#3695) - Bump
@metamask/base-controllerto^4.0.1(#3695) - Bump
@metamask/eth-keyring-controllerto^15.1.0(#3617) - Bump
@metamask/eth-sig-utilto^7.0.1(#3614) - Bump
@metamask/message-managerto^7.3.7(#3695) - Update
forgetQRDeviceto return an object containingremovedAccountsandremainingAccounts(#3641)
- Remove
@metamask/preferences-controllerdependency (#3607)
- BREAKING: Bump
@metamask/base-controllerto ^4.0.0 (#2063)- This is breaking because the type of the
messengerhas backward-incompatible changes. See the changelog for this package for more.
- This is breaking because the type of the
- Bump
@metamask/message-managerto ^7.3.6 (#2063) - Bump
@metamask/preferences-controllerto ^4.5.0 (#2063)
- Add
KeyringController:persistAllKeyringsmessenger action (#1965)
- BREAKING Change
encryptorconstructor option property type toGenericEncryptor | ExportableKeyEncryptor | undefined(#2041)- When the controller is instantiated with
cacheEncryptionKey: true,encryptormay no longer be of typeGenericEncryptor.
- When the controller is instantiated with
- Bump dependency on
@metamask/scure-bip392.1.1 (#1868) - Bump dependency on
@metamask/utilsto 8.2.0 (#1957) - Bump @metamask/eth-keyring-controller to 14.0.0 (#1771)
- Adds additional options to KeyringTypes enum (#1839)
signTransactionnow accepts an optionalopts: Record<string, unknown>argument to supportsignTransactionfromKeyringtype (#1789)- Bump dependency and peer dependency on
@metamask/preferences-controllerto ^4.4.3
- Bump dependency on
@metamask/utilsto ^8.1.0 (#1639) - Bump dependency on
@metamask/base-controllerto ^3.2.3 - Bump dependency on
@metamask/message-managerto ^7.3.5
- Update
removeAccountto remove call toPreferencesController.removeIdentityasPreferencesControlleralready handles account removal side effects through messenger events (#1759)
- Update TypeScript to v4.8.x (#1718)
- Removed
keyringTypesfrommemStore(#1710)- This property was accidentally getting copied into the memstore from the internal keyring controller. It was causing errors because there is no metadata for this state property.
- Add
getQRKeyring(): QRKeyring | undefinedmethod - Add
KeyringController:qrKeyringStateChangemessenger event - The event emits updates from the internal
QRKeyringinstance, if there's one
- BREAKING: addNewKeyring(type) return type changed from Promise<Keyring> to Promise
- When calling with QRKeyring type the keyring instance is retrieved or created (no multiple QRKeyring instances possible)
- Bump dependency on
@metamask/message-managerto ^7.3.3 - Bump dependency on
@metamask/preferences-controllerto ^4.4.1
- Fix
addNewAccountForKeyringforCustodyKeyring(#1694)
- Add
KeyringControllermessenger actions (#1691)KeyringController:getAccountsKeyringController:getKeyringsByTypeKeyringController:getKeyringForAccount
- Bump
@metamask/eth-sig-utilfrom 6.0.0 to 7.0.0 (#1669)
- Add
KeyringControllermessenger actions (#1654)KeyringController:signMessageKeyringController:signPersonalMessageKeyringController:signTypedMessageKeyringController:decryptMessageKeyringController:getEncryptionPublicKey
- Add
decryptMessagemethod (#1596)
- Add
addNewAccountForKeyringmethod (#1591) - Add
addNewKeyringmethod (#1594) - Add
persistAllKeyringsmethod (#1574)
- Bump dependency on
@metamask/base-controllerto ^3.2.1 - Bump dependency on
@metamask/message-managerto ^7.3.1 - Bump dependency and peer dependency on
@metamask/preferences-controllerto ^4.4.0
- Add
getEncryptionPublicKeymethod on KeyringController (#1569)
- BREAKING: Remove
keyringTypesproperty from the KeyringController state (#1441) - BREAKING: Constructor
KeyringControllerOptionstype changed (#1441)- The
KeyringControllerOptions.stateaccepted type is now{ vault?: string } - The
KeyringControllerOptions.keyringBuilderstype is now{ (): Keyring<Json>; type: string }[]
- The
- BREAKING: The
addresstype accepted by theremoveAccountmethod is nowHex(#1441) - BREAKING: The
signTypedMessagemethod now returns aPromise<string>(#1441) - BREAKING: The
signTransactionmethod now requires aTypedTransactionfrom@ethereumjs/tx@^4for thetransactionargument, and returns aPromise<TxData>(#1441) - BREAKING: Rename
Keyringtype toKeyringObject(#1441) - BREAKING:
addNewAccountnow throws if address of new account is not a hex string (#1441) - BREAKING:
exportSeedPhrasenow throws if first keyring does not have a mnemonic (#1441) - BREAKING:
verifySeedPhrasenow throws if HD keyring does not have a mnemonic (#1441) - Update return type of
getAccountKeyringTypetoPromise<string>(#1441) - Update
@metamask/eth-keyring-controllerto^13.0.0(#1441) - Update
@metamask/utilsto^6.2.0(#1514) - Update
@ethereumjs/txto^4.2.0(#1514) - Update
@ethereumjs/commonto^3.2.0(#1514) - Update
@keystonehq/metamask-airgapped-keyringto^0.13.1(#1514)
- Bump @metamask/eth-sig-util to ^6.0.0 (#1483)
- Add messenger events
KeyringController:lockandKeyringController:unlock, emitted when the inner EthKeyringController is locked/unlocked (#1378)- Also add corresponding types
KeyringControllerLockEventandKeyringControllerUnlockEvent
- Also add corresponding types
- Add
KeyringController:accountRemovedevent, fired whenever an account is removed throughremoveAccount(#1416)
- BREAKING: Update constructor to take a single argument, an options bag, instead of three arguments (#1378)
- BREAKING: Update controller so state is now accessible via
controller.stateinstead ofcontroller.store.getState()(#1378) - BREAKING: Update KeyringController to take a required
messengeroption (#1378)- The messenger will now publish
KeyringController:stateChangeon state changes thanks to BaseControllerV2 - The messenger features a
KeyringController:getStateaction thanks to BaseControllerV2 - Add types
KeyringControllerGetStateActionandKeyringControllerStateChangeEventfor the above - Add type
KeyringControllerMessenger
- The messenger will now publish
- BREAKING: Update
keyringStateproperty in the return value of several methods from a type ofKeyringMemStatetoKeyringControllerMemState(#1378)- The affected methods are:
addNewAccountaddNewAccountWithoutUpdatecreateNewVaultAndRestorecreateNewVaultAndKeychainimportAccountWithStrategyremoveAccountsetLockedsubmitEncryptionKeysubmitPassword
- The new type omits
vault,encryptionKey, andencryptionSalt
- The affected methods are:
- BREAKING: Remove
KeyringState,KeyringMemState, andKeyringConfigin favor of new typesKeyringControllerState,KeyringControllerMemState,KeyringControllerActions,KeyringControllerEvents, andKeyringControllerOptions(#1378)KeyringControllerStateis like the previousKeyringMemStatebut with an extravaultpropertyKeyringControllerMemStateis like the previousKeyringMemStatebut withoutencryptionKeyorencryptionSaltKeyringControllerOptionsincorporates the previous set of options andKeyringConfig
- Add
immeras a dependency (#1378)
- BREAKING: Remove
subscribeandunsubscribemethods (#1378)- State changes can be directly subscribed to (or unsubscribed from) via the messenger if necessary
- BREAKING: Remove
lockandunlockmethods (#1378)KeyringController:lockandKeyringController:unlockmay now be subscribed to via the messenger if necessary
- BREAKING: Remove
fullUpdatemethod (#1378)- There is no need to call this method anymore because the controller should always be up to date with the EthKeyringController instance
- BREAKING: Remove
indexfrom theKeyringtype (#1378)
- Add
cancelQRSynchronizationmethod (#1387)
- Add support for encryption keys (#1342)
- The configuration option
cacheEncryptionKeyhas been added, along with two new state properties (encryptionKeyandencryptionSalt) and a new method (submitEncryptionKey) - All new state and config entries are optional, so this will have no effect if you're not using this feature.
- The configuration option
- Make
addNewAccountidempotent (#1298)- The
addNewAccountmethod now takes an optionalaccountCountparameter. If provided, we ensure that this can be called repeatedly with the same result.
- The
- Add deprecated
getKeyringForAccountandgetKeyringsByTypemethods (#1376, #1386)
- BREAKING: Bump to Node 16 (#1262)
- BREAKING: Change return type of
createNewVaultAndRestorefromstring | number[]toUint8Array(#1349) - BREAKING: Change return type of
verifySeedPhrasefromstringtoUint8Array(#1338) - BREAKING: Replace
validatePasswordwithverifyPassword(#1348)verifyPasswordis asynchronous, unlikevalidatePasswordwhich was not.verifyPassworddoes not return a boolean to indicate whether the password is valid. Instead an error is thrown when it's invalid.
- BREAKING:
createNewVaultAndKeychainwill now skip vault creation if one already exists, rather than replacing it (#1324)- If you do want to replace a vault if one exists, you will have to remove it first before this is called.
- BREAKING:
importAccountWithStrategyandaddNewAccountno longer update the selected address (#1296, #1309)- If you want the newly imported account to be selected, you will have to do that manually after this is called.
- BREAKING: Change
importAccountWithStrategyreturn type (#1295)importAccountWithStrategynow returns an object withkeyringStateandimportedAccountAddress, rather than just the keyring state.
- BREAKING: Change
addNewAccountreturn type (#1294)addNewAccountnow returns an object withkeyringStateandaddedAccountAddress, rather than just the keyring state.
- BREAKING: Add
@metamask/preferences-controllerpeer dependency (#1393) - Bump @metamask/eth-keyring-controller from 10.0.0 to 10.0.1 (#1280)
- Bump @metamask/eth-sig-util from 5.0.2 to 5.0.3 (#1278)
- Update
@metamask/preferences-controllerdependency
- Improve validation of
fromaddress insignTypedMessage(#1293) - Improve private key validation in
importAccountWithStrategy(#1297)- A more helpful error is now thrown when the given private key has the wrong length
- Keep
vaultstate in sync with the internalEthKeyringControllervault state (#1384)- Previously the
vaultstate would never be updated after construction, becoming stale as account changes were made - The old behavior was especially confusing because the
subscribemethod is overridden to return state change events from the internalEthKeyingControllerstate, resulting in state change events being out of sync with controller state. They should be the same now.
- Previously the
- BREAKING: Remove
isomorphic-fetch(#1106)- Consumers must now import
isomorphic-fetchor another polyfill themselves if they are running in an environment withoutfetch
- Consumers must now import
- BREAKING:: Bump eth-keyring-controller version to @metamask/eth-keyring-controller v10 (#1072)
exportSeedPhrasenow returns aUint8Arraytyped SRP (can be converted to a string using this approach). It was previously a Buffer.- The HD keyring included with the keyring controller has been updated from v4 to v6. See the
eth-hd-keyringchangelog entries for v5 and v6 for further details on breaking changes.
- BREAKING:: Require ES2020 support or greater (#914)
- This change was introduced by an indirect dependency on
ethereumjs/utilv8
- This change was introduced by an indirect dependency on
- Rename this repository to
core(#1031) - Update
@metamask/eth-sig-utilto v5 (#914) - Update
@metamask/controller-utilspackage (#1041)
- Relax dependencies on
@metamask/base-controller,@metamask/controller-utils,@metamask/message-manager, and@metamask/preferences-controller(use^instead of~) (#998)
-
Initial release
-
As a result of converting our shared controllers repo into a monorepo (#831), we've created this package from select parts of
@metamask/controllersv33.0.0, namely:- Everything in
src/keyring
All changes listed after this point were applied to this package following the monorepo conversion.
- Everything in
-