Skip to content

Commit 8abe43e

Browse files
Use satisfiesVersionRange
1 parent d61e1fc commit 8abe43e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/snaps-controllers/src/snaps/registry/json.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ describe('JsonSnapsRegistry', () => {
389389
versions: {
390390
['1.0.0' as SemVerVersion]: {
391391
checksum: DEFAULT_SNAP_SHASUM,
392+
clientVersions: {
393+
extension: '>=13.9.0',
394+
},
392395
},
393396
['1.1.0' as SemVerVersion]: {
394397
checksum: DEFAULT_SNAP_SHASUM,
@@ -405,7 +408,7 @@ describe('JsonSnapsRegistry', () => {
405408
JSON.stringify({
406409
...MOCK_SIGNATURE_FILE,
407410
signature:
408-
'0x3045022100e17cf0f34e4d521d984ed8f8492ce8a51b65178e7ba5508e01b179c5dd013c52022025e4a4008232a883048c8174e585cd89b9054eadc37330e00fd2f07a65c9bbb4',
411+
'0x30440220337683880fa580d8eed89c37f9b6d5639a015d416d58afc50ff0602820ab8af3022008b6a5b37a028d8d632fb311ddd0e92fc2d98cff013da4e47b99a754638a8876',
409412
}),
410413
);
411414

packages/snaps-controllers/src/snaps/registry/json.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
assert,
1313
assertIsSemVerRange,
1414
Duration,
15-
gtRange,
1615
inMilliseconds,
1716
satisfiesVersionRange,
1817
} from '@metamask/utils';
@@ -352,7 +351,10 @@ export class JsonSnapsRegistry extends BaseController<
352351
const compatibleVersions = Object.entries(versions).reduce<SemVerVersion[]>(
353352
(accumulator, [version, metadata]) => {
354353
const clientRange = metadata.clientVersions?.[this.#clientConfig.type];
355-
if (!clientRange || gtRange(this.#clientConfig.version, clientRange)) {
354+
if (
355+
!clientRange ||
356+
satisfiesVersionRange(this.#clientConfig.version, clientRange)
357+
) {
356358
accumulator.push(version as SemVerVersion);
357359
}
358360

0 commit comments

Comments
 (0)