@metamask-previews/keyring-controller 15.0.0-preview-cb17e99 → 15.0.0-preview-96ea89dc

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.
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkQDPHKQONjs = require('./chunk-QDPHKQON.js');
6
+ var _chunkZGV2QNCGjs = require('./chunk-ZGV2QNCG.js');
7
7
 
8
8
  // src/KeyringController.ts
9
9
  var _util = require('@ethereumjs/util');
@@ -124,14 +124,14 @@ var KeyringController = class extends _basecontroller.BaseController {
124
124
  * Constructor helper for registering this controller's messaging system
125
125
  * actions.
126
126
  */
127
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _registerMessageHandlers);
127
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _registerMessageHandlers);
128
128
  /**
129
129
  * Get the keyring builder for the given `type`.
130
130
  *
131
131
  * @param type - The type of keyring to get the builder for.
132
132
  * @returns The keyring builder, or undefined if none exists.
133
133
  */
134
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _getKeyringBuilderForType);
134
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getKeyringBuilderForType);
135
135
  /**
136
136
  * Add qr hardware keyring.
137
137
  *
@@ -139,15 +139,15 @@ var KeyringController = class extends _basecontroller.BaseController {
139
139
  * @throws If a QRKeyring builder is not provided
140
140
  * when initializing the controller
141
141
  */
142
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _addQRKeyring);
142
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _addQRKeyring);
143
143
  /**
144
144
  * Subscribe to a QRKeyring state change events and
145
145
  * forward them through the messaging system.
146
146
  *
147
147
  * @param qrKeyring - The QRKeyring instance to subscribe to
148
148
  */
149
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _subscribeToQRKeyringEvents);
150
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _unsubscribeFromQRKeyringsEvents);
149
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _subscribeToQRKeyringEvents);
150
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _unsubscribeFromQRKeyringsEvents);
151
151
  /**
152
152
  * Create new vault with an initial keyring
153
153
  *
@@ -162,14 +162,14 @@ var KeyringController = class extends _basecontroller.BaseController {
162
162
  * @param keyring.opts - Optional parameters required to instantiate the keyring.
163
163
  * @returns A promise that resolves to the state.
164
164
  */
165
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _createNewVaultWithKeyring);
165
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _createNewVaultWithKeyring);
166
166
  /**
167
167
  * Get the updated array of each keyring's type and
168
168
  * accounts list.
169
169
  *
170
170
  * @returns A promise resolving to the updated keyrings array.
171
171
  */
172
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _getUpdatedKeyrings);
172
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getUpdatedKeyrings);
173
173
  /**
174
174
  * Serialize the current array of keyring instances,
175
175
  * including unsupported keyrings by default.
@@ -178,13 +178,13 @@ var KeyringController = class extends _basecontroller.BaseController {
178
178
  * @param options.includeUnsupported - Whether to include unsupported keyrings.
179
179
  * @returns The serialized keyrings.
180
180
  */
181
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _getSerializedKeyrings);
181
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getSerializedKeyrings);
182
182
  /**
183
183
  * Restore a serialized keyrings array.
184
184
  *
185
185
  * @param serializedKeyrings - The serialized keyrings array.
186
186
  */
187
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _restoreSerializedKeyrings);
187
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _restoreSerializedKeyrings);
188
188
  /**
189
189
  * Unlock Keyrings, decrypting the vault and deserializing all
190
190
  * keyrings contained in it, using a password or an encryption key with salt.
@@ -194,20 +194,20 @@ var KeyringController = class extends _basecontroller.BaseController {
194
194
  * @param encryptionSalt - The salt used to encrypt the vault.
195
195
  * @returns A promise resolving to the deserialized keyrings array.
196
196
  */
197
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _unlockKeyrings);
197
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _unlockKeyrings);
198
198
  /**
199
199
  * Update the vault with the current keyrings.
200
200
  *
201
201
  * @returns A promise resolving to `true` if the operation is successful.
202
202
  */
203
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _updateVault);
203
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _updateVault);
204
204
  /**
205
205
  * Retrieves all the accounts from keyrings instances
206
206
  * that are currently in memory.
207
207
  *
208
208
  * @returns A promise resolving to an array of accounts.
209
209
  */
210
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _getAccountsFromKeyrings);
210
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _getAccountsFromKeyrings);
211
211
  /**
212
212
  * Create a new keyring, ensuring that the first account is
213
213
  * also created.
@@ -216,7 +216,7 @@ var KeyringController = class extends _basecontroller.BaseController {
216
216
  * @param opts - Optional parameters required to instantiate the keyring.
217
217
  * @returns A promise that resolves if the operation is successful.
218
218
  */
219
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _createKeyringWithFirstAccount);
219
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _createKeyringWithFirstAccount);
220
220
  /**
221
221
  * Instantiate, initialize and return a new keyring of the given `type`,
222
222
  * using the given `opts`. The keyring is built using the keyring builder
@@ -228,12 +228,12 @@ var KeyringController = class extends _basecontroller.BaseController {
228
228
  * @returns The new keyring.
229
229
  * @throws If the keyring includes duplicated accounts.
230
230
  */
231
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _newKeyring);
231
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _newKeyring);
232
232
  /**
233
233
  * Remove all managed keyrings, destroying all their
234
234
  * instances in memory.
235
235
  */
236
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _clearKeyrings);
236
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _clearKeyrings);
237
237
  /**
238
238
  * Restore a Keyring from a provided serialized payload.
239
239
  * On success, returns the resulting keyring instance.
@@ -241,7 +241,7 @@ var KeyringController = class extends _basecontroller.BaseController {
241
241
  * @param serialized - The serialized keyring.
242
242
  * @returns The deserialized keyring or undefined if the keyring type is unsupported.
243
243
  */
