From 4afbff3463d51bc9c4c92fb9cc3ed166d1722264 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Thu, 7 Sep 2023 04:50:48 +0000 Subject: [PATCH] lint:fix --- .../snaps-controllers/src/snaps/SnapController.test.ts | 2 +- packages/snaps-controllers/src/snaps/SnapController.ts | 2 +- .../snaps-controllers/src/snaps/endowments/cronjob.ts | 2 +- packages/snaps-controllers/src/snaps/endowments/rpc.ts | 2 +- .../src/snaps/endowments/transaction-insight.ts | 2 +- packages/snaps-controllers/src/snaps/registry/json.ts | 8 ++++++-- packages/snaps-controllers/src/test-utils/controller.ts | 2 +- .../src/common/BaseSnapExecutor.ts | 2 +- packages/snaps-execution-environments/src/common/utils.ts | 2 +- 9 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/snaps-controllers/src/snaps/SnapController.test.ts b/packages/snaps-controllers/src/snaps/SnapController.test.ts index 0b73ce571e..201a25f8f2 100644 --- a/packages/snaps-controllers/src/snaps/SnapController.test.ts +++ b/packages/snaps-controllers/src/snaps/SnapController.test.ts @@ -4,6 +4,7 @@ import type { SubjectPermissions, ValidPermission, } from '@metamask/permission-controller'; +import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods'; import type { SnapPermissions, ValidatedSnapId } from '@metamask/snaps-utils'; import { @@ -31,7 +32,6 @@ import { } from '@metamask/snaps-utils/test-utils'; import type { SemVerRange, SemVerVersion } from '@metamask/utils'; import { AssertionError } from '@metamask/utils'; -import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; import fetchMock from 'jest-fetch-mock'; import { createAsyncMiddleware, JsonRpcEngine } from 'json-rpc-engine'; import { createEngineStream } from 'json-rpc-middleware-stream'; diff --git a/packages/snaps-controllers/src/snaps/SnapController.ts b/packages/snaps-controllers/src/snaps/SnapController.ts index 0be2b5eda2..5b7ab263f2 100644 --- a/packages/snaps-controllers/src/snaps/SnapController.ts +++ b/packages/snaps-controllers/src/snaps/SnapController.ts @@ -24,6 +24,7 @@ import type { ValidPermission, } from '@metamask/permission-controller'; import { SubjectType } from '@metamask/permission-controller'; +import { rpcErrors } from '@metamask/rpc-errors'; import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods'; import type { BlockReason } from '@metamask/snaps-registry'; import type { @@ -76,7 +77,6 @@ import { } from '@metamask/utils'; import type { StateMachine } from '@xstate/fsm'; import { createMachine, interpret } from '@xstate/fsm'; -import { rpcErrors } from '@metamask/rpc-errors'; import type { Patch } from 'immer'; import { nanoid } from 'nanoid'; diff --git a/packages/snaps-controllers/src/snaps/endowments/cronjob.ts b/packages/snaps-controllers/src/snaps/endowments/cronjob.ts index 079134cf10..fbe9957636 100644 --- a/packages/snaps-controllers/src/snaps/endowments/cronjob.ts +++ b/packages/snaps-controllers/src/snaps/endowments/cronjob.ts @@ -7,6 +7,7 @@ import type { CaveatSpecificationConstraint, } from '@metamask/permission-controller'; import { PermissionType, SubjectType } from '@metamask/permission-controller'; +import { rpcErrors } from '@metamask/rpc-errors'; import type { CronjobSpecification } from '@metamask/snaps-utils'; import { SnapCaveatType, @@ -14,7 +15,6 @@ import { } from '@metamask/snaps-utils'; import type { Json, NonEmptyArray } from '@metamask/utils'; import { assert, hasProperty, isPlainObject } from '@metamask/utils'; -import { rpcErrors } from '@metamask/rpc-errors'; import { SnapEndowments } from './enum'; diff --git a/packages/snaps-controllers/src/snaps/endowments/rpc.ts b/packages/snaps-controllers/src/snaps/endowments/rpc.ts index f5abc4d098..2892a00b9b 100644 --- a/packages/snaps-controllers/src/snaps/endowments/rpc.ts +++ b/packages/snaps-controllers/src/snaps/endowments/rpc.ts @@ -8,11 +8,11 @@ import type { ValidPermissionSpecification, } from '@metamask/permission-controller'; import { PermissionType, SubjectType } from '@metamask/permission-controller'; +import { rpcErrors } from '@metamask/rpc-errors'; import type { RpcOrigins } from '@metamask/snaps-utils'; import { assertIsRpcOrigins, SnapCaveatType } from '@metamask/snaps-utils'; import type { Json, NonEmptyArray } from '@metamask/utils'; import { hasProperty, isPlainObject, assert } from '@metamask/utils'; -import { rpcErrors } from '@metamask/rpc-errors'; import { SnapEndowments } from './enum'; diff --git a/packages/snaps-controllers/src/snaps/endowments/transaction-insight.ts b/packages/snaps-controllers/src/snaps/endowments/transaction-insight.ts index bc534df3a5..fe500c5ee3 100644 --- a/packages/snaps-controllers/src/snaps/endowments/transaction-insight.ts +++ b/packages/snaps-controllers/src/snaps/endowments/transaction-insight.ts @@ -8,10 +8,10 @@ import type { Caveat, } from '@metamask/permission-controller'; import { PermissionType, SubjectType } from '@metamask/permission-controller'; +import { rpcErrors } from '@metamask/rpc-errors'; import { SnapCaveatType } from '@metamask/snaps-utils'; import type { Json, NonEmptyArray } from '@metamask/utils'; import { assert, hasProperty, isObject, isPlainObject } from '@metamask/utils'; -import { rpcErrors } from '@metamask/rpc-errors'; import { SnapEndowments } from './enum'; diff --git a/packages/snaps-controllers/src/snaps/registry/json.ts b/packages/snaps-controllers/src/snaps/registry/json.ts index 64244ee27d..a98b76af36 100644 --- a/packages/snaps-controllers/src/snaps/registry/json.ts +++ b/packages/snaps-controllers/src/snaps/registry/json.ts @@ -3,12 +3,13 @@ import { BaseControllerV2 as BaseController } from '@metamask/base-controller'; import type { SnapsRegistryDatabase } from '@metamask/snaps-registry'; import { verify } from '@metamask/snaps-registry'; import type { SnapId } from '@metamask/snaps-utils'; -import type { Hex } from '@metamask/utils'; +import type { Hex, SemVerRange } from '@metamask/utils'; import { assert, Duration, inMilliseconds, satisfiesVersionRange, + SemVerVersion, } from '@metamask/utils'; import type { @@ -226,7 +227,10 @@ export class JsonSnapsRegistry extends BaseController< if ('id' in blocked) { return ( blocked.id === snapId && - satisfiesVersionRange(snapInfo.version, blocked.versionRange) + satisfiesVersionRange( + snapInfo.version, + blocked.versionRange as SemVerRange, + ) ); } diff --git a/packages/snaps-controllers/src/test-utils/controller.ts b/packages/snaps-controllers/src/test-utils/controller.ts index 97febf77c3..fd68410305 100644 --- a/packages/snaps-controllers/src/test-utils/controller.ts +++ b/packages/snaps-controllers/src/test-utils/controller.ts @@ -7,6 +7,7 @@ import type { SubjectMetadata, } from '@metamask/permission-controller'; import { SubjectType } from '@metamask/permission-controller'; +import { providerErrors } from '@metamask/rpc-errors'; import { WALLET_SNAP_PERMISSION_KEY } from '@metamask/rpc-methods'; import type { ValidatedSnapId } from '@metamask/snaps-utils'; import { SnapCaveatType } from '@metamask/snaps-utils'; @@ -19,7 +20,6 @@ import { MOCK_SNAP_ID, } from '@metamask/snaps-utils/test-utils'; import type { Json } from '@metamask/utils'; -import { providerErrors } from '@metamask/rpc-errors'; import type { CronjobControllerActions, diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index 7c4d3a2726..060e34336f 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -2,6 +2,7 @@ /// import { StreamProvider } from '@metamask/providers'; import type { RequestArguments } from '@metamask/providers/dist/BaseProvider'; +import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors'; import type { SnapsGlobalObject } from '@metamask/rpc-methods'; import type { SnapExports, @@ -27,7 +28,6 @@ import { hasProperty, getSafeJson, } from '@metamask/utils'; -import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors'; import { createIdRemapMiddleware } from 'json-rpc-engine'; import type { Duplex } from 'stream'; import { validate } from 'superstruct'; diff --git a/packages/snaps-execution-environments/src/common/utils.ts b/packages/snaps-execution-environments/src/common/utils.ts index 1d381a676f..9397f63750 100644 --- a/packages/snaps-execution-environments/src/common/utils.ts +++ b/packages/snaps-execution-environments/src/common/utils.ts @@ -1,7 +1,7 @@ import type { StreamProvider } from '@metamask/providers'; import type { RequestArguments } from '@metamask/providers/dist/BaseProvider'; -import { assert, assertStruct, JsonStruct } from '@metamask/utils'; import { rpcErrors } from '@metamask/rpc-errors'; +import { assert, assertStruct, JsonStruct } from '@metamask/utils'; import { log } from '../logging';