@metamask-previews/keyring-controller 19.0.5-preview-aec8dc46 → 19.0.5-preview-958adf52

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,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Changed
11
+
12
+ - Bump `@metamask/keyring-api"` from `^16.1.0` to `^17.0.0` ([#5280](https://github.com/MetaMask/core/pull/5280))
13
+
10
14
  ## [19.0.5]
11
15
 
12
16
  ### Changed
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
36
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
- var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_unsupportedKeyrings, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_keyringsMetadata, _KeyringController_password, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringById, _KeyringController_getKeyringBuilderForType, _KeyringController_addQRKeyring, _KeyringController_subscribeToQRKeyringEvents, _KeyringController_unsubscribeFromQRKeyringsEvents, _KeyringController_createNewVaultWithKeyring, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_checkForDuplicate, _KeyringController_setUnlocked, _KeyringController_persistOrRollback, _KeyringController_withRollback, _KeyringController_assertControllerMutexIsLocked, _KeyringController_withControllerLock, _KeyringController_withVaultLock;
39
+ var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_unsupportedKeyrings, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_password, _KeyringController_qrKeyringStateListener, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringBuilderForType, _KeyringController_addQRKeyring, _KeyringController_subscribeToQRKeyringEvents, _KeyringController_unsubscribeFromQRKeyringsEvents, _KeyringController_createNewVaultWithKeyring, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_checkForDuplicate, _KeyringController_setUnlocked, _KeyringController_persistOrRollback, _KeyringController_withRollback, _KeyringController_assertControllerMutexIsLocked, _KeyringController_withControllerLock, _KeyringController_withVaultLock;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.KeyringController = exports.getDefaultKeyringState = exports.keyringBuilderFactory = exports.SignTypedDataVersion = exports.AccountImportStrategy = exports.isCustodyKeyring = exports.KeyringTypes = void 0;
42
42
  const util_1 = require("@ethereumjs/util");
@@ -48,10 +48,7 @@ const eth_simple_keyring_1 = __importDefault(require("@metamask/eth-simple-keyri
48
48
  const utils_1 = require("@metamask/utils");
49
49
  const async_mutex_1 = require("async-mutex");
50
50
  const ethereumjs_wallet_1 = __importStar(require("ethereumjs-wallet"));
51
- // When generating a ULID within the same millisecond, monotonicFactory provides some guarantees regarding sort order.
52
- const ulid_1 = require("ulid");
53
51
  const constants_1 = require("./constants.cjs");
54
- const ulid = (0, ulid_1.monotonicFactory)();
55
52
  const name = 'KeyringController';
56
53
  /**
57
54
  * Available keyring types
@@ -118,7 +115,6 @@ const getDefaultKeyringState = () => {
118
115
  return {
119
116
  isUnlocked: false,
120
117
  keyrings: [],
121
- keyringsMetadata: [],
122
118
  };
123
119
  };
124
120
  exports.getDefaultKeyringState = getDefaultKeyringState;
@@ -250,7 +246,6 @@ class KeyringController extends base_controller_1.BaseController {
250
246
  vault: { persist: true, anonymous: false },
251
247
  isUnlocked: { persist: false, anonymous: true },
252
248
  keyrings: { persist: false, anonymous: false },
253
- keyringsMetadata: { persist: true, anonymous: false },
254
249
  encryptionKey: { persist: false, anonymous: false },
255
250
  encryptionSalt: { persist: false, anonymous: false },
256
251
  },
@@ -268,7 +263,6 @@ class KeyringController extends base_controller_1.BaseController {
268
263
  _KeyringController_encryptor.set(this, void 0);
269
264
  _KeyringController_cacheEncryptionKey.set(this, void 0);
270
265
  _KeyringController_keyrings.set(this, void 0);
271
- _KeyringController_keyringsMetadata.set(this, void 0);
272
266
  _KeyringController_password.set(this, void 0);
273
267
  _KeyringController_qrKeyringStateListener.set(this, void 0);
274
268
  __classPrivateFieldSet(this, _KeyringController_keyringBuilders, keyringBuilders
@@ -276,7 +270,6 @@ class KeyringController extends base_controller_1.BaseController {
276
270
  : defaultKeyringBuilders, "f");
277
271
  __classPrivateFieldSet(this, _KeyringController_encryptor, encryptor, "f");
278
272
  __classPrivateFieldSet(this, _KeyringController_keyrings, [], "f");
279
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, state?.keyringsMetadata ?? [], "f");
280
273
  __classPrivateFieldSet(this, _KeyringController_unsupportedKeyrings, [], "f");
281
274
  // This option allows the controller to cache an exported key
282
275
  // for use in decrypting and encrypting data without password
@@ -295,11 +288,11 @@ class KeyringController extends base_controller_1.BaseController {
295
288
  */
296
289
  async addNewAccount(accountCount) {
297
290
  return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
298
- const selectedKeyring = this.getKeyringsByType('HD Key Tree')[0];
299
- if (!selectedKeyring) {
291
+ const primaryKeyring = this.getKeyringsByType('HD Key Tree')[0];
292
+ if (!primaryKeyring) {
300
293
  throw new Error('No HD keyring found');
301
294
  }
302
- const oldAccounts = await selectedKeyring.getAccounts();
295
+ const oldAccounts = await primaryKeyring.getAccounts();
303
296
  if (accountCount && oldAccounts.length !== accountCount) {
304
297
  if (accountCount > oldAccounts.length) {
305
298
  throw new Error('Account out of sequence');
@@ -311,7 +304,7 @@ class KeyringController extends base_controller_1.BaseController {
311
304
  }
312
305
  return existingAccount;
313
306
  }
314
- const [addedAccountAddress] = await selectedKeyring.addAccounts(1);
307
+ const [addedAccountAddress] = await primaryKeyring.addAccounts(1);
315
308
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this);
316
309
  return addedAccountAddress;
317
310
  });
@@ -422,21 +415,12 @@ class KeyringController extends base_controller_1.BaseController {
422
415
  * Gets the seed phrase of the HD keyring.
423
416
  *
424
417
  * @param password - Password of the keyring.
425
- * @param keyringId - The id of the keyring.
426
418
  * @returns Promise resolving to the seed phrase.
427
419
  */
428
- async exportSeedPhrase(password, keyringId) {
420
+ async exportSeedPhrase(password) {
429
421
  await this.verifyPassword(password);
430
- if (!keyringId) {
431
- assertHasUint8ArrayMnemonic(__classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0]);
432
- return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0].mnemonic;
433
- }
434
- const selectedKeyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, keyringId);
435
- if (!selectedKeyring) {
436
- throw new Error('Keyring not found');
437
- }
438
- assertHasUint8ArrayMnemonic(selectedKeyring);
439
- return selectedKeyring.mnemonic;
422
+ assertHasUint8ArrayMnemonic(__classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0]);
423
+ return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0].mnemonic;
440
424
  }
441
425
  /**
442
426
  * Gets the private key from the keyring controlling an address.
@@ -836,24 +820,10 @@ class KeyringController extends base_controller_1.BaseController {
836
820
  /**
837
821
  * Verifies the that the seed phrase restores the current keychain's accounts.
838
822
  *
839
- * @param keyringId - The id of the keyring to verify.
840
823
  * @returns Promise resolving to the seed phrase as Uint8Array.
841
824
  */
842
- async verifySeedPhrase(keyringId) {
843
- let keyring;
844
- if (!keyringId) {
845
- keyring = __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[0];
846
- }
847
- else {
848
- keyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, keyringId);
849
- if (keyring.type !== KeyringTypes.hd) {
850
- throw new Error(constants_1.KeyringControllerError.UnsupportedVerifySeedPhrase);
851
- }
852
- }
853
- if (!keyring) {
854
- throw new Error(constants_1.KeyringControllerError.NoHdKeyring);
855
- }
856
- return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this, keyringId));
825
+ async verifySeedPhrase() {
826
+ return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withControllerLock).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this));
857
827
  }