244
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _restoreKeyring);
244
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _restoreKeyring);
245
245
  /**
246
246
  * Destroy Keyring
247
247
  *
@@ -251,14 +251,14 @@ var KeyringController = class extends _basecontroller.BaseController {
251
251
  *
252
252
  * @param keyring - The keyring to destroy.
253
253
  */
254
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _destroyKeyring);
254
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _destroyKeyring);
255
255
  /**
256
256
  * Remove empty keyrings.
257
257
  *
258
258
  * Loops through the keyrings and removes the ones with empty accounts
259
259
  * (usually after removing the last / only account) from a keyring.
260
260
  */
261
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _removeEmptyKeyrings);
261
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _removeEmptyKeyrings);
262
262
  /**
263
263
  * Checks for duplicate keypairs, using the the first account in the given
264
264
  * array. Rejects if a duplicate is found.
@@ -269,14 +269,14 @@ var KeyringController = class extends _basecontroller.BaseController {
269
269
  * @param newAccountArray - Array of new accounts.
270
270
  * @returns The account, if no duplicate is found.
271
271
  */
272
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _checkForDuplicate);
272
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _checkForDuplicate);
273
273
  /**
274
274
  * Set the `isUnlocked` to true and notify listeners
275
275
  * through the messenger.
276
276
  *
277
277
  * @fires KeyringController:unlock
278
278
  */
279
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _setUnlocked);
279
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _setUnlocked);
280
280
  /**
281
281
  * Execute the given function after acquiring the controller lock
282
282
  * and save the keyrings to state after it, or rollback to their
@@ -285,7 +285,7 @@ var KeyringController = class extends _basecontroller.BaseController {
285
285
  * @param fn - The function to execute.
286
286
  * @returns The result of the function.
287
287
  */
288
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _persistOrRollback);
288
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _persistOrRollback);
289
289
  /**
290
290
  * Execute the given function after acquiring the controller lock
291
291
  * and rollback keyrings and password states in case of error.
@@ -293,13 +293,13 @@ var KeyringController = class extends _basecontroller.BaseController {
293
293
  * @param fn - The function to execute atomically.
294
294
  * @returns The result of the function.
295
295
  */
296
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _withRollback);
296
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _withRollback);
297
297
  /**
298
298
  * Assert that the controller mutex is locked.
299
299
  *
300
300
  * @throws If the controller mutex is not locked.
301
301
  */
302
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _assertControllerMutexIsLocked);
302
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _assertControllerMutexIsLocked);
303
303
  /**
304
304
  * Lock the controller mutex before executing the given function,
305
305
  * and release it after the function is resolved or after an
@@ -312,7 +312,7 @@ var KeyringController = class extends _basecontroller.BaseController {
312
312
  * @param fn - The function to execute while the controller mutex is locked.
313
313
  * @returns The result of the function.
314
314
  */
315
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _withControllerLock);
315
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _withControllerLock);
316
316
  /**
317
317
  * Lock the vault mutex before executing the given function,
318
318
  * and release it after the function is resolved or after an
@@ -324,25 +324,25 @@ var KeyringController = class extends _basecontroller.BaseController {
324
324
  * @param fn - The function to execute while the vault mutex is locked.
325
325
  * @returns The result of the function.
326
326
  */
327
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _withVaultLock);
328
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _controllerOperationMutex, new (0, _asyncmutex.Mutex)());
329
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _vaultOperationMutex, new (0, _asyncmutex.Mutex)());
330
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _keyringBuilders, void 0);
331
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _keyrings, void 0);
332
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _unsupportedKeyrings, void 0);
333
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _password, void 0);
334
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _encryptor, void 0);
335
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _cacheEncryptionKey, void 0);
336
- _chunkQDPHKQONjs.__privateAdd.call(void 0, this, _qrKeyringStateListener, void 0);
337
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _keyringBuilders, keyringBuilders ? defaultKeyringBuilders.concat(keyringBuilders) : defaultKeyringBuilders);
338
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _encryptor, encryptor);
339
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _keyrings, []);
340
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _unsupportedKeyrings, []);
341
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _cacheEncryptionKey, Boolean(options.cacheEncryptionKey));
342
- if (_chunkQDPHKQONjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
327
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _withVaultLock);
328
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _controllerOperationMutex, new (0, _asyncmutex.Mutex)());
329
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _vaultOperationMutex, new (0, _asyncmutex.Mutex)());
330
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _keyringBuilders, void 0);
331
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _keyrings, void 0);
332
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _unsupportedKeyrings, void 0);
333
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _password, void 0);
334
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _encryptor, void 0);
335
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _cacheEncryptionKey, void 0);
336
+ _chunkZGV2QNCGjs.__privateAdd.call(void 0, this, _qrKeyringStateListener, void 0);
337
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyringBuilders, keyringBuilders ? defaultKeyringBuilders.concat(keyringBuilders) : defaultKeyringBuilders);
338
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _encryptor, encryptor);
339
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, []);
340
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _unsupportedKeyrings, []);
341
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _cacheEncryptionKey, Boolean(options.cacheEncryptionKey));
342
+ if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
343
343
  assertIsExportableKeyEncryptor(encryptor);
344
344
  }
345
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
345
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
346
346
  }
347
347
  /**
348
348
  * Adds a new account to the default (first) HD seed phrase keyring.
@@ -352,7 +352,7 @@ var KeyringController = class extends _basecontroller.BaseController {
352
352
  * @returns Promise resolving to the added account address.
353
353
  */
