@metamask-previews/keyring-controller 21.0.4-preview-f603e07 → 21.0.4-preview-dd4e5c6
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 +0 -1
- package/dist/KeyringController.cjs +1 -10
- package/dist/KeyringController.cjs.map +1 -1
- package/dist/KeyringController.d.cts.map +1 -1
- package/dist/KeyringController.d.mts.map +1 -1
- package/dist/KeyringController.mjs +2 -11
- package/dist/KeyringController.mjs.map +1 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
11
|
|
|
12
|
-
- Don't emit `:stateChange` from `withKeyring` unnecessarily ([#5732](https://github.com/MetaMask/core/pull/5732))
|
|
13
12
|
- Bump `@metamask/base-controller` from ^8.0.0 to ^8.0.1 ([#5722](https://github.com/MetaMask/core/pull/5722))
|
|
14
13
|
|
|
15
14
|
## [21.0.4]
|
|
@@ -49,7 +49,6 @@ 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
51
|
// When generating a ULID within the same millisecond, monotonicFactory provides some guarantees regarding sort order.
|
|
52
|
-
const lodash_1 = require("lodash");
|
|
53
52
|
const ulid_1 = require("ulid");
|
|
54
53
|
const constants_1 = require("./constants.cjs");
|
|
55
54
|
const name = 'KeyringController';
|
|
@@ -894,9 +893,8 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
894
893
|
createIfMissing: false,
|
|
895
894
|
}) {
|
|
896
895
|
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
897
|
-
return __classPrivateFieldGet(this, _KeyringController_instances, "m",
|
|
896
|
+
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
|
|
898
897
|
let keyring;
|
|
899
|
-
let forceUpdate = false;
|
|
900
898
|
if ('address' in selector) {
|
|
901
899
|
keyring = (await this.getKeyringForAccount(selector.address));
|
|
902
900
|
}
|
|
@@ -904,8 +902,6 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
904
902
|
keyring = this.getKeyringsByType(selector.type)[selector.index || 0];
|
|
905
903
|
if (!keyring && options.createIfMissing) {
|
|
906
904
|
keyring = (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, selector.type, options.createWithData));
|
|
907
|
-
// This is a new keyring, so we force the vault update in that case.
|
|
908
|
-
forceUpdate = true;
|
|
909
905
|
}
|
|
910
906
|
}
|
|
911
907
|
else if ('id' in selector) {
|
|
@@ -914,7 +910,6 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
914
910
|
if (!keyring) {
|
|
915
911
|
throw new Error(constants_1.KeyringControllerError.KeyringNotFound);
|
|
916
912
|
}
|
|
917
|
-
const oldKeyringState = await keyring.serialize();
|
|
918
913
|
const result = await operation({
|
|
919
914
|
keyring,
|
|
920
915
|
metadata: __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringMetadata).call(this, keyring),
|
|
@@ -926,10 +921,6 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
926
921
|
// as a way to get a reference to a keyring instance.
|
|
927
922
|
throw new Error(constants_1.KeyringControllerError.UnsafeDirectKeyringAccess);
|
|
928
923
|
}
|
|
929
|
-
if (forceUpdate || !(0, lodash_1.isEqual)(oldKeyringState, await keyring.serialize())) {
|
|
930
|
-
// Keyring has been updated, we need to update the vault.
|
|
931
|
-
await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_updateVault).call(this);
|
|
932
|
-
}
|
|
933
924
|
return result;
|
|
934
925
|
});
|
|
935
926
|
}
|