858
828
  async withKeyring(selector, operation, options = {
859
829
  createIfMissing: false,
@@ -863,15 +833,12 @@ class KeyringController extends base_controller_1.BaseController {
863
833
  if ('address' in selector) {
864
834
  keyring = (await this.getKeyringForAccount(selector.address));
865
835
  }
866
- else if ('type' in selector) {
836
+ else {
867
837
  keyring = this.getKeyringsByType(selector.type)[selector.index || 0];
868
838
  if (!keyring && options.createIfMissing) {
869
839
  keyring = (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, selector.type, options.createWithData));
870
840
  }
871
841
  }
872
- else if ('id' in selector) {
873
- keyring = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, selector.id);
874
- }
875
842
  if (!keyring) {
876
843
  throw new Error(constants_1.KeyringControllerError.KeyringNotFound);
877
844
  }
@@ -1071,7 +1038,7 @@ class KeyringController extends base_controller_1.BaseController {
1071
1038
  }
1072
1039
  }
1073
1040
  exports.KeyringController = KeyringController;
1074
- _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_keyringsMetadata = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1041
+ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1075
1042
  this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
1076
1043
  this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
1077
1044
  this.messagingSystem.registerActionHandler(`${name}:signTypedMessage`, this.signTypedMessage.bind(this));
@@ -1085,9 +1052,6 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1085
1052
  this.messagingSystem.registerActionHandler(`${name}:patchUserOperation`, this.patchUserOperation.bind(this));
1086
1053
  this.messagingSystem.registerActionHandler(`${name}:signUserOperation`, this.signUserOperation.bind(this));
1087
1054
  this.messagingSystem.registerActionHandler(`${name}:addNewAccount`, this.addNewAccount.bind(this));
1088
- }, _KeyringController_getKeyringById = function _KeyringController_getKeyringById(keyringId) {
1089
- const index = this.state.keyringsMetadata.findIndex((metadata) => metadata.id === keyringId);
1090
- return __classPrivateFieldGet(this, _KeyringController_keyrings, "f")[index];
1091
1055
  }, _KeyringController_getKeyringBuilderForType = function _KeyringController_getKeyringBuilderForType(type) {
1092
1056
  return __classPrivateFieldGet(this, _KeyringController_keyringBuilders, "f").find((keyringBuilder) => keyringBuilder.type === type);
1093
1057
  }, _KeyringController_addQRKeyring =