354
354
  async addNewAccount(accountCount) {
355
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
355
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
356
356
  const primaryKeyring = this.getKeyringsByType("HD Key Tree")[0];
357
357
  if (!primaryKeyring) {
358
358
  throw new Error("No HD keyring found");
@@ -381,8 +381,8 @@ var KeyringController = class extends _basecontroller.BaseController {
381
381
  * @returns Promise resolving to the added account address
382
382
  */
383
383
  async addNewAccountForKeyring(keyring, accountCount) {
384
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
385
- const oldAccounts = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
384
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
385
+ const oldAccounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
386
386
  if (accountCount && oldAccounts.length !== accountCount) {
387
387
  if (accountCount > oldAccounts.length) {
388
388
  throw new Error("Account out of sequence");
@@ -392,7 +392,7 @@ var KeyringController = class extends _basecontroller.BaseController {
392
392
  return existingAccount;
393
393
  }
394
394
  await keyring.addAccounts(1);
395
- const addedAccountAddress = (await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this)).find(
395
+ const addedAccountAddress = (await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this)).find(
396
396
  (selectedAddress) => !oldAccounts.includes(selectedAddress)
397
397
  );
398
398
  _utils.assertIsStrictHexString.call(void 0, addedAccountAddress);
@@ -405,7 +405,7 @@ var KeyringController = class extends _basecontroller.BaseController {
405
405
  * @returns Promise resolving to the added account address.
406
406
  */
407
407
  async addNewAccountWithoutUpdate() {
408
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
408
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
409
409
  const primaryKeyring = this.getKeyringsByType("HD Key Tree")[0];
410
410
  if (!primaryKeyring) {
411
411
  throw new Error("No HD keyring found");
@@ -425,11 +425,11 @@ var KeyringController = class extends _basecontroller.BaseController {
425
425
  * @returns Promise resolving when the operation ends successfully.
426
426
  */
427
427
  async createNewVaultAndRestore(password, seed) {
428
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
428
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
429
429
  if (!password || !password.length) {
430
430
  throw new Error("Invalid password");
431
431
  }
432
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
432
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
433
433
  type: "HD Key Tree" /* hd */,
434
434
  opts: {
435
435
  mnemonic: seed,
@@ -445,10 +445,10 @@ var KeyringController = class extends _basecontroller.BaseController {
445
445
  * @returns Promise resolving when the operation ends successfully.
446
446
  */
447
447
  async createNewVaultAndKeychain(password) {
448
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
449
- const accounts = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
448
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
449
+ const accounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
450
450
  if (!accounts.length) {
451
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
451
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _createNewVaultWithKeyring, createNewVaultWithKeyring_fn).call(this, password, {
452
452
  type: "HD Key Tree" /* hd */
453
453
  });
454
454
  }
@@ -466,7 +466,7 @@ var KeyringController = class extends _basecontroller.BaseController {
466
466
  if (type === "QR Hardware Wallet Device" /* qr */) {
467
467
  return this.getOrAddQRKeyring();
468
468
  }
469
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts));
469
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts));
470
470
  }
471
471
  /**
472
472
  * Method to verify a given password validity. Throws an
@@ -478,7 +478,7 @@ var KeyringController = class extends _basecontroller.BaseController {
478
478
  if (!this.state.vault) {
479
479
  throw new Error("KeyringController - Cannot unlock without a previous vault." /* VaultError */);
480
480
  }
481
- await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, this.state.vault);
481
+ await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, this.state.vault);
482
482
  }
483
483
  /**
484
484
  * Returns the status of the vault.
@@ -496,8 +496,8 @@ var KeyringController = class extends _basecontroller.BaseController {
496
496
  */
497
497
  async exportSeedPhrase(password) {
498
498
  await this.verifyPassword(password);
499
- assertHasUint8ArrayMnemonic(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings)[0]);
500
- return _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings)[0].mnemonic;
499
+ assertHasUint8ArrayMnemonic(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings)[0]);
500
+ return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings)[0].mnemonic;
501
501
  }
502
502
  /**
503
503
  * Gets the private key from the keyring controlling an address.
@@ -569,14 +569,14 @@ var KeyringController = class extends _basecontroller.BaseController {
569
569
  *
570
570
  * @deprecated Use of this method is discouraged as actions executed directly on
571
571
  * keyrings are not being reflected in the KeyringController state and not
572
- * persisted in the vault.
572
+ * persisted in the vault. Use `withKeyring` instead.
573
573
  * @param account - An account address.
574
574
  * @returns Promise resolving to keyring of the `account` if one exists.
575
575
  */
576
576
  async getKeyringForAccount(account) {
577
577
  const hexed = _ethsigutil.normalize.call(void 0, account);
578
578
  const candidates = await Promise.all(
579
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
579
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
580
580
  return Promise.all([keyring, keyring.getAccounts()]);
581
581
  })
582
582
  );
@@ -604,21 +604,22 @@ var KeyringController = class extends _basecontroller.BaseController {
604
604
  *
605
605
  * @deprecated Use of this method is discouraged as actions executed directly on
606
606
  * keyrings are not being reflected in the KeyringController state and not
607
- * persisted in the vault.
607
+ * persisted in the vault. Use `withKeyring` instead.
608
608
  * @param type - Keyring type name.
609
609
  * @returns An array of keyrings of the given type.
610
610
  */
611
611
  getKeyringsByType(type) {
612
- return _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings).filter((keyring) => keyring.type === type);
612
+ return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).filter((keyring) => keyring.type === type);
613
613
  }
614
614
  /**
615
615
  * Persist all serialized keyrings in the vault.
616
616
  *
617
+ * @deprecated This method is being phased out in favor of `withKeyring`.
617
618
  * @returns Promise resolving with `true` value when the
618
619
  * operation completes.
619
620
  */
