From c3f2c5e828746cf0475c53ef8d00c38908224fd9 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 12 Jul 2024 14:35:57 -0400 Subject: [PATCH] Linter fixes --- packages/create-snap/src/cmds/init/index.ts | 2 +- .../src/cmds/init/initHandler.test.ts | 4 +- .../create-snap/src/cmds/init/initHandler.ts | 2 +- .../src/cmds/init/initUtils.test.ts | 2 +- .../src/commands/build/build.test.ts | 4 +- .../snaps-cli/src/commands/build/build.ts | 2 +- .../src/commands/build/implementation.test.ts | 2 +- .../snaps-cli/src/commands/build/index.ts | 2 +- packages/snaps-cli/src/commands/eval/eval.ts | 2 +- .../snaps-cli/src/commands/eval/index.test.ts | 2 +- packages/snaps-cli/src/commands/eval/index.ts | 2 +- .../commands/manifest/implementation.test.ts | 2 +- .../src/commands/manifest/index.test.ts | 2 +- .../snaps-cli/src/commands/manifest/index.ts | 2 +- .../src/commands/manifest/manifest.ts | 2 +- .../src/commands/serve/index.test.ts | 2 +- .../snaps-cli/src/commands/serve/index.ts | 2 +- .../src/commands/serve/serve.test.ts | 2 +- .../src/commands/watch/implementation.test.ts | 2 +- .../src/commands/watch/index.test.ts | 2 +- .../snaps-cli/src/commands/watch/index.ts | 2 +- .../src/commands/watch/watch.test.ts | 2 +- .../snaps-cli/src/commands/watch/watch.ts | 2 +- packages/snaps-cli/src/utils/errors.test.ts | 2 +- packages/snaps-cli/src/utils/legacy.test.ts | 2 +- .../snaps-cli/src/webpack/compiler.test.ts | 2 +- packages/snaps-cli/src/webpack/compiler.ts | 2 +- packages/snaps-cli/src/webpack/config.test.ts | 2 +- packages/snaps-cli/src/webpack/config.ts | 2 +- .../snaps-cli/src/webpack/loaders/function.ts | 2 +- .../snaps-cli/src/webpack/plugins.test.ts | 4 +- packages/snaps-cli/src/webpack/plugins.ts | 2 +- packages/snaps-cli/src/webpack/utils.test.ts | 4 +- packages/snaps-cli/src/webpack/utils.ts | 2 +- .../src/cronjob/CronjobController.test.ts | 2 +- .../insights/SnapInsightsController.test.ts | 2 +- .../SnapInterfaceController.test.tsx | 2 +- .../services/AbstractExecutionService.test.ts | 2 +- .../src/services/AbstractExecutionService.ts | 6 +-- .../IframeExecutionService.test.browser.ts | 2 +- .../NodeProcessExecutionService.test.ts | 2 +- .../NodeThreadExecutionService.test.ts | 2 +- .../OffscreenExecutionService.test.ts | 2 +- .../webview/WebViewExecutionService.test.ts | 4 +- .../webview/WebViewExecutionService.ts | 4 +- .../WebWorkerExecutionService.test.browser.ts | 2 +- .../src/snaps/SnapController.test.tsx | 24 +++++----- .../src/snaps/SnapController.ts | 46 +++++++++---------- .../src/snaps/registry/json.test.ts | 2 +- .../src/test-utils/controller.ts | 6 +-- .../src/test-utils/service.ts | 2 +- packages/snaps-controllers/src/utils.test.ts | 2 +- .../src/common/BaseSnapExecutor.ts | 2 +- .../endowments/commonEndowmentFactory.ts | 4 +- .../src/common/endowments/console.test.ts | 2 +- .../src/common/endowments/console.ts | 2 +- .../src/common/endowments/date.test.ts | 2 +- .../endowments/endowments.test.browser.ts | 4 +- .../src/common/endowments/index.ts | 6 +-- .../src/common/endowments/math.test.ts | 2 +- .../src/common/endowments/math.ts | 2 +- .../src/common/endowments/network.ts | 2 +- .../src/common/test-utils/endowments.ts | 2 +- .../src/iframe/index.ts | 2 +- .../src/node-process/index.ts | 2 +- .../src/node-thread/index.ts | 2 +- .../src/webview/index.ts | 2 +- .../src/webworker/executor/index.ts | 2 +- .../src/webworker/pool/index.ts | 2 +- packages/snaps-jest/src/helpers.ts | 4 +- .../snaps-jest/src/internals/request.test.tsx | 12 ++--- packages/snaps-jest/src/internals/request.ts | 10 ++-- packages/snaps-jest/src/internals/server.ts | 2 +- .../internals/simulation/controllers.test.ts | 2 +- .../internals/simulation/interface.test.tsx | 26 +++++------ .../src/internals/simulation/interface.ts | 15 +++--- .../methods/hooks/get-locale.test.ts | 2 +- .../methods/hooks/interface.test.ts | 8 ++-- .../methods/hooks/notifications.test.ts | 4 +- .../hooks/request-user-approval.test.ts | 2 +- .../simulation/methods/hooks/state.test.ts | 4 +- .../simulation/methods/specifications.test.ts | 6 +-- .../simulation/methods/specifications.ts | 6 +-- .../simulation/middleware/engine.test.ts | 2 +- .../internals/simulation/middleware/engine.ts | 4 +- .../internal-methods/account.test.ts | 2 +- .../simulation/middleware/mock.test.ts | 2 +- .../internals/simulation/simulation.test.ts | 6 +-- .../internals/simulation/store/store.test.ts | 2 +- .../src/internals/simulation/store/store.ts | 2 +- packages/snaps-jest/src/matchers.ts | 2 +- .../endowments/caveats/requestTime.test.ts | 2 +- .../src/permitted/invokeKeyring.ts | 10 ++-- .../src/permitted/middleware.ts | 2 +- .../src/permitted/requestSnaps.test.ts | 2 +- .../src/permitted/resolveInterface.ts | 4 +- .../src/permitted/updateInterface.test.tsx | 7 ++- .../src/restricted/caveats/index.ts | 8 ++-- .../src/internals/error-wrappers.test.ts | 2 +- packages/snaps-sdk/src/internals/jsx.ts | 2 +- .../snaps-sdk/src/internals/structs.test.ts | 2 +- .../snaps-sdk/src/jsx/components/Container.ts | 2 +- .../snaps-sdk/src/jsx/components/Footer.ts | 2 +- packages/snaps-sdk/src/jsx/components/Link.ts | 2 +- packages/snaps-sdk/src/jsx/components/Row.ts | 2 +- packages/snaps-sdk/src/jsx/components/Text.ts | 4 +- .../snaps-sdk/src/jsx/components/Tooltip.ts | 2 +- .../src/jsx/components/form/Dropdown.ts | 2 +- .../src/jsx/components/form/Field.ts | 2 +- .../src/jsx/components/form/Option.ts | 2 +- packages/snaps-sdk/src/jsx/validation.ts | 6 +-- .../snaps-sdk/src/types/handlers/signature.ts | 2 +- packages/snaps-sdk/src/types/interface.ts | 2 +- .../src/types/methods/dialog.test.ts | 2 +- .../snaps-sdk/src/types/methods/methods.ts | 2 +- packages/snaps-sdk/src/ui/component.test.ts | 9 ++-- .../src/ui/components/address.test.ts | 2 +- .../src/ui/components/button.test.ts | 2 +- .../src/ui/components/copyable.test.ts | 2 +- .../src/ui/components/divider.test.ts | 2 +- .../snaps-sdk/src/ui/components/form.test.ts | 2 +- packages/snaps-sdk/src/ui/components/form.ts | 4 +- .../src/ui/components/heading.test.ts | 2 +- .../snaps-sdk/src/ui/components/image.test.ts | 2 +- .../snaps-sdk/src/ui/components/input.test.ts | 2 +- .../snaps-sdk/src/ui/components/panel.test.ts | 2 +- packages/snaps-sdk/src/ui/components/panel.ts | 6 +-- .../snaps-sdk/src/ui/components/row.test.ts | 2 +- packages/snaps-sdk/src/ui/components/row.ts | 6 +-- .../src/ui/components/spinner.test.ts | 2 +- .../snaps-sdk/src/ui/components/text.test.ts | 2 +- .../src/components/Author.test.tsx | 2 +- .../src/components/Icon.test.tsx | 2 +- .../src/components/Link.test.tsx | 2 +- .../src/components/Logo.test.tsx | 2 +- .../src/components/Prefill.test.tsx | 2 +- .../src/components/SnapIcon.test.tsx | 2 +- .../src/components/SnapIcon.tsx | 2 +- .../src/components/Window.test.tsx | 2 +- .../components/dialogs/AlertDialog.test.tsx | 2 +- .../dialogs/ConfirmationDialog.test.tsx | 2 +- .../components/dialogs/PromptDialog.test.tsx | 2 +- .../src/contexts/SnapInterface.tsx | 2 +- .../src/features/builder/Builder.tsx | 2 +- .../builder/components/EditableNodeInput.tsx | 4 +- .../builder/components/MultiEditableNode.tsx | 2 +- .../builder/components/NodeRenderer.tsx | 2 +- .../features/builder/components/NodeTree.tsx | 2 +- .../components/TemplateComponentList.tsx | 2 +- .../builder/components/TextEditableNode.tsx | 2 +- .../src/features/builder/utils.ts | 5 +- .../configuration/Configuration.test.tsx | 2 +- .../features/configuration/Configuration.tsx | 2 +- .../src/features/console/Console.tsx | 4 +- .../src/features/console/ConsoleContent.tsx | 2 +- .../handlers/components/Handler.test.tsx | 2 +- .../features/handlers/components/Handler.tsx | 8 ++-- .../handlers/components/History.test.tsx | 2 +- .../features/handlers/components/History.tsx | 2 +- .../handlers/components/HistoryItem.test.tsx | 2 +- .../handlers/components/Response.test.tsx | 2 +- .../components/UserInterface.test.tsx | 2 +- .../components/CronjobPrefill.test.tsx | 2 +- .../components/CronjobPrefills.test.tsx | 2 +- .../cronjobs/components/CronjobPrefills.tsx | 4 +- .../cronjobs/components/Request.test.tsx | 2 +- .../handlers/cronjobs/components/Request.tsx | 4 +- .../transactions/components/Request.tsx | 2 +- .../components/TransactionPrefill.test.tsx | 2 +- .../components/TransactionPrefills.test.tsx | 2 +- .../components/TransactionPrefills.tsx | 2 +- .../src/features/layout/Layout.tsx | 2 +- .../layout/components/Header.test.tsx | 2 +- .../layout/components/Sidebar.test.tsx | 2 +- .../src/features/manifest/Manifest.test.tsx | 2 +- .../src/features/manifest/Manifest.tsx | 2 +- .../manifest/components/Item.test.tsx | 2 +- .../manifest/components/Validation.test.tsx | 2 +- .../manifest/components/Validation.tsx | 2 +- .../src/features/manifest/sagas.test.ts | 10 ++-- .../src/features/manifest/sagas.ts | 2 +- .../features/navigation/Navigation.test.tsx | 2 +- .../src/features/navigation/Navigation.tsx | 4 +- .../navigation/components/Bottom.test.tsx | 2 +- .../features/navigation/components/Bottom.tsx | 2 +- .../navigation/components/Item.test.tsx | 2 +- .../notifications/Notifications.test.tsx | 2 +- .../features/notifications/Notifications.tsx | 2 +- .../src/features/polling/sagas.test.ts | 2 +- .../src/features/renderer/Renderer.tsx | 2 +- .../src/features/renderer/SnapComponent.tsx | 2 +- .../src/features/simulation/hooks.test.ts | 2 +- .../src/features/simulation/hooks.ts | 2 +- .../features/simulation/middleware.test.ts | 2 +- .../src/features/simulation/sagas.test.ts | 2 +- .../src/features/simulation/sagas.ts | 15 +++--- .../features/status/StatusIndicator.test.tsx | 2 +- .../snaps-simulator/src/utils/render.test.tsx | 2 +- .../snaps-utils/src/manifest/manifest.test.ts | 20 ++++---- packages/snaps-utils/src/manifest/manifest.ts | 2 +- .../src/manifest/validation.test.ts | 2 +- .../snaps-utils/src/test-utils/manifest.ts | 2 +- packages/snaps-utils/src/test-utils/snap.ts | 4 +- .../test-snaps/src/components/Connect.tsx | 2 +- packages/test-snaps/src/components/Snap.tsx | 2 +- .../src/features/snaps/bip32/BIP32.tsx | 2 +- .../src/features/snaps/bip44/BIP44.tsx | 4 +- .../snaps/client-status/ClientStatus.tsx | 6 +-- .../src/features/snaps/cronjobs/Cronjobs.tsx | 2 +- .../src/features/snaps/dialogs/Dialogs.tsx | 6 +-- .../src/features/snaps/errors/Errors.tsx | 2 +- .../ethereum-provider/EthereumProvider.tsx | 6 +-- .../src/features/snaps/ethers-js/EthersJs.tsx | 2 +- .../features/snaps/file-upload/FileUpload.tsx | 6 +-- .../features/snaps/get-entropy/GetEntropy.tsx | 2 +- .../src/features/snaps/get-file/GetFile.tsx | 6 +-- .../src/features/snaps/home-page/HomePage.tsx | 2 +- .../src/features/snaps/images/Images.tsx | 2 +- .../snaps/images/components/ShowQr.tsx | 8 +++- .../snaps/interactive-ui/InteractiveUI.tsx | 6 +-- .../src/features/snaps/json-rpc/JsonRpc.tsx | 6 +-- .../test-snaps/src/features/snaps/jsx/Jsx.tsx | 2 +- .../snaps/lifecycle-hooks/LifecycleHooks.tsx | 2 +- .../snaps/localization/Localization.tsx | 6 +-- .../snaps/manage-state/ManageState.tsx | 2 +- .../features/snaps/name-lookup/NameLookup.tsx | 2 +- .../snaps/network-access/NetworkAccess.tsx | 6 +-- .../snaps/notifications/Notifications.tsx | 6 +-- .../signature-insights/SignatureInsights.tsx | 2 +- .../TransactionInsights.tsx | 4 +- .../src/features/snaps/updates/Updates.tsx | 4 +- .../src/features/snaps/wasm/WebAssembly.tsx | 2 +- 232 files changed, 406 insertions(+), 389 deletions(-) diff --git a/packages/create-snap/src/cmds/init/index.ts b/packages/create-snap/src/cmds/init/index.ts index 93a5cc14c3..8ab8534e1e 100644 --- a/packages/create-snap/src/cmds/init/index.ts +++ b/packages/create-snap/src/cmds/init/index.ts @@ -1,9 +1,9 @@ import { logInfo } from '@metamask/snaps-utils'; import type yargs from 'yargs'; +import { initHandler } from './initHandler'; import builders from '../../builders'; import type { YargsArgs } from '../../types/yargs'; -import { initHandler } from './initHandler'; export const initCommand = { command: ['$0 [directory]'], diff --git a/packages/create-snap/src/cmds/init/initHandler.test.ts b/packages/create-snap/src/cmds/init/initHandler.test.ts index 27262933f0..5695e01a6e 100644 --- a/packages/create-snap/src/cmds/init/initHandler.test.ts +++ b/packages/create-snap/src/cmds/init/initHandler.test.ts @@ -8,10 +8,10 @@ import { promises as fs } from 'fs'; import pathUtils from 'path'; import semver from 'semver'; -import { resetFileSystem } from '../../test-utils'; -import type { YargsArgs } from '../../types/yargs'; import { initHandler } from './initHandler'; import * as initUtils from './initUtils'; +import { resetFileSystem } from '../../test-utils'; +import type { YargsArgs } from '../../types/yargs'; jest.mock('fs'); diff --git a/packages/create-snap/src/cmds/init/initHandler.ts b/packages/create-snap/src/cmds/init/initHandler.ts index ed55ffee78..c5622689f8 100644 --- a/packages/create-snap/src/cmds/init/initHandler.ts +++ b/packages/create-snap/src/cmds/init/initHandler.ts @@ -12,7 +12,6 @@ import pathUtils from 'path'; import type { SemVer } from 'semver'; import semver from 'semver'; -import type { YargsArgs } from '../../types/yargs'; import { buildSnap, cloneTemplate, @@ -23,6 +22,7 @@ import { SNAP_LOCATION, yarnInstall, } from './initUtils'; +import type { YargsArgs } from '../../types/yargs'; /** * Creates a new snap package, based on one of the provided templates. This diff --git a/packages/create-snap/src/cmds/init/initUtils.test.ts b/packages/create-snap/src/cmds/init/initUtils.test.ts index 22a60433fd..17c41ba9f7 100644 --- a/packages/create-snap/src/cmds/init/initUtils.test.ts +++ b/packages/create-snap/src/cmds/init/initUtils.test.ts @@ -3,7 +3,6 @@ import childProcess from 'child_process'; import { promises as fs } from 'fs'; import pathUtils from 'path'; -import { resetFileSystem } from '../../test-utils'; import { buildSnap, cloneTemplate, @@ -14,6 +13,7 @@ import { yarnInstall, TEMPLATE_GIT_URL, } from './initUtils'; +import { resetFileSystem } from '../../test-utils'; jest.mock('fs'); diff --git a/packages/snaps-cli/src/commands/build/build.test.ts b/packages/snaps-cli/src/commands/build/build.test.ts index f8c774304c..143194e139 100644 --- a/packages/snaps-cli/src/commands/build/build.test.ts +++ b/packages/snaps-cli/src/commands/build/build.test.ts @@ -1,10 +1,10 @@ import { DEFAULT_SNAP_BUNDLE } from '@metamask/snaps-utils/test-utils'; import fs from 'fs'; -import { getMockConfig } from '../../test-utils'; -import { evaluate } from '../eval'; import { buildHandler } from './build'; import { build } from './implementation'; +import { getMockConfig } from '../../test-utils'; +import { evaluate } from '../eval'; jest.mock('fs'); jest.mock('../eval'); diff --git a/packages/snaps-cli/src/commands/build/build.ts b/packages/snaps-cli/src/commands/build/build.ts index e4166f98c2..19ae8d43b0 100644 --- a/packages/snaps-cli/src/commands/build/build.ts +++ b/packages/snaps-cli/src/commands/build/build.ts @@ -1,12 +1,12 @@ import { isFile } from '@metamask/snaps-utils/node'; import { resolve as pathResolve } from 'path'; +import { build } from './implementation'; import type { ProcessedConfig, ProcessedWebpackConfig } from '../../config'; import { CommandError } from '../../errors'; import type { Steps } from '../../utils'; import { executeSteps, info } from '../../utils'; import { evaluate } from '../eval'; -import { build } from './implementation'; type BuildContext = { config: ProcessedWebpackConfig; diff --git a/packages/snaps-cli/src/commands/build/implementation.test.ts b/packages/snaps-cli/src/commands/build/implementation.test.ts index 8d6bd5a9de..d802e81499 100644 --- a/packages/snaps-cli/src/commands/build/implementation.test.ts +++ b/packages/snaps-cli/src/commands/build/implementation.test.ts @@ -7,12 +7,12 @@ import normalFs from 'fs'; import { dirname, resolve } from 'path'; import type { Configuration } from 'webpack'; +import { build } from './implementation'; import { getMockConfig } from '../../test-utils'; import { getCompiler } from '../../webpack'; import type * as webpack from '../../webpack'; import type * as utils from '../../webpack/utils'; import { BROWSERSLIST_FILE } from '../../webpack/utils'; -import { build } from './implementation'; const { promises: fs } = normalFs; diff --git a/packages/snaps-cli/src/commands/build/index.ts b/packages/snaps-cli/src/commands/build/index.ts index 28b8c687c3..47eb8968ef 100644 --- a/packages/snaps-cli/src/commands/build/index.ts +++ b/packages/snaps-cli/src/commands/build/index.ts @@ -1,8 +1,8 @@ import type yargs from 'yargs'; +import { buildHandler } from './build'; import builders from '../../builders'; import type { YargsArgs } from '../../types/yargs'; -import { buildHandler } from './build'; const command = { command: ['build', 'b'], diff --git a/packages/snaps-cli/src/commands/eval/eval.ts b/packages/snaps-cli/src/commands/eval/eval.ts index b82f7906a0..1f8c91c6c0 100644 --- a/packages/snaps-cli/src/commands/eval/eval.ts +++ b/packages/snaps-cli/src/commands/eval/eval.ts @@ -1,11 +1,11 @@ import { isFile } from '@metamask/snaps-utils/node'; import { resolve } from 'path'; +import { evaluate } from './implementation'; import type { ProcessedConfig } from '../../config'; import { CommandError } from '../../errors'; import type { Steps } from '../../utils'; import { executeSteps, getRelativePath } from '../../utils'; -import { evaluate } from './implementation'; export type EvalOptions = { input?: string; diff --git a/packages/snaps-cli/src/commands/eval/index.test.ts b/packages/snaps-cli/src/commands/eval/index.test.ts index e65cf831ba..8065dbf32f 100644 --- a/packages/snaps-cli/src/commands/eval/index.test.ts +++ b/packages/snaps-cli/src/commands/eval/index.test.ts @@ -1,7 +1,7 @@ import command from '.'; +import { evaluateHandler } from './eval'; import { getMockConfig } from '../../test-utils'; import type { YargsArgs } from '../../types/yargs'; -import { evaluateHandler } from './eval'; jest.mock('./eval'); diff --git a/packages/snaps-cli/src/commands/eval/index.ts b/packages/snaps-cli/src/commands/eval/index.ts index 700767590e..af3758131b 100644 --- a/packages/snaps-cli/src/commands/eval/index.ts +++ b/packages/snaps-cli/src/commands/eval/index.ts @@ -1,8 +1,8 @@ import type yargs from 'yargs'; +import { evaluateHandler } from './eval'; import builders from '../../builders'; import type { YargsArgs } from '../../types/yargs'; -import { evaluateHandler } from './eval'; const command = { command: ['eval', 'e'], diff --git a/packages/snaps-cli/src/commands/manifest/implementation.test.ts b/packages/snaps-cli/src/commands/manifest/implementation.test.ts index 7c5ef2a99f..601d911f02 100644 --- a/packages/snaps-cli/src/commands/manifest/implementation.test.ts +++ b/packages/snaps-cli/src/commands/manifest/implementation.test.ts @@ -6,8 +6,8 @@ import { import normalFs from 'fs'; import ora from 'ora'; -import type * as webpack from '../../webpack'; import { manifest } from './implementation'; +import type * as webpack from '../../webpack'; const { promises: fs } = normalFs; diff --git a/packages/snaps-cli/src/commands/manifest/index.test.ts b/packages/snaps-cli/src/commands/manifest/index.test.ts index afa77959a5..237f234201 100644 --- a/packages/snaps-cli/src/commands/manifest/index.test.ts +++ b/packages/snaps-cli/src/commands/manifest/index.test.ts @@ -1,7 +1,7 @@ import command from '.'; +import { manifestHandler } from './manifest'; import { getMockConfig } from '../../test-utils'; import type { YargsArgs } from '../../types/yargs'; -import { manifestHandler } from './manifest'; jest.mock('./manifest'); diff --git a/packages/snaps-cli/src/commands/manifest/index.ts b/packages/snaps-cli/src/commands/manifest/index.ts index b871f46cfa..bf8a1308ca 100644 --- a/packages/snaps-cli/src/commands/manifest/index.ts +++ b/packages/snaps-cli/src/commands/manifest/index.ts @@ -1,8 +1,8 @@ import type yargs from 'yargs'; +import { manifestHandler } from './manifest'; import builders from '../../builders'; import type { YargsArgs } from '../../types/yargs'; -import { manifestHandler } from './manifest'; const command = { command: ['manifest', 'm'], diff --git a/packages/snaps-cli/src/commands/manifest/manifest.ts b/packages/snaps-cli/src/commands/manifest/manifest.ts index dd9bd7ff4c..d625a4c62c 100644 --- a/packages/snaps-cli/src/commands/manifest/manifest.ts +++ b/packages/snaps-cli/src/commands/manifest/manifest.ts @@ -1,10 +1,10 @@ import { isFile } from '@metamask/snaps-utils/node'; +import { manifest } from './implementation'; import type { ProcessedConfig } from '../../config'; import { CommandError } from '../../errors'; import type { Steps } from '../../utils'; import { executeSteps } from '../../utils'; -import { manifest } from './implementation'; type ManifestOptions = { fix?: boolean; diff --git a/packages/snaps-cli/src/commands/serve/index.test.ts b/packages/snaps-cli/src/commands/serve/index.test.ts index ff2ed42dee..d5c6ef56d0 100644 --- a/packages/snaps-cli/src/commands/serve/index.test.ts +++ b/packages/snaps-cli/src/commands/serve/index.test.ts @@ -1,7 +1,7 @@ import command from '.'; +import { serveHandler } from './serve'; import { getMockConfig } from '../../test-utils'; import type { YargsArgs } from '../../types/yargs'; -import { serveHandler } from './serve'; jest.mock('./serve'); diff --git a/packages/snaps-cli/src/commands/serve/index.ts b/packages/snaps-cli/src/commands/serve/index.ts index 2f3e85e2b2..7330faf12f 100644 --- a/packages/snaps-cli/src/commands/serve/index.ts +++ b/packages/snaps-cli/src/commands/serve/index.ts @@ -1,8 +1,8 @@ import type yargs from 'yargs'; +import { serveHandler } from './serve'; import builders from '../../builders'; import type { YargsArgs } from '../../types/yargs'; -import { serveHandler } from './serve'; const command = { command: ['serve', 's'], diff --git a/packages/snaps-cli/src/commands/serve/serve.test.ts b/packages/snaps-cli/src/commands/serve/serve.test.ts index 610364641b..c7691969f7 100644 --- a/packages/snaps-cli/src/commands/serve/serve.test.ts +++ b/packages/snaps-cli/src/commands/serve/serve.test.ts @@ -1,6 +1,6 @@ +import { serveHandler } from './serve'; import { getMockConfig } from '../../test-utils'; import * as webpack from '../../webpack'; -import { serveHandler } from './serve'; jest.mock('../../webpack'); diff --git a/packages/snaps-cli/src/commands/watch/implementation.test.ts b/packages/snaps-cli/src/commands/watch/implementation.test.ts index 0a879aa786..6ec3cb67b6 100644 --- a/packages/snaps-cli/src/commands/watch/implementation.test.ts +++ b/packages/snaps-cli/src/commands/watch/implementation.test.ts @@ -5,10 +5,10 @@ import { } from '@metamask/snaps-utils/test-utils'; import normalFs from 'fs'; +import { watch } from './implementation'; import { getMockConfig } from '../../test-utils'; import { getCompiler } from '../../webpack'; import type * as webpack from '../../webpack'; -import { watch } from './implementation'; const { promises: fs } = normalFs; diff --git a/packages/snaps-cli/src/commands/watch/index.test.ts b/packages/snaps-cli/src/commands/watch/index.test.ts index b4e16dd9df..6cdce57907 100644 --- a/packages/snaps-cli/src/commands/watch/index.test.ts +++ b/packages/snaps-cli/src/commands/watch/index.test.ts @@ -1,7 +1,7 @@ import command from '.'; +import { watchHandler } from './watch'; import { getMockConfig } from '../../test-utils'; import type { YargsArgs } from '../../types/yargs'; -import { watchHandler } from './watch'; jest.mock('./watch'); diff --git a/packages/snaps-cli/src/commands/watch/index.ts b/packages/snaps-cli/src/commands/watch/index.ts index 6d7d093cb3..8e1e499647 100644 --- a/packages/snaps-cli/src/commands/watch/index.ts +++ b/packages/snaps-cli/src/commands/watch/index.ts @@ -1,8 +1,8 @@ import type yargs from 'yargs'; +import { watchHandler } from './watch'; import builders from '../../builders'; import type { YargsArgs } from '../../types/yargs'; -import { watchHandler } from './watch'; const command = { command: ['watch', 'w'], diff --git a/packages/snaps-cli/src/commands/watch/watch.test.ts b/packages/snaps-cli/src/commands/watch/watch.test.ts index 22059a43e6..e6de712b56 100644 --- a/packages/snaps-cli/src/commands/watch/watch.test.ts +++ b/packages/snaps-cli/src/commands/watch/watch.test.ts @@ -2,9 +2,9 @@ import { getMockConfig } from '@metamask/snaps-cli/test-utils'; import { DEFAULT_SNAP_BUNDLE } from '@metamask/snaps-utils/test-utils'; import fs from 'fs'; -import * as webpack from '../../webpack'; import { watch } from './implementation'; import { watchHandler } from './watch'; +import * as webpack from '../../webpack'; jest.mock('fs'); jest.mock('../../webpack'); diff --git a/packages/snaps-cli/src/commands/watch/watch.ts b/packages/snaps-cli/src/commands/watch/watch.ts index 81ef64cea0..58d2b15a56 100644 --- a/packages/snaps-cli/src/commands/watch/watch.ts +++ b/packages/snaps-cli/src/commands/watch/watch.ts @@ -1,11 +1,11 @@ import { isFile } from '@metamask/snaps-utils/node'; +import { watch } from './implementation'; import type { ProcessedConfig, ProcessedWebpackConfig } from '../../config'; import { CommandError } from '../../errors'; import type { Steps } from '../../utils'; import { executeSteps, info } from '../../utils'; import { getServer } from '../../webpack'; -import { watch } from './implementation'; type WatchOptions = { /** diff --git a/packages/snaps-cli/src/utils/errors.test.ts b/packages/snaps-cli/src/utils/errors.test.ts index 887db93828..b314360d3b 100644 --- a/packages/snaps-cli/src/utils/errors.test.ts +++ b/packages/snaps-cli/src/utils/errors.test.ts @@ -1,5 +1,5 @@ -import { CommandError } from '../errors'; import { getErrorMessage, getYargsErrorMessage } from './errors'; +import { CommandError } from '../errors'; describe('getYargsErrorMessage', () => { it('returns the plain message if the error is undefined', () => { diff --git a/packages/snaps-cli/src/utils/legacy.test.ts b/packages/snaps-cli/src/utils/legacy.test.ts index 0a79e558a8..0b2fb89160 100644 --- a/packages/snaps-cli/src/utils/legacy.test.ts +++ b/packages/snaps-cli/src/utils/legacy.test.ts @@ -1,11 +1,11 @@ import { getMockConfig } from '@metamask/snaps-cli/test-utils'; -import { TranspilationModes } from '../builders'; import { getDependencyRegExp, processDependencies, sanitizeDependencyPaths, } from './legacy'; +import { TranspilationModes } from '../builders'; describe('processDependencies', () => { it('returns an empty array when `transpilationMode` is not `localAndDeps`', () => { diff --git a/packages/snaps-cli/src/webpack/compiler.test.ts b/packages/snaps-cli/src/webpack/compiler.test.ts index c1776a8124..315f7afd77 100644 --- a/packages/snaps-cli/src/webpack/compiler.test.ts +++ b/packages/snaps-cli/src/webpack/compiler.test.ts @@ -2,8 +2,8 @@ import type { Configuration } from 'webpack'; import { Compiler } from 'webpack'; import merge from 'webpack-merge'; -import { getMockConfig } from '../test-utils'; import { getCompiler } from './compiler'; +import { getMockConfig } from '../test-utils'; jest.dontMock('fs'); jest.mock('serve-handler', () => diff --git a/packages/snaps-cli/src/webpack/compiler.ts b/packages/snaps-cli/src/webpack/compiler.ts index 40b3ace1bc..7f51b9b2a5 100644 --- a/packages/snaps-cli/src/webpack/compiler.ts +++ b/packages/snaps-cli/src/webpack/compiler.ts @@ -1,8 +1,8 @@ import { webpack } from 'webpack'; -import type { ProcessedWebpackConfig } from '../config'; import type { WebpackOptions } from './config'; import { getDefaultConfiguration } from './config'; +import type { ProcessedWebpackConfig } from '../config'; /** * Get a Webpack compiler for the given config. diff --git a/packages/snaps-cli/src/webpack/config.test.ts b/packages/snaps-cli/src/webpack/config.test.ts index afc7e27c7f..817708ffc4 100644 --- a/packages/snaps-cli/src/webpack/config.test.ts +++ b/packages/snaps-cli/src/webpack/config.test.ts @@ -2,8 +2,8 @@ import { promises as fs } from 'fs'; import ora from 'ora'; import { dirname } from 'path'; -import { getMockConfig, normalizeConfig } from '../test-utils'; import { getDefaultConfiguration } from './config'; +import { getMockConfig, normalizeConfig } from '../test-utils'; jest.mock('fs'); jest.mock('path', () => ({ diff --git a/packages/snaps-cli/src/webpack/config.ts b/packages/snaps-cli/src/webpack/config.ts index d377718e69..a3b85cdcaf 100644 --- a/packages/snaps-cli/src/webpack/config.ts +++ b/packages/snaps-cli/src/webpack/config.ts @@ -5,7 +5,6 @@ import TerserPlugin from 'terser-webpack-plugin'; import type { Configuration } from 'webpack'; import { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack'; -import type { ProcessedWebpackConfig } from '../config'; import { getFunctionLoader, wasm } from './loaders'; import { SnapsBuiltInResolver, @@ -22,6 +21,7 @@ import { getImageSVG, getProgressHandler, } from './utils'; +import type { ProcessedWebpackConfig } from '../config'; export type WebpackOptions = { /** diff --git a/packages/snaps-cli/src/webpack/loaders/function.ts b/packages/snaps-cli/src/webpack/loaders/function.ts index 3350448a2c..d0c944f289 100644 --- a/packages/snaps-cli/src/webpack/loaders/function.ts +++ b/packages/snaps-cli/src/webpack/loaders/function.ts @@ -18,7 +18,7 @@ export type FunctionLoaderOptions = { * @param content - The input file contents as a `Uint8Array`. * @returns The output of the function. */ -const loader: LoaderDefinitionFunction = function ( +const loader: LoaderDefinitionFunction = async function ( content, ) { const { fn } = this.getOptions(); diff --git a/packages/snaps-cli/src/webpack/plugins.test.ts b/packages/snaps-cli/src/webpack/plugins.test.ts index a59614a3ef..b5212b625a 100644 --- a/packages/snaps-cli/src/webpack/plugins.test.ts +++ b/packages/snaps-cli/src/webpack/plugins.test.ts @@ -4,14 +4,14 @@ import { promisify } from 'util'; import type { Compiler, Watching } from 'webpack'; import { WebpackError, ProvidePlugin } from 'webpack'; -import * as evalImplementation from '../commands/eval/implementation'; -import { compile, getCompiler } from '../test-utils'; import { SnapsBuiltInResolver, SnapsBundleWarningsPlugin, SnapsStatsPlugin, SnapsWatchPlugin, } from './plugins'; +import * as evalImplementation from '../commands/eval/implementation'; +import { compile, getCompiler } from '../test-utils'; jest.dontMock('fs'); jest.mock('../commands/eval/implementation'); diff --git a/packages/snaps-cli/src/webpack/plugins.ts b/packages/snaps-cli/src/webpack/plugins.ts index ca90580c7e..c3030a2a76 100644 --- a/packages/snaps-cli/src/webpack/plugins.ts +++ b/packages/snaps-cli/src/webpack/plugins.ts @@ -12,9 +12,9 @@ import type { } from 'webpack'; import { WebpackError } from 'webpack'; +import { formatText, pluralize } from './utils'; import { evaluate } from '../commands/eval'; import { error, getErrorMessage, info, warn } from '../utils'; -import { formatText, pluralize } from './utils'; export type SnapsStatsPluginOptions = { /** diff --git a/packages/snaps-cli/src/webpack/utils.test.ts b/packages/snaps-cli/src/webpack/utils.test.ts index 26a440f697..464c2d7ef6 100644 --- a/packages/snaps-cli/src/webpack/utils.test.ts +++ b/packages/snaps-cli/src/webpack/utils.test.ts @@ -1,7 +1,5 @@ import { dim } from 'chalk'; -import type { ProcessedWebpackConfig } from '../config'; -import { getMockConfig } from '../test-utils'; import { browserify } from './loaders'; import { WEBPACK_FALLBACKS, @@ -15,6 +13,8 @@ import { formatText, getImageSVG, } from './utils'; +import type { ProcessedWebpackConfig } from '../config'; +import { getMockConfig } from '../test-utils'; describe('getDefaultLoader', () => { it('returns the Browserify loader if `legacy` is set', async () => { diff --git a/packages/snaps-cli/src/webpack/utils.ts b/packages/snaps-cli/src/webpack/utils.ts index efe2dcfed1..2ea9a4b128 100644 --- a/packages/snaps-cli/src/webpack/utils.ts +++ b/packages/snaps-cli/src/webpack/utils.ts @@ -7,8 +7,8 @@ import { dirname, resolve } from 'path'; import stripAnsi from 'strip-ansi'; import type { Configuration } from 'webpack'; -import type { ProcessedWebpackConfig } from '../config'; import { browserify, getFunctionLoader } from './loaders'; +import type { ProcessedWebpackConfig } from '../config'; export const BROWSERSLIST_FILE = resolve( dirname( diff --git a/packages/snaps-controllers/src/cronjob/CronjobController.test.ts b/packages/snaps-controllers/src/cronjob/CronjobController.test.ts index a33f8ed9e7..e3e09164e9 100644 --- a/packages/snaps-controllers/src/cronjob/CronjobController.test.ts +++ b/packages/snaps-controllers/src/cronjob/CronjobController.test.ts @@ -5,12 +5,12 @@ import { MOCK_ORIGIN, MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; import type { SemVerVersion } from '@metamask/utils'; import { Duration, inMilliseconds } from '@metamask/utils'; +import { CronjobController } from './CronjobController'; import { getRestrictedCronjobControllerMessenger, getRootCronjobControllerMessenger, } from '../test-utils'; import { getCronjobPermission } from '../test-utils/cronjob'; -import { CronjobController } from './CronjobController'; const MOCK_VERSION = '1.0' as SemVerVersion; diff --git a/packages/snaps-controllers/src/insights/SnapInsightsController.test.ts b/packages/snaps-controllers/src/insights/SnapInsightsController.test.ts index 6068424080..028600b7c3 100644 --- a/packages/snaps-controllers/src/insights/SnapInsightsController.test.ts +++ b/packages/snaps-controllers/src/insights/SnapInsightsController.test.ts @@ -7,6 +7,7 @@ import { } from '@metamask/snaps-utils/test-utils'; import { nanoid } from 'nanoid'; +import { SnapInsightsController } from './SnapInsightsController'; import { getRestrictedSnapInsightsControllerMessenger, getRootSnapInsightsControllerMessenger, @@ -16,7 +17,6 @@ import { TYPED_SIGNATURE_MOCK, MOCK_INSIGHTS_PERMISSIONS_NO_ORIGINS, } from '../test-utils'; -import { SnapInsightsController } from './SnapInsightsController'; describe('SnapInsightsController', () => { it('adds insight for transactions', async () => { diff --git a/packages/snaps-controllers/src/interface/SnapInterfaceController.test.tsx b/packages/snaps-controllers/src/interface/SnapInterfaceController.test.tsx index 05400d3fdf..a54105ffcb 100644 --- a/packages/snaps-controllers/src/interface/SnapInterfaceController.test.tsx +++ b/packages/snaps-controllers/src/interface/SnapInterfaceController.test.tsx @@ -13,12 +13,12 @@ import { import { getJsxElementFromComponent } from '@metamask/snaps-utils'; import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; +import { SnapInterfaceController } from './SnapInterfaceController'; import { MockApprovalController, getRestrictedSnapInterfaceControllerMessenger, getRootSnapInterfaceControllerMessenger, } from '../test-utils'; -import { SnapInterfaceController } from './SnapInterfaceController'; describe('SnapInterfaceController', () => { describe('createInterface', () => { diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.test.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.test.ts index 49dc43740c..82cc62f154 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.test.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.test.ts @@ -3,9 +3,9 @@ import { HandlerType } from '@metamask/snaps-utils'; import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; import { Duration, inMilliseconds } from '@metamask/utils'; -import { createService } from '../test-utils'; import type { ExecutionServiceArgs } from './AbstractExecutionService'; import { NodeThreadExecutionService } from './node'; +import { createService } from '../test-utils'; class MockExecutionService extends NodeThreadExecutionService { constructor({ messenger, setupSnapProvider }: ExecutionServiceArgs) { diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.ts index 31c6e0d9cf..7b99557387 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.ts @@ -22,15 +22,15 @@ import { nanoid } from 'nanoid'; import { pipeline } from 'readable-stream'; import type { Duplex } from 'readable-stream'; -import { log } from '../logging'; -import { Timer } from '../snaps/Timer'; -import { hasTimedOut, withTimeout } from '../utils'; import type { ExecutionService, ExecutionServiceMessenger, SnapErrorJson, SnapExecutionData, } from './ExecutionService'; +import { log } from '../logging'; +import { Timer } from '../snaps/Timer'; +import { hasTimedOut, withTimeout } from '../utils'; const controllerName = 'ExecutionService'; diff --git a/packages/snaps-controllers/src/services/iframe/IframeExecutionService.test.browser.ts b/packages/snaps-controllers/src/services/iframe/IframeExecutionService.test.browser.ts index e81f4decf0..ede30e4d95 100644 --- a/packages/snaps-controllers/src/services/iframe/IframeExecutionService.test.browser.ts +++ b/packages/snaps-controllers/src/services/iframe/IframeExecutionService.test.browser.ts @@ -7,8 +7,8 @@ import { } from '@metamask/snaps-utils/test-utils'; import { assert } from '@metamask/utils'; -import { createService, MOCK_BLOCK_NUMBER } from '../../test-utils'; import { IframeExecutionService } from './IframeExecutionService'; +import { createService, MOCK_BLOCK_NUMBER } from '../../test-utils'; const IFRAME_URL = 'http://localhost:4567'; diff --git a/packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.test.ts b/packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.test.ts index ef8a72d52f..be8ed95747 100644 --- a/packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.test.ts +++ b/packages/snaps-controllers/src/services/node-js/NodeProcessExecutionService.test.ts @@ -1,10 +1,10 @@ import { JsonRpcError } from '@metamask/rpc-errors'; import { HandlerType } from '@metamask/snaps-utils'; +import { NodeProcessExecutionService } from './NodeProcessExecutionService'; import { createService, MOCK_BLOCK_NUMBER } from '../../test-utils'; import { delay } from '../../utils'; import type { SnapErrorJson } from '../ExecutionService'; -import { NodeProcessExecutionService } from './NodeProcessExecutionService'; const ON_RPC_REQUEST = HandlerType.OnRpcRequest; diff --git a/packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.test.ts b/packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.test.ts index 96431c08fd..e94c6dc9d5 100644 --- a/packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.test.ts +++ b/packages/snaps-controllers/src/services/node-js/NodeThreadExecutionService.test.ts @@ -1,10 +1,10 @@ import { JsonRpcError } from '@metamask/rpc-errors'; import { HandlerType } from '@metamask/snaps-utils'; +import { NodeThreadExecutionService } from './NodeThreadExecutionService'; import { createService, MOCK_BLOCK_NUMBER } from '../../test-utils'; import { delay } from '../../utils'; import type { SnapErrorJson } from '../ExecutionService'; -import { NodeThreadExecutionService } from './NodeThreadExecutionService'; const ON_RPC_REQUEST = HandlerType.OnRpcRequest; diff --git a/packages/snaps-controllers/src/services/offscreen/OffscreenExecutionService.test.ts b/packages/snaps-controllers/src/services/offscreen/OffscreenExecutionService.test.ts index 7554f97197..42cf616f1a 100644 --- a/packages/snaps-controllers/src/services/offscreen/OffscreenExecutionService.test.ts +++ b/packages/snaps-controllers/src/services/offscreen/OffscreenExecutionService.test.ts @@ -9,9 +9,9 @@ import { isPlainObject, } from '@metamask/utils'; +import { OffscreenExecutionService } from './OffscreenExecutionService'; import { createService } from '../../test-utils'; import { getMockedFunction } from '../../test-utils/mock'; -import { OffscreenExecutionService } from './OffscreenExecutionService'; const OFFSCREEN_PROMISE = Promise.resolve(); diff --git a/packages/snaps-controllers/src/services/webview/WebViewExecutionService.test.ts b/packages/snaps-controllers/src/services/webview/WebViewExecutionService.test.ts index dbce1a6073..60ed290786 100644 --- a/packages/snaps-controllers/src/services/webview/WebViewExecutionService.test.ts +++ b/packages/snaps-controllers/src/services/webview/WebViewExecutionService.test.ts @@ -5,10 +5,10 @@ import { import type { Json, JsonRpcRequest } from '@metamask/utils'; import { isJsonRpcRequest, isPlainObject } from '@metamask/utils'; -import { createService } from '../../test-utils'; -import { parseInjectedJS } from '../../test-utils/webview'; import { WebViewExecutionService } from './WebViewExecutionService'; import type { WebViewInterface } from './WebViewMessageStream'; +import { createService } from '../../test-utils'; +import { parseInjectedJS } from '../../test-utils/webview'; /** * Create a response message for the given request. This function assumes that diff --git a/packages/snaps-controllers/src/services/webview/WebViewExecutionService.ts b/packages/snaps-controllers/src/services/webview/WebViewExecutionService.ts index 1750abe341..e609643e5a 100644 --- a/packages/snaps-controllers/src/services/webview/WebViewExecutionService.ts +++ b/packages/snaps-controllers/src/services/webview/WebViewExecutionService.ts @@ -1,7 +1,7 @@ -import type { ExecutionServiceArgs } from '../AbstractExecutionService'; -import { ProxyExecutionService } from '../proxy/ProxyExecutionService'; import type { WebViewInterface } from './WebViewMessageStream'; import { WebViewMessageStream } from './WebViewMessageStream'; +import type { ExecutionServiceArgs } from '../AbstractExecutionService'; +import { ProxyExecutionService } from '../proxy/ProxyExecutionService'; export type WebViewExecutionServiceArgs = ExecutionServiceArgs & { getWebView: () => Promise; diff --git a/packages/snaps-controllers/src/services/webworker/WebWorkerExecutionService.test.browser.ts b/packages/snaps-controllers/src/services/webworker/WebWorkerExecutionService.test.browser.ts index a9eb5e5c71..5e663d4d1a 100644 --- a/packages/snaps-controllers/src/services/webworker/WebWorkerExecutionService.test.browser.ts +++ b/packages/snaps-controllers/src/services/webworker/WebWorkerExecutionService.test.browser.ts @@ -7,11 +7,11 @@ import { spy, } from '@metamask/snaps-utils/test-utils'; -import { createService, MOCK_BLOCK_NUMBER } from '../../test-utils'; import { WebWorkerExecutionService, WORKER_POOL_ID, } from './WebWorkerExecutionService'; +import { createService, MOCK_BLOCK_NUMBER } from '../../test-utils'; const WORKER_POOL_URL = 'http://localhost:4567/worker/pool'; diff --git a/packages/snaps-controllers/src/snaps/SnapController.test.tsx b/packages/snaps-controllers/src/snaps/SnapController.test.tsx index 42a235c95a..a48f3fb6ce 100644 --- a/packages/snaps-controllers/src/snaps/SnapController.test.tsx +++ b/packages/snaps-controllers/src/snaps/SnapController.test.tsx @@ -5,9 +5,9 @@ import { JsonRpcEngine, } from '@metamask/json-rpc-engine'; import { createEngineStream } from '@metamask/json-rpc-middleware-stream'; -import type { PermissionConstraint } from '@metamask/permission-controller'; -import { - SubjectType, +import { SubjectType } from '@metamask/permission-controller'; +import type { + PermissionConstraint, type Caveat, type SubjectPermissions, type ValidPermission, @@ -65,6 +65,14 @@ import fetchMock from 'jest-fetch-mock'; import { pipeline } from 'readable-stream'; import type { Duplex } from 'readable-stream'; +import { LEGACY_ENCRYPTION_KEY_DERIVATION_OPTIONS } from './constants'; +import { SnapsRegistryStatus } from './registry'; +import type { SnapControllerState } from './SnapController'; +import { + SNAP_APPROVAL_INSTALL, + SNAP_APPROVAL_RESULT, + SNAP_APPROVAL_UPDATE, +} from './SnapController'; import { setupMultiplex } from '../services'; import type { NodeThreadExecutionService } from '../services/node'; import { @@ -96,14 +104,6 @@ import { sleep, } from '../test-utils'; import { delay } from '../utils'; -import { LEGACY_ENCRYPTION_KEY_DERIVATION_OPTIONS } from './constants'; -import { SnapsRegistryStatus } from './registry'; -import type { SnapControllerState } from './SnapController'; -import { - SNAP_APPROVAL_INSTALL, - SNAP_APPROVAL_RESULT, - SNAP_APPROVAL_UPDATE, -} from './SnapController'; if (!('CryptoKey' in globalThis)) { // We can remove this once we drop Node 18 @@ -3869,7 +3869,7 @@ describe('SnapController', () => { // we need an rpc message handler function to be returned jest .spyOn(messenger, 'call') - .mockImplementation((method, ..._args: unknown[]) => { + .mockImplementation(async (method, ..._args: unknown[]) => { if (method === 'ExecutionService:executeSnap') { return deferredExecutePromise; } else if (method === 'ExecutionService:handleRpcRequest') { diff --git a/packages/snaps-controllers/src/snaps/SnapController.ts b/packages/snaps-controllers/src/snaps/SnapController.ts index 212f6986da..3496c0faae 100644 --- a/packages/snaps-controllers/src/snaps/SnapController.ts +++ b/packages/snaps-controllers/src/snaps/SnapController.ts @@ -105,6 +105,24 @@ import { createMachine, interpret } from '@xstate/fsm'; import type { Patch } from 'immer'; import { nanoid } from 'nanoid'; +import { + ALLOWED_PERMISSIONS, + LEGACY_ENCRYPTION_KEY_DERIVATION_OPTIONS, +} from './constants'; +import type { SnapLocation } from './location'; +import { detectSnapLocation } from './location'; +import type { + GetMetadata, + GetResult, + ResolveVersion, + SnapsRegistryInfo, + SnapsRegistryMetadata, + SnapsRegistryRequest, + Update, +} from './registry'; +import { SnapsRegistryStatus } from './registry'; +import { RequestQueue } from './RequestQueue'; +import { Timer } from './Timer'; import { forceStrict, validateMachine } from '../fsm'; import type { CreateInterface, GetInterface } from '../interface'; import { log } from '../logging'; @@ -116,8 +134,8 @@ import type { TerminateAllSnapsAction, TerminateSnapAction, } from '../services'; -import type { EncryptionResult } from '../types'; -import { +import type { + EncryptionResult, type ExportableKeyEncryptor, type KeyDerivationOptions, } from '../types'; @@ -128,24 +146,6 @@ import { setDiff, withTimeout, } from '../utils'; -import { - ALLOWED_PERMISSIONS, - LEGACY_ENCRYPTION_KEY_DERIVATION_OPTIONS, -} from './constants'; -import type { SnapLocation } from './location'; -import { detectSnapLocation } from './location'; -import type { - GetMetadata, - GetResult, - ResolveVersion, - SnapsRegistryInfo, - SnapsRegistryMetadata, - SnapsRegistryRequest, - Update, -} from './registry'; -import { SnapsRegistryStatus } from './registry'; -import { RequestQueue } from './RequestQueue'; -import { Timer } from './Timer'; export const controllerName = 'SnapController'; @@ -2867,7 +2867,7 @@ export class SnapController extends BaseController< initialConnections: manifest.result.initialConnections, initialPermissions: manifest.result.initialPermissions, manifest: manifest.result, - status: this.#statusMachine.config.initial as StatusStates['value'], + status: this.#statusMachine.config.initial, sourceCode, version, versionHistory, @@ -3501,9 +3501,7 @@ export class SnapController extends BaseController< const interpreter = interpret(this.#statusMachine); interpreter.start({ context: { snapId }, - value: - snap?.status ?? - (this.#statusMachine.config.initial as StatusStates['value']), + value: snap?.status ?? this.#statusMachine.config.initial, }); forceStrict(interpreter); diff --git a/packages/snaps-controllers/src/snaps/registry/json.test.ts b/packages/snaps-controllers/src/snaps/registry/json.test.ts index b31afd1f78..9ffbc10f23 100644 --- a/packages/snaps-controllers/src/snaps/registry/json.test.ts +++ b/packages/snaps-controllers/src/snaps/registry/json.test.ts @@ -6,10 +6,10 @@ import { import type { SemVerRange, SemVerVersion } from '@metamask/utils'; import fetchMock from 'jest-fetch-mock'; -import { getRestrictedSnapsRegistryControllerMessenger } from '../../test-utils'; import type { JsonSnapsRegistryArgs } from './json'; import { JsonSnapsRegistry } from './json'; import { SnapsRegistryStatus } from './registry'; +import { getRestrictedSnapsRegistryControllerMessenger } from '../../test-utils'; // Public key for the private key: // `0x541c6759fd86c69eceb8d792d7174623db139d81a5b560aa026afcb2dd1bb21c`. diff --git a/packages/snaps-controllers/src/test-utils/controller.ts b/packages/snaps-controllers/src/test-utils/controller.ts index bcb7e27708..d4a02e5f5b 100644 --- a/packages/snaps-controllers/src/test-utils/controller.ts +++ b/packages/snaps-controllers/src/test-utils/controller.ts @@ -34,6 +34,9 @@ import { } from '@metamask/snaps-utils/test-utils'; import type { Json } from '@metamask/utils'; +import { MOCK_CRONJOB_PERMISSION } from './cronjob'; +import { getNodeEES, getNodeEESMessenger } from './execution-environment'; +import { MockSnapsRegistry } from './registry'; import type { CronjobControllerActions, CronjobControllerEvents, @@ -58,9 +61,6 @@ import type { } from '../snaps'; import { SnapController } from '../snaps'; import type { KeyDerivationOptions } from '../types'; -import { MOCK_CRONJOB_PERMISSION } from './cronjob'; -import { getNodeEES, getNodeEESMessenger } from './execution-environment'; -import { MockSnapsRegistry } from './registry'; const asyncNoOp = async () => Promise.resolve(); diff --git a/packages/snaps-controllers/src/test-utils/service.ts b/packages/snaps-controllers/src/test-utils/service.ts index 90f150b493..25c86aab3a 100644 --- a/packages/snaps-controllers/src/test-utils/service.ts +++ b/packages/snaps-controllers/src/test-utils/service.ts @@ -5,9 +5,9 @@ import { logError } from '@metamask/snaps-utils'; import { pipeline } from 'readable-stream'; import type { Duplex } from 'readable-stream'; +import { MOCK_BLOCK_NUMBER } from './execution-environment'; import type { ErrorMessageEvent } from '../services'; import { setupMultiplex } from '../services'; -import { MOCK_BLOCK_NUMBER } from './execution-environment'; export const createService = < Service extends new (...args: any[]) => InstanceType, diff --git a/packages/snaps-controllers/src/utils.test.ts b/packages/snaps-controllers/src/utils.test.ts index 2abc7b8974..26e1a802cf 100644 --- a/packages/snaps-controllers/src/utils.test.ts +++ b/packages/snaps-controllers/src/utils.test.ts @@ -5,7 +5,6 @@ import { } from '@metamask/snaps-utils/test-utils'; import { assert } from '@metamask/utils'; -import { SnapEndowments } from '../../snaps-rpc-methods/src/endowments'; import { LoopbackLocation, MOCK_ALLOWED_RPC_ORIGINS_PERMISSION, @@ -15,6 +14,7 @@ import { MOCK_SNAP_DIALOG_PERMISSION, } from './test-utils'; import { getSnapFiles, permissionsDiff, setDiff } from './utils'; +import { SnapEndowments } from '../../snaps-rpc-methods/src/endowments'; describe('setDiff', () => { it('does nothing on empty type {}-B', () => { diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index d66cddcf99..16cc4c8da3 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -35,7 +35,6 @@ import { } from '@metamask/utils'; import type { Duplex } from 'readable-stream'; -import { log } from '../logging'; import type { CommandMethodsMapping } from './commands'; import { getCommandMethodImplementations } from './commands'; import { createEndowments } from './endowments'; @@ -55,6 +54,7 @@ import { SnapRpcRequestArgumentsStruct, TerminateRequestArgumentsStruct, } from './validation'; +import { log } from '../logging'; type EvaluationData = { stop: () => void; diff --git a/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts b/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts index b05678de65..c1f1a9e25e 100644 --- a/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts +++ b/packages/snaps-execution-environments/src/common/endowments/commonEndowmentFactory.ts @@ -1,5 +1,3 @@ -import type { NotifyFunction } from '../BaseSnapExecutor'; -import { rootRealmGlobal } from '../globalObject'; import consoleEndowment from './console'; import crypto from './crypto'; import date from './date'; @@ -9,6 +7,8 @@ import network from './network'; import textDecoder from './textDecoder'; import textEncoder from './textEncoder'; import timeout from './timeout'; +import type { NotifyFunction } from '../BaseSnapExecutor'; +import { rootRealmGlobal } from '../globalObject'; export type EndowmentFactoryOptions = { snapId?: string; diff --git a/packages/snaps-execution-environments/src/common/endowments/console.test.ts b/packages/snaps-execution-environments/src/common/endowments/console.test.ts index d4c242d95c..61f628dcac 100644 --- a/packages/snaps-execution-environments/src/common/endowments/console.test.ts +++ b/packages/snaps-execution-environments/src/common/endowments/console.test.ts @@ -1,10 +1,10 @@ import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; -import { rootRealmGlobal } from '../globalObject'; import consoleEndowment, { consoleAttenuatedMethods, consoleMethods, } from './console'; +import { rootRealmGlobal } from '../globalObject'; describe('Console endowment', () => { it('has expected properties', () => { diff --git a/packages/snaps-execution-environments/src/common/endowments/console.ts b/packages/snaps-execution-environments/src/common/endowments/console.ts index 49f3ac294f..dd3c394bda 100644 --- a/packages/snaps-execution-environments/src/common/endowments/console.ts +++ b/packages/snaps-execution-environments/src/common/endowments/console.ts @@ -1,7 +1,7 @@ import { assert } from '@metamask/utils'; -import { rootRealmGlobal } from '../globalObject'; import type { EndowmentFactoryOptions } from './commonEndowmentFactory'; +import { rootRealmGlobal } from '../globalObject'; export const consoleAttenuatedMethods = new Set([ 'log', diff --git a/packages/snaps-execution-environments/src/common/endowments/date.test.ts b/packages/snaps-execution-environments/src/common/endowments/date.test.ts index ecb4778a44..4b23773853 100644 --- a/packages/snaps-execution-environments/src/common/endowments/date.test.ts +++ b/packages/snaps-execution-environments/src/common/endowments/date.test.ts @@ -1,5 +1,5 @@ -import { rootRealmGlobal } from '../globalObject'; import date from './date'; +import { rootRealmGlobal } from '../globalObject'; describe('Date endowment', () => { beforeEach(() => { diff --git a/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts b/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts index 888ce0070d..ad1ab5fe22 100644 --- a/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts +++ b/packages/snaps-execution-environments/src/common/endowments/endowments.test.browser.ts @@ -4,8 +4,6 @@ import 'ses'; import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; -import { walkAndSearch } from '../test-utils/endowments'; -import { testEndowmentHardening } from '../test-utils/hardening'; import buildCommonEndowments from './commonEndowmentFactory'; import consoleEndowment from './console'; import CryptoEndowment from './crypto'; @@ -14,6 +12,8 @@ import interval from './interval'; import math from './math'; import network from './network'; import timeout from './timeout'; +import { walkAndSearch } from '../test-utils/endowments'; +import { testEndowmentHardening } from '../test-utils/hardening'; // @ts-expect-error - `globalThis.process` is not optional. delete globalThis.process; diff --git a/packages/snaps-execution-environments/src/common/endowments/index.ts b/packages/snaps-execution-environments/src/common/endowments/index.ts index 92f4b62f60..1fb8beb2c4 100644 --- a/packages/snaps-execution-environments/src/common/endowments/index.ts +++ b/packages/snaps-execution-environments/src/common/endowments/index.ts @@ -4,10 +4,10 @@ import type { SnapsProvider } from '@metamask/snaps-sdk'; import { logWarning } from '@metamask/snaps-utils'; import { hasProperty } from '@metamask/utils'; -import type { NotifyFunction } from '../BaseSnapExecutor'; -import { rootRealmGlobal } from '../globalObject'; import type { EndowmentFactoryOptions } from './commonEndowmentFactory'; import buildCommonEndowments from './commonEndowmentFactory'; +import type { NotifyFunction } from '../BaseSnapExecutor'; +import { rootRealmGlobal } from '../globalObject'; type EndowmentFactoryResult = { /** @@ -123,7 +123,7 @@ export function createEndowments({ const teardown = async () => { await Promise.all( - result.teardowns.map((teardownFunction) => teardownFunction()), + result.teardowns.map(async (teardownFunction) => teardownFunction()), ); }; return { endowments: result.allEndowments, teardown }; diff --git a/packages/snaps-execution-environments/src/common/endowments/math.test.ts b/packages/snaps-execution-environments/src/common/endowments/math.test.ts index f454d10ba2..8a06fb5761 100644 --- a/packages/snaps-execution-environments/src/common/endowments/math.test.ts +++ b/packages/snaps-execution-environments/src/common/endowments/math.test.ts @@ -1,5 +1,5 @@ -import { rootRealmGlobal } from '../globalObject'; import math from './math'; +import { rootRealmGlobal } from '../globalObject'; describe('Math endowment', () => { it('has expected properties', () => { diff --git a/packages/snaps-execution-environments/src/common/endowments/math.ts b/packages/snaps-execution-environments/src/common/endowments/math.ts index 794b251127..06f8d3970f 100644 --- a/packages/snaps-execution-environments/src/common/endowments/math.ts +++ b/packages/snaps-execution-environments/src/common/endowments/math.ts @@ -1,5 +1,5 @@ -import { rootRealmGlobal } from '../globalObject'; import { createCrypto } from './crypto'; +import { rootRealmGlobal } from '../globalObject'; /** * Create a {@link Math} object, with the same properties as the global diff --git a/packages/snaps-execution-environments/src/common/endowments/network.ts b/packages/snaps-execution-environments/src/common/endowments/network.ts index 7dccdf47f5..3c4ce0d4e2 100644 --- a/packages/snaps-execution-environments/src/common/endowments/network.ts +++ b/packages/snaps-execution-environments/src/common/endowments/network.ts @@ -1,7 +1,7 @@ import { assert } from '@metamask/utils'; -import { withTeardown } from '../utils'; import type { EndowmentFactoryOptions } from './commonEndowmentFactory'; +import { withTeardown } from '../utils'; /** * This class wraps a Response object. diff --git a/packages/snaps-execution-environments/src/common/test-utils/endowments.ts b/packages/snaps-execution-environments/src/common/test-utils/endowments.ts index 63baeb8379..96c0de3199 100644 --- a/packages/snaps-execution-environments/src/common/test-utils/endowments.ts +++ b/packages/snaps-execution-environments/src/common/test-utils/endowments.ts @@ -6,12 +6,12 @@ import { StreamProvider } from '@metamask/providers'; import type { RequestArguments } from '@metamask/providers/dist/BaseProvider'; import { SNAP_STREAM_NAMES } from '@metamask/snaps-utils'; +import { SILENT_LOGGER } from './logger'; import { assertEthereumOutboundRequest, proxyStreamProvider, withTeardown, } from '../utils'; -import { SILENT_LOGGER } from './logger'; /** * Object walker test utility function. diff --git a/packages/snaps-execution-environments/src/iframe/index.ts b/packages/snaps-execution-environments/src/iframe/index.ts index 83416afbfe..5193f76bd1 100644 --- a/packages/snaps-execution-environments/src/iframe/index.ts +++ b/packages/snaps-execution-environments/src/iframe/index.ts @@ -1,6 +1,6 @@ +import { IFrameSnapExecutor } from './IFrameSnapExecutor'; import { executeLockdownEvents } from '../common/lockdown/lockdown-events'; import { executeLockdownMore } from '../common/lockdown/lockdown-more'; -import { IFrameSnapExecutor } from './IFrameSnapExecutor'; // Lockdown is already applied in LavaMoat executeLockdownMore(); diff --git a/packages/snaps-execution-environments/src/node-process/index.ts b/packages/snaps-execution-environments/src/node-process/index.ts index 171c6e5bef..1ec3edf37d 100644 --- a/packages/snaps-execution-environments/src/node-process/index.ts +++ b/packages/snaps-execution-environments/src/node-process/index.ts @@ -1,5 +1,5 @@ -import { executeLockdownMore } from '../common/lockdown/lockdown-more'; import { ChildProcessSnapExecutor } from './ChildProcessSnapExecutor'; +import { executeLockdownMore } from '../common/lockdown/lockdown-more'; // Lockdown is already applied in LavaMoat executeLockdownMore(); diff --git a/packages/snaps-execution-environments/src/node-thread/index.ts b/packages/snaps-execution-environments/src/node-thread/index.ts index 377292dfb1..b1ef1da26c 100644 --- a/packages/snaps-execution-environments/src/node-thread/index.ts +++ b/packages/snaps-execution-environments/src/node-thread/index.ts @@ -1,5 +1,5 @@ -import { executeLockdownMore } from '../common/lockdown/lockdown-more'; import { ThreadSnapExecutor } from './ThreadSnapExecutor'; +import { executeLockdownMore } from '../common/lockdown/lockdown-more'; // Lockdown is already applied in LavaMoat executeLockdownMore(); diff --git a/packages/snaps-execution-environments/src/webview/index.ts b/packages/snaps-execution-environments/src/webview/index.ts index 4db0d3f11c..4fdd253291 100644 --- a/packages/snaps-execution-environments/src/webview/index.ts +++ b/packages/snaps-execution-environments/src/webview/index.ts @@ -1,7 +1,7 @@ +import { WebViewExecutorStream } from './WebViewExecutorStream'; import { executeLockdownEvents } from '../common/lockdown/lockdown-events'; import { executeLockdownMore } from '../common/lockdown/lockdown-more'; import { ProxySnapExecutor } from '../proxy/ProxySnapExecutor'; -import { WebViewExecutorStream } from './WebViewExecutorStream'; // Lockdown is already applied in LavaMoat executeLockdownMore(); diff --git a/packages/snaps-execution-environments/src/webworker/executor/index.ts b/packages/snaps-execution-environments/src/webworker/executor/index.ts index fed53265c6..ec8f55ee81 100644 --- a/packages/snaps-execution-environments/src/webworker/executor/index.ts +++ b/packages/snaps-execution-environments/src/webworker/executor/index.ts @@ -1,6 +1,6 @@ +import { WebWorkerSnapExecutor } from './WebWorkerSnapExecutor'; import { executeLockdownEvents } from '../../common/lockdown/lockdown-events'; import { executeLockdownMore } from '../../common/lockdown/lockdown-more'; -import { WebWorkerSnapExecutor } from './WebWorkerSnapExecutor'; // Lockdown is already applied in LavaMoat executeLockdownMore(); diff --git a/packages/snaps-execution-environments/src/webworker/pool/index.ts b/packages/snaps-execution-environments/src/webworker/pool/index.ts index 78e21d384e..7d85d1c642 100644 --- a/packages/snaps-execution-environments/src/webworker/pool/index.ts +++ b/packages/snaps-execution-environments/src/webworker/pool/index.ts @@ -1,6 +1,6 @@ +import { WebWorkerPool } from './WebWorkerPool'; import { executeLockdownEvents } from '../../common/lockdown/lockdown-events'; import { executeLockdownMore } from '../../common/lockdown/lockdown-more'; -import { WebWorkerPool } from './WebWorkerPool'; // Lockdown is already applied in LavaMoat executeLockdownMore(); diff --git a/packages/snaps-jest/src/helpers.ts b/packages/snaps-jest/src/helpers.ts index 4c6c8f454a..ec57cb8675 100644 --- a/packages/snaps-jest/src/helpers.ts +++ b/packages/snaps-jest/src/helpers.ts @@ -343,7 +343,7 @@ export async function installSnap< return response; }; - const onCronjob = (request: CronjobOptions) => { + const onCronjob = async (request: CronjobOptions) => { log('Running cronjob %o.', options); return handleRequest({ @@ -358,7 +358,7 @@ export async function installSnap< }; return { - request: (request) => { + request: async (request) => { log('Sending request %o.', request); return handleRequest({ diff --git a/packages/snaps-jest/src/internals/request.test.tsx b/packages/snaps-jest/src/internals/request.test.tsx index ff830deba2..be450f47cc 100644 --- a/packages/snaps-jest/src/internals/request.test.tsx +++ b/packages/snaps-jest/src/internals/request.test.tsx @@ -5,18 +5,18 @@ import { Dropdown, Option } from '@metamask/snaps-sdk/jsx'; import { getJsxElementFromComponent, HandlerType } from '@metamask/snaps-utils'; import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; -import { - getMockServer, - getRestrictedSnapInterfaceControllerMessenger, - getRootControllerMessenger, -} from '../test-utils'; -import type { SnapResponseWithInterface } from '../types'; import { getInterfaceApi, getInterfaceFromResult, handleRequest, } from './request'; import { handleInstallSnap } from './simulation'; +import { + getMockServer, + getRestrictedSnapInterfaceControllerMessenger, + getRootControllerMessenger, +} from '../test-utils'; +import type { SnapResponseWithInterface } from '../types'; describe('handleRequest', () => { it('sends a JSON-RPC request and returns the response', async () => { diff --git a/packages/snaps-jest/src/internals/request.ts b/packages/snaps-jest/src/internals/request.ts index 95f8e6d808..304d514e75 100644 --- a/packages/snaps-jest/src/internals/request.ts +++ b/packages/snaps-jest/src/internals/request.ts @@ -16,11 +16,6 @@ import { } from '@metamask/utils'; import { nanoid } from '@reduxjs/toolkit'; -import type { - RequestOptions, - SnapHandlerInterface, - SnapRequest, -} from '../types'; import type { RunSagaFunction, Store } from './simulation'; import { clearNotifications, @@ -30,6 +25,11 @@ import { } from './simulation'; import type { RootControllerMessenger } from './simulation/controllers'; import { SnapResponseStruct } from './structs'; +import type { + RequestOptions, + SnapHandlerInterface, + SnapRequest, +} from '../types'; export type HandleRequestOptions = { snapId: SnapId; diff --git a/packages/snaps-jest/src/internals/server.ts b/packages/snaps-jest/src/internals/server.ts index 5ce77d2104..5d6493cba1 100644 --- a/packages/snaps-jest/src/internals/server.ts +++ b/packages/snaps-jest/src/internals/server.ts @@ -11,8 +11,8 @@ import type { Server } from 'http'; import { createServer } from 'http'; import { resolve as pathResolve } from 'path'; -import type { SnapsEnvironmentOptions } from '../options'; import { rootLogger } from './logger'; +import type { SnapsEnvironmentOptions } from '../options'; export type ServerOptions = Required< // We need a double `Required` for the type to be inferred correctly. diff --git a/packages/snaps-jest/src/internals/simulation/controllers.test.ts b/packages/snaps-jest/src/internals/simulation/controllers.test.ts index 968e5d8a9c..2df9d56759 100644 --- a/packages/snaps-jest/src/internals/simulation/controllers.test.ts +++ b/packages/snaps-jest/src/internals/simulation/controllers.test.ts @@ -4,9 +4,9 @@ import { SubjectMetadataController, } from '@metamask/permission-controller'; -import { getMockOptions } from '../../test-utils/options'; import { getControllers } from './controllers'; import type { MiddlewareHooks } from './simulation'; +import { getMockOptions } from '../../test-utils/options'; const MOCK_HOOKS: MiddlewareHooks = { getIsLocked: jest.fn(), diff --git a/packages/snaps-jest/src/internals/simulation/interface.test.tsx b/packages/snaps-jest/src/internals/simulation/interface.test.tsx index a177b647c1..5eb8f7c23b 100644 --- a/packages/snaps-jest/src/internals/simulation/interface.test.tsx +++ b/packages/snaps-jest/src/internals/simulation/interface.test.tsx @@ -32,6 +32,19 @@ import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; import type { SagaIterator } from 'redux-saga'; import { take } from 'redux-saga/effects'; +import { + clickElement, + getElement, + getInterface, + getInterfaceResponse, + mergeValue, + resolveWithSaga, + selectInDropdown, + typeInField, + uploadFile, +} from './interface'; +import type { RunSagaFunction } from './store'; +import { createStore, resolveInterface, setInterface } from './store'; import { assertIsAlertDialog, assertIsConfirmationDialog, @@ -46,19 +59,6 @@ import { getRestrictedSnapInterfaceControllerMessenger, getRootControllerMessenger, } from '../../test-utils'; -import { - clickElement, - getElement, - getInterface, - getInterfaceResponse, - mergeValue, - resolveWithSaga, - selectInDropdown, - typeInField, - uploadFile, -} from './interface'; -import type { RunSagaFunction } from './store'; -import { createStore, resolveInterface, setInterface } from './store'; /** * Wait for the `resolveInterface` action to be dispatched and return the diff --git a/packages/snaps-jest/src/internals/simulation/interface.ts b/packages/snaps-jest/src/internals/simulation/interface.ts index e3d529391f..d53dc5a3ae 100644 --- a/packages/snaps-jest/src/internals/simulation/interface.ts +++ b/packages/snaps-jest/src/internals/simulation/interface.ts @@ -9,8 +9,11 @@ import type { File, } from '@metamask/snaps-sdk'; import { DialogType, UserInputEventType, assert } from '@metamask/snaps-sdk'; -import type { FooterElement } from '@metamask/snaps-sdk/jsx'; -import { type FormElement, type JSXElement } from '@metamask/snaps-sdk/jsx'; +import type { + FooterElement, + type FormElement, + type JSXElement, +} from '@metamask/snaps-sdk/jsx'; import { HandlerType, getJsxChildren, @@ -22,15 +25,15 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { type SagaIterator } from 'redux-saga'; import { call, put, select, take } from 'redux-saga/effects'; +import type { RootControllerMessenger } from './controllers'; +import { getFileSize, getFileToUpload } from './files'; +import type { Interface, RunSagaFunction } from './store'; +import { getCurrentInterface, resolveInterface, setInterface } from './store'; import type { FileOptions, SnapInterface, SnapInterfaceActions, } from '../../types'; -import type { RootControllerMessenger } from './controllers'; -import { getFileSize, getFileToUpload } from './files'; -import type { Interface, RunSagaFunction } from './store'; -import { getCurrentInterface, resolveInterface, setInterface } from './store'; /** * The maximum file size that can be uploaded. diff --git a/packages/snaps-jest/src/internals/simulation/methods/hooks/get-locale.test.ts b/packages/snaps-jest/src/internals/simulation/methods/hooks/get-locale.test.ts index 3c8c18acb0..afd7ea60cb 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/hooks/get-locale.test.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/hooks/get-locale.test.ts @@ -1,5 +1,5 @@ -import { getMockOptions } from '../../../../test-utils/options'; import { getGetLocaleMethodImplementation } from './get-locale'; +import { getMockOptions } from '../../../../test-utils/options'; describe('getGetLocaleMethodImplementation', () => { it('returns the implementation of the `getLocale` hook', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/methods/hooks/interface.test.ts b/packages/snaps-jest/src/internals/simulation/methods/hooks/interface.test.ts index a08ee12186..6b8d5a7980 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/hooks/interface.test.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/hooks/interface.test.ts @@ -3,14 +3,14 @@ import { text } from '@metamask/snaps-sdk'; import { getJsxElementFromComponent } from '@metamask/snaps-utils'; import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; -import { - getRestrictedSnapInterfaceControllerMessenger, - getRootControllerMessenger, -} from '../../../../test-utils'; import { getCreateInterfaceImplementation, getGetInterfaceImplementation, } from './interface'; +import { + getRestrictedSnapInterfaceControllerMessenger, + getRootControllerMessenger, +} from '../../../../test-utils'; describe('getCreateInterfaceImplementation', () => { it('returns the implementation of the `createInterface` hook', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/methods/hooks/notifications.test.ts b/packages/snaps-jest/src/internals/simulation/methods/hooks/notifications.test.ts index 4c6c739596..85278cc95d 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/hooks/notifications.test.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/hooks/notifications.test.ts @@ -1,11 +1,11 @@ import { NotificationType } from '@metamask/snaps-sdk'; -import { getMockOptions } from '../../../../test-utils'; -import { createStore } from '../../store'; import { getShowInAppNotificationImplementation, getShowNativeNotificationImplementation, } from './notifications'; +import { getMockOptions } from '../../../../test-utils'; +import { createStore } from '../../store'; describe('getShowNativeNotificationImplementation', () => { it('returns the implementation of the `showNativeNotification` hook', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/methods/hooks/request-user-approval.test.ts b/packages/snaps-jest/src/internals/simulation/methods/hooks/request-user-approval.test.ts index b04731551d..03d86a89f0 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/hooks/request-user-approval.test.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/hooks/request-user-approval.test.ts @@ -1,9 +1,9 @@ import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import { DialogType } from '@metamask/snaps-sdk'; +import { getRequestUserApprovalImplementation } from './request-user-approval'; import { getMockOptions } from '../../../../test-utils'; import { createStore, resolveInterface } from '../../store'; -import { getRequestUserApprovalImplementation } from './request-user-approval'; describe('getShowUserApprovalImplementation', () => { it('returns the implementation of the `requestUserApproval` hook', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/methods/hooks/state.test.ts b/packages/snaps-jest/src/internals/simulation/methods/hooks/state.test.ts index 7218b242e0..807eef4e89 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/hooks/state.test.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/hooks/state.test.ts @@ -1,12 +1,12 @@ import { MOCK_SNAP_ID } from '@metamask/snaps-utils/test-utils'; -import { getMockOptions } from '../../../../test-utils'; -import { createStore, getState, setState } from '../../store'; import { getClearSnapStateMethodImplementation, getGetSnapStateMethodImplementation, getUpdateSnapStateMethodImplementation, } from './state'; +import { getMockOptions } from '../../../../test-utils'; +import { createStore, getState, setState } from '../../store'; describe('getGetSnapStateMethodImplementation', () => { it('returns the implementation of the `getSnapState` hook', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/methods/specifications.test.ts b/packages/snaps-jest/src/internals/simulation/methods/specifications.test.ts index fe851d21f4..cb771936b3 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/specifications.test.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/specifications.test.ts @@ -4,15 +4,15 @@ import { MOCK_SNAP_ID, } from '@metamask/snaps-utils/test-utils'; -import { getMockOptions } from '../../../test-utils/options'; -import { getControllers, registerSnap } from '../controllers'; -import type { MiddlewareHooks } from '../simulation'; import { asyncResolve, getEndowments, getPermissionSpecifications, resolve, } from './specifications'; +import { getMockOptions } from '../../../test-utils/options'; +import { getControllers, registerSnap } from '../controllers'; +import type { MiddlewareHooks } from '../simulation'; const MOCK_HOOKS: MiddlewareHooks = { getMnemonic: jest.fn(), diff --git a/packages/snaps-jest/src/internals/simulation/methods/specifications.ts b/packages/snaps-jest/src/internals/simulation/methods/specifications.ts index e07865f3ed..07e01948ac 100644 --- a/packages/snaps-jest/src/internals/simulation/methods/specifications.ts +++ b/packages/snaps-jest/src/internals/simulation/methods/specifications.ts @@ -7,9 +7,6 @@ import { import type { SnapId } from '@metamask/snaps-sdk'; import { DEFAULT_ENDOWMENTS } from '@metamask/snaps-utils'; -import type { RootControllerMessenger } from '../controllers'; -import type { SimulationOptions } from '../options'; -import type { RunSagaFunction } from '../store'; import { EXCLUDED_SNAP_ENDOWMENTS, EXCLUDED_SNAP_PERMISSIONS, @@ -25,6 +22,9 @@ import { getGetInterfaceImplementation, getRequestUserApprovalImplementation, } from './hooks'; +import type { RootControllerMessenger } from '../controllers'; +import type { SimulationOptions } from '../options'; +import type { RunSagaFunction } from '../store'; export type PermissionSpecificationsHooks = { /** diff --git a/packages/snaps-jest/src/internals/simulation/middleware/engine.test.ts b/packages/snaps-jest/src/internals/simulation/middleware/engine.test.ts index e55ac0c7d4..f64d58558f 100644 --- a/packages/snaps-jest/src/internals/simulation/middleware/engine.test.ts +++ b/packages/snaps-jest/src/internals/simulation/middleware/engine.test.ts @@ -1,6 +1,6 @@ +import { createJsonRpcEngine } from './engine'; import { getMockOptions } from '../../../test-utils'; import { createStore } from '../store'; -import { createJsonRpcEngine } from './engine'; describe('createJsonRpcEngine', () => { it('creates a JSON-RPC engine', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/middleware/engine.ts b/packages/snaps-jest/src/internals/simulation/middleware/engine.ts index 026a8c7590..274b9f51aa 100644 --- a/packages/snaps-jest/src/internals/simulation/middleware/engine.ts +++ b/packages/snaps-jest/src/internals/simulation/middleware/engine.ts @@ -5,11 +5,11 @@ import type { RestrictedMethodParameters } from '@metamask/permission-controller import { createSnapsMethodMiddleware } from '@metamask/snaps-rpc-methods'; import type { Json } from '@metamask/utils'; +import { createInternalMethodsMiddleware } from './internal-methods'; +import { createMockMiddleware } from './mock'; import { DEFAULT_JSON_RPC_ENDPOINT } from '../constants'; import type { MiddlewareHooks } from '../simulation'; import type { Store } from '../store'; -import { createInternalMethodsMiddleware } from './internal-methods'; -import { createMockMiddleware } from './mock'; export type CreateJsonRpcEngineOptions = { store: Store; diff --git a/packages/snaps-jest/src/internals/simulation/middleware/internal-methods/account.test.ts b/packages/snaps-jest/src/internals/simulation/middleware/internal-methods/account.test.ts index f6101a1727..0f719e68d4 100644 --- a/packages/snaps-jest/src/internals/simulation/middleware/internal-methods/account.test.ts +++ b/packages/snaps-jest/src/internals/simulation/middleware/internal-methods/account.test.ts @@ -1,8 +1,8 @@ import { mnemonicPhraseToBytes } from '@metamask/key-tree'; import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { DEFAULT_SRP } from '../../constants'; import { getAccountsHandler } from './accounts'; +import { DEFAULT_SRP } from '../../constants'; describe('getAccountsHandler', () => { it('returns the first address for the selected secret recovery phrase', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/middleware/mock.test.ts b/packages/snaps-jest/src/internals/simulation/middleware/mock.test.ts index 576c6f4eba..d1c16dfd10 100644 --- a/packages/snaps-jest/src/internals/simulation/middleware/mock.test.ts +++ b/packages/snaps-jest/src/internals/simulation/middleware/mock.test.ts @@ -1,9 +1,9 @@ import { JsonRpcEngine } from '@metamask/json-rpc-engine'; +import { createMockMiddleware } from './mock'; import { getMockOptions } from '../../../test-utils'; import { createStore } from '../store'; import { addJsonRpcMock } from '../store/mocks'; -import { createMockMiddleware } from './mock'; describe('createMockMiddleware', () => { it('mocks a JSON-RPC method', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/simulation.test.ts b/packages/snaps-jest/src/internals/simulation/simulation.test.ts index 5482742032..d6117e9c79 100644 --- a/packages/snaps-jest/src/internals/simulation/simulation.test.ts +++ b/packages/snaps-jest/src/internals/simulation/simulation.test.ts @@ -10,15 +10,15 @@ import { AuxiliaryFileEncoding, text } from '@metamask/snaps-sdk'; import { VirtualFile } from '@metamask/snaps-utils'; import { getSnapManifest } from '@metamask/snaps-utils/test-utils'; +import { DEFAULT_SRP } from './constants'; +import { getHooks, handleInstallSnap, registerActions } from './simulation'; +import { createStore, setInterface } from './store'; import { getMockOptions, getMockServer, getRestrictedSnapInterfaceControllerMessenger, getRootControllerMessenger, } from '../../test-utils'; -import { DEFAULT_SRP } from './constants'; -import { getHooks, handleInstallSnap, registerActions } from './simulation'; -import { createStore, setInterface } from './store'; describe('handleInstallSnap', () => { it('installs a Snap and returns the execution service', async () => { diff --git a/packages/snaps-jest/src/internals/simulation/store/store.test.ts b/packages/snaps-jest/src/internals/simulation/store/store.test.ts index 974b77bdea..9dcb02777a 100644 --- a/packages/snaps-jest/src/internals/simulation/store/store.test.ts +++ b/packages/snaps-jest/src/internals/simulation/store/store.test.ts @@ -1,5 +1,5 @@ -import { getMockOptions } from '../../../test-utils'; import { createStore } from './store'; +import { getMockOptions } from '../../../test-utils'; describe('createStore', () => { it('creates a Redux store', () => { diff --git a/packages/snaps-jest/src/internals/simulation/store/store.ts b/packages/snaps-jest/src/internals/simulation/store/store.ts index 20d3780d9a..b2f6f49af4 100644 --- a/packages/snaps-jest/src/internals/simulation/store/store.ts +++ b/packages/snaps-jest/src/internals/simulation/store/store.ts @@ -1,11 +1,11 @@ import { configureStore } from '@reduxjs/toolkit'; import createSagaMiddleware from 'redux-saga'; -import type { SimulationOptions } from '../options'; import { mocksSlice } from './mocks'; import { notificationsSlice } from './notifications'; import { setState, stateSlice } from './state'; import { uiSlice } from './ui'; +import type { SimulationOptions } from '../options'; /** * Create a Redux store. diff --git a/packages/snaps-jest/src/matchers.ts b/packages/snaps-jest/src/matchers.ts index f4a38e3156..2e3ddd1be7 100644 --- a/packages/snaps-jest/src/matchers.ts +++ b/packages/snaps-jest/src/matchers.ts @@ -218,7 +218,7 @@ const toRenderLegacy: MatcherFunction<[expected: Component]> = function ( }; export const toRender: MatcherFunction<[expected: ComponentOrElement]> = - function (actual, expected) { + async function (actual, expected) { assertHasInterface(actual, 'toRender'); if (!isJSXElementUnsafe(expected)) { diff --git a/packages/snaps-rpc-methods/src/endowments/caveats/requestTime.test.ts b/packages/snaps-rpc-methods/src/endowments/caveats/requestTime.test.ts index e8fd769680..9e5d28a39e 100644 --- a/packages/snaps-rpc-methods/src/endowments/caveats/requestTime.test.ts +++ b/packages/snaps-rpc-methods/src/endowments/caveats/requestTime.test.ts @@ -1,13 +1,13 @@ import type { PermissionConstraint } from '@metamask/permission-controller'; import { SnapCaveatType } from '@metamask/snaps-utils'; -import { getCronjobCaveatMapper } from '../cronjob'; import { createMaxRequestTimeMapper, getMaxRequestTimeCaveat, getMaxRequestTimeCaveatMapper, maxRequestTimeCaveatSpecifications, } from './requestTime'; +import { getCronjobCaveatMapper } from '../cronjob'; describe('maxRequestTimeCaveatSpecifications', () => { describe('validator', () => { diff --git a/packages/snaps-rpc-methods/src/permitted/invokeKeyring.ts b/packages/snaps-rpc-methods/src/permitted/invokeKeyring.ts index c81443943c..2c588e09cf 100644 --- a/packages/snaps-rpc-methods/src/permitted/invokeKeyring.ts +++ b/packages/snaps-rpc-methods/src/permitted/invokeKeyring.ts @@ -8,11 +8,15 @@ import type { } from '@metamask/snaps-sdk'; import type { Snap, SnapRpcHookArgs } from '@metamask/snaps-utils'; import { HandlerType, WALLET_SNAP_PERMISSION_KEY } from '@metamask/snaps-utils'; -import type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils'; -import { hasProperty, type Json } from '@metamask/utils'; +import { hasProperty } from '@metamask/utils'; +import type { + PendingJsonRpcResponse, + JsonRpcRequest, + type Json, +} from '@metamask/utils'; -import type { MethodHooksObject } from '../utils'; import { getValidatedParams } from './invokeSnapSugar'; +import type { MethodHooksObject } from '../utils'; const hookNames: MethodHooksObject = { hasPermission: true, diff --git a/packages/snaps-rpc-methods/src/permitted/middleware.ts b/packages/snaps-rpc-methods/src/permitted/middleware.ts index 303eba08eb..89d2664db4 100644 --- a/packages/snaps-rpc-methods/src/permitted/middleware.ts +++ b/packages/snaps-rpc-methods/src/permitted/middleware.ts @@ -3,8 +3,8 @@ import { rpcErrors } from '@metamask/rpc-errors'; import { logError } from '@metamask/snaps-utils'; import type { Json, JsonRpcParams } from '@metamask/utils'; -import { selectHooks } from '../utils'; import { methodHandlers } from './handlers'; +import { selectHooks } from '../utils'; /** * Creates a middleware that handles permitted snap RPC methods. diff --git a/packages/snaps-rpc-methods/src/permitted/requestSnaps.test.ts b/packages/snaps-rpc-methods/src/permitted/requestSnaps.test.ts index 041dd146f2..3e35afd19a 100644 --- a/packages/snaps-rpc-methods/src/permitted/requestSnaps.test.ts +++ b/packages/snaps-rpc-methods/src/permitted/requestSnaps.test.ts @@ -20,12 +20,12 @@ import type { PendingJsonRpcResponse, } from '@metamask/utils'; -import { WALLET_SNAP_PERMISSION_KEY } from '../restricted/invokeSnap'; import { requestSnapsHandler, hasRequestedSnaps, getSnapPermissionsRequest, } from './requestSnaps'; +import { WALLET_SNAP_PERMISSION_KEY } from '../restricted/invokeSnap'; describe('requestSnapsHandler', () => { it('has the expected shape', () => { diff --git a/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts b/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts index 3401f30129..026f3d2e36 100644 --- a/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts +++ b/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts @@ -8,8 +8,8 @@ import type { } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; import { StructError, create, object, string } from '@metamask/superstruct'; -import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { JsonStruct, type Json } from '@metamask/utils'; +import { JsonStruct } from '@metamask/utils'; +import type { PendingJsonRpcResponse, type Json } from '@metamask/utils'; import type { MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/permitted/updateInterface.test.tsx b/packages/snaps-rpc-methods/src/permitted/updateInterface.test.tsx index 289176f331..da90e39a38 100644 --- a/packages/snaps-rpc-methods/src/permitted/updateInterface.test.tsx +++ b/packages/snaps-rpc-methods/src/permitted/updateInterface.test.tsx @@ -1,6 +1,9 @@ import { JsonRpcEngine } from '@metamask/json-rpc-engine'; -import type { UpdateInterfaceParams } from '@metamask/snaps-sdk'; -import { text, type UpdateInterfaceResult } from '@metamask/snaps-sdk'; +import { text } from '@metamask/snaps-sdk'; +import type { + UpdateInterfaceParams, + type UpdateInterfaceResult, +} from '@metamask/snaps-sdk'; import { Box, type JSXElement, Text } from '@metamask/snaps-sdk/jsx'; import type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils'; diff --git a/packages/snaps-rpc-methods/src/restricted/caveats/index.ts b/packages/snaps-rpc-methods/src/restricted/caveats/index.ts index 5ef90283e3..55107579eb 100644 --- a/packages/snaps-rpc-methods/src/restricted/caveats/index.ts +++ b/packages/snaps-rpc-methods/src/restricted/caveats/index.ts @@ -1,10 +1,6 @@ import type { PermissionConstraint } from '@metamask/permission-controller'; import type { Json } from '@metamask/utils'; -import { getBip32EntropyBuilder } from '../getBip32Entropy'; -import { getBip32PublicKeyBuilder } from '../getBip32PublicKey'; -import { getBip44EntropyBuilder } from '../getBip44Entropy'; -import { invokeSnapBuilder } from '../invokeSnap'; import { permittedCoinTypesCaveatMapper, PermittedCoinTypesCaveatSpecification, @@ -14,6 +10,10 @@ import { PermittedDerivationPathsCaveatSpecification, } from './permittedDerivationPaths'; import { snapIdsCaveatMapper, SnapIdsCaveatSpecification } from './snapIds'; +import { getBip32EntropyBuilder } from '../getBip32Entropy'; +import { getBip32PublicKeyBuilder } from '../getBip32PublicKey'; +import { getBip44EntropyBuilder } from '../getBip44Entropy'; +import { invokeSnapBuilder } from '../invokeSnap'; export const caveatSpecifications = { ...PermittedDerivationPathsCaveatSpecification, diff --git a/packages/snaps-sdk/src/internals/error-wrappers.test.ts b/packages/snaps-sdk/src/internals/error-wrappers.test.ts index 26fcb0637e..ddd27df5a3 100644 --- a/packages/snaps-sdk/src/internals/error-wrappers.test.ts +++ b/packages/snaps-sdk/src/internals/error-wrappers.test.ts @@ -1,7 +1,7 @@ import { rpcErrors } from '@metamask/rpc-errors'; -import { SnapError } from '../errors'; import { createSnapError } from './error-wrappers'; +import { SnapError } from '../errors'; describe('createSnapError', () => { it('creates a SnapError from an rpc-errors function', () => { diff --git a/packages/snaps-sdk/src/internals/jsx.ts b/packages/snaps-sdk/src/internals/jsx.ts index cf8ae331c2..5cf95f97ed 100644 --- a/packages/snaps-sdk/src/internals/jsx.ts +++ b/packages/snaps-sdk/src/internals/jsx.ts @@ -11,8 +11,8 @@ import type { UnionToIntersection, } from '@metamask/superstruct'; -import type { EmptyObject } from '../types'; import { union } from './structs'; +import type { EmptyObject } from '../types'; /** * Check if a type is a union. Infers `true` if it is a union, otherwise diff --git a/packages/snaps-sdk/src/internals/structs.test.ts b/packages/snaps-sdk/src/internals/structs.test.ts index e6903fbfde..09a80c0075 100644 --- a/packages/snaps-sdk/src/internals/structs.test.ts +++ b/packages/snaps-sdk/src/internals/structs.test.ts @@ -1,8 +1,8 @@ import { is, validate } from '@metamask/superstruct'; +import { enumValue, literal, typedUnion, union } from './structs'; import { Text } from '../jsx'; import { BoxStruct, FieldStruct, TextStruct } from '../jsx/validation'; -import { enumValue, literal, typedUnion, union } from './structs'; describe('enumValue', () => { it('validates an enum value', () => { diff --git a/packages/snaps-sdk/src/jsx/components/Container.ts b/packages/snaps-sdk/src/jsx/components/Container.ts index d6a6bf8c9b..bd49c66c45 100644 --- a/packages/snaps-sdk/src/jsx/components/Container.ts +++ b/packages/snaps-sdk/src/jsx/components/Container.ts @@ -1,6 +1,6 @@ -import { createSnapComponent } from '../component'; import type { BoxElement } from './Box'; import type { FooterElement } from './Footer'; +import { createSnapComponent } from '../component'; /** * The props of the {@link Container} component. diff --git a/packages/snaps-sdk/src/jsx/components/Footer.ts b/packages/snaps-sdk/src/jsx/components/Footer.ts index 937ce4a147..5fd9ac2652 100644 --- a/packages/snaps-sdk/src/jsx/components/Footer.ts +++ b/packages/snaps-sdk/src/jsx/components/Footer.ts @@ -1,5 +1,5 @@ -import { createSnapComponent } from '../component'; import type { ButtonElement } from './form'; +import { createSnapComponent } from '../component'; /** * The props of the {@link Footer} component. diff --git a/packages/snaps-sdk/src/jsx/components/Link.ts b/packages/snaps-sdk/src/jsx/components/Link.ts index 047ba7b0ed..6abfd18c1a 100644 --- a/packages/snaps-sdk/src/jsx/components/Link.ts +++ b/packages/snaps-sdk/src/jsx/components/Link.ts @@ -1,6 +1,6 @@ +import type { StandardFormattingElement } from './formatting'; import type { SnapsChildren } from '../component'; import { createSnapComponent } from '../component'; -import type { StandardFormattingElement } from './formatting'; /** * The children of the {@link Link} component. diff --git a/packages/snaps-sdk/src/jsx/components/Row.ts b/packages/snaps-sdk/src/jsx/components/Row.ts index a23672ab44..80d5118e09 100644 --- a/packages/snaps-sdk/src/jsx/components/Row.ts +++ b/packages/snaps-sdk/src/jsx/components/Row.ts @@ -1,8 +1,8 @@ -import { createSnapComponent } from '../component'; import type { AddressElement } from './Address'; import type { ImageElement } from './Image'; import type { TextElement } from './Text'; import type { ValueElement } from './Value'; +import { createSnapComponent } from '../component'; /** * The children of a {@link Row} component. diff --git a/packages/snaps-sdk/src/jsx/components/Text.ts b/packages/snaps-sdk/src/jsx/components/Text.ts index 7d18e1c3b0..518d64a017 100644 --- a/packages/snaps-sdk/src/jsx/components/Text.ts +++ b/packages/snaps-sdk/src/jsx/components/Text.ts @@ -1,7 +1,7 @@ -import type { SnapsChildren } from '../component'; -import { createSnapComponent } from '../component'; import type { StandardFormattingElement } from './formatting'; import type { LinkElement } from './Link'; +import type { SnapsChildren } from '../component'; +import { createSnapComponent } from '../component'; /** * The children of the {@link Text} component. diff --git a/packages/snaps-sdk/src/jsx/components/Tooltip.ts b/packages/snaps-sdk/src/jsx/components/Tooltip.ts index e1932e94c8..28bb3a6e71 100644 --- a/packages/snaps-sdk/src/jsx/components/Tooltip.ts +++ b/packages/snaps-sdk/src/jsx/components/Tooltip.ts @@ -1,8 +1,8 @@ -import { createSnapComponent } from '../component'; import type { StandardFormattingElement } from './formatting'; import type { ImageElement } from './Image'; import type { LinkElement } from './Link'; import type { TextElement } from './Text'; +import { createSnapComponent } from '../component'; export type TooltipChildren = | TextElement diff --git a/packages/snaps-sdk/src/jsx/components/form/Dropdown.ts b/packages/snaps-sdk/src/jsx/components/form/Dropdown.ts index f0c476fb2b..4c34b4dfd2 100644 --- a/packages/snaps-sdk/src/jsx/components/form/Dropdown.ts +++ b/packages/snaps-sdk/src/jsx/components/form/Dropdown.ts @@ -1,6 +1,6 @@ +import type { OptionElement } from './Option'; import type { SnapsChildren } from '../../component'; import { createSnapComponent } from '../../component'; -import type { OptionElement } from './Option'; /** * The props of the {@link Dropdown} component. diff --git a/packages/snaps-sdk/src/jsx/components/form/Field.ts b/packages/snaps-sdk/src/jsx/components/form/Field.ts index d2f87f38ba..b02ef12ce2 100644 --- a/packages/snaps-sdk/src/jsx/components/form/Field.ts +++ b/packages/snaps-sdk/src/jsx/components/form/Field.ts @@ -1,9 +1,9 @@ -import { createSnapComponent } from '../../component'; import type { ButtonElement } from './Button'; import type { CheckboxElement } from './Checkbox'; import type { DropdownElement } from './Dropdown'; import type { FileInputElement } from './FileInput'; import type { InputElement } from './Input'; +import { createSnapComponent } from '../../component'; /** * The props of the {@link Field} component. diff --git a/packages/snaps-sdk/src/jsx/components/form/Option.ts b/packages/snaps-sdk/src/jsx/components/form/Option.ts index 6466ce068c..869280d9a5 100644 --- a/packages/snaps-sdk/src/jsx/components/form/Option.ts +++ b/packages/snaps-sdk/src/jsx/components/form/Option.ts @@ -1,6 +1,6 @@ +import { Dropdown } from './Dropdown'; import { createSnapComponent } from '../../component'; // eslint-disable-next-line @typescript-eslint/no-unused-vars -import { Dropdown } from './Dropdown'; /** * The props of the {@link Option} component. diff --git a/packages/snaps-sdk/src/jsx/validation.ts b/packages/snaps-sdk/src/jsx/validation.ts index 665608a584..d1170b0758 100644 --- a/packages/snaps-sdk/src/jsx/validation.ts +++ b/packages/snaps-sdk/src/jsx/validation.ts @@ -25,9 +25,6 @@ import { JsonStruct, } from '@metamask/utils'; -import type { Describe } from '../internals'; -import { literal, nullUnion, svg, typedUnion } from '../internals'; -import type { EmptyObject } from '../types'; import type { GenericSnapElement, JsonObject, @@ -66,6 +63,9 @@ import type { ContainerElement, FooterElement, } from './components'; +import type { Describe } from '../internals'; +import { literal, nullUnion, svg, typedUnion } from '../internals'; +import type { EmptyObject } from '../types'; /** * A struct for the {@link Key} type. diff --git a/packages/snaps-sdk/src/types/handlers/signature.ts b/packages/snaps-sdk/src/types/handlers/signature.ts index 2bc13b0c13..13cbab5005 100644 --- a/packages/snaps-sdk/src/types/handlers/signature.ts +++ b/packages/snaps-sdk/src/types/handlers/signature.ts @@ -1,6 +1,6 @@ +import type { SeverityLevel } from './transaction'; import type { EnumToUnion } from '../../internals'; import type { Component } from '../../ui'; -import type { SeverityLevel } from './transaction'; /** * An eth_sign signature object. diff --git a/packages/snaps-sdk/src/types/interface.ts b/packages/snaps-sdk/src/types/interface.ts index 86d2ed311c..adb75fcfd1 100644 --- a/packages/snaps-sdk/src/types/interface.ts +++ b/packages/snaps-sdk/src/types/interface.ts @@ -8,11 +8,11 @@ import { } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; +import { FileStruct } from './handlers'; import type { JSXElement } from '../jsx'; import { RootJSXElementStruct } from '../jsx'; import type { Component } from '../ui'; import { ComponentStruct } from '../ui'; -import { FileStruct } from './handlers'; /** * To avoid typing problems with the interface state when manipulating it we diff --git a/packages/snaps-sdk/src/types/methods/dialog.test.ts b/packages/snaps-sdk/src/types/methods/dialog.test.ts index 11483951d8..3181f42027 100644 --- a/packages/snaps-sdk/src/types/methods/dialog.test.ts +++ b/packages/snaps-sdk/src/types/methods/dialog.test.ts @@ -1,6 +1,5 @@ import { expectTypeOf } from 'expect-type'; -import type { text } from '../../ui'; import type { ConfirmationDialog, PromptDialog, @@ -8,6 +7,7 @@ import type { DialogParams, } from './dialog'; import { DialogType } from './dialog'; +import type { text } from '../../ui'; describe('DialogType', () => { it('has the correct values', () => { diff --git a/packages/snaps-sdk/src/types/methods/methods.ts b/packages/snaps-sdk/src/types/methods/methods.ts index d18381eccc..f7b30d4dcb 100644 --- a/packages/snaps-sdk/src/types/methods/methods.ts +++ b/packages/snaps-sdk/src/types/methods/methods.ts @@ -1,4 +1,3 @@ -import type { Method } from '../../internals'; import type { CreateInterfaceParams, CreateInterfaceResult, @@ -48,6 +47,7 @@ import type { UpdateInterfaceParams, UpdateInterfaceResult, } from './update-interface'; +import type { Method } from '../../internals'; /** * The methods that are available to the Snap. Each method is a tuple of the diff --git a/packages/snaps-sdk/src/ui/component.test.ts b/packages/snaps-sdk/src/ui/component.test.ts index a13de382c6..2ccfdf284e 100644 --- a/packages/snaps-sdk/src/ui/component.test.ts +++ b/packages/snaps-sdk/src/ui/component.test.ts @@ -1,7 +1,8 @@ import { assertIsComponent, isComponent } from './component'; -import type { Input, Form } from './components'; -import { - ButtonVariant, +import { ButtonVariant, ButtonType, InputType } from './components'; +import type { + Input, + Form, type Button, type Divider, type Heading, @@ -9,8 +10,6 @@ import { type Panel, type Spinner, type Text, - ButtonType, - InputType, } from './components'; import { NodeType } from './nodes'; diff --git a/packages/snaps-sdk/src/ui/components/address.test.ts b/packages/snaps-sdk/src/ui/components/address.test.ts index 4e1a5e4de3..b44db058fb 100644 --- a/packages/snaps-sdk/src/ui/components/address.test.ts +++ b/packages/snaps-sdk/src/ui/components/address.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { address } from './address'; +import { NodeType } from '../nodes'; describe('address', () => { const MOCK_ADDRESS = '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520'; diff --git a/packages/snaps-sdk/src/ui/components/button.test.ts b/packages/snaps-sdk/src/ui/components/button.test.ts index 70ee5e5be5..ab26fae879 100644 --- a/packages/snaps-sdk/src/ui/components/button.test.ts +++ b/packages/snaps-sdk/src/ui/components/button.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { ButtonType, ButtonVariant, button } from './button'; +import { NodeType } from '../nodes'; describe('button', () => { it('creates a button component', () => { diff --git a/packages/snaps-sdk/src/ui/components/copyable.test.ts b/packages/snaps-sdk/src/ui/components/copyable.test.ts index 75c01df185..e5bb0f8eb8 100644 --- a/packages/snaps-sdk/src/ui/components/copyable.test.ts +++ b/packages/snaps-sdk/src/ui/components/copyable.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { copyable } from './copyable'; +import { NodeType } from '../nodes'; describe('copyable', () => { it('creates a copyable component', () => { diff --git a/packages/snaps-sdk/src/ui/components/divider.test.ts b/packages/snaps-sdk/src/ui/components/divider.test.ts index 9ea1b9a5c0..806bc794f1 100644 --- a/packages/snaps-sdk/src/ui/components/divider.test.ts +++ b/packages/snaps-sdk/src/ui/components/divider.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { divider } from './divider'; +import { NodeType } from '../nodes'; describe('divider', () => { it('creates a divider component', () => { diff --git a/packages/snaps-sdk/src/ui/components/form.test.ts b/packages/snaps-sdk/src/ui/components/form.test.ts index 4ec9a11850..89334df6a6 100644 --- a/packages/snaps-sdk/src/ui/components/form.test.ts +++ b/packages/snaps-sdk/src/ui/components/form.test.ts @@ -1,6 +1,6 @@ -import { NodeType } from '../nodes'; import { form } from './form'; import { input } from './input'; +import { NodeType } from '../nodes'; describe('Form', () => { it('creates a form component', () => { diff --git a/packages/snaps-sdk/src/ui/components/form.ts b/packages/snaps-sdk/src/ui/components/form.ts index 5d9381a4e4..6aaed3c0ab 100644 --- a/packages/snaps-sdk/src/ui/components/form.ts +++ b/packages/snaps-sdk/src/ui/components/form.ts @@ -8,10 +8,10 @@ import { union, } from '@metamask/superstruct'; -import { createBuilder } from '../builder'; -import { NodeStruct, NodeType } from '../nodes'; import { ButtonStruct } from './button'; import { InputStruct } from './input'; +import { createBuilder } from '../builder'; +import { NodeStruct, NodeType } from '../nodes'; export const FormComponentStruct = union([InputStruct, ButtonStruct]); diff --git a/packages/snaps-sdk/src/ui/components/heading.test.ts b/packages/snaps-sdk/src/ui/components/heading.test.ts index d4bca3e616..5fdae38561 100644 --- a/packages/snaps-sdk/src/ui/components/heading.test.ts +++ b/packages/snaps-sdk/src/ui/components/heading.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { heading } from './heading'; +import { NodeType } from '../nodes'; describe('heading', () => { it('creates a heading component', () => { diff --git a/packages/snaps-sdk/src/ui/components/image.test.ts b/packages/snaps-sdk/src/ui/components/image.test.ts index 76619ec467..b27343bafc 100644 --- a/packages/snaps-sdk/src/ui/components/image.test.ts +++ b/packages/snaps-sdk/src/ui/components/image.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { image } from './image'; +import { NodeType } from '../nodes'; const MOCK_SVG = ''; diff --git a/packages/snaps-sdk/src/ui/components/input.test.ts b/packages/snaps-sdk/src/ui/components/input.test.ts index 87a0bfc0c3..629b9c7fdd 100644 --- a/packages/snaps-sdk/src/ui/components/input.test.ts +++ b/packages/snaps-sdk/src/ui/components/input.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { input, InputType } from './input'; +import { NodeType } from '../nodes'; describe('Input', () => { it('creates an input component', () => { diff --git a/packages/snaps-sdk/src/ui/components/panel.test.ts b/packages/snaps-sdk/src/ui/components/panel.test.ts index 2ce14fec68..7301b59a97 100644 --- a/packages/snaps-sdk/src/ui/components/panel.test.ts +++ b/packages/snaps-sdk/src/ui/components/panel.test.ts @@ -1,8 +1,8 @@ import { is } from '@metamask/superstruct'; -import { NodeType } from '../nodes'; import { heading } from './heading'; import { panel, PanelStruct, ParentStruct } from './panel'; +import { NodeType } from '../nodes'; describe('ParentStruct', () => { it('validates that a value is a node with children', () => { diff --git a/packages/snaps-sdk/src/ui/components/panel.ts b/packages/snaps-sdk/src/ui/components/panel.ts index 90b8d71ae5..7832039d78 100644 --- a/packages/snaps-sdk/src/ui/components/panel.ts +++ b/packages/snaps-sdk/src/ui/components/panel.ts @@ -1,9 +1,6 @@ import type { Infer, Struct } from '@metamask/superstruct'; import { array, assign, lazy, literal, object } from '@metamask/superstruct'; -import { typedUnion } from '../../internals'; -import { createBuilder } from '../builder'; -import { NodeStruct, NodeType } from '../nodes'; import { AddressStruct } from './address'; import { ButtonStruct } from './button'; import { CopyableStruct } from './copyable'; @@ -15,6 +12,9 @@ import { InputStruct } from './input'; import { RowStruct } from './row'; import { SpinnerStruct } from './spinner'; import { TextStruct } from './text'; +import { typedUnion } from '../../internals'; +import { createBuilder } from '../builder'; +import { NodeStruct, NodeType } from '../nodes'; /** * @internal diff --git a/packages/snaps-sdk/src/ui/components/row.test.ts b/packages/snaps-sdk/src/ui/components/row.test.ts index ac928c805b..5bcf4a52ce 100644 --- a/packages/snaps-sdk/src/ui/components/row.test.ts +++ b/packages/snaps-sdk/src/ui/components/row.test.ts @@ -1,6 +1,6 @@ -import { NodeType } from '../nodes'; import { RowVariant, row } from './row'; import { text } from './text'; +import { NodeType } from '../nodes'; describe('row', () => { it('creates a row component', () => { diff --git a/packages/snaps-sdk/src/ui/components/row.ts b/packages/snaps-sdk/src/ui/components/row.ts index 80a886fca8..4d2c665edd 100644 --- a/packages/snaps-sdk/src/ui/components/row.ts +++ b/packages/snaps-sdk/src/ui/components/row.ts @@ -8,12 +8,12 @@ import { union, } from '@metamask/superstruct'; -import { enumValue } from '../../internals'; -import { createBuilder } from '../builder'; -import { LiteralStruct, NodeType } from '../nodes'; import { AddressStruct } from './address'; import { ImageStruct } from './image'; import { TextStruct } from './text'; +import { enumValue } from '../../internals'; +import { createBuilder } from '../builder'; +import { LiteralStruct, NodeType } from '../nodes'; export enum RowVariant { Default = 'default', diff --git a/packages/snaps-sdk/src/ui/components/spinner.test.ts b/packages/snaps-sdk/src/ui/components/spinner.test.ts index 4111f2bd8f..8d8e53344d 100644 --- a/packages/snaps-sdk/src/ui/components/spinner.test.ts +++ b/packages/snaps-sdk/src/ui/components/spinner.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { spinner } from './spinner'; +import { NodeType } from '../nodes'; describe('spinner', () => { it('creates a spinner component', () => { diff --git a/packages/snaps-sdk/src/ui/components/text.test.ts b/packages/snaps-sdk/src/ui/components/text.test.ts index 53618e299f..765512dd9e 100644 --- a/packages/snaps-sdk/src/ui/components/text.test.ts +++ b/packages/snaps-sdk/src/ui/components/text.test.ts @@ -1,5 +1,5 @@ -import { NodeType } from '../nodes'; import { text } from './text'; +import { NodeType } from '../nodes'; describe('text', () => { it('creates a text component', () => { diff --git a/packages/snaps-simulator/src/components/Author.test.tsx b/packages/snaps-simulator/src/components/Author.test.tsx index 1d993673a6..add0e148f6 100644 --- a/packages/snaps-simulator/src/components/Author.test.tsx +++ b/packages/snaps-simulator/src/components/Author.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { Author } from './Author'; +import { render } from '../utils'; describe('Author', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/Icon.test.tsx b/packages/snaps-simulator/src/components/Icon.test.tsx index 3bf6f3055a..ffe8044867 100644 --- a/packages/snaps-simulator/src/components/Icon.test.tsx +++ b/packages/snaps-simulator/src/components/Icon.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { Icon } from './Icon'; +import { render } from '../utils'; describe('Icon', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/Link.test.tsx b/packages/snaps-simulator/src/components/Link.test.tsx index 8c3e2ada82..1bd0890388 100644 --- a/packages/snaps-simulator/src/components/Link.test.tsx +++ b/packages/snaps-simulator/src/components/Link.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { Link } from './Link'; +import { render } from '../utils'; describe('Link', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/Logo.test.tsx b/packages/snaps-simulator/src/components/Logo.test.tsx index 4fccc9ea7c..fe0947593d 100644 --- a/packages/snaps-simulator/src/components/Logo.test.tsx +++ b/packages/snaps-simulator/src/components/Logo.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { Logo } from './Logo'; +import { render } from '../utils'; describe('Logo', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/Prefill.test.tsx b/packages/snaps-simulator/src/components/Prefill.test.tsx index 5a18da88a4..cea5a5b316 100644 --- a/packages/snaps-simulator/src/components/Prefill.test.tsx +++ b/packages/snaps-simulator/src/components/Prefill.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { Prefill } from './Prefill'; +import { render } from '../utils'; describe('Prefill', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/SnapIcon.test.tsx b/packages/snaps-simulator/src/components/SnapIcon.test.tsx index 4b6e93455c..c8bb2615b0 100644 --- a/packages/snaps-simulator/src/components/SnapIcon.test.tsx +++ b/packages/snaps-simulator/src/components/SnapIcon.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { SnapIcon } from './SnapIcon'; +import { render } from '../utils'; describe('SnapIcon', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/SnapIcon.tsx b/packages/snaps-simulator/src/components/SnapIcon.tsx index f81a86e0ec..f986b75171 100644 --- a/packages/snaps-simulator/src/components/SnapIcon.tsx +++ b/packages/snaps-simulator/src/components/SnapIcon.tsx @@ -1,9 +1,9 @@ import { Avatar, Box } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; +import { Icon } from './Icon'; import { getIcon } from '../features'; import { useSelector } from '../hooks'; -import { Icon } from './Icon'; export type SnapIconProps = { snapName: string; diff --git a/packages/snaps-simulator/src/components/Window.test.tsx b/packages/snaps-simulator/src/components/Window.test.tsx index 5285dedbf1..2861bf361f 100644 --- a/packages/snaps-simulator/src/components/Window.test.tsx +++ b/packages/snaps-simulator/src/components/Window.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../utils'; import { Window } from './Window'; +import { render } from '../utils'; describe('Window', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/dialogs/AlertDialog.test.tsx b/packages/snaps-simulator/src/components/dialogs/AlertDialog.test.tsx index a22e2a56ff..791ac581eb 100644 --- a/packages/snaps-simulator/src/components/dialogs/AlertDialog.test.tsx +++ b/packages/snaps-simulator/src/components/dialogs/AlertDialog.test.tsx @@ -1,7 +1,7 @@ import { Box } from '@metamask/snaps-sdk/jsx'; -import { render } from '../../utils'; import { AlertDialog } from './AlertDialog'; +import { render } from '../../utils'; describe('AlertDialog', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/dialogs/ConfirmationDialog.test.tsx b/packages/snaps-simulator/src/components/dialogs/ConfirmationDialog.test.tsx index ed5dd0a580..63c7f2b621 100644 --- a/packages/snaps-simulator/src/components/dialogs/ConfirmationDialog.test.tsx +++ b/packages/snaps-simulator/src/components/dialogs/ConfirmationDialog.test.tsx @@ -1,7 +1,7 @@ import { Box } from '@metamask/snaps-sdk/jsx'; -import { render } from '../../utils'; import { ConfirmationDialog } from './ConfirmationDialog'; +import { render } from '../../utils'; describe('ConfirmationDialog', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/components/dialogs/PromptDialog.test.tsx b/packages/snaps-simulator/src/components/dialogs/PromptDialog.test.tsx index b5b3fd4232..aa3d072840 100644 --- a/packages/snaps-simulator/src/components/dialogs/PromptDialog.test.tsx +++ b/packages/snaps-simulator/src/components/dialogs/PromptDialog.test.tsx @@ -1,7 +1,7 @@ import { Box } from '@metamask/snaps-sdk/jsx'; -import { render } from '../../utils'; import { PromptDialog } from './PromptDialog'; +import { render } from '../../utils'; describe('PromptDialog', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/contexts/SnapInterface.tsx b/packages/snaps-simulator/src/contexts/SnapInterface.tsx index da21d7dbed..ccf066f1bc 100644 --- a/packages/snaps-simulator/src/contexts/SnapInterface.tsx +++ b/packages/snaps-simulator/src/contexts/SnapInterface.tsx @@ -6,6 +6,7 @@ import throttle from 'lodash.throttle'; import type { FunctionComponent, ReactNode } from 'react'; import { createContext, useContext } from 'react'; +import { mergeValue } from './utils'; import { getSnapInterfaceController, getSnapInterface, @@ -13,7 +14,6 @@ import { setSnapInterfaceState, } from '../features'; import { useDispatch, useSelector } from '../hooks'; -import { mergeValue } from './utils'; /** * A no-op function. diff --git a/packages/snaps-simulator/src/features/builder/Builder.tsx b/packages/snaps-simulator/src/features/builder/Builder.tsx index bc7d2e33c2..8f4b7e4ffb 100644 --- a/packages/snaps-simulator/src/features/builder/Builder.tsx +++ b/packages/snaps-simulator/src/features/builder/Builder.tsx @@ -12,9 +12,9 @@ import type { NodeModel } from '@minoru/react-dnd-treeview'; import type { FunctionComponent } from 'react'; import { useState } from 'react'; -import { Editor } from '../../components'; import { TemplateComponentList, NodeTree, NodeRenderer } from './components'; import { boxToCode, nodeModelsToComponent } from './utils'; +import { Editor } from '../../components'; export const Builder: FunctionComponent = () => { const [id, setId] = useState(2); diff --git a/packages/snaps-simulator/src/features/builder/components/EditableNodeInput.tsx b/packages/snaps-simulator/src/features/builder/components/EditableNodeInput.tsx index 4533e12b7c..74861dc06f 100644 --- a/packages/snaps-simulator/src/features/builder/components/EditableNodeInput.tsx +++ b/packages/snaps-simulator/src/features/builder/components/EditableNodeInput.tsx @@ -1,6 +1,6 @@ import { Input as ChakraInput } from '@chakra-ui/react'; -import type { ChangeEvent } from 'react'; -import { useState, type FunctionComponent } from 'react'; +import { useState } from 'react'; +import type { ChangeEvent, type FunctionComponent } from 'react'; type EditableNodeInputProps = { placeholder: string; diff --git a/packages/snaps-simulator/src/features/builder/components/MultiEditableNode.tsx b/packages/snaps-simulator/src/features/builder/components/MultiEditableNode.tsx index 22578c946d..70cd20853f 100644 --- a/packages/snaps-simulator/src/features/builder/components/MultiEditableNode.tsx +++ b/packages/snaps-simulator/src/features/builder/components/MultiEditableNode.tsx @@ -8,10 +8,10 @@ import type { } from '@metamask/snaps-sdk/jsx'; import type { FunctionComponent } from 'react'; -import type { EditableNodeProps } from '../../../types'; import { BaseNode } from './BaseNode'; import { EditableNodeInput } from './EditableNodeInput'; import { EditableNodeSelect } from './EditableNodeSelect'; +import type { EditableNodeProps } from '../../../types'; export type MultiEditableComponent = | ButtonElement diff --git a/packages/snaps-simulator/src/features/builder/components/NodeRenderer.tsx b/packages/snaps-simulator/src/features/builder/components/NodeRenderer.tsx index c4e476d8fc..b741c4c1f1 100644 --- a/packages/snaps-simulator/src/features/builder/components/NodeRenderer.tsx +++ b/packages/snaps-simulator/src/features/builder/components/NodeRenderer.tsx @@ -5,6 +5,7 @@ import type { FunctionComponent } from 'react'; import { useMemo } from 'react'; import { useSelector } from 'react-redux'; +import { ErrorBoundary } from './ErrorBoundary'; import { Delineator, DelineatorType, @@ -15,7 +16,6 @@ import { getSnapId } from '../../configuration'; import { Renderer } from '../../renderer'; import { getSnapName } from '../../simulation'; import { nodeModelsToComponent } from '../utils'; -import { ErrorBoundary } from './ErrorBoundary'; export type NodeRendererProps = { items: NodeModel[]; diff --git a/packages/snaps-simulator/src/features/builder/components/NodeTree.tsx b/packages/snaps-simulator/src/features/builder/components/NodeTree.tsx index ffce01ac99..0250a98e76 100644 --- a/packages/snaps-simulator/src/features/builder/components/NodeTree.tsx +++ b/packages/snaps-simulator/src/features/builder/components/NodeTree.tsx @@ -10,9 +10,9 @@ import { Tree } from '@minoru/react-dnd-treeview'; import type { FunctionComponent } from 'react'; import { useEffect, useRef } from 'react'; -import { canDropElement } from '../utils'; import { Node } from './Node'; import { Start } from './Start'; +import { canDropElement } from '../utils'; export type NodeTreeProps = { items: NodeModel[]; diff --git a/packages/snaps-simulator/src/features/builder/components/TemplateComponentList.tsx b/packages/snaps-simulator/src/features/builder/components/TemplateComponentList.tsx index ffd5dccf4f..b89b749f69 100644 --- a/packages/snaps-simulator/src/features/builder/components/TemplateComponentList.tsx +++ b/packages/snaps-simulator/src/features/builder/components/TemplateComponentList.tsx @@ -20,8 +20,8 @@ import { } from '@metamask/snaps-sdk/jsx'; import type { FunctionComponent } from 'react'; -import type { IconName } from '../../../components'; import { TemplateComponent } from './TemplateComponent'; +import type { IconName } from '../../../components'; type TemplateComponent = { icon: IconName; diff --git a/packages/snaps-simulator/src/features/builder/components/TextEditableNode.tsx b/packages/snaps-simulator/src/features/builder/components/TextEditableNode.tsx index 0cd39286e4..89add7e05d 100644 --- a/packages/snaps-simulator/src/features/builder/components/TextEditableNode.tsx +++ b/packages/snaps-simulator/src/features/builder/components/TextEditableNode.tsx @@ -8,9 +8,9 @@ import { assert, hasProperty } from '@metamask/utils'; import type { ChangeEvent, FunctionComponent } from 'react'; import { useState } from 'react'; +import { BaseNode } from './BaseNode'; import type { EditableNodeProps } from '../../../types'; import { getNodeText } from '../utils'; -import { BaseNode } from './BaseNode'; export type TextEditableComponent = | TextElement diff --git a/packages/snaps-simulator/src/features/builder/utils.ts b/packages/snaps-simulator/src/features/builder/utils.ts index a27d11a1e0..716a24e15c 100644 --- a/packages/snaps-simulator/src/features/builder/utils.ts +++ b/packages/snaps-simulator/src/features/builder/utils.ts @@ -1,9 +1,12 @@ -import type { FieldElement, FormElement } from '@metamask/snaps-sdk/jsx'; import { BoxChildStruct, FieldChildUnionStruct, FormChildStruct, Input, +} from '@metamask/snaps-sdk/jsx'; +import type { + FieldElement, + FormElement, type BoxElement, type JSXElement, } from '@metamask/snaps-sdk/jsx'; diff --git a/packages/snaps-simulator/src/features/configuration/Configuration.test.tsx b/packages/snaps-simulator/src/features/configuration/Configuration.test.tsx index 535e728ee6..c890ced8a9 100644 --- a/packages/snaps-simulator/src/features/configuration/Configuration.test.tsx +++ b/packages/snaps-simulator/src/features/configuration/Configuration.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../utils'; import { Configuration } from './Configuration'; +import { render } from '../../utils'; describe('Configuration', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/configuration/Configuration.tsx b/packages/snaps-simulator/src/features/configuration/Configuration.tsx index 7b5a9d12d5..54a9dbeca2 100644 --- a/packages/snaps-simulator/src/features/configuration/Configuration.tsx +++ b/packages/snaps-simulator/src/features/configuration/Configuration.tsx @@ -32,7 +32,6 @@ import { import type { FormEvent } from 'react'; import { useEffect, useState } from 'react'; -import { useDispatch, useSelector } from '../../hooks'; import { getOpen, getSesEnabled, @@ -43,6 +42,7 @@ import { setSnapId, setSnapVersion, } from './slice'; +import { useDispatch, useSelector } from '../../hooks'; export const Configuration = () => { const dispatch = useDispatch(); diff --git a/packages/snaps-simulator/src/features/console/Console.tsx b/packages/snaps-simulator/src/features/console/Console.tsx index 8273712665..0444150aad 100644 --- a/packages/snaps-simulator/src/features/console/Console.tsx +++ b/packages/snaps-simulator/src/features/console/Console.tsx @@ -9,10 +9,10 @@ import { import type { FunctionComponent } from 'react'; import { useEffect, useRef, useState } from 'react'; -import { Icon } from '../../components'; -import { useSelector } from '../../hooks'; import { ConsoleContent } from './ConsoleContent'; import { getConsoleEntries } from './slice'; +import { Icon } from '../../components'; +import { useSelector } from '../../hooks'; /** * Console component. diff --git a/packages/snaps-simulator/src/features/console/ConsoleContent.tsx b/packages/snaps-simulator/src/features/console/ConsoleContent.tsx index b36e4a1800..c8ecce21a0 100644 --- a/packages/snaps-simulator/src/features/console/ConsoleContent.tsx +++ b/packages/snaps-simulator/src/features/console/ConsoleContent.tsx @@ -1,7 +1,7 @@ import { Text } from '@chakra-ui/react'; -import { useSelector } from '../../hooks'; import { ConsoleEntryType, getConsoleEntries } from './slice'; +import { useSelector } from '../../hooks'; export const ConsoleContent = () => { const entries = useSelector(getConsoleEntries); diff --git a/packages/snaps-simulator/src/features/handlers/components/Handler.test.tsx b/packages/snaps-simulator/src/features/handlers/components/Handler.test.tsx index 41ba0ac471..f242a33956 100644 --- a/packages/snaps-simulator/src/features/handlers/components/Handler.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/Handler.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { Handler } from './Handler'; +import { render } from '../../../utils'; describe('Handler', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/components/Handler.tsx b/packages/snaps-simulator/src/features/handlers/components/Handler.tsx index 38c0261b44..a3b2cc7c7a 100644 --- a/packages/snaps-simulator/src/features/handlers/components/Handler.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/Handler.tsx @@ -11,16 +11,16 @@ import type { FunctionComponent } from 'react'; import { useState } from 'react'; import { Outlet } from 'react-router-dom'; -import { TestConditional } from '../../../components'; -import { useSelector } from '../../../hooks'; -import { IS_TEST_BUILD } from '../../../utils'; -import { getUserInterface } from '../../simulation'; import { History } from './History'; import { PlayButton } from './PlayButton'; import { ResetTab } from './ResetTab'; import { ResetUserInterfaceTab } from './ResetUserInterfaceTab'; import { Response } from './Response'; import { UserInterface } from './UserInterface'; +import { TestConditional } from '../../../components'; +import { useSelector } from '../../../hooks'; +import { IS_TEST_BUILD } from '../../../utils'; +import { getUserInterface } from '../../simulation'; export const Handler: FunctionComponent = () => { const [tab, setTab] = useState(0); diff --git a/packages/snaps-simulator/src/features/handlers/components/History.test.tsx b/packages/snaps-simulator/src/features/handlers/components/History.test.tsx index eda35acc66..fd2ec3d87d 100644 --- a/packages/snaps-simulator/src/features/handlers/components/History.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/History.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { History } from './History'; +import { render } from '../../../utils'; describe('History', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/components/History.tsx b/packages/snaps-simulator/src/features/handlers/components/History.tsx index c228999c68..3bc6caac7f 100644 --- a/packages/snaps-simulator/src/features/handlers/components/History.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/History.tsx @@ -1,9 +1,9 @@ import { Center, Heading, List, Text } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; +import { HistoryItem } from './HistoryItem'; import { Icon } from '../../../components'; import { useHandler, useSelector } from '../../../hooks'; -import { HistoryItem } from './HistoryItem'; export const History: FunctionComponent = () => { const handler = useHandler(); diff --git a/packages/snaps-simulator/src/features/handlers/components/HistoryItem.test.tsx b/packages/snaps-simulator/src/features/handlers/components/HistoryItem.test.tsx index 7395945f48..676691a8f6 100644 --- a/packages/snaps-simulator/src/features/handlers/components/HistoryItem.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/HistoryItem.test.tsx @@ -1,7 +1,7 @@ import { List, Tabs } from '@chakra-ui/react'; -import { render } from '../../../utils'; import { HistoryItem } from './HistoryItem'; +import { render } from '../../../utils'; describe('HistoryItem', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/components/Response.test.tsx b/packages/snaps-simulator/src/features/handlers/components/Response.test.tsx index 906eee4beb..2c7ad69311 100644 --- a/packages/snaps-simulator/src/features/handlers/components/Response.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/Response.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { Response } from './Response'; +import { render } from '../../../utils'; describe('Response', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/components/UserInterface.test.tsx b/packages/snaps-simulator/src/features/handlers/components/UserInterface.test.tsx index d790d27a2e..4963f0301b 100644 --- a/packages/snaps-simulator/src/features/handlers/components/UserInterface.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/components/UserInterface.test.tsx @@ -1,7 +1,7 @@ import { Tabs } from '@chakra-ui/react'; -import { render } from '../../../utils'; import { UserInterface } from './UserInterface'; +import { render } from '../../../utils'; describe('UserInterface', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefill.test.tsx b/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefill.test.tsx index 95332c1bba..e7c82113ca 100644 --- a/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefill.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefill.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../../utils'; import { CronjobPrefill } from './CronjobPrefill'; +import { render } from '../../../../utils'; describe('CronjobPrefill', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.test.tsx b/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.test.tsx index 99dc8007eb..bc5551d100 100644 --- a/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../../utils'; import { CronjobPrefills } from './CronjobPrefills'; +import { render } from '../../../../utils'; describe('CronjobPrefills', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.tsx b/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.tsx index e045ed44d6..7947e284e9 100644 --- a/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.tsx +++ b/packages/snaps-simulator/src/features/handlers/cronjobs/components/CronjobPrefills.tsx @@ -1,10 +1,10 @@ import { Box, Flex, Text } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; -import { useSelector } from '../../../../hooks'; -import { getSnapManifest } from '../../../simulation'; import type { CronjobData } from './CronjobPrefill'; import { CronjobPrefill } from './CronjobPrefill'; +import { useSelector } from '../../../../hooks'; +import { getSnapManifest } from '../../../simulation'; export type CronjobPrefillsProps = { onClick: (prefill: CronjobData) => void; diff --git a/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.test.tsx b/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.test.tsx index 4fdaff05a0..ca2b1865f3 100644 --- a/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../../utils'; import { Request } from './Request'; +import { render } from '../../../../utils'; jest.mock('react-monaco-editor'); diff --git a/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.tsx b/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.tsx index a24c68c783..417b37d271 100644 --- a/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.tsx +++ b/packages/snaps-simulator/src/features/handlers/cronjobs/components/Request.tsx @@ -9,13 +9,13 @@ import { HandlerType } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Controller, useForm } from 'react-hook-form'; +import type { CronjobData } from './CronjobPrefill'; +import { CronjobPrefills } from './CronjobPrefills'; import { Editor } from '../../../../components'; import { useDispatch, useSelector } from '../../../../hooks'; import { sendRequest } from '../../../simulation'; import { SAMPLE_JSON_RPC_REQUEST } from '../../json-rpc/schema'; import { getCronjobRequest } from '../slice'; -import type { CronjobData } from './CronjobPrefill'; -import { CronjobPrefills } from './CronjobPrefills'; type CronjobFormData = { origin: string; diff --git a/packages/snaps-simulator/src/features/handlers/transactions/components/Request.tsx b/packages/snaps-simulator/src/features/handlers/transactions/components/Request.tsx index 848dc70c4d..741d45d00c 100644 --- a/packages/snaps-simulator/src/features/handlers/transactions/components/Request.tsx +++ b/packages/snaps-simulator/src/features/handlers/transactions/components/Request.tsx @@ -13,12 +13,12 @@ import { HandlerType } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { useForm } from 'react-hook-form'; +import { TransactionPrefills } from './TransactionPrefills'; import { useDispatch, useSelector } from '../../../../hooks'; import { sendRequest } from '../../../simulation'; import { getTransactionRequest } from '../slice'; import type { TransactionFormData } from '../utils'; import { hexlifyTransactionData } from '../utils'; -import { TransactionPrefills } from './TransactionPrefills'; const PLACEHOLDERS = { chainId: 'eip155:1', diff --git a/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefill.test.tsx b/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefill.test.tsx index d34d31a0d6..69366bbe5d 100644 --- a/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefill.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefill.test.tsx @@ -1,6 +1,6 @@ +import { TransactionPrefill } from './TransactionPrefill'; import { render } from '../../../../utils'; import { TRANSACTION_PRESETS } from '../presets'; -import { TransactionPrefill } from './TransactionPrefill'; describe('TransactionPrefill', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.test.tsx b/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.test.tsx index 3a40c25ce6..96a3099a27 100644 --- a/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.test.tsx +++ b/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../../utils'; import { TransactionPrefills } from './TransactionPrefills'; +import { render } from '../../../../utils'; describe('TransactionPrefills', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.tsx b/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.tsx index b163814858..869a2cb07f 100644 --- a/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.tsx +++ b/packages/snaps-simulator/src/features/handlers/transactions/components/TransactionPrefills.tsx @@ -1,9 +1,9 @@ import { Box, Flex, Text } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; +import { TransactionPrefill } from './TransactionPrefill'; import { TRANSACTION_PRESETS } from '../presets'; import type { TransactionFormData } from '../utils'; -import { TransactionPrefill } from './TransactionPrefill'; export type TransactionPrefillsProps = { onClick: (prefill: TransactionFormData) => void; diff --git a/packages/snaps-simulator/src/features/layout/Layout.tsx b/packages/snaps-simulator/src/features/layout/Layout.tsx index 34c9d58651..4575440770 100644 --- a/packages/snaps-simulator/src/features/layout/Layout.tsx +++ b/packages/snaps-simulator/src/features/layout/Layout.tsx @@ -2,8 +2,8 @@ import { Flex } from '@chakra-ui/react'; import type { FunctionComponent, ReactNode } from 'react'; import { Outlet } from 'react-router-dom'; -import { Console } from '../console'; import { Header, Sidebar } from './components'; +import { Console } from '../console'; type LayoutProps = { children?: ReactNode; diff --git a/packages/snaps-simulator/src/features/layout/components/Header.test.tsx b/packages/snaps-simulator/src/features/layout/components/Header.test.tsx index 2d192d9eed..a4a68d076e 100644 --- a/packages/snaps-simulator/src/features/layout/components/Header.test.tsx +++ b/packages/snaps-simulator/src/features/layout/components/Header.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { Header } from './Header'; +import { render } from '../../../utils'; describe('Header', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/layout/components/Sidebar.test.tsx b/packages/snaps-simulator/src/features/layout/components/Sidebar.test.tsx index a81a4d3fc0..a8f59b59f1 100644 --- a/packages/snaps-simulator/src/features/layout/components/Sidebar.test.tsx +++ b/packages/snaps-simulator/src/features/layout/components/Sidebar.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { Sidebar } from './Sidebar'; +import { render } from '../../../utils'; describe('Sidebar', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/manifest/Manifest.test.tsx b/packages/snaps-simulator/src/features/manifest/Manifest.test.tsx index 4ce69cd61d..634759f71f 100644 --- a/packages/snaps-simulator/src/features/manifest/Manifest.test.tsx +++ b/packages/snaps-simulator/src/features/manifest/Manifest.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../utils'; import { Manifest } from './Manifest'; +import { render } from '../../utils'; jest.mock('react-monaco-editor'); diff --git a/packages/snaps-simulator/src/features/manifest/Manifest.tsx b/packages/snaps-simulator/src/features/manifest/Manifest.tsx index a486354642..5bd47d8b5a 100644 --- a/packages/snaps-simulator/src/features/manifest/Manifest.tsx +++ b/packages/snaps-simulator/src/features/manifest/Manifest.tsx @@ -9,10 +9,10 @@ import { } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; +import { Validation } from './components'; import { Editor } from '../../components'; import { useSelector } from '../../hooks'; import { getLocalizedSnapManifest } from '../simulation'; -import { Validation } from './components'; /** * Manifest page, which displays the manifest of a snap, and any errors that diff --git a/packages/snaps-simulator/src/features/manifest/components/Item.test.tsx b/packages/snaps-simulator/src/features/manifest/components/Item.test.tsx index 1dba1e5f5d..22ca61eb21 100644 --- a/packages/snaps-simulator/src/features/manifest/components/Item.test.tsx +++ b/packages/snaps-simulator/src/features/manifest/components/Item.test.tsx @@ -1,7 +1,7 @@ import { List } from '@chakra-ui/react'; -import { render } from '../../../utils'; import { Item } from './Item'; +import { render } from '../../../utils'; describe('Item', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/manifest/components/Validation.test.tsx b/packages/snaps-simulator/src/features/manifest/components/Validation.test.tsx index 2dfb10a1d2..d90707ef2c 100644 --- a/packages/snaps-simulator/src/features/manifest/components/Validation.test.tsx +++ b/packages/snaps-simulator/src/features/manifest/components/Validation.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { Validation } from './Validation'; +import { render } from '../../../utils'; describe('Validation', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/manifest/components/Validation.tsx b/packages/snaps-simulator/src/features/manifest/components/Validation.tsx index ee3977ef85..ac1918ac4c 100644 --- a/packages/snaps-simulator/src/features/manifest/components/Validation.tsx +++ b/packages/snaps-simulator/src/features/manifest/components/Validation.tsx @@ -1,11 +1,11 @@ import { Center, Heading, List, Text } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; +import { Item } from './Item'; import { Icon } from '../../../components'; import { useSelector } from '../../../hooks'; import { getSnapManifest } from '../../simulation'; import { getManifestResults } from '../slice'; -import { Item } from './Item'; export const Validation: FunctionComponent = () => { const manifest = useSelector(getSnapManifest); diff --git a/packages/snaps-simulator/src/features/manifest/sagas.test.ts b/packages/snaps-simulator/src/features/manifest/sagas.test.ts index 108ba8a9dc..c4aa47ca2d 100644 --- a/packages/snaps-simulator/src/features/manifest/sagas.test.ts +++ b/packages/snaps-simulator/src/features/manifest/sagas.test.ts @@ -1,10 +1,5 @@ import { expectSaga } from 'redux-saga-test-plan'; -import { MOCK_MANIFEST_FILE } from '../simulation/test/mockManifest'; -import { - MOCK_SNAP_ICON_FILE, - MOCK_SNAP_SOURCE_FILE, -} from '../simulation/test/mockSnap'; import { validationSaga } from './sagas'; import { ManifestStatus, @@ -12,6 +7,11 @@ import { setValid, validateManifest, } from './slice'; +import { MOCK_MANIFEST_FILE } from '../simulation/test/mockManifest'; +import { + MOCK_SNAP_ICON_FILE, + MOCK_SNAP_SOURCE_FILE, +} from '../simulation/test/mockSnap'; describe('validationSaga', () => { it('validates the manifest', async () => { diff --git a/packages/snaps-simulator/src/features/manifest/sagas.ts b/packages/snaps-simulator/src/features/manifest/sagas.ts index 8c796de2ff..796f9afef1 100644 --- a/packages/snaps-simulator/src/features/manifest/sagas.ts +++ b/packages/snaps-simulator/src/features/manifest/sagas.ts @@ -7,7 +7,6 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import type { SagaIterator } from 'redux-saga'; import { all, call, put, select, takeLatest } from 'redux-saga/effects'; -import { getAuxiliaryFiles, getIcon, getSourceCode } from '../simulation'; import type { ValidationResult } from './slice'; import { ManifestStatus, @@ -16,6 +15,7 @@ import { validateManifest, } from './slice'; import { validators } from './validators'; +import { getAuxiliaryFiles, getIcon, getSourceCode } from '../simulation'; /** * Validate the snap manifest. diff --git a/packages/snaps-simulator/src/features/navigation/Navigation.test.tsx b/packages/snaps-simulator/src/features/navigation/Navigation.test.tsx index 1901c3e47e..dc62ed2ce4 100644 --- a/packages/snaps-simulator/src/features/navigation/Navigation.test.tsx +++ b/packages/snaps-simulator/src/features/navigation/Navigation.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../utils'; import { Navigation } from './Navigation'; +import { render } from '../../utils'; describe('Navigation', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/navigation/Navigation.tsx b/packages/snaps-simulator/src/features/navigation/Navigation.tsx index caf955931b..c898d0ddab 100644 --- a/packages/snaps-simulator/src/features/navigation/Navigation.tsx +++ b/packages/snaps-simulator/src/features/navigation/Navigation.tsx @@ -1,11 +1,11 @@ import { Box, Container, List, Stack, Text } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; -import { Icon } from '../../components'; -import { useSelector } from '../../hooks'; import { Item, ManifestStatusIndicator } from './components'; import { NavigationTag } from './components/NavigationTag'; import { NAVIGATION_ITEMS } from './items'; +import { Icon } from '../../components'; +import { useSelector } from '../../hooks'; /** * The navigation component, which holds the navigation buttons. diff --git a/packages/snaps-simulator/src/features/navigation/components/Bottom.test.tsx b/packages/snaps-simulator/src/features/navigation/components/Bottom.test.tsx index 5987fe341e..8a40f87b78 100644 --- a/packages/snaps-simulator/src/features/navigation/components/Bottom.test.tsx +++ b/packages/snaps-simulator/src/features/navigation/components/Bottom.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../../utils'; import { Bottom } from './Bottom'; +import { render } from '../../../utils'; describe('Bottom', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/navigation/components/Bottom.tsx b/packages/snaps-simulator/src/features/navigation/components/Bottom.tsx index 1118b27a6c..2b06a89568 100644 --- a/packages/snaps-simulator/src/features/navigation/components/Bottom.tsx +++ b/packages/snaps-simulator/src/features/navigation/components/Bottom.tsx @@ -1,10 +1,10 @@ import { Box, List, Text } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; +import { Item } from './Item'; import { Icon } from '../../../components'; import { useDispatch } from '../../../hooks'; import { openConfigurationModal } from '../../configuration'; -import { Item } from './Item'; export const Bottom: FunctionComponent = () => { const dispatch = useDispatch(); diff --git a/packages/snaps-simulator/src/features/navigation/components/Item.test.tsx b/packages/snaps-simulator/src/features/navigation/components/Item.test.tsx index 61567d8906..ca36f27fe8 100644 --- a/packages/snaps-simulator/src/features/navigation/components/Item.test.tsx +++ b/packages/snaps-simulator/src/features/navigation/components/Item.test.tsx @@ -1,7 +1,7 @@ import { List } from '@chakra-ui/react'; -import { render } from '../../../utils'; import { Item } from './Item'; +import { render } from '../../../utils'; describe('Item', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/notifications/Notifications.test.tsx b/packages/snaps-simulator/src/features/notifications/Notifications.test.tsx index 5dd5c0db98..92115ac678 100644 --- a/packages/snaps-simulator/src/features/notifications/Notifications.test.tsx +++ b/packages/snaps-simulator/src/features/notifications/Notifications.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../utils'; import { Notifications } from './Notifications'; +import { render } from '../../utils'; describe('Notifications', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/features/notifications/Notifications.tsx b/packages/snaps-simulator/src/features/notifications/Notifications.tsx index 484f5a91e0..a988ca8a4f 100644 --- a/packages/snaps-simulator/src/features/notifications/Notifications.tsx +++ b/packages/snaps-simulator/src/features/notifications/Notifications.tsx @@ -2,8 +2,8 @@ import { useToast } from '@chakra-ui/react'; import type { FunctionComponent } from 'react'; import { useEffect } from 'react'; -import { useDispatch, useSelector } from '../../hooks'; import { getNotifications, removeNotification } from './slice'; +import { useDispatch, useSelector } from '../../hooks'; export const Notifications: FunctionComponent = () => { const dispatch = useDispatch(); diff --git a/packages/snaps-simulator/src/features/polling/sagas.test.ts b/packages/snaps-simulator/src/features/polling/sagas.test.ts index 05feb5b03a..6e839fe0fb 100644 --- a/packages/snaps-simulator/src/features/polling/sagas.test.ts +++ b/packages/snaps-simulator/src/features/polling/sagas.test.ts @@ -9,6 +9,7 @@ import { stringToBytes } from '@metamask/utils'; import fetchMock from 'jest-fetch-mock'; import { expectSaga } from 'redux-saga-test-plan'; +import { fetchingSaga, pollingSaga } from './sagas'; import { setAuxiliaryFiles, setIcon, @@ -26,7 +27,6 @@ import { MOCK_SNAP_SOURCE, MOCK_SNAP_SOURCE_FILE, } from '../simulation/test/mockSnap'; -import { fetchingSaga, pollingSaga } from './sagas'; fetchMock.enableMocks(); diff --git a/packages/snaps-simulator/src/features/renderer/Renderer.tsx b/packages/snaps-simulator/src/features/renderer/Renderer.tsx index 5500bafd22..db39f89e89 100644 --- a/packages/snaps-simulator/src/features/renderer/Renderer.tsx +++ b/packages/snaps-simulator/src/features/renderer/Renderer.tsx @@ -1,9 +1,9 @@ import type { JSXElement } from '@metamask/snaps-sdk/jsx'; import type { FunctionComponent } from 'react'; +import { SnapComponent } from './SnapComponent'; import { SnapInterfaceContextProvider } from '../../contexts'; import { generateKey } from '../../utils'; -import { SnapComponent } from './SnapComponent'; type RendererProps = { content: JSXElement; diff --git a/packages/snaps-simulator/src/features/renderer/SnapComponent.tsx b/packages/snaps-simulator/src/features/renderer/SnapComponent.tsx index b5e441ffa9..103f4950f2 100644 --- a/packages/snaps-simulator/src/features/renderer/SnapComponent.tsx +++ b/packages/snaps-simulator/src/features/renderer/SnapComponent.tsx @@ -1,7 +1,6 @@ import type { JSXElement } from '@metamask/snaps-sdk/jsx'; import type { FunctionComponent } from 'react'; -import { generateKey } from '../../utils'; import { Bold, Copyable, @@ -18,6 +17,7 @@ import { Italic, Link, } from './components'; +import { generateKey } from '../../utils'; export const components: Partial< Record< diff --git a/packages/snaps-simulator/src/features/simulation/hooks.test.ts b/packages/snaps-simulator/src/features/simulation/hooks.test.ts index 3efee20f20..72782638ef 100644 --- a/packages/snaps-simulator/src/features/simulation/hooks.test.ts +++ b/packages/snaps-simulator/src/features/simulation/hooks.test.ts @@ -6,7 +6,6 @@ import { base64ToBytes, stringToBytes } from '@metamask/utils'; import { File } from 'buffer'; import { expectSaga } from 'redux-saga-test-plan'; -import { addNotification } from '../notifications'; import { createInterface, getInterface, @@ -34,6 +33,7 @@ import { } from './slice'; import { getSnapInterfaceController as getTestSnapInterfaceController } from './test/controllers'; import { MOCK_MANIFEST_FILE } from './test/mockManifest'; +import { addNotification } from '../notifications'; Object.defineProperty(globalThis, 'Notification', { value: class Notification { diff --git a/packages/snaps-simulator/src/features/simulation/hooks.ts b/packages/snaps-simulator/src/features/simulation/hooks.ts index a3d2b7c613..6e9f825824 100644 --- a/packages/snaps-simulator/src/features/simulation/hooks.ts +++ b/packages/snaps-simulator/src/features/simulation/hooks.ts @@ -20,7 +20,6 @@ import { nanoid } from '@reduxjs/toolkit'; import type { SagaIterator } from 'redux-saga'; import { call, put, select, take } from 'redux-saga/effects'; -import { addNativeNotification, addNotification } from '../notifications'; import { closeUserInterface, getAuxiliaryFiles, @@ -35,6 +34,7 @@ import { setSnapInterface, showUserInterface, } from './slice'; +import { addNativeNotification, addNotification } from '../notifications'; /** * Show a dialog to the user. diff --git a/packages/snaps-simulator/src/features/simulation/middleware.test.ts b/packages/snaps-simulator/src/features/simulation/middleware.test.ts index 4f7230ccd7..d4f6e5c41e 100644 --- a/packages/snaps-simulator/src/features/simulation/middleware.test.ts +++ b/packages/snaps-simulator/src/features/simulation/middleware.test.ts @@ -1,8 +1,8 @@ import { JsonRpcEngine } from '@metamask/json-rpc-engine'; import { mnemonicPhraseToBytes } from '@metamask/key-tree'; -import { DEFAULT_SRP } from '../configuration'; import { createMiscMethodMiddleware } from './middleware'; +import { DEFAULT_SRP } from '../configuration'; const hooks = { getMnemonic: async () => mnemonicPhraseToBytes(DEFAULT_SRP) }; diff --git a/packages/snaps-simulator/src/features/simulation/sagas.test.ts b/packages/snaps-simulator/src/features/simulation/sagas.test.ts index b724f349ab..be275adfeb 100644 --- a/packages/snaps-simulator/src/features/simulation/sagas.test.ts +++ b/packages/snaps-simulator/src/features/simulation/sagas.test.ts @@ -11,7 +11,6 @@ import { import { expectSaga } from 'redux-saga-test-plan'; import { call } from 'redux-saga-test-plan/matchers'; -import { DEFAULT_SRP, setSnapId } from '../configuration'; import { createInterface, getInterface } from './hooks'; import { initSaga, permissionsSaga, rebootSaga, requestSaga } from './sagas'; import { @@ -27,6 +26,7 @@ import { getSnapInterfaceController } from './test/controllers'; import { MockExecutionService } from './test/mockExecutionService'; import { MOCK_MANIFEST, MOCK_MANIFEST_FILE } from './test/mockManifest'; import { MOCK_SNAP_SOURCE, MOCK_SNAP_SOURCE_FILE } from './test/mockSnap'; +import { DEFAULT_SRP, setSnapId } from '../configuration'; const snapId = 'local:http://localhost:8080'; diff --git a/packages/snaps-simulator/src/features/simulation/sagas.ts b/packages/snaps-simulator/src/features/simulation/sagas.ts index f1f8a97509..b3a017b432 100644 --- a/packages/snaps-simulator/src/features/simulation/sagas.ts +++ b/packages/snaps-simulator/src/features/simulation/sagas.ts @@ -24,8 +24,11 @@ import { buildSnapEndowmentSpecifications, buildSnapRestrictedMethodSpecifications, } from '@metamask/snaps-rpc-methods'; -import type { SnapId } from '@metamask/snaps-sdk'; -import { type Component, type ComponentOrElement } from '@metamask/snaps-sdk'; +import type { + SnapId, + type Component, + type ComponentOrElement, +} from '@metamask/snaps-sdk'; import type { SnapManifest, SnapRpcHookArgs, @@ -45,10 +48,6 @@ import { takeLatest, } from 'redux-saga/effects'; -import { runSaga } from '../../store/middleware'; -import { getSnapId, getSrp, setSnapId } from '../configuration'; -import { addError } from '../console'; -import { ManifestStatus, setValid } from '../manifest'; import { JSON_RPC_ENDPOINT } from './constants'; import { createInterface, @@ -83,6 +82,10 @@ import { getEndowments, unrestrictedMethods, } from './snap-permissions'; +import { runSaga } from '../../store/middleware'; +import { getSnapId, getSrp, setSnapId } from '../configuration'; +import { addError } from '../console'; +import { ManifestStatus, setValid } from '../manifest'; const DEFAULT_ENVIRONMENT_URL = `https://execution.metamask.io/iframe/${packageJson.version}/index.html`; diff --git a/packages/snaps-simulator/src/features/status/StatusIndicator.test.tsx b/packages/snaps-simulator/src/features/status/StatusIndicator.test.tsx index 4a1aa7f467..e5be159eea 100644 --- a/packages/snaps-simulator/src/features/status/StatusIndicator.test.tsx +++ b/packages/snaps-simulator/src/features/status/StatusIndicator.test.tsx @@ -1,5 +1,5 @@ -import { render } from '../../utils'; import { StatusIndicator } from './StatusIndicator'; +import { render } from '../../utils'; describe('StatusIndicator', () => { it('renders', () => { diff --git a/packages/snaps-simulator/src/utils/render.test.tsx b/packages/snaps-simulator/src/utils/render.test.tsx index cdd27ef250..6751b7280b 100644 --- a/packages/snaps-simulator/src/utils/render.test.tsx +++ b/packages/snaps-simulator/src/utils/render.test.tsx @@ -1,8 +1,8 @@ import { Bold, Text } from '@metamask/snaps-sdk/jsx'; import { getJsxChildren } from '@metamask/snaps-utils'; -import { SnapComponent } from '../features/renderer'; import { renderTextChildren } from './render'; +import { SnapComponent } from '../features/renderer'; describe('renderTextChildren', () => { it('returns a sting child', () => { diff --git a/packages/snaps-utils/src/manifest/manifest.test.ts b/packages/snaps-utils/src/manifest/manifest.test.ts index 1dfe7eedbd..a4f0d3c739 100644 --- a/packages/snaps-utils/src/manifest/manifest.test.ts +++ b/packages/snaps-utils/src/manifest/manifest.test.ts @@ -1,6 +1,16 @@ import { promises as fs } from 'fs'; import { join } from 'path'; +import { + checkManifest, + fixManifest, + getSnapFilePaths, + getSnapFiles, + getSnapIcon, + getSnapSourceCode, + getWritableManifest, +} from './manifest'; +import type { SnapManifest } from './validation'; import { readJsonFile } from '../fs'; import * as npm from '../npm'; import { validateNpmSnap } from '../npm'; @@ -18,16 +28,6 @@ import { } from '../test-utils'; import type { SnapFiles } from '../types'; import { NpmSnapFileNames, SnapValidationFailureReason } from '../types'; -import { - checkManifest, - fixManifest, - getSnapFilePaths, - getSnapFiles, - getSnapIcon, - getSnapSourceCode, - getWritableManifest, -} from './manifest'; -import type { SnapManifest } from './validation'; jest.mock('fs'); jest.mock('../npm', () => ({ diff --git a/packages/snaps-utils/src/manifest/manifest.ts b/packages/snaps-utils/src/manifest/manifest.ts index 558fdf4070..db3fb907cb 100644 --- a/packages/snaps-utils/src/manifest/manifest.ts +++ b/packages/snaps-utils/src/manifest/manifest.ts @@ -5,6 +5,7 @@ import deepEqual from 'fast-deep-equal'; import { promises as fs } from 'fs'; import pathUtils from 'path'; +import type { SnapManifest } from './validation'; import { deepClone } from '../deep-clone'; import { readJsonFile } from '../fs'; import { getSvgDimensions } from '../icon'; @@ -17,7 +18,6 @@ import { import type { SnapFiles, UnvalidatedSnapFiles } from '../types'; import { NpmSnapFileNames, SnapValidationFailureReason } from '../types'; import { readVirtualFile, VirtualFile } from '../virtual-file/node'; -import type { SnapManifest } from './validation'; const MANIFEST_SORT_ORDER: Record = { $schema: 1, diff --git a/packages/snaps-utils/src/manifest/validation.test.ts b/packages/snaps-utils/src/manifest/validation.test.ts index 082552d01b..a43651118a 100644 --- a/packages/snaps-utils/src/manifest/validation.test.ts +++ b/packages/snaps-utils/src/manifest/validation.test.ts @@ -1,6 +1,5 @@ import { assert, is, StructError } from '@metamask/superstruct'; -import { getSnapManifest, MOCK_SNAP_ID } from '../test-utils'; import { assertIsSnapManifest, Bip32EntropyStruct, @@ -12,6 +11,7 @@ import { PermissionsStruct, SnapIdsStruct, } from './validation'; +import { getSnapManifest, MOCK_SNAP_ID } from '../test-utils'; describe('Bip32PathStruct', () => { it.each(['m/0/1/2', "m/0'/1/2", "m/1'/2'/3'/4/5/6", "m/0/1'/2"])( diff --git a/packages/snaps-utils/src/test-utils/manifest.ts b/packages/snaps-utils/src/test-utils/manifest.ts index f95126d505..699702af8c 100644 --- a/packages/snaps-utils/src/test-utils/manifest.ts +++ b/packages/snaps-utils/src/test-utils/manifest.ts @@ -1,12 +1,12 @@ import type { SemVerVersion } from '@metamask/utils'; +import type { MakeSemVer } from './common'; import type { LocalizationFile } from '../localization'; import type { SnapManifest } from '../manifest/validation'; import type { Chain, Namespace } from '../namespace'; import { getSnapChecksum } from '../snaps'; import type { NpmSnapPackageJson, SnapFiles } from '../types'; import { VirtualFile } from '../virtual-file'; -import type { MakeSemVer } from './common'; type GetSnapManifestOptions = Partial> & { shasum?: string; diff --git a/packages/snaps-utils/src/test-utils/snap.ts b/packages/snaps-utils/src/test-utils/snap.ts index e6f7498ee6..2012112dc0 100644 --- a/packages/snaps-utils/src/test-utils/snap.ts +++ b/packages/snaps-utils/src/test-utils/snap.ts @@ -1,14 +1,14 @@ import type { SnapId } from '@metamask/snaps-sdk'; import type { SemVerVersion } from '@metamask/utils'; -import type { PersistedSnap, Snap, TruncatedSnap } from '../snaps'; -import { SnapStatus } from '../snaps'; import type { MakeSemVer } from './common'; import { DEFAULT_SNAP_BUNDLE, DEFAULT_SNAP_SHASUM, getSnapManifest, } from './manifest'; +import type { PersistedSnap, Snap, TruncatedSnap } from '../snaps'; +import { SnapStatus } from '../snaps'; export const MOCK_SNAP_ID = 'npm:@metamask/example-snap' as SnapId; export const MOCK_LOCAL_SNAP_ID = 'local:http://localhost:8080' as SnapId; diff --git a/packages/test-snaps/src/components/Connect.tsx b/packages/test-snaps/src/components/Connect.tsx index 1a80cdbb5e..8e27e55c0b 100644 --- a/packages/test-snaps/src/components/Connect.tsx +++ b/packages/test-snaps/src/components/Connect.tsx @@ -3,10 +3,10 @@ import type { ChangeEvent, FormEvent, FunctionComponent } from 'react'; import { useState } from 'react'; import { Button, Form } from 'react-bootstrap'; +import { ButtonSpinner } from './ButtonSpinner'; import packageJson from '../../package.json'; import { useInstallSnapMutation } from '../api'; import { useInstalled } from '../utils'; -import { ButtonSpinner } from './ButtonSpinner'; type ConnectProps = { name: string; diff --git a/packages/test-snaps/src/components/Snap.tsx b/packages/test-snaps/src/components/Snap.tsx index 0fb198dac1..f9e330d0cf 100644 --- a/packages/test-snaps/src/components/Snap.tsx +++ b/packages/test-snaps/src/components/Snap.tsx @@ -2,8 +2,8 @@ import type { FunctionComponent, ReactNode } from 'react'; import { Card, Col } from 'react-bootstrap'; import CardHeader from 'react-bootstrap/CardHeader'; -import { getSnapId } from '../utils'; import { Connect } from './Connect'; +import { getSnapId } from '../utils'; export type SnapProps = { /** diff --git a/packages/test-snaps/src/features/snaps/bip32/BIP32.tsx b/packages/test-snaps/src/features/snaps/bip32/BIP32.tsx index 51b593f794..8ee6490ae5 100644 --- a/packages/test-snaps/src/features/snaps/bip32/BIP32.tsx +++ b/packages/test-snaps/src/features/snaps/bip32/BIP32.tsx @@ -1,8 +1,8 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { PublicKey, SignMessage } from './components'; import { BIP_32_PORT, BIP_32_SNAP_ID, BIP_32_VERSION } from './constants'; +import { Snap } from '../../../components'; export const BIP32: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/bip44/BIP44.tsx b/packages/test-snaps/src/features/snaps/bip44/BIP44.tsx index 2a63745c91..4aa047269a 100644 --- a/packages/test-snaps/src/features/snaps/bip44/BIP44.tsx +++ b/packages/test-snaps/src/features/snaps/bip44/BIP44.tsx @@ -2,11 +2,11 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; +import { SignMessage } from './components'; +import { BIP_44_PORT, BIP_44_SNAP_ID, BIP_44_VERSION } from './constants'; import { useInvokeMutation } from '../../../api'; import { Result, Snap } from '../../../components'; import { getSnapId } from '../../../utils'; -import { SignMessage } from './components'; -import { BIP_44_PORT, BIP_44_SNAP_ID, BIP_44_VERSION } from './constants'; export const BIP44: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/client-status/ClientStatus.tsx b/packages/test-snaps/src/features/snaps/client-status/ClientStatus.tsx index cbe86ae4a5..6d82873167 100644 --- a/packages/test-snaps/src/features/snaps/client-status/ClientStatus.tsx +++ b/packages/test-snaps/src/features/snaps/client-status/ClientStatus.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { CLIENT_STATUS_SNAP_ID, CLIENT_STATUS_SNAP_PORT, CLIENT_STATUS_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const ClientStatus: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/cronjobs/Cronjobs.tsx b/packages/test-snaps/src/features/snaps/cronjobs/Cronjobs.tsx index 4bf6e8bbd6..76ea9d5562 100644 --- a/packages/test-snaps/src/features/snaps/cronjobs/Cronjobs.tsx +++ b/packages/test-snaps/src/features/snaps/cronjobs/Cronjobs.tsx @@ -1,11 +1,11 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { CRONJOBS_SNAP_ID, CRONJOBS_SNAP_PORT, CRONJOBS_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const Cronjobs: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/dialogs/Dialogs.tsx b/packages/test-snaps/src/features/snaps/dialogs/Dialogs.tsx index 06a3ca7bc3..5f22d8fd3a 100644 --- a/packages/test-snaps/src/features/snaps/dialogs/Dialogs.tsx +++ b/packages/test-snaps/src/features/snaps/dialogs/Dialogs.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { DIALOGS_SNAP_ID, DIALOGS_SNAP_PORT, DIALOGS_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const Dialogs: FunctionComponent = () => { const [invokeSnap, { isLoading, data }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/errors/Errors.tsx b/packages/test-snaps/src/features/snaps/errors/Errors.tsx index b036d907e1..027e688061 100644 --- a/packages/test-snaps/src/features/snaps/errors/Errors.tsx +++ b/packages/test-snaps/src/features/snaps/errors/Errors.tsx @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button } from 'react-bootstrap'; +import { ERRORS_SNAP_ID, ERRORS_SNAP_PORT, ERRORS_VERSION } from './constants'; import { useInvokeMutation } from '../../../api'; import { Result, Snap } from '../../../components'; import { getSnapId } from '../../../utils'; -import { ERRORS_SNAP_ID, ERRORS_SNAP_PORT, ERRORS_VERSION } from './constants'; export const Errors: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/ethereum-provider/EthereumProvider.tsx b/packages/test-snaps/src/features/snaps/ethereum-provider/EthereumProvider.tsx index 4a00afb898..f65aef63ce 100644 --- a/packages/test-snaps/src/features/snaps/ethereum-provider/EthereumProvider.tsx +++ b/packages/test-snaps/src/features/snaps/ethereum-provider/EthereumProvider.tsx @@ -2,15 +2,15 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { SignMessage } from './components/SignMessage'; import { ETHEREUM_PROVIDER_SNAP_ID, ETHEREUM_PROVIDER_SNAP_PORT, ETHEREUM_PROVIDER_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const EthereumProvider: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/ethers-js/EthersJs.tsx b/packages/test-snaps/src/features/snaps/ethers-js/EthersJs.tsx index bac9d015ec..1774873e21 100644 --- a/packages/test-snaps/src/features/snaps/ethers-js/EthersJs.tsx +++ b/packages/test-snaps/src/features/snaps/ethers-js/EthersJs.tsx @@ -1,12 +1,12 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { SignMessage } from './components'; import { ETHERS_JS_PORT, ETHERS_JS_SNAP_ID, ETHERS_JS_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const EthersJs: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/file-upload/FileUpload.tsx b/packages/test-snaps/src/features/snaps/file-upload/FileUpload.tsx index f8c6df6855..6362e19694 100644 --- a/packages/test-snaps/src/features/snaps/file-upload/FileUpload.tsx +++ b/packages/test-snaps/src/features/snaps/file-upload/FileUpload.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import { type FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { FILE_UPLOAD_SNAP_ID, FILE_UPLOAD_SNAP_PORT, FILE_UPLOAD_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const FileUpload: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/get-entropy/GetEntropy.tsx b/packages/test-snaps/src/features/snaps/get-entropy/GetEntropy.tsx index 9af15a0e12..8db568202e 100644 --- a/packages/test-snaps/src/features/snaps/get-entropy/GetEntropy.tsx +++ b/packages/test-snaps/src/features/snaps/get-entropy/GetEntropy.tsx @@ -1,12 +1,12 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { SignMessage } from './components'; import { GET_ENTROPY_PORT, GET_ENTROPY_SNAP_ID, GET_ENTROPY_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const GetEntropy: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/get-file/GetFile.tsx b/packages/test-snaps/src/features/snaps/get-file/GetFile.tsx index a92844e9e3..00a36c7fd4 100644 --- a/packages/test-snaps/src/features/snaps/get-file/GetFile.tsx +++ b/packages/test-snaps/src/features/snaps/get-file/GetFile.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { GET_FILE_SNAP_ID, GET_FILE_SNAP_PORT, GET_FILE_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const GetFile: FunctionComponent = () => { const [invokeSnap, { isLoading, data }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/home-page/HomePage.tsx b/packages/test-snaps/src/features/snaps/home-page/HomePage.tsx index ba69efba27..ad92bc1114 100644 --- a/packages/test-snaps/src/features/snaps/home-page/HomePage.tsx +++ b/packages/test-snaps/src/features/snaps/home-page/HomePage.tsx @@ -1,11 +1,11 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { HOME_PAGE_SNAP_ID, HOME_PAGE_SNAP_PORT, HOME_PAGE_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const HomePage: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/images/Images.tsx b/packages/test-snaps/src/features/snaps/images/Images.tsx index 49343ad661..69840bd7b3 100644 --- a/packages/test-snaps/src/features/snaps/images/Images.tsx +++ b/packages/test-snaps/src/features/snaps/images/Images.tsx @@ -1,8 +1,8 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { ShowImage, ShowQr } from './components'; import { IMAGES_SNAP_ID, IMAGES_SNAP_PORT, IMAGES_VERSION } from './constants'; +import { Snap } from '../../../components'; export const Images: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/images/components/ShowQr.tsx b/packages/test-snaps/src/features/snaps/images/components/ShowQr.tsx index 9bf9d892ea..7e7a0cc5cf 100644 --- a/packages/test-snaps/src/features/snaps/images/components/ShowQr.tsx +++ b/packages/test-snaps/src/features/snaps/images/components/ShowQr.tsx @@ -1,6 +1,10 @@ import { logError } from '@metamask/snaps-utils'; -import type { FunctionComponent } from 'react'; -import { type ChangeEvent, type FormEvent, useState } from 'react'; +import { useState } from 'react'; +import type { + FunctionComponent, + type ChangeEvent, + type FormEvent, +} from 'react'; import { Button, Form } from 'react-bootstrap'; import { useInvokeMutation } from '../../../../api'; diff --git a/packages/test-snaps/src/features/snaps/interactive-ui/InteractiveUI.tsx b/packages/test-snaps/src/features/snaps/interactive-ui/InteractiveUI.tsx index 28a0242592..24cc1811fd 100644 --- a/packages/test-snaps/src/features/snaps/interactive-ui/InteractiveUI.tsx +++ b/packages/test-snaps/src/features/snaps/interactive-ui/InteractiveUI.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import { type FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { INTERACTIVE_UI_SNAP_ID, INTERACTIVE_UI_SNAP_PORT, INTERACTIVE_UI_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const InteractiveUI: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/json-rpc/JsonRpc.tsx b/packages/test-snaps/src/features/snaps/json-rpc/JsonRpc.tsx index c0f8cc1110..d54dc60ac0 100644 --- a/packages/test-snaps/src/features/snaps/json-rpc/JsonRpc.tsx +++ b/packages/test-snaps/src/features/snaps/json-rpc/JsonRpc.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { JSON_RPC_SNAP_ID, JSON_RPC_SNAP_PORT, JSON_RPC_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const JsonRpc: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/jsx/Jsx.tsx b/packages/test-snaps/src/features/snaps/jsx/Jsx.tsx index 9dc4a7aba1..191558be50 100644 --- a/packages/test-snaps/src/features/snaps/jsx/Jsx.tsx +++ b/packages/test-snaps/src/features/snaps/jsx/Jsx.tsx @@ -2,10 +2,10 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button } from 'react-bootstrap'; +import { JSX_SNAP_ID, JSX_SNAP_PORT, JSX_VERSION } from './constants'; import { useInvokeMutation } from '../../../api'; import { Result, Snap } from '../../../components'; import { getSnapId } from '../../../utils'; -import { JSX_SNAP_ID, JSX_SNAP_PORT, JSX_VERSION } from './constants'; export const Jsx: FunctionComponent = () => { const [invokeSnap, { isLoading, data, error }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/lifecycle-hooks/LifecycleHooks.tsx b/packages/test-snaps/src/features/snaps/lifecycle-hooks/LifecycleHooks.tsx index b360a0678d..7dd39802d7 100644 --- a/packages/test-snaps/src/features/snaps/lifecycle-hooks/LifecycleHooks.tsx +++ b/packages/test-snaps/src/features/snaps/lifecycle-hooks/LifecycleHooks.tsx @@ -1,11 +1,11 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { LIFECYCLE_HOOKS_SNAP_ID, LIFECYCLE_HOOKS_SNAP_PORT, LIFECYCLE_HOOKS_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const LifecycleHooks: FunctionComponent = () => { // TODO: Right now there isn't any published version of this snap, so we can't diff --git a/packages/test-snaps/src/features/snaps/localization/Localization.tsx b/packages/test-snaps/src/features/snaps/localization/Localization.tsx index 0b4c7b0170..c017631add 100644 --- a/packages/test-snaps/src/features/snaps/localization/Localization.tsx +++ b/packages/test-snaps/src/features/snaps/localization/Localization.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { LOCALIZATION_SNAP_ID, LOCALIZATION_SNAP_PORT, LOCALIZATION_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const Localization: FunctionComponent = () => { const [invokeSnap, { isLoading, data }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/manage-state/ManageState.tsx b/packages/test-snaps/src/features/snaps/manage-state/ManageState.tsx index 386e56a704..2e3424fc25 100644 --- a/packages/test-snaps/src/features/snaps/manage-state/ManageState.tsx +++ b/packages/test-snaps/src/features/snaps/manage-state/ManageState.tsx @@ -1,6 +1,5 @@ import type { FunctionComponent } from 'react'; -import { Result, Snap } from '../../../components'; import { ClearData, SendData } from './components'; import { MANAGE_STATE_SNAP_ID, @@ -8,6 +7,7 @@ import { MANAGE_STATE_VERSION, } from './constants'; import { useSnapState } from './hooks'; +import { Result, Snap } from '../../../components'; export const ManageState: FunctionComponent = () => { const encryptedState = useSnapState(true); diff --git a/packages/test-snaps/src/features/snaps/name-lookup/NameLookup.tsx b/packages/test-snaps/src/features/snaps/name-lookup/NameLookup.tsx index 254102f4a4..b08def49c8 100644 --- a/packages/test-snaps/src/features/snaps/name-lookup/NameLookup.tsx +++ b/packages/test-snaps/src/features/snaps/name-lookup/NameLookup.tsx @@ -1,11 +1,11 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { NAME_LOOKUP_SNAP_ID, NAME_LOOKUP_SNAP_PORT, NAME_LOOKUP_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const NameLookup: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/network-access/NetworkAccess.tsx b/packages/test-snaps/src/features/snaps/network-access/NetworkAccess.tsx index 563f4ffd85..c7450be8b2 100644 --- a/packages/test-snaps/src/features/snaps/network-access/NetworkAccess.tsx +++ b/packages/test-snaps/src/features/snaps/network-access/NetworkAccess.tsx @@ -3,14 +3,14 @@ import type { ChangeEvent, FunctionComponent } from 'react'; import { useState } from 'react'; import { Button, Form } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { NETWORK_ACCESS_PORT, NETWORK_ACCESS_SNAP_ID, NETWORK_ACCESS_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const NetworkAccess: FunctionComponent = () => { const [url, setUrl] = useState(`${window.location.href}test-data.json`); diff --git a/packages/test-snaps/src/features/snaps/notifications/Notifications.tsx b/packages/test-snaps/src/features/snaps/notifications/Notifications.tsx index 3fcd0a8938..a3daa9ec56 100644 --- a/packages/test-snaps/src/features/snaps/notifications/Notifications.tsx +++ b/packages/test-snaps/src/features/snaps/notifications/Notifications.tsx @@ -2,14 +2,14 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useInvokeMutation } from '../../../api'; -import { Snap } from '../../../components'; -import { getSnapId } from '../../../utils'; import { NOTIFICATIONS_SNAP_ID, NOTIFICATIONS_SNAP_PORT, NOTIFICATIONS_VERSION, } from './constants'; +import { useInvokeMutation } from '../../../api'; +import { Snap } from '../../../components'; +import { getSnapId } from '../../../utils'; export const Notifications: FunctionComponent = () => { const [invokeSnap, { isLoading }] = useInvokeMutation(); diff --git a/packages/test-snaps/src/features/snaps/signature-insights/SignatureInsights.tsx b/packages/test-snaps/src/features/snaps/signature-insights/SignatureInsights.tsx index 4e097b67ec..81c3374838 100644 --- a/packages/test-snaps/src/features/snaps/signature-insights/SignatureInsights.tsx +++ b/packages/test-snaps/src/features/snaps/signature-insights/SignatureInsights.tsx @@ -1,11 +1,11 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { SIGNATURE_INSIGHTS_SNAP_ID, SIGNATURE_INSIGHTS_SNAP_PORT, SIGNATURE_INSIGHTS_VERSION, } from './constants'; +import { Snap } from '../../../components'; export const SignatureInsights: FunctionComponent = () => { return ( diff --git a/packages/test-snaps/src/features/snaps/transaction-insights/TransactionInsights.tsx b/packages/test-snaps/src/features/snaps/transaction-insights/TransactionInsights.tsx index 08035cd301..4fcb4f74fc 100644 --- a/packages/test-snaps/src/features/snaps/transaction-insights/TransactionInsights.tsx +++ b/packages/test-snaps/src/features/snaps/transaction-insights/TransactionInsights.tsx @@ -3,13 +3,13 @@ import { assert } from '@metamask/utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useLazyGetAccountsQuery, useLazyRequestQuery } from '../../../api'; -import { Snap, Result } from '../../../components'; import { TRANSACTION_INSIGHTS_SNAP_ID, TRANSACTION_INSIGHTS_SNAP_PORT, TRANSACTION_INSIGHTS_VERSION, } from './constants'; +import { useLazyGetAccountsQuery, useLazyRequestQuery } from '../../../api'; +import { Snap, Result } from '../../../components'; export const TransactionInsights: FunctionComponent = () => { const [getAccounts, { isLoading: isLoadingAccounts, data: accounts }] = diff --git a/packages/test-snaps/src/features/snaps/updates/Updates.tsx b/packages/test-snaps/src/features/snaps/updates/Updates.tsx index 1b1f7df8e7..f23e13824a 100644 --- a/packages/test-snaps/src/features/snaps/updates/Updates.tsx +++ b/packages/test-snaps/src/features/snaps/updates/Updates.tsx @@ -2,13 +2,13 @@ import { logError } from '@metamask/snaps-utils'; import type { FunctionComponent } from 'react'; import { Button, ButtonGroup } from 'react-bootstrap'; -import { useGetSnapsQuery, useInstallSnapMutation } from '../../../api'; -import { Result, Snap } from '../../../components'; import { UPDATES_SNAP_ID, UPDATES_SNAP_NEW_VERSION, UPDATES_SNAP_OLD_VERSION, } from './constants'; +import { useGetSnapsQuery, useInstallSnapMutation } from '../../../api'; +import { Result, Snap } from '../../../components'; export const Updates: FunctionComponent = () => { const [installSnap, { isLoading }] = useInstallSnapMutation(); diff --git a/packages/test-snaps/src/features/snaps/wasm/WebAssembly.tsx b/packages/test-snaps/src/features/snaps/wasm/WebAssembly.tsx index c8a4aaaaee..cf63105283 100644 --- a/packages/test-snaps/src/features/snaps/wasm/WebAssembly.tsx +++ b/packages/test-snaps/src/features/snaps/wasm/WebAssembly.tsx @@ -1,8 +1,8 @@ import type { FunctionComponent } from 'react'; -import { Snap } from '../../../components'; import { FibonacciInput } from './components'; import { WASM_SNAP_ID, WASM_SNAP_PORT, WASM_VERSION } from './constants'; +import { Snap } from '../../../components'; export const WASM: FunctionComponent = () => { return (