@@ -1101,7 +1065,7 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1101
1065
  async function _KeyringController_addQRKeyring() {
1102
1066
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1103
1067
  // QRKeyring is not yet compatible with Keyring type from @metamask/utils
1104
- return (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, KeyringTypes.qr, undefined));
1068
+ return (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, KeyringTypes.qr));
1105
1069
  }, _KeyringController_subscribeToQRKeyringEvents = function _KeyringController_subscribeToQRKeyringEvents(qrKeyring) {
1106
1070
  __classPrivateFieldSet(this, _KeyringController_qrKeyringStateListener, (state) => {
1107
1071
  this.messagingSystem.publish(`${name}:qrKeyringStateChange`, state);
@@ -1146,20 +1110,17 @@ async function _KeyringController_createNewVaultWithKeyring(password, keyring) {
1146
1110
  /**
1147
1111
  * Internal non-exclusive method to verify the seed phrase.
1148
1112
  *
1149
- * @param keyringId - The id of the keyring to verify the seed phrase for.
1150
1113
  * @returns A promise resolving to the seed phrase as Uint8Array.
1151
1114
  */
1152
- async function _KeyringController_verifySeedPhrase(keyringId) {
1115
+ async function _KeyringController_verifySeedPhrase() {
1153
1116
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1154
- const keyring = keyringId
1155
- ? __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringById).call(this, keyringId)
1156
- : this.getKeyringsByType(KeyringTypes.hd)[0];
1157
- if (!keyring) {
1117
+ const primaryKeyring = this.getKeyringsByType(KeyringTypes.hd)[0];
1118
+ if (!primaryKeyring) {
1158
1119
  throw new Error('No HD keyring found.');
1159
1120
  }
1160
- assertHasUint8ArrayMnemonic(keyring);
1161
- const seedWords = keyring.mnemonic;
1162
- const accounts = await keyring.getAccounts();
1121
+ assertHasUint8ArrayMnemonic(primaryKeyring);
1122
+ const seedWords = primaryKeyring.mnemonic;
1123
+ const accounts = await primaryKeyring.getAccounts();
1163
1124
  /* istanbul ignore if */
1164
1125
  if (accounts.length === 0) {
1165
1126
  throw new Error('Cannot verify an empty keyring.');
@@ -1207,7 +1168,7 @@ async function _KeyringController_getUpdatedKeyrings() {
1207
1168
  async function _KeyringController_getSerializedKeyrings({ includeUnsupported } = {
1208
1169
  includeUnsupported: true,
1209
1170
  }) {
1210
- const serializedKeyrings = await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring, index) => {
1171
+ const serializedKeyrings = await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring) => {
1211
1172
  const [type, data] = await Promise.all([
1212
1173
  keyring.type,
1213
1174
  keyring.serialize(),
@@ -1229,9 +1190,6 @@ async function _KeyringController_restoreSerializedKeyrings(serializedKeyrings)
1229
1190
  for (const serializedKeyring of serializedKeyrings) {
1230
1191
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_restoreKeyring).call(this, serializedKeyring);
1231
1192
  }
1232
- if (__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length > __classPrivateFieldGet(this, _KeyringController_keyrings, "f").length) {
1233
- throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1234
- }
1235
1193
  }, _KeyringController_unlockKeyrings =
1236
1194
  /**
1237
1195
  * Unlock Keyrings, decrypting the vault and deserializing all
@@ -1345,14 +1303,10 @@ async function _KeyringController_unlockKeyrings(password, encryptionKey, encryp
1345
1303
  this.update((state) => {
1346
1304
  state.vault = updatedState.vault;
1347
1305
  state.keyrings = updatedKeyrings;
1348
- state.keyringsMetadata = __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f");
1349
1306
  if (updatedState.encryptionKey) {
1350
1307
  state.encryptionKey = updatedState.encryptionKey;
1351
1308
  state.encryptionSalt = JSON.parse(updatedState.vault).salt;
1352
1309
  }
1353
- if (updatedKeyrings.length < __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length) {
1354
- throw new Error(constants_1.KeyringControllerError.KeyringMetadataLengthMismatch);
1355
- }
1356
1310
  });
1357
1311
  return true;
1358
1312
  });
@@ -1388,13 +1342,13 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1388
1342
  if (!firstAccount) {
1389
1343
  throw new Error(constants_1.KeyringControllerError.NoFirstAccount);
1390
1344
  }
1391
- return firstAccount;
1392
1345
  }, _KeyringController_newKeyring =
1393
1346
  /**
1394
1347
  * Instantiate, initialize and return a new keyring of the given `type`,
1395
1348
  * using the given `opts`. The keyring is built using the keyring builder
1396
1349
  * registered for the given `type`.
1397
1350
  *
1351
+ *
1398
1352
  * @param type - The type of keyring to add.
1399
1353
  * @param data - The data to restore a previously serialized keyring.
1400
1354
  * @returns The new keyring.
@@ -1402,10 +1356,6 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1402
1356
  */
1403
1357
  async function _KeyringController_newKeyring(type, data) {
1404
1358
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1405
- const newKeyringMetadata = {
1406
- id: ulid().toString(),
1407
- name: '',
1408
- };
1409
1359
  const keyringBuilder = __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringBuilderForType).call(this, type);
1410
1360
  if (!keyringBuilder) {
1411
1361
  throw new Error(`${constants_1.KeyringControllerError.NoKeyringBuilder}. Keyring type: ${type}`);
@@ -1433,10 +1383,6 @@ async function _KeyringController_newKeyring(type, data) {
1433
1383
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_subscribeToQRKeyringEvents).call(this, keyring);
1434
1384
  }
1435
1385
  __classPrivateFieldGet(this, _KeyringController_keyrings, "f").push(keyring);
1436
- if (newKeyringMetadata &&
1437
- __classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f").length < __classPrivateFieldGet(this, _KeyringController_keyrings, "f").length) {
1438
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, [...__classPrivateFieldGet(this, _KeyringController_keyringsMetadata, "f"), newKeyringMetadata], "f");
1439
- }
1440
1386
  return keyring;
1441
1387
  }, _KeyringController_clearKeyrings =
1442
1388
  /**
@@ -1449,10 +1395,6 @@ async function _KeyringController_clearKeyrings() {
1449
1395
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_destroyKeyring).call(this, keyring);
1450
1396
  }
1451
1397
  __classPrivateFieldSet(this, _KeyringController_keyrings, [], "f");
1452
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, [], "f");
1453
- // this.update((state) => {
1454
- // state.keyringsMetadata = [];
1455
- // });
1456
1398
  }, _KeyringController_restoreKeyring =
1457
1399
  /**
1458
1400
  * Restore a Keyring from a provided serialized payload.
@@ -1493,22 +1435,19 @@ async function _KeyringController_destroyKeyring(keyring) {
1493
1435
  async function _KeyringController_removeEmptyKeyrings() {
1494
1436
  __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
1495
1437
  const validKeyrings = [];
1496
- const validKeyringMetadata = [];
1497
1438
  // Since getAccounts returns a Promise
1498
1439
  // We need to wait to hear back form each keyring
1499
1440
  // in order to decide which ones are now valid (accounts.length > 0)
1500
- await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring, index) => {
1441
+ await Promise.all(__classPrivateFieldGet(this, _KeyringController_keyrings, "f").map(async (keyring) => {
1501
1442
  const accounts = await keyring.getAccounts();
1502
1443
  if (accounts.length > 0) {
1503
1444
  validKeyrings.push(keyring);
1504
- validKeyringMetadata.push(this.state.keyringsMetadata[index]);
1505
1445
  }
1506
1446
  else {
1507
1447
  await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_destroyKeyring).call(this, keyring);
1508
1448
  }
1509
1449
  }));
1510
1450
  __classPrivateFieldSet(this, _KeyringController_keyrings, validKeyrings, "f");
1511
- __classPrivateFieldSet(this, _KeyringController_keyringsMetadata, validKeyringMetadata, "f");
1512
1451
  }, _KeyringController_checkForDuplicate =
1513
1452
  /**
1514
1453
  * Checks for duplicate keypairs, using the the first account in the given