620
621
  async persistAllKeyrings() {
621
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => true);
622
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => true);
622
623
  }
623
624
  /**
624
625
  * Imports an account with the specified import strategy.
@@ -629,7 +630,7 @@ var KeyringController = class extends _basecontroller.BaseController {
629
630
  * @returns Promise resolving to the imported account address.
630
631
  */
631
632
  async importAccountWithStrategy(strategy, args) {
632
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
633
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
633
634
  let privateKey;
634
635
  switch (strategy) {
635
636
  case "privateKey":
@@ -663,7 +664,7 @@ var KeyringController = class extends _basecontroller.BaseController {
663
664
  default:
664
665
  throw new Error(`Unexpected import strategy: '${strategy}'`);
665
666
  }
666
- const newKeyring = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "Simple Key Pair" /* simple */, [
667
+ const newKeyring = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "Simple Key Pair" /* simple */, [
667
668
  privateKey
668
669
  ]);
669
670
  const accounts = await newKeyring.getAccounts();
@@ -678,7 +679,7 @@ var KeyringController = class extends _basecontroller.BaseController {
678
679
  * @returns Promise resolving when the account is removed.
679
680
  */
680
681
  async removeAccount(address) {
681
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
682
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
682
683
  const keyring = await this.getKeyringForAccount(
683
684
  address
684
685
  );
@@ -688,7 +689,7 @@ var KeyringController = class extends _basecontroller.BaseController {
688
689
  await keyring.removeAccount(address);
689
690
  const accounts = await keyring.getAccounts();
690
691
  if (accounts.length === 0) {
691
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _removeEmptyKeyrings, removeEmptyKeyrings_fn).call(this);
692
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _removeEmptyKeyrings, removeEmptyKeyrings_fn).call(this);
692
693
  }
693
694
  });
694
695
  this.messagingSystem.publish(`${name}:accountRemoved`, address);
@@ -699,10 +700,10 @@ var KeyringController = class extends _basecontroller.BaseController {
699
700
  * @returns Promise resolving when the operation completes.
700
701
  */
701
702
  async setLocked() {
702
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
703
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _unsubscribeFromQRKeyringsEvents, unsubscribeFromQRKeyringsEvents_fn).call(this);
704
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _password, void 0);
705
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
703
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
704
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _unsubscribeFromQRKeyringsEvents, unsubscribeFromQRKeyringsEvents_fn).call(this);
705
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, void 0);
706
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
706
707
  this.update((state) => {
707
708
  state.isUnlocked = false;
708
709
  state.keyrings = [];
@@ -865,9 +866,9 @@ var KeyringController = class extends _basecontroller.BaseController {
865
866
  * @returns Promise resolving when the operation completes.
866
867
  */
867
868
  async submitEncryptionKey(encryptionKey, encryptionSalt) {
868
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
869
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _keyrings, await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, void 0, encryptionKey, encryptionSalt));
870
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
869
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
870
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, void 0, encryptionKey, encryptionSalt));
871
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
871
872
  });
872
873
  }
873
874
  /**
@@ -878,9 +879,9 @@ var KeyringController = class extends _basecontroller.BaseController {
878
879
  * @returns Promise resolving when the operation completes.
879
880
  */
880
881
  async submitPassword(password) {
881
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
882
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _keyrings, await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, password));
883
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
882
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async () => {
883
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _unlockKeyrings, unlockKeyrings_fn).call(this, password));
884
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
884
885
  });
885
886
  }
886
887
  /**
@@ -899,7 +900,7 @@ var KeyringController = class extends _basecontroller.BaseController {
899
900
  if (accounts.length === 0) {
900
901
  throw new Error("Cannot verify an empty keyring.");
901
902
  }
902
- const hdKeyringBuilder = _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, "HD Key Tree" /* hd */);
903
+ const hdKeyringBuilder = _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, "HD Key Tree" /* hd */);
903
904
  const hdKeyring = hdKeyringBuilder();
904
905
  await hdKeyring.deserialize({
905
906
  mnemonic: seedWords,
@@ -916,6 +917,29 @@ var KeyringController = class extends _basecontroller.BaseController {
916
917
  });
917
918
  return seedWords;
918
919
  }
920
+ async withKeyring(selector, operation, options = {
921
+ createIfMissing: false
922
+ }) {
923
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
924
+ let keyring;
925
+ if ("address" in selector) {
926
+ keyring = await this.getKeyringForAccount(selector.address);
927
+ } else {
928
+ keyring = this.getKeyringsByType(selector.type)[selector.index || 0];
929
+ if (!keyring && options.createIfMissing) {
930
+ keyring = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, selector.type, options.createWithData);
931
+ }
932
+ }
933
+ if (!keyring) {
934
+ throw new Error("KeyringController - Keyring not found." /* KeyringNotFound */);
935
+ }
936
+ const result = await operation(keyring);
937
+ if (Object.is(result, keyring)) {
938
+ throw new Error("KeyringController - Returning keyring instances is unsafe" /* UnsafeDirectKeyringAccess */);
939
+ }
940
+ return result;
941
+ });
942
+ }
919
943
  // QR Hardware related methods
920
944
  /**
921
945
  * Get QR Hardware keyring.
@@ -931,13 +955,13 @@ var KeyringController = class extends _basecontroller.BaseController {
931
955
  * @returns The added keyring
932
956
  */
933
957
  async getOrAddQRKeyring() {
934
- return this.getQRKeyring() || await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this));
958
+ return this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this));
935
959
  }
936
960
  // TODO: Replace `any` with type
