@metamask-previews/keyring-controller 19.1.0-preview-cd1fb95d → 19.1.0-preview-74b4a89

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.
@@ -340,30 +340,6 @@ class KeyringController extends base_controller_1.BaseController {
340
340
  return addedAccountAddress;
341
341
  });
342
342
  }
343
- async addNewAccounts(numberOfAccountsToAdd, accountCount) {
344
- __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
345
- return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
346
- const primaryKeyring = this.getKeyringsByType('HD Key Tree')[0];
347
- if (!primaryKeyring) {
348
- throw new Error('No HD keyring found');
349
- }
350
- const oldAccounts = await primaryKeyring.getAccounts();
351
- if (accountCount && oldAccounts.length !== accountCount) {
352
- if (accountCount > oldAccounts.length) {
353
- throw new Error('Accounts out of sequence');
354
- }
355
- // we return the accounts already existing starting at index `accountCount`
356
- const existingAccounts = oldAccounts.slice(accountCount);
357
- if (!existingAccounts[0]) {
358
- throw new Error(`Can't find account at index ${accountCount}`);
359
- }
360
- return existingAccounts;
361
- }
362
- const newAccounts = await primaryKeyring.addAccounts(numberOfAccountsToAdd);
363
- await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_verifySeedPhrase).call(this);
364
- return newAccounts;
365
- });
366
- }
367
343
  /**
368
344
  * Effectively the same as creating a new keychain then populating it
369
345
  * using the given seed phrase.
@@ -1111,7 +1087,7 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
1111
1087
  this.messagingSystem.registerActionHandler(`${name}:patchUserOperation`, this.patchUserOperation.bind(this));
1112
1088
  this.messagingSystem.registerActionHandler(`${name}:signUserOperation`, this.signUserOperation.bind(this));
1113
1089
  this.messagingSystem.registerActionHandler(`${name}:addNewAccount`, this.addNewAccount.bind(this));
1114
- this.messagingSystem.registerActionHandler(`${name}:addNewAccounts`, this.addNewAccounts.bind(this));
1090
+ this.messagingSystem.registerActionHandler(`${name}:withKeyring`, this.withKeyring.bind(this));
1115
1091
  }, _KeyringController_getKeyringBuilderForType = function _KeyringController_getKeyringBuilderForType(type) {
1116
1092
  return __classPrivateFieldGet(this, _KeyringController_keyringBuilders, "f").find((keyringBuilder) => keyringBuilder.type === type);
1117
1093
  }, _KeyringController_addQRKeyring =
@@ -1408,6 +1384,7 @@ async function _KeyringController_createKeyringWithFirstAccount(type, opts) {
1408
1384
  * using the given `opts`. The keyring is built using the keyring builder
1409
1385
  * registered for the given `type`.
1410
1386
  *
1387
+ *
1411
1388
  * @param type - The type of keyring to add.
1412
1389
  * @param data - The data to restore a previously serialized keyring.
1413
1390
  * @returns The new keyring.