@metamask/snaps-controllers 3.1.0 → 3.1.1

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
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.1.1]
10
+ ### Fixed
11
+ - Fix a few issues with allowlist version resolving ([#1888](https://github.com/MetaMask/snaps/pull/1888))
12
+
9
13
  ## [3.1.0]
10
14
  ### Added
11
15
  - Add static file API ([#1836](https://github.com/MetaMask/snaps/pull/1836))
@@ -90,7 +94,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
90
94
  - The version of the package no longer needs to match the version of all other
91
95
  MetaMask Snaps packages.
92
96
 
93
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@3.1.0...HEAD
97
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@3.1.1...HEAD
98
+ [3.1.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@3.1.0...@metamask/snaps-controllers@3.1.1
94
99
  [3.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@3.0.0...@metamask/snaps-controllers@3.1.0
95
100
  [3.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@2.0.2...@metamask/snaps-controllers@3.0.0
96
101
  [2.0.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-controllers@2.0.1...@metamask/snaps-controllers@2.0.2
@@ -597,16 +597,15 @@ class SnapController extends _basecontroller.BaseControllerV2 {
597
597
  try {
598
598
  for (const [snapId, { version: rawVersion }] of Object.entries(requestedSnaps)){
599
599
  (0, _snapsutils.assertIsValidSnapId)(snapId);
600
- const [error, resolvedVersion] = (0, _snapsutils.resolveVersionRange)(rawVersion);
600
+ const [error, version] = (0, _snapsutils.resolveVersionRange)(rawVersion);
601
601
  if (error) {
602
602
  throw _rpcerrors.rpcErrors.invalidParams(`The "version" field must be a valid SemVer version range if specified. Received: "${rawVersion}".`);
603
603
  }
604
- // If we are running in allowlist mode, try to match the version with an allowlist version.
605
- const version = _class_private_field_get(this, _featureFlags).requireAllowlist ? await _class_private_method_get(this, _resolveAllowlistVersion, resolveAllowlistVersion).call(this, snapId, resolvedVersion) : resolvedVersion;
606
604
  const location = _class_private_field_get(this, _detectSnapLocation).call(this, snapId, {
607
605
  versionRange: version,
608
606
  fetch: _class_private_field_get(this, _fetchFunction),
609
- allowLocal: _class_private_field_get(this, _featureFlags).allowLocalSnaps
607
+ allowLocal: _class_private_field_get(this, _featureFlags).allowLocalSnaps,
608
+ resolveVersion: async (range)=>_class_private_field_get(this, _featureFlags).requireAllowlist ? await _class_private_method_get(this, _resolveAllowlistVersion, resolveAllowlistVersion).call(this, snapId, range) : range
610
609
  });
611
610
  // Existing snaps may need to be updated, unless they should be re-installed (e.g. local snaps)
612
611
  // Everything else is treated as an install