937
961
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
938
962
  async restoreQRKeyring(serialized) {
939
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
940
- const keyring = this.getQRKeyring() || await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
963
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
964
+ const keyring = this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
941
965
  keyring.deserialize(serialized);
942
966
  });
943
967
  }
@@ -966,9 +990,9 @@ var KeyringController = class extends _basecontroller.BaseController {
966
990
  (await this.getOrAddQRKeyring()).cancelSync();
967
991
  }
968
992
  async connectQRHardware(page) {
969
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
993
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
970
994
  try {
971
- const keyring = this.getQRKeyring() || await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
995
+ const keyring = this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
972
996
  let accounts;
973
997
  switch (page) {
974
998
  case -1:
@@ -992,8 +1016,8 @@ var KeyringController = class extends _basecontroller.BaseController {
992
1016
  });
993
1017
  }
994
1018
  async unlockQRHardwareWalletAccount(index) {
995
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
996
- const keyring = this.getQRKeyring() || await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
1019
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1020
+ const keyring = this.getQRKeyring() || await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _addQRKeyring, addQRKeyring_fn).call(this);
997
1021
  keyring.setAccountToUnlock(index);
998
1022
  await keyring.addAccounts(1);
999
1023
  });
@@ -1005,14 +1029,14 @@ var KeyringController = class extends _basecontroller.BaseController {
1005
1029
  return keyring.type;
1006
1030
  }
1007
1031
  async forgetQRDevice() {
1008
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1032
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _persistOrRollback, persistOrRollback_fn).call(this, async () => {
1009
1033
  const keyring = this.getQRKeyring();
1010
1034
  if (!keyring) {
1011
1035
  return { removedAccounts: [], remainingAccounts: [] };
1012
1036
  }
1013
- const allAccounts = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1037
+ const allAccounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1014
1038
  keyring.forgetDevice();
1015
- const remainingAccounts = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1039
+ const remainingAccounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1016
1040
  const removedAccounts = allAccounts.filter(
1017
1041
  (address) => !remainingAccounts.includes(address)
1018
1042
  );
@@ -1082,23 +1106,23 @@ registerMessageHandlers_fn = function() {
1082
1106
  };
1083
1107
  _getKeyringBuilderForType = new WeakSet();
1084
1108
  getKeyringBuilderForType_fn = function(type) {
1085
- return _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyringBuilders).find(
1109
+ return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyringBuilders).find(
1086
1110
  (keyringBuilder) => keyringBuilder.type === type
1087
1111
  );
1088
1112
  };
1089
1113
  _addQRKeyring = new WeakSet();
1090
1114
  addQRKeyring_fn = async function() {
1091
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1092
- return await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */, {
1115
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1116
+ return await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, "QR Hardware Wallet Device" /* qr */, {
1093
1117
  accounts: []
1094
1118
  });
1095
1119
  };
1096
1120
  _subscribeToQRKeyringEvents = new WeakSet();
1097
1121
  subscribeToQRKeyringEvents_fn = function(qrKeyring) {
1098
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _qrKeyringStateListener, (state) => {
1122
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _qrKeyringStateListener, (state) => {
1099
1123
  this.messagingSystem.publish(`${name}:qrKeyringStateChange`, state);
1100
1124
  });
1101
- qrKeyring.getMemStore().subscribe(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1125
+ qrKeyring.getMemStore().subscribe(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1102
1126
  };
1103
1127
  _unsubscribeFromQRKeyringsEvents = new WeakSet();
1104
1128
  unsubscribeFromQRKeyringsEvents_fn = function() {
@@ -1106,32 +1130,32 @@ unsubscribeFromQRKeyringsEvents_fn = function() {
1106
1130
  "QR Hardware Wallet Device" /* qr */
1107
1131
  );
1108
1132
  qrKeyrings.forEach((qrKeyring) => {
1109
- if (_chunkQDPHKQONjs.__privateGet.call(void 0, this, _qrKeyringStateListener)) {
1110
- qrKeyring.getMemStore().unsubscribe(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1133
+ if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _qrKeyringStateListener)) {
1134
+ qrKeyring.getMemStore().unsubscribe(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _qrKeyringStateListener));
1111
1135
  }
1112
1136
  });
1113
1137
  };
1114
1138
  _createNewVaultWithKeyring = new WeakSet();
1115
1139
  createNewVaultWithKeyring_fn = async function(password, keyring) {
1116
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1140
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1117
1141
  if (typeof password !== "string") {
1118
1142
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1119
1143
  }
1120
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _password, password);
1121
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1122
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _createKeyringWithFirstAccount, createKeyringWithFirstAccount_fn).call(this, keyring.type, keyring.opts);
1123
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
1144
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, password);
1145
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1146
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _createKeyringWithFirstAccount, createKeyringWithFirstAccount_fn).call(this, keyring.type, keyring.opts);
1147
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _setUnlocked, setUnlocked_fn).call(this);
1124
1148
  };
1125
1149
  _getUpdatedKeyrings = new WeakSet();
1126
1150
  getUpdatedKeyrings_fn = async function() {
1127
- return Promise.all(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings).map(displayForKeyring));
1151
+ return Promise.all(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(displayForKeyring));
1128
1152
  };
1129
1153
  _getSerializedKeyrings = new WeakSet();
