@metamask-previews/keyring-controller 25.5.0-preview-781882851 → 26.0.0-preview-d3514bcb5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [26.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Change `KeyringSelectorV2` type selectors for `withKeyringV2` and `withKeyringV2Unsafe` to use `KeyringType` (v2 variant) ([#8901](https://github.com/MetaMask/core/pull/8901))
15
+ - Use values such as `KeyringType.Hd` instead of legacy `KeyringTypes.hd`.
16
+ - Deprecate `KeyringTypes` ([#8907](https://github.com/MetaMask/core/pull/8907))
17
+ - Use `KeyringTypes` from `@metamask/keyring-api/v2` if your keyring has a v2 builder.
18
+
10
19
  ## [25.5.0]
11
20
 
12
21
  ### Added
@@ -1008,7 +1017,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1008
1017
 
1009
1018
  All changes listed after this point were applied to this package following the monorepo conversion.
1010
1019
 
1011
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@25.5.0...HEAD
1020
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@26.0.0...HEAD
1021
+ [26.0.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@25.5.0...@metamask/keyring-controller@26.0.0
1012
1022
  [25.5.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@25.4.0...@metamask/keyring-controller@25.5.0
1013
1023
  [25.4.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@25.3.0...@metamask/keyring-controller@25.4.0
1014
1024
  [25.3.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@25.2.0...@metamask/keyring-controller@25.3.0
@@ -94,6 +94,10 @@ const MESSENGER_EXPOSED_METHODS = [
94
94
  ];
95
95
  /**
96
96
  * Available keyring types
97
+ *
98
+ * @deprecated Use `KeyringType` from `@metamask/keyring-api/v2` instead. This enum will be removed
99
+ * in a future release once V2 is fully adopted. Only use it if the keyring you are trying to access
100
+ * has no V2 builder available yet.
97
101
  */
98
102
  var KeyringTypes;
99
103
  (function (KeyringTypes) {
@@ -601,7 +605,7 @@ class KeyringController extends base_controller_1.BaseController {
601
605
  */
602
606
  getKeyringsByType(type) {
603
607
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
604
- return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntriesByType).call(this, type).map(({ keyring }) => keyring);
608
+ return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntriesByType).call(this, { v2: false, type }).map(({ keyring }) => keyring);
605
609
  }
606
610
  /**
607
611
  * Persist all serialized keyrings in the vault.
@@ -1275,9 +1279,9 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1275
1279
  const address = account.toLowerCase();
1276
1280
  const accountsPerKeyring = await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(({ keyring }) => keyring.getAccounts()));
1277
1281
  return accountsPerKeyring.findIndex((accounts) => accounts.map((a) => a.toLowerCase()).includes(address));
1278
- }, _KeyringController_getKeyringEntriesByType = function _KeyringController_getKeyringEntriesByType(type) {
1282
+ }, _KeyringController_getKeyringEntriesByType = function _KeyringController_getKeyringEntriesByType({ v2, type, }) {
1279
1283
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
1280
- return __classPrivateFieldGet(this, _KeyringController_keyrings, "f").filter(({ keyring }) => keyring.type === type);
1284
+ return __classPrivateFieldGet(this, _KeyringController_keyrings, "f").filter(({ keyring, keyringV2 }) => v2 ? keyringV2?.type === type : keyring.type === type);
1281
1285
  }, _KeyringController_assertNoUnsafeDirectKeyringAccess = function _KeyringController_assertNoUnsafeDirectKeyringAccess(value, keyring) {
1282
1286
  if (Object.is(value, keyring)) {
1283
1287
  // Access to a keyring instance outside of controller safeguards
@@ -1306,7 +1310,10 @@ async function _KeyringController_selectKeyringEntry({ v2, selector, }) {
1306
1310
  entry = await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntryForAccount).call(this, selector.address);
1307
1311
  }
1308
1312
  else if ('type' in selector) {
1309
- entry = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntriesByType).call(this, selector.type)[selector.index ?? 0];
1313
+ const entries = v2
1314
+ ? __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntriesByType).call(this, { v2: true, type: selector.type })
1315
+ : __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntriesByType).call(this, { v2: false, type: selector.type });
1316
+ entry = entries[selector.index ?? 0];
1310
1317
  }
1311
1318
  else if ('id' in selector) {
1312
1319
  entry = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringEntryById).call(this, selector.id);