1130
1154
  getSerializedKeyrings_fn = async function({ includeUnsupported } = {
1131
1155
  includeUnsupported: true
1132
1156
  }) {
1133
1157
  const serializedKeyrings = await Promise.all(
1134
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1158
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1135
1159
  const [type, data] = await Promise.all([
1136
1160
  keyring.type,
1137
1161
  keyring.serialize()
@@ -1140,35 +1164,35 @@ getSerializedKeyrings_fn = async function({ includeUnsupported } = {
1140
1164
  })
1141
1165
  );
1142
1166
  if (includeUnsupported) {
1143
- serializedKeyrings.push(..._chunkQDPHKQONjs.__privateGet.call(void 0, this, _unsupportedKeyrings));
1167
+ serializedKeyrings.push(..._chunkZGV2QNCGjs.__privateGet.call(void 0, this, _unsupportedKeyrings));
1144
1168
  }
1145
1169
  return serializedKeyrings;
1146
1170
  };
1147
1171
  _restoreSerializedKeyrings = new WeakSet();
1148
1172
  restoreSerializedKeyrings_fn = async function(serializedKeyrings) {
1149
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1173
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _clearKeyrings, clearKeyrings_fn).call(this);
1150
1174
  for (const serializedKeyring of serializedKeyrings) {
1151
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _restoreKeyring, restoreKeyring_fn).call(this, serializedKeyring);
1175
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _restoreKeyring, restoreKeyring_fn).call(this, serializedKeyring);
1152
1176
  }
1153
1177
  };
1154
1178
  _unlockKeyrings = new WeakSet();
1155
1179
  unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1156
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async ({ releaseLock }) => {
1180
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async ({ releaseLock }) => {
1157
1181
  const encryptedVault = this.state.vault;
1158
1182
  if (!encryptedVault) {
1159
1183
  throw new Error("KeyringController - Cannot unlock without a previous vault." /* VaultError */);
1160
1184
  }
1161
1185
  let vault;
1162
1186
  const updatedState = {};
1163
- if (_chunkQDPHKQONjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1164
- assertIsExportableKeyEncryptor(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor));
1187
+ if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1188
+ assertIsExportableKeyEncryptor(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor));
1165
1189
  if (password) {
1166
- const result = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).decryptWithDetail(
1190
+ const result = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decryptWithDetail(
1167
1191
  password,
1168
1192
  encryptedVault
1169
1193
  );
1170
1194
  vault = result.vault;
1171
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _password, password);
1195
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, password);
1172
1196
  updatedState.encryptionKey = result.exportedKeyString;
1173
1197
  updatedState.encryptionSalt = result.salt;
1174
1198
  } else {
@@ -1179,8 +1203,8 @@ unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1179
1203
  if (typeof encryptionKey !== "string") {
1180
1204
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1181
1205
  }
1182
- const key = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1183
- vault = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).decryptWithKey(
1206
+ const key = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1207
+ vault = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decryptWithKey(
1184
1208
  key,
1185
1209
  parsedEncryptedVault
1186
1210
  );
@@ -1191,14 +1215,14 @@ unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1191
1215
  if (typeof password !== "string") {
1192
1216
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1193
1217
  }
1194
- vault = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, encryptedVault);
1195
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _password, password);
1218
+ vault = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).decrypt(password, encryptedVault);
1219
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, password);
1196
1220
  }
1197
1221
  if (!isSerializedKeyringsArray(vault)) {
1198
1222
  throw new Error("KeyringController - The decrypted vault has an unexpected shape." /* VaultDataError */);
1199
1223
  }
1200
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, vault);
1201
- const updatedKeyrings = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1224
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, vault);
1225
+ const updatedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1202
1226
  this.update((state) => {
1203
1227
  state.keyrings = updatedKeyrings;
1204
1228
  if (updatedState.encryptionKey || updatedState.encryptionSalt) {
@@ -1206,56 +1230,56 @@ unlockKeyrings_fn = async function(password, encryptionKey, encryptionSalt) {
1206
1230
  state.encryptionSalt = updatedState.encryptionSalt;
1207
1231
  }
1208
1232
  });
1209
- if (_chunkQDPHKQONjs.__privateGet.call(void 0, this, _password) && (!_chunkQDPHKQONjs.__privateGet.call(void 0, this, _cacheEncryptionKey) || !encryptionKey) && _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated && !_chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated(encryptedVault)) {
1233
+ if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password) && (!_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey) || !encryptionKey) && _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated && !_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).isVaultUpdated(encryptedVault)) {
1210
1234
  releaseLock();
1211
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1235
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1212
1236
  }
1213
- return _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings);
1237
+ return _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings);
1214
1238
  });
1215
1239
  };
1216
1240
  _updateVault = new WeakSet();
1217
1241
  updateVault_fn = function() {
1218
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async () => {
1242
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withVaultLock, withVaultLock_fn).call(this, async () => {
1219
1243
  const { encryptionKey, encryptionSalt } = this.state;
1220
- if (!_chunkQDPHKQONjs.__privateGet.call(void 0, this, _password) && !encryptionKey) {
1244
+ if (!_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password) && !encryptionKey) {
1221
1245
  throw new Error("KeyringController - Cannot persist vault without password and encryption key" /* MissingCredentials */);
1222
1246
  }
1223
- const serializedKeyrings = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1247
+ const serializedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1224
1248
  if (!serializedKeyrings.some((keyring) => keyring.type === "HD Key Tree" /* hd */)) {
1225
1249
  throw new Error("KeyringController - No HD Keyring found" /* NoHdKeyring */);
1226
1250
  }
1227
1251
  const updatedState = {};
1228
- if (_chunkQDPHKQONjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1229
- assertIsExportableKeyEncryptor(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor));
1252
+ if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _cacheEncryptionKey)) {
1253
+ assertIsExportableKeyEncryptor(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor));
1230
1254
  if (encryptionKey) {
1231
- const key = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1232
- const vaultJSON = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).encryptWithKey(
1255
+ const key = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).importKey(encryptionKey);
1256
+ const vaultJSON = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).encryptWithKey(
1233
1257
  key,
1234
1258
  serializedKeyrings
1235
1259
  );
1236
1260
  vaultJSON.salt = encryptionSalt;
1237
1261
  updatedState.vault = JSON.stringify(vaultJSON);
1238
- } else if (_chunkQDPHKQONjs.__privateGet.call(void 0, this, _password)) {
1239
- const { vault: newVault, exportedKeyString } = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).encryptWithDetail(
1240
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _password),
1262
+ } else if (_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password)) {
1263
+ const { vault: newVault, exportedKeyString } = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).encryptWithDetail(
1264
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password),
1241
1265
  serializedKeyrings
1242
1266
  );
1243
1267
  updatedState.vault = newVault;
1244
1268
  updatedState.encryptionKey = exportedKeyString;
1245
1269
  }
1246
1270
  } else {
1247
- if (typeof _chunkQDPHKQONjs.__privateGet.call(void 0, this, _password) !== "string") {
1271
+ if (typeof _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password) !== "string") {
1248
1272
  throw new TypeError("KeyringController - Password must be of type string." /* WrongPasswordType */);
1249
1273
  }
1250
- updatedState.vault = await _chunkQDPHKQONjs.__privateGet.call(void 0, this, _encryptor).encrypt(
1251
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _password),
1274
+ updatedState.vault = await _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _encryptor).encrypt(
1275
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password),
1252
1276
  serializedKeyrings
1253
1277
  );
1254
1278
  }
1255
1279
  if (!updatedState.vault) {
1256
1280
  throw new Error("KeyringController - Cannot persist vault without vault information" /* MissingVaultData */);
1257
1281
  }
1258
- const updatedKeyrings = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1282
+ const updatedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getUpdatedKeyrings, getUpdatedKeyrings_fn).call(this);
1259
1283
  this.update((state) => {
1260
1284
  state.vault = updatedState.vault;
1261
1285
  state.keyrings = updatedKeyrings;
@@ -1269,7 +1293,7 @@ updateVault_fn = function() {
1269
1293
  };
1270
1294
  _getAccountsFromKeyrings = new WeakSet();
1271
1295
  getAccountsFromKeyrings_fn = async function() {
1272
- const keyrings = _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings);
1296
+ const keyrings = _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings);
1273
1297
  const keyringArrays = await Promise.all(
1274
1298
  keyrings.map(async (keyring) => keyring.getAccounts())
1275
1299
  );
@@ -1280,8 +1304,8 @@ getAccountsFromKeyrings_fn = async function() {
1280
1304
  };
1281
1305
  _createKeyringWithFirstAccount = new WeakSet();
1282
1306
  createKeyringWithFirstAccount_fn = async function(type, opts) {
1283
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1284
- const keyring = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts);
1307
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1308
+ const keyring = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, opts);
1285
1309
  const [firstAccount] = await keyring.getAccounts();
1286
1310
  if (!firstAccount) {
1287
1311
  throw new Error("KeyringController - First Account not found." /* NoFirstAccount */);
@@ -1289,8 +1313,8 @@ createKeyringWithFirstAccount_fn = async function(type, opts) {
1289
1313
  };
1290
1314
  _newKeyring = new WeakSet();
1291
1315
  newKeyring_fn = async function(type, data) {
1292
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1293
- const keyringBuilder = _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, type);
1316
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1317
+ const keyringBuilder = _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getKeyringBuilderForType, getKeyringBuilderForType_fn).call(this, type);
1294
1318
  if (!keyringBuilder) {
1295
1319
  throw new Error(
1296
1320
  `${"KeyringController - No keyringBuilder found for keyring" /* NoKeyringBuilder */}. Keyring type: ${type}`
@@ -1310,29 +1334,29 @@ newKeyring_fn = async function(type, data) {
1310
1334
  keyring.generateRandomMnemonic();
1311
1335
  await keyring.addAccounts(1);
1312
1336
  }
1313
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _checkForDuplicate, checkForDuplicate_fn).call(this, type, await keyring.getAccounts());
1337
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _checkForDuplicate, checkForDuplicate_fn).call(this, type, await keyring.getAccounts());
1314
1338
  if (type === "QR Hardware Wallet Device" /* qr */) {
1315
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _subscribeToQRKeyringEvents, subscribeToQRKeyringEvents_fn).call(this, keyring);
1339
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _subscribeToQRKeyringEvents, subscribeToQRKeyringEvents_fn).call(this, keyring);
1316
1340
  }
1317
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings).push(keyring);
1341
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).push(keyring);
1318
1342
  return keyring;
1319
1343
  };
1320
1344
  _clearKeyrings = new WeakSet();
1321
1345
  clearKeyrings_fn = async function() {
1322
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1323
- for (const keyring of _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings)) {
1324
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1346
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1347
+ for (const keyring of _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings)) {
1348
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1325
1349
  }
1326
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _keyrings, []);
1350
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, []);
1327
1351
  };
1328
1352
  _restoreKeyring = new WeakSet();
1329
1353
  restoreKeyring_fn = async function(serialized) {
1330
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1354
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1331
1355
  try {
1332
1356
  const { type, data } = serialized;
1333
- return await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, data);
1357
+ return await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _newKeyring, newKeyring_fn).call(this, type, data);
1334
1358
  } catch (_) {
1335
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _unsupportedKeyrings).push(serialized);
1359
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _unsupportedKeyrings).push(serialized);
1336
1360
  return void 0;
1337
1361
  }
1338
1362
  };
@@ -1342,23 +1366,23 @@ destroyKeyring_fn = async function(keyring) {
1342
1366
  };
1343
1367
  _removeEmptyKeyrings = new WeakSet();
1344
1368
  removeEmptyKeyrings_fn = async function() {
1345
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1369
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1346
1370
  const validKeyrings = [];
1347
1371
  await Promise.all(
1348
- _chunkQDPHKQONjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1372
+ _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _keyrings).map(async (keyring) => {
1349
1373
  const accounts = await keyring.getAccounts();
1350
1374
  if (accounts.length > 0) {
1351
1375
  validKeyrings.push(keyring);
1352
1376
  } else {
1353
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1377
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _destroyKeyring, destroyKeyring_fn).call(this, keyring);
1354
1378
  }
1355
1379
  })
1356
1380
  );
1357
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _keyrings, validKeyrings);
1381
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _keyrings, validKeyrings);
1358
1382
  };
1359
1383
  _checkForDuplicate = new WeakSet();
1360
1384
  checkForDuplicate_fn = async function(type, newAccountArray) {
1361
- const accounts = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1385
+ const accounts = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getAccountsFromKeyrings, getAccountsFromKeyrings_fn).call(this);
1362
1386
  switch (type) {
1363
1387
  case "Simple Key Pair" /* simple */: {
1364
1388
  const isIncluded = Boolean(
@@ -1378,7 +1402,7 @@ checkForDuplicate_fn = async function(type, newAccountArray) {
1378
1402
  };
1379
1403
  _setUnlocked = new WeakSet();
1380
1404
  setUnlocked_fn = function() {
1381
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1405
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1382
1406
  this.update((state) => {
1383
1407
  state.isUnlocked = true;
1384
1408
  });
@@ -1386,40 +1410,40 @@ setUnlocked_fn = function() {
1386
1410
  };
1387
1411
  _persistOrRollback = new WeakSet();
1388
1412
  persistOrRollback_fn = async function(fn) {
1389
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async ({ releaseLock }) => {
1413
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withRollback, withRollback_fn).call(this, async ({ releaseLock }) => {
1390
1414
  const callbackResult = await fn({ releaseLock });
1391
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1415
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _updateVault, updateVault_fn).call(this);
1392
1416
  return callbackResult;
1393
1417
  });
1394
1418
  };
1395
1419
  _withRollback = new WeakSet();
1396
1420
  withRollback_fn = async function(fn) {
1397
- return _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _withControllerLock, withControllerLock_fn).call(this, async ({ releaseLock }) => {
1398
- const currentSerializedKeyrings = await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1399
- const currentPassword = _chunkQDPHKQONjs.__privateGet.call(void 0, this, _password);
1421
+ return _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _withControllerLock, withControllerLock_fn).call(this, async ({ releaseLock }) => {
1422
+ const currentSerializedKeyrings = await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _getSerializedKeyrings, getSerializedKeyrings_fn).call(this);
1423
+ const currentPassword = _chunkZGV2QNCGjs.__privateGet.call(void 0, this, _password);
1400
1424
  try {
1401
1425
  return await fn({ releaseLock });
1402
1426
  } catch (e) {
1403
- await _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, currentSerializedKeyrings);
1404
- _chunkQDPHKQONjs.__privateSet.call(void 0, this, _password, currentPassword);
1427
+ await _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _restoreSerializedKeyrings, restoreSerializedKeyrings_fn).call(this, currentSerializedKeyrings);
1428
+ _chunkZGV2QNCGjs.__privateSet.call(void 0, this, _password, currentPassword);
1405
1429
  throw e;
1406
1430
  }
1407
1431
  });
1408
1432
  };
1409
1433
  _assertControllerMutexIsLocked = new WeakSet();
1410
1434
  assertControllerMutexIsLocked_fn = function() {
1411
- if (!_chunkQDPHKQONjs.__privateGet.call(void 0, this, _controllerOperationMutex).isLocked()) {
1435
+ if (!_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _controllerOperationMutex).isLocked()) {
1412
1436
  throw new Error("KeyringController - attempt to update vault during a non mutually exclusive operation" /* ControllerLockRequired */);
1413
1437
  }
1414
1438
  };
1415
1439
  _withControllerLock = new WeakSet();
1416
1440
  withControllerLock_fn = async function(fn) {
1417
- return withLock(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _controllerOperationMutex), fn);
1441
+ return withLock(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _controllerOperationMutex), fn);
1418
1442
  };
1419
1443
  _withVaultLock = new WeakSet();
1420
1444
  withVaultLock_fn = async function(fn) {
1421
- _chunkQDPHKQONjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1422
- return withLock(_chunkQDPHKQONjs.__privateGet.call(void 0, this, _vaultOperationMutex), fn);
1445
+ _chunkZGV2QNCGjs.__privateMethod.call(void 0, this, _assertControllerMutexIsLocked, assertControllerMutexIsLocked_fn).call(this);
1446
+ return withLock(_chunkZGV2QNCGjs.__privateGet.call(void 0, this, _vaultOperationMutex), fn);
1423
1447
  };
1424
1448
  async function withLock(mutex, fn) {
1425
1449
  const releaseLock = await mutex.acquire();
@@ -1441,4 +1465,4 @@ var KeyringController_default = KeyringController;
1441
1465
 
1442
1466
 
1443
1467
  exports.KeyringTypes = KeyringTypes; exports.isCustodyKeyring = isCustodyKeyring; exports.AccountImportStrategy = AccountImportStrategy; exports.SignTypedDataVersion = SignTypedDataVersion; exports.keyringBuilderFactory = keyringBuilderFactory; exports.getDefaultKeyringState = getDefaultKeyringState; exports.KeyringController = KeyringController; exports.KeyringController_default = KeyringController_default;
1444
- //# sourceMappingURL=chunk-H4OUA6YG.js.map
1468
+ //# sourceMappingURL=chunk-2GJQ6KDW.js.map