From c4429bc98352e5021e06e47a747f8555f8cb3cdd Mon Sep 17 00:00:00 2001 From: Charly Chevalier Date: Wed, 18 Dec 2024 11:57:18 +0100 Subject: [PATCH] refactor: use new `@metamask/keyring-api` layout (split packages) (#28861) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Bumping accounts related dependencies + use the new `keyring-api` layout. Those tests requires a higher timeout (which might not be true once merged to `main`) `flags = {"circleci": {"timeoutMinutes": 35}}` [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28861?quickstart=1) ## **Related issues** N/A ## **Manual testing steps** N/A ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Howard Braham Co-authored-by: MetaMask Bot Co-authored-by: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com> --- .../account-tracker-controller.test.ts | 2 +- .../controllers/account-tracker-controller.ts | 2 +- .../metametrics-controller.test.ts | 2 +- app/scripts/controllers/mmi-controller.ts | 2 +- .../controllers/permissions/specifications.js | 6 +- .../lib/AccountIdentitiesPetnamesBridge.ts | 2 +- .../lib/accounts/BalancesController.test.ts | 8 +- .../lib/accounts/BalancesController.ts | 8 +- .../lib/snap-keyring/snap-keyring.test.ts | 3 +- app/scripts/lib/transaction/util.test.ts | 2 +- app/scripts/lib/transaction/util.ts | 3 +- app/scripts/migrations/105.test.ts | 2 +- app/scripts/migrations/105.ts | 3 +- app/scripts/migrations/119.ts | 2 +- lavamoat/browserify/beta/policy.json | 96 ++++++++----------- lavamoat/browserify/flask/policy.json | 96 ++++++++----------- lavamoat/browserify/main/policy.json | 96 ++++++++----------- lavamoat/browserify/mmi/policy.json | 96 ++++++++----------- package.json | 10 +- shared/lib/multichain.ts | 3 +- test/data/mock-accounts.ts | 2 +- test/jest/mocks.ts | 2 +- ui/components/app/contact-list/utils.ts | 2 +- ui/components/app/toast-master/selectors.ts | 3 +- ...referenced-currency-display.component.d.ts | 2 +- .../app/wallet-overview/coin-buttons.tsx | 3 +- .../app/wallet-overview/coin-overview.tsx | 2 +- .../account-list-menu/account-list-menu.tsx | 2 +- .../app-header-unlocked-content.tsx | 2 +- .../connect-account-modal.types.ts | 2 +- .../connect-accounts-modal.tsx | 3 +- .../connected-accounts-menu.types.ts | 2 +- .../create-account/create-account.tsx | 2 +- .../create-named-snap-account.tsx | 2 +- .../menu-items/view-explorer-menu-item.tsx | 2 +- .../components/connections.types.tsx | 2 +- .../review-permission.types.tsx | 2 +- .../review-permissions-page.tsx | 3 +- .../pages/send/components/your-accounts.tsx | 7 +- ui/components/multichain/toast/toast.test.tsx | 2 +- ui/helpers/utils/permissions.test.ts | 7 +- ui/helpers/utils/permissions.ts | 3 +- .../accounts/useMultichainWalletSnapClient.ts | 2 +- .../useNotifications.ts | 2 +- ...MultichainAccountTotalFiatBalance.test.tsx | 3 +- .../useMultichainAccountTotalFiatBalance.ts | 3 +- ui/hooks/useMultichainSelector.test.ts | 2 +- ui/hooks/useMultichainSelector.ts | 2 +- .../connect-page/connect-page.tsx | 3 +- ...nap-account-transaction-loading-screen.tsx | 2 +- ui/selectors/accounts.ts | 7 +- ui/selectors/multichain.test.ts | 2 +- ui/selectors/multichain.ts | 3 +- ui/selectors/selectors.types.ts | 2 +- ui/store/store.ts | 2 +- yarn.lock | 94 +++++++++++------- 56 files changed, 306 insertions(+), 326 deletions(-) diff --git a/app/scripts/controllers/account-tracker-controller.test.ts b/app/scripts/controllers/account-tracker-controller.test.ts index 7456244fc5a4..d9090c2e67f8 100644 --- a/app/scripts/controllers/account-tracker-controller.test.ts +++ b/app/scripts/controllers/account-tracker-controller.test.ts @@ -1,6 +1,6 @@ import EventEmitter from 'events'; import { ControllerMessenger } from '@metamask/base-controller'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { BlockTracker, Provider } from '@metamask/network-controller'; import { flushPromises } from '../../../test/lib/timer-helpers'; diff --git a/app/scripts/controllers/account-tracker-controller.ts b/app/scripts/controllers/account-tracker-controller.ts index 5f509a1901bf..ec6ba74ceec2 100644 --- a/app/scripts/controllers/account-tracker-controller.ts +++ b/app/scripts/controllers/account-tracker-controller.ts @@ -36,7 +36,7 @@ import { AccountsControllerSelectedEvmAccountChangeEvent, } from '@metamask/accounts-controller'; import { KeyringControllerAccountRemovedEvent } from '@metamask/keyring-controller'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { LOCALHOST_RPC_URL } from '../../../shared/constants/network'; import { SINGLE_CALL_BALANCES_ADDRESSES } from '../constants/contracts'; diff --git a/app/scripts/controllers/metametrics-controller.test.ts b/app/scripts/controllers/metametrics-controller.test.ts index bee3c3c323d2..939d8e506070 100644 --- a/app/scripts/controllers/metametrics-controller.test.ts +++ b/app/scripts/controllers/metametrics-controller.test.ts @@ -10,7 +10,7 @@ import { Token, TokensControllerState, } from '@metamask/assets-controllers'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { Browser } from 'webextension-polyfill'; import { ControllerMessenger } from '@metamask/base-controller'; import { merge } from 'lodash'; diff --git a/app/scripts/controllers/mmi-controller.ts b/app/scripts/controllers/mmi-controller.ts index f94388aa5e8f..7378585a7e8f 100644 --- a/app/scripts/controllers/mmi-controller.ts +++ b/app/scripts/controllers/mmi-controller.ts @@ -27,8 +27,8 @@ import { OriginalRequest, SignatureController, } from '@metamask/signature-controller'; -import { InternalAccount } from '@metamask/keyring-api'; import { toHex } from '@metamask/controller-utils'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils'; // TODO: Remove restricted import // eslint-disable-next-line import/no-restricted-paths diff --git a/app/scripts/controllers/permissions/specifications.js b/app/scripts/controllers/permissions/specifications.js index b0b2051b10f5..38a2bb002523 100644 --- a/app/scripts/controllers/permissions/specifications.js +++ b/app/scripts/controllers/permissions/specifications.js @@ -47,7 +47,7 @@ export const CaveatFactories = Object.freeze({ * PermissionController. * * @param {{ - * getInternalAccounts: () => Record, + * getInternalAccounts: () => Record, * }} options - Options bag. */ export const getCaveatSpecifications = ({ @@ -96,7 +96,7 @@ export const getCaveatSpecifications = ({ * * @param {{ * getAllAccounts: () => Promise, - * getInternalAccounts: () => Record, + * getInternalAccounts: () => Record, * }} options - Options bag. * @param options.getAllAccounts - A function that returns all Ethereum accounts * in the current MetaMask instance. @@ -254,7 +254,7 @@ export const getPermissionSpecifications = ({ * corresponds to a PreferencesController identity. * * @param {string[]} accounts - The accounts associated with the caveat. - * @param {() => Record} getInternalAccounts - + * @param {() => Record} getInternalAccounts - * Gets all AccountsController InternalAccounts. */ function validateCaveatAccounts(accounts, getInternalAccounts) { diff --git a/app/scripts/lib/AccountIdentitiesPetnamesBridge.ts b/app/scripts/lib/AccountIdentitiesPetnamesBridge.ts index 87f4d114eabb..dac123744772 100644 --- a/app/scripts/lib/AccountIdentitiesPetnamesBridge.ts +++ b/app/scripts/lib/AccountIdentitiesPetnamesBridge.ts @@ -4,7 +4,7 @@ import { NameType, NameOrigin, } from '@metamask/name-controller'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { AccountsControllerChangeEvent, AccountsControllerListAccountsAction, diff --git a/app/scripts/lib/accounts/BalancesController.test.ts b/app/scripts/lib/accounts/BalancesController.test.ts index 982df0289fea..e18fbc1e7be8 100644 --- a/app/scripts/lib/accounts/BalancesController.test.ts +++ b/app/scripts/lib/accounts/BalancesController.test.ts @@ -1,10 +1,6 @@ import { ControllerMessenger } from '@metamask/base-controller'; -import { - Balance, - BtcAccountType, - CaipAssetType, - InternalAccount, -} from '@metamask/keyring-api'; +import { Balance, BtcAccountType, CaipAssetType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { createMockInternalAccount } from '../../../../test/jest/mocks'; import { MultichainNetworks } from '../../../../shared/constants/multichain/networks'; import { diff --git a/app/scripts/lib/accounts/BalancesController.ts b/app/scripts/lib/accounts/BalancesController.ts index 588053d6ea2a..4b9616fac35f 100644 --- a/app/scripts/lib/accounts/BalancesController.ts +++ b/app/scripts/lib/accounts/BalancesController.ts @@ -8,13 +8,13 @@ import { } from '@metamask/base-controller'; import { BtcAccountType, - KeyringClient, + SolAccountType, + isEvmAccountType, type Balance, type CaipAssetType, - type InternalAccount, - isEvmAccountType, - SolAccountType, } from '@metamask/keyring-api'; +import { type InternalAccount } from '@metamask/keyring-internal-api'; +import { KeyringClient } from '@metamask/keyring-snap-client'; import type { HandleSnapRequest } from '@metamask/snaps-controllers'; import type { SnapId } from '@metamask/snaps-sdk'; import { HandlerType } from '@metamask/snaps-utils'; diff --git a/app/scripts/lib/snap-keyring/snap-keyring.test.ts b/app/scripts/lib/snap-keyring/snap-keyring.test.ts index 4136fd1fd1fc..0e778b2268d7 100644 --- a/app/scripts/lib/snap-keyring/snap-keyring.test.ts +++ b/app/scripts/lib/snap-keyring/snap-keyring.test.ts @@ -1,5 +1,6 @@ import { ControllerMessenger } from '@metamask/base-controller'; -import { EthAccountType, InternalAccount } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES } from '../../../../shared/constants/app'; import { MetaMetricsEventCategory, diff --git a/app/scripts/lib/transaction/util.test.ts b/app/scripts/lib/transaction/util.test.ts index 4d78ea51cfa5..0a941968d802 100644 --- a/app/scripts/lib/transaction/util.test.ts +++ b/app/scripts/lib/transaction/util.test.ts @@ -1,4 +1,4 @@ -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { TransactionParams } from '@metamask/eth-json-rpc-middleware'; import { TransactionController, diff --git a/app/scripts/lib/transaction/util.ts b/app/scripts/lib/transaction/util.ts index 34f27d321e0b..a3d0b929aff8 100644 --- a/app/scripts/lib/transaction/util.ts +++ b/app/scripts/lib/transaction/util.ts @@ -1,4 +1,5 @@ -import { EthAccountType, InternalAccount } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { TransactionController, TransactionMeta, diff --git a/app/scripts/migrations/105.test.ts b/app/scripts/migrations/105.test.ts index 168fe8dd0916..b7d5ac0303e6 100644 --- a/app/scripts/migrations/105.test.ts +++ b/app/scripts/migrations/105.test.ts @@ -1,6 +1,6 @@ import { v4 as uuid } from 'uuid'; import { sha256FromString } from 'ethereumjs-util'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import { migrate } from './105'; diff --git a/app/scripts/migrations/105.ts b/app/scripts/migrations/105.ts index a54b3e6457a7..5febcb0479f2 100644 --- a/app/scripts/migrations/105.ts +++ b/app/scripts/migrations/105.ts @@ -1,4 +1,5 @@ -import { EthAccountType, InternalAccount } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { sha256FromString } from 'ethereumjs-util'; import { v4 as uuid } from 'uuid'; import { cloneDeep } from 'lodash'; diff --git a/app/scripts/migrations/119.ts b/app/scripts/migrations/119.ts index 8cb0d2c04b97..606a9e38a31d 100644 --- a/app/scripts/migrations/119.ts +++ b/app/scripts/migrations/119.ts @@ -1,7 +1,7 @@ import { cloneDeep, isObject } from 'lodash'; import { hasProperty } from '@metamask/utils'; import { AccountsControllerState } from '@metamask/accounts-controller'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; type VersionedData = { meta: { version: number }; diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 42c0b3ff7385..542d38004de3 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -1051,6 +1051,7 @@ "packages": { "@ethereumjs/tx": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, "@metamask/eth-snap-keyring>@metamask/utils": true, "@metamask/eth-snap-keyring>uuid": true, "@metamask/keyring-api": true, @@ -1069,6 +1070,11 @@ "browserify>buffer": true } }, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": { + "packages": { + "@metamask/keyring-snap-client": true + } + }, "@metamask/eth-snap-keyring>@metamask/utils": { "globals": { "TextDecoder": true, @@ -1434,17 +1440,23 @@ } }, "@metamask/keyring-api": { + "packages": { + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-api>@metamask/utils": true, + "@metamask/keyring-api>bech32": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true }, "packages": { - "@metamask/keyring-api>@metamask/utils": true, - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-api>uuid": true, + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, "@metamask/utils>@metamask/superstruct": true } }, - "@metamask/keyring-api>@metamask/utils": { + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { "globals": { "TextDecoder": true, "TextEncoder": true @@ -1459,9 +1471,19 @@ "semver": true } }, - "@metamask/keyring-api>uuid": { + "@metamask/keyring-api>@metamask/utils": { "globals": { - "crypto": true + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/keyring-controller": { @@ -1556,30 +1578,6 @@ "semver": true } }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": { - "globals": { - "URL": true - }, - "packages": { - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/keyring-controller>ethereumjs-wallet": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, @@ -1624,6 +1622,19 @@ "browserify>buffer": true } }, + "@metamask/keyring-snap-client": { + "packages": { + "@metamask/keyring-api": true, + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-snap-client>uuid": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-snap-client>uuid": { + "globals": { + "crypto": true + } + }, "@metamask/logging-controller": { "packages": { "@metamask/base-controller": true, @@ -2127,9 +2138,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "@metamask/network-controller": true, - "@metamask/profile-sync-controller>@metamask/keyring-api": true, "@metamask/profile-sync-controller>@noble/ciphers": true, "@metamask/profile-sync-controller>siwe": true, "@noble/hashes": true, @@ -2137,29 +2148,6 @@ "loglevel": true } }, - "@metamask/profile-sync-controller>@metamask/keyring-api": { - "packages": { - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": true, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/profile-sync-controller>@noble/ciphers": { "globals": { "TextDecoder": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 42c0b3ff7385..542d38004de3 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -1051,6 +1051,7 @@ "packages": { "@ethereumjs/tx": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, "@metamask/eth-snap-keyring>@metamask/utils": true, "@metamask/eth-snap-keyring>uuid": true, "@metamask/keyring-api": true, @@ -1069,6 +1070,11 @@ "browserify>buffer": true } }, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": { + "packages": { + "@metamask/keyring-snap-client": true + } + }, "@metamask/eth-snap-keyring>@metamask/utils": { "globals": { "TextDecoder": true, @@ -1434,17 +1440,23 @@ } }, "@metamask/keyring-api": { + "packages": { + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-api>@metamask/utils": true, + "@metamask/keyring-api>bech32": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true }, "packages": { - "@metamask/keyring-api>@metamask/utils": true, - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-api>uuid": true, + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, "@metamask/utils>@metamask/superstruct": true } }, - "@metamask/keyring-api>@metamask/utils": { + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { "globals": { "TextDecoder": true, "TextEncoder": true @@ -1459,9 +1471,19 @@ "semver": true } }, - "@metamask/keyring-api>uuid": { + "@metamask/keyring-api>@metamask/utils": { "globals": { - "crypto": true + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/keyring-controller": { @@ -1556,30 +1578,6 @@ "semver": true } }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": { - "globals": { - "URL": true - }, - "packages": { - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/keyring-controller>ethereumjs-wallet": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, @@ -1624,6 +1622,19 @@ "browserify>buffer": true } }, + "@metamask/keyring-snap-client": { + "packages": { + "@metamask/keyring-api": true, + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-snap-client>uuid": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-snap-client>uuid": { + "globals": { + "crypto": true + } + }, "@metamask/logging-controller": { "packages": { "@metamask/base-controller": true, @@ -2127,9 +2138,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "@metamask/network-controller": true, - "@metamask/profile-sync-controller>@metamask/keyring-api": true, "@metamask/profile-sync-controller>@noble/ciphers": true, "@metamask/profile-sync-controller>siwe": true, "@noble/hashes": true, @@ -2137,29 +2148,6 @@ "loglevel": true } }, - "@metamask/profile-sync-controller>@metamask/keyring-api": { - "packages": { - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": true, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/profile-sync-controller>@noble/ciphers": { "globals": { "TextDecoder": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 42c0b3ff7385..542d38004de3 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -1051,6 +1051,7 @@ "packages": { "@ethereumjs/tx": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, "@metamask/eth-snap-keyring>@metamask/utils": true, "@metamask/eth-snap-keyring>uuid": true, "@metamask/keyring-api": true, @@ -1069,6 +1070,11 @@ "browserify>buffer": true } }, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": { + "packages": { + "@metamask/keyring-snap-client": true + } + }, "@metamask/eth-snap-keyring>@metamask/utils": { "globals": { "TextDecoder": true, @@ -1434,17 +1440,23 @@ } }, "@metamask/keyring-api": { + "packages": { + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-api>@metamask/utils": true, + "@metamask/keyring-api>bech32": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true }, "packages": { - "@metamask/keyring-api>@metamask/utils": true, - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-api>uuid": true, + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, "@metamask/utils>@metamask/superstruct": true } }, - "@metamask/keyring-api>@metamask/utils": { + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { "globals": { "TextDecoder": true, "TextEncoder": true @@ -1459,9 +1471,19 @@ "semver": true } }, - "@metamask/keyring-api>uuid": { + "@metamask/keyring-api>@metamask/utils": { "globals": { - "crypto": true + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/keyring-controller": { @@ -1556,30 +1578,6 @@ "semver": true } }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": { - "globals": { - "URL": true - }, - "packages": { - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/keyring-controller>ethereumjs-wallet": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, @@ -1624,6 +1622,19 @@ "browserify>buffer": true } }, + "@metamask/keyring-snap-client": { + "packages": { + "@metamask/keyring-api": true, + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-snap-client>uuid": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-snap-client>uuid": { + "globals": { + "crypto": true + } + }, "@metamask/logging-controller": { "packages": { "@metamask/base-controller": true, @@ -2127,9 +2138,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "@metamask/network-controller": true, - "@metamask/profile-sync-controller>@metamask/keyring-api": true, "@metamask/profile-sync-controller>@noble/ciphers": true, "@metamask/profile-sync-controller>siwe": true, "@noble/hashes": true, @@ -2137,29 +2148,6 @@ "loglevel": true } }, - "@metamask/profile-sync-controller>@metamask/keyring-api": { - "packages": { - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": true, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/profile-sync-controller>@noble/ciphers": { "globals": { "TextDecoder": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index cd8c3a1c7396..8c76cb6df139 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1143,6 +1143,7 @@ "packages": { "@ethereumjs/tx": true, "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": true, "@metamask/eth-snap-keyring>@metamask/utils": true, "@metamask/eth-snap-keyring>uuid": true, "@metamask/keyring-api": true, @@ -1161,6 +1162,11 @@ "browserify>buffer": true } }, + "@metamask/eth-snap-keyring>@metamask/keyring-internal-snap-client": { + "packages": { + "@metamask/keyring-snap-client": true + } + }, "@metamask/eth-snap-keyring>@metamask/utils": { "globals": { "TextDecoder": true, @@ -1526,17 +1532,23 @@ } }, "@metamask/keyring-api": { + "packages": { + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-api>@metamask/utils": true, + "@metamask/keyring-api>bech32": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-api>@metamask/keyring-utils": { "globals": { "URL": true }, "packages": { - "@metamask/keyring-api>@metamask/utils": true, - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-api>uuid": true, + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, "@metamask/utils>@metamask/superstruct": true } }, - "@metamask/keyring-api>@metamask/utils": { + "@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { "globals": { "TextDecoder": true, "TextEncoder": true @@ -1551,9 +1563,19 @@ "semver": true } }, - "@metamask/keyring-api>uuid": { + "@metamask/keyring-api>@metamask/utils": { "globals": { - "crypto": true + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/keyring-controller": { @@ -1648,30 +1670,6 @@ "semver": true } }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": { - "globals": { - "URL": true - }, - "packages": { - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/keyring-controller>ethereumjs-wallet": { "packages": { "@metamask/keyring-controller>ethereumjs-wallet>ethereum-cryptography": true, @@ -1716,6 +1714,19 @@ "browserify>buffer": true } }, + "@metamask/keyring-snap-client": { + "packages": { + "@metamask/keyring-api": true, + "@metamask/keyring-api>@metamask/keyring-utils": true, + "@metamask/keyring-snap-client>uuid": true, + "@metamask/utils>@metamask/superstruct": true + } + }, + "@metamask/keyring-snap-client>uuid": { + "globals": { + "crypto": true + } + }, "@metamask/logging-controller": { "packages": { "@metamask/base-controller": true, @@ -2219,9 +2230,9 @@ }, "packages": { "@metamask/base-controller": true, + "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "@metamask/network-controller": true, - "@metamask/profile-sync-controller>@metamask/keyring-api": true, "@metamask/profile-sync-controller>@noble/ciphers": true, "@metamask/profile-sync-controller>siwe": true, "@noble/hashes": true, @@ -2229,29 +2240,6 @@ "loglevel": true } }, - "@metamask/profile-sync-controller>@metamask/keyring-api": { - "packages": { - "@metamask/keyring-api>bech32": true, - "@metamask/keyring-controller>@metamask/keyring-api>@metamask/keyring-utils": true, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": true, - "@metamask/utils>@metamask/superstruct": true - } - }, - "@metamask/profile-sync-controller>@metamask/keyring-api>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/profile-sync-controller>@noble/ciphers": { "globals": { "TextDecoder": true, diff --git a/package.json b/package.json index cca9f509c9b5..0cc3222a7d1d 100644 --- a/package.json +++ b/package.json @@ -282,7 +282,7 @@ "@metamask-institutional/types": "^1.2.0", "@metamask/abi-utils": "^2.0.2", "@metamask/account-watcher": "^4.1.2", - "@metamask/accounts-controller": "^20.0.0", + "@metamask/accounts-controller": "^20.0.2", "@metamask/address-book-controller": "^6.0.0", "@metamask/announcement-controller": "^7.0.0", "@metamask/approval-controller": "^7.0.0", @@ -300,7 +300,7 @@ "@metamask/eth-ledger-bridge-keyring": "^5.0.1", "@metamask/eth-query": "^4.0.0", "@metamask/eth-sig-util": "^7.0.1", - "@metamask/eth-snap-keyring": "^5.0.1", + "@metamask/eth-snap-keyring": "^7.0.0", "@metamask/eth-token-tracker": "^9.0.0", "@metamask/eth-trezor-keyring": "^3.1.3", "@metamask/etherscan-link": "^3.0.0", @@ -311,8 +311,10 @@ "@metamask/jazzicon": "^2.0.0", "@metamask/json-rpc-engine": "^10.0.0", "@metamask/json-rpc-middleware-stream": "^8.0.4", - "@metamask/keyring-api": "^10.1.0", - "@metamask/keyring-controller": "^19.0.0", + "@metamask/keyring-api": "^12.0.0", + "@metamask/keyring-controller": "^19.0.2", + "@metamask/keyring-internal-api": "^1.0.0", + "@metamask/keyring-snap-client": "^1.0.0", "@metamask/logging-controller": "^6.0.0", "@metamask/logo": "^3.1.2", "@metamask/message-manager": "^11.0.0", diff --git a/shared/lib/multichain.ts b/shared/lib/multichain.ts index 26111a0970a2..49dc1add445b 100644 --- a/shared/lib/multichain.ts +++ b/shared/lib/multichain.ts @@ -6,7 +6,8 @@ import { } from '@metamask/utils'; import { validate, Network } from 'bitcoin-address-validation'; import { isAddress } from '@solana/addresses'; -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; /** * Returns whether an address is on the Bitcoin mainnet. diff --git a/test/data/mock-accounts.ts b/test/data/mock-accounts.ts index b956dbadd6bb..eab4cd4aa74d 100644 --- a/test/data/mock-accounts.ts +++ b/test/data/mock-accounts.ts @@ -1,6 +1,6 @@ import { KeyringTypes } from '@metamask/keyring-controller'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { - InternalAccount, EthAccountType, BtcMethod, BtcAccountType, diff --git a/test/jest/mocks.ts b/test/jest/mocks.ts index 8822b96315b6..9fdc6538d9d6 100644 --- a/test/jest/mocks.ts +++ b/test/jest/mocks.ts @@ -3,9 +3,9 @@ import { EthMethod, BtcMethod, BtcAccountType, - InternalAccount, isEvmAccountType, } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { KeyringTypes } from '@metamask/keyring-controller'; import { v4 as uuidv4 } from 'uuid'; import { keyringTypeToName } from '@metamask/accounts-controller'; diff --git a/ui/components/app/contact-list/utils.ts b/ui/components/app/contact-list/utils.ts index 4254988e4af6..fe40d3fd6437 100644 --- a/ui/components/app/contact-list/utils.ts +++ b/ui/components/app/contact-list/utils.ts @@ -1,5 +1,5 @@ import { AddressBookEntry } from '@metamask/address-book-controller'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; export const buildDuplicateContactMap = ( addressBook: AddressBookEntry[], diff --git a/ui/components/app/toast-master/selectors.ts b/ui/components/app/toast-master/selectors.ts index b88762c3bc19..80b574c05d90 100644 --- a/ui/components/app/toast-master/selectors.ts +++ b/ui/components/app/toast-master/selectors.ts @@ -1,4 +1,5 @@ -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getAlertEnabledness } from '../../../ducks/metamask/metamask'; import { PRIVACY_POLICY_DATE } from '../../../helpers/constants/privacy-policy'; import { diff --git a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.d.ts b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.d.ts index 779309858a18..50402436f960 100644 --- a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.d.ts +++ b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.d.ts @@ -1,4 +1,4 @@ -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import type { CurrencyDisplayProps } from '../../ui/currency-display/currency-display.component'; import type { PRIMARY, SECONDARY } from '../../../helpers/constants/common'; diff --git a/ui/components/app/wallet-overview/coin-buttons.tsx b/ui/components/app/wallet-overview/coin-buttons.tsx index 2819e24cad0b..0a3c23ef7e9c 100644 --- a/ui/components/app/wallet-overview/coin-buttons.tsx +++ b/ui/components/app/wallet-overview/coin-buttons.tsx @@ -24,7 +24,8 @@ import { } from '@metamask/utils'; ///: BEGIN:ONLY_INCLUDE_IF(build-flask) -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { SnapId } from '@metamask/snaps-sdk'; ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) diff --git a/ui/components/app/wallet-overview/coin-overview.tsx b/ui/components/app/wallet-overview/coin-overview.tsx index 3be53776581d..ff820da55f98 100644 --- a/ui/components/app/wallet-overview/coin-overview.tsx +++ b/ui/components/app/wallet-overview/coin-overview.tsx @@ -10,7 +10,7 @@ import classnames from 'classnames'; import { CaipChainId } from '@metamask/utils'; import type { Hex } from '@metamask/utils'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getNativeTokenAddress } from '@metamask/assets-controllers'; import { Box, diff --git a/ui/components/multichain/account-list-menu/account-list-menu.tsx b/ui/components/multichain/account-list-menu/account-list-menu.tsx index d278b5745423..ca9852af1474 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.tsx +++ b/ui/components/multichain/account-list-menu/account-list-menu.tsx @@ -19,11 +19,11 @@ import { EthAccountType, SolAccountType, ///: BEGIN:ONLY_INCLUDE_IF(build-flask) - InternalAccount, KeyringAccountType, ///: END:ONLY_INCLUDE_IF } from '@metamask/keyring-api'; ///: BEGIN:ONLY_INCLUDE_IF(build-flask) +import { InternalAccount } from '@metamask/keyring-internal-api'; import { BITCOIN_WALLET_NAME, BITCOIN_WALLET_SNAP_ID, diff --git a/ui/components/multichain/app-header/app-header-unlocked-content.tsx b/ui/components/multichain/app-header/app-header-unlocked-content.tsx index 69ffca3f71c3..84f6ccf8159a 100644 --- a/ui/components/multichain/app-header/app-header-unlocked-content.tsx +++ b/ui/components/multichain/app-header/app-header-unlocked-content.tsx @@ -1,7 +1,7 @@ import React, { useContext, useState } from 'react'; import browser from 'webextension-polyfill'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { useDispatch, useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { diff --git a/ui/components/multichain/connect-accounts-modal/connect-account-modal.types.ts b/ui/components/multichain/connect-accounts-modal/connect-account-modal.types.ts index 392d5b210dd4..4f9b4e56b4a2 100644 --- a/ui/components/multichain/connect-accounts-modal/connect-account-modal.types.ts +++ b/ui/components/multichain/connect-accounts-modal/connect-account-modal.types.ts @@ -1,4 +1,4 @@ -import { type InternalAccount } from '@metamask/keyring-api'; +import { type InternalAccount } from '@metamask/keyring-internal-api'; export enum ConnectAccountsType { Account = 'disconnectAllAccountsText', diff --git a/ui/components/multichain/connect-accounts-modal/connect-accounts-modal.tsx b/ui/components/multichain/connect-accounts-modal/connect-accounts-modal.tsx index 457e15b0141d..ff48f416e29d 100644 --- a/ui/components/multichain/connect-accounts-modal/connect-accounts-modal.tsx +++ b/ui/components/multichain/connect-accounts-modal/connect-accounts-modal.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getUnconnectedAccounts } from '../../../selectors/selectors'; import { ConnectAccountsModalList } from './connect-accounts-modal-list'; diff --git a/ui/components/multichain/connected-accounts-menu/connected-accounts-menu.types.ts b/ui/components/multichain/connected-accounts-menu/connected-accounts-menu.types.ts index c5c28678e689..4c510166d48f 100644 --- a/ui/components/multichain/connected-accounts-menu/connected-accounts-menu.types.ts +++ b/ui/components/multichain/connected-accounts-menu/connected-accounts-menu.types.ts @@ -1,4 +1,4 @@ -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; export type KeyringMetadata = { type: string; diff --git a/ui/components/multichain/create-account/create-account.tsx b/ui/components/multichain/create-account/create-account.tsx index 446d487482e5..81e63ff60b39 100644 --- a/ui/components/multichain/create-account/create-account.tsx +++ b/ui/components/multichain/create-account/create-account.tsx @@ -8,7 +8,7 @@ import React, { } from 'react'; import { useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { Box, ButtonPrimary, diff --git a/ui/components/multichain/create-named-snap-account/create-named-snap-account.tsx b/ui/components/multichain/create-named-snap-account/create-named-snap-account.tsx index 194a8c6399df..d04763902247 100644 --- a/ui/components/multichain/create-named-snap-account/create-named-snap-account.tsx +++ b/ui/components/multichain/create-named-snap-account/create-named-snap-account.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from 'react'; import { useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { KeyringTypes } from '@metamask/keyring-controller'; import { CreateAccount } from '..'; import { Box, ModalHeader } from '../../component-library'; diff --git a/ui/components/multichain/menu-items/view-explorer-menu-item.tsx b/ui/components/multichain/menu-items/view-explorer-menu-item.tsx index d29b679d3111..b6c1d23eb07b 100644 --- a/ui/components/multichain/menu-items/view-explorer-menu-item.tsx +++ b/ui/components/multichain/menu-items/view-explorer-menu-item.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { parseCaipChainId } from '@metamask/utils'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getMultichainAccountUrl, getMultichainBlockExplorerUrl, diff --git a/ui/components/multichain/pages/connections/components/connections.types.tsx b/ui/components/multichain/pages/connections/components/connections.types.tsx index 9bdbf86d9d95..2d459e047f46 100644 --- a/ui/components/multichain/pages/connections/components/connections.types.tsx +++ b/ui/components/multichain/pages/connections/components/connections.types.tsx @@ -1,4 +1,4 @@ -import { type InternalAccount } from '@metamask/keyring-api'; +import { type InternalAccount } from '@metamask/keyring-internal-api'; // Define ConnectedSite interface export type ConnectedSite = { diff --git a/ui/components/multichain/pages/review-permissions-page/review-permission.types.tsx b/ui/components/multichain/pages/review-permissions-page/review-permission.types.tsx index 6111dd8d946f..a92aba300c1a 100644 --- a/ui/components/multichain/pages/review-permissions-page/review-permission.types.tsx +++ b/ui/components/multichain/pages/review-permissions-page/review-permission.types.tsx @@ -1,4 +1,4 @@ -import { type InternalAccount } from '@metamask/keyring-api'; +import { type InternalAccount } from '@metamask/keyring-internal-api'; // Define ConnectedSite interface export type ConnectedSite = { diff --git a/ui/components/multichain/pages/review-permissions-page/review-permissions-page.tsx b/ui/components/multichain/pages/review-permissions-page/review-permissions-page.tsx index 95a8ea394000..d71bc499717e 100644 --- a/ui/components/multichain/pages/review-permissions-page/review-permissions-page.tsx +++ b/ui/components/multichain/pages/review-permissions-page/review-permissions-page.tsx @@ -2,7 +2,8 @@ import React, { useEffect, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useHistory, useParams } from 'react-router-dom'; import { NonEmptyArray } from '@metamask/utils'; -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { NetworkConfiguration } from '@metamask/network-controller'; import { AlignItems, diff --git a/ui/components/multichain/pages/send/components/your-accounts.tsx b/ui/components/multichain/pages/send/components/your-accounts.tsx index e59d0aa2d5a1..a0d431919ce6 100644 --- a/ui/components/multichain/pages/send/components/your-accounts.tsx +++ b/ui/components/multichain/pages/send/components/your-accounts.tsx @@ -1,10 +1,7 @@ import React, { useContext, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { - EthAccountType, - InternalAccount, - KeyringAccountType, -} from '@metamask/keyring-api'; +import { EthAccountType, KeyringAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getUpdatedAndSortedAccounts, getInternalAccounts, diff --git a/ui/components/multichain/toast/toast.test.tsx b/ui/components/multichain/toast/toast.test.tsx index eb208d41e122..65e40bc243d8 100644 --- a/ui/components/multichain/toast/toast.test.tsx +++ b/ui/components/multichain/toast/toast.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable jest/require-top-level-describe */ import React from 'react'; import { fireEvent, render } from '@testing-library/react'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { AvatarAccount, AvatarAccountSize } from '../../component-library'; import { BorderColor } from '../../../helpers/constants/design-system'; import { createMockInternalAccount } from '../../../../test/jest/mocks'; diff --git a/ui/helpers/utils/permissions.test.ts b/ui/helpers/utils/permissions.test.ts index 43857afb1815..7dd37d3a6c96 100644 --- a/ui/helpers/utils/permissions.test.ts +++ b/ui/helpers/utils/permissions.test.ts @@ -1,8 +1,5 @@ -import { - BtcAccountType, - BtcMethod, - InternalAccount, -} from '@metamask/keyring-api'; +import { BtcAccountType, BtcMethod } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { createMockInternalAccount } from '../../../test/jest/mocks'; import { containsEthPermissionsAndNonEvmAccount } from './permissions'; diff --git a/ui/helpers/utils/permissions.ts b/ui/helpers/utils/permissions.ts index 2e9d25a065f9..605f4e721d48 100644 --- a/ui/helpers/utils/permissions.ts +++ b/ui/helpers/utils/permissions.ts @@ -1,4 +1,5 @@ -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; import { RestrictedEthMethods } from '../../../shared/constants/permissions'; export const containsEthPermissionsAndNonEvmAccount = ( diff --git a/ui/hooks/accounts/useMultichainWalletSnapClient.ts b/ui/hooks/accounts/useMultichainWalletSnapClient.ts index 98dfa9b429d3..702f07771a28 100644 --- a/ui/hooks/accounts/useMultichainWalletSnapClient.ts +++ b/ui/hooks/accounts/useMultichainWalletSnapClient.ts @@ -1,4 +1,4 @@ -import { KeyringClient, Sender } from '@metamask/keyring-api'; +import { KeyringClient, Sender } from '@metamask/keyring-snap-client'; import { HandlerType } from '@metamask/snaps-utils'; import { CaipChainId, Json, JsonRpcRequest } from '@metamask/utils'; import { SnapId } from '@metamask/snaps-sdk'; diff --git a/ui/hooks/metamask-notifications/useNotifications.ts b/ui/hooks/metamask-notifications/useNotifications.ts index 60eb154bc75e..b2ada59c2f7a 100644 --- a/ui/hooks/metamask-notifications/useNotifications.ts +++ b/ui/hooks/metamask-notifications/useNotifications.ts @@ -1,6 +1,6 @@ import { useState, useCallback } from 'react'; import { useDispatch } from 'react-redux'; -import type { InternalAccount } from '@metamask/keyring-api'; +import type { InternalAccount } from '@metamask/keyring-internal-api'; import log from 'loglevel'; import { type MarkAsReadNotificationsParam } from '@metamask/notification-services-controller/notification-services'; diff --git a/ui/hooks/useMultichainAccountTotalFiatBalance.test.tsx b/ui/hooks/useMultichainAccountTotalFiatBalance.test.tsx index 921baaebab08..9b6cd5e51455 100644 --- a/ui/hooks/useMultichainAccountTotalFiatBalance.test.tsx +++ b/ui/hooks/useMultichainAccountTotalFiatBalance.test.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { renderHook } from '@testing-library/react-hooks'; import { Provider } from 'react-redux'; -import { BtcAccountType, InternalAccount } from '@metamask/keyring-api'; +import { BtcAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import mockState from '../../test/data/mock-state.json'; import configureStore from '../store/store'; import { createMockInternalAccount } from '../../test/jest/mocks'; diff --git a/ui/hooks/useMultichainAccountTotalFiatBalance.ts b/ui/hooks/useMultichainAccountTotalFiatBalance.ts index 335b8399c6d5..816be806142c 100644 --- a/ui/hooks/useMultichainAccountTotalFiatBalance.ts +++ b/ui/hooks/useMultichainAccountTotalFiatBalance.ts @@ -1,5 +1,6 @@ import { useSelector } from 'react-redux'; -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; import { getMultichainCurrencyImage, getMultichainBalances, diff --git a/ui/hooks/useMultichainSelector.test.ts b/ui/hooks/useMultichainSelector.test.ts index e5d7f197ffcb..f04fef64783a 100644 --- a/ui/hooks/useMultichainSelector.test.ts +++ b/ui/hooks/useMultichainSelector.test.ts @@ -1,4 +1,4 @@ -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { createMockInternalAccount } from '../../test/jest/mocks'; import { renderHookWithProvider } from '../../test/lib/render-helpers'; import { getSelectedNetworkClientId } from '../../shared/modules/selectors/networks'; diff --git a/ui/hooks/useMultichainSelector.ts b/ui/hooks/useMultichainSelector.ts index 9bd979df7e7e..286e8b111cd7 100644 --- a/ui/hooks/useMultichainSelector.ts +++ b/ui/hooks/useMultichainSelector.ts @@ -1,5 +1,5 @@ import { useSelector, DefaultRootState } from 'react-redux'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getSelectedInternalAccount } from '../selectors'; export function useMultichainSelector< diff --git a/ui/pages/permissions-connect/connect-page/connect-page.tsx b/ui/pages/permissions-connect/connect-page/connect-page.tsx index 32001a75d3a7..741629b3d4d7 100644 --- a/ui/pages/permissions-connect/connect-page/connect-page.tsx +++ b/ui/pages/permissions-connect/connect-page/connect-page.tsx @@ -1,6 +1,7 @@ import React, { useMemo, useState } from 'react'; import { useSelector } from 'react-redux'; -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; import { NetworkConfiguration } from '@metamask/network-controller'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { diff --git a/ui/pages/snap-account-transaction-loading-screen/snap-account-transaction-loading-screen.tsx b/ui/pages/snap-account-transaction-loading-screen/snap-account-transaction-loading-screen.tsx index cf2e0b222dd9..03b8c36f1265 100644 --- a/ui/pages/snap-account-transaction-loading-screen/snap-account-transaction-loading-screen.tsx +++ b/ui/pages/snap-account-transaction-loading-screen/snap-account-transaction-loading-screen.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect } from 'react'; -import { InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { useI18nContext } from '../../hooks/useI18nContext'; import { MetaMetricsContext } from '../../contexts/metametrics'; import { diff --git a/ui/selectors/accounts.ts b/ui/selectors/accounts.ts index af977b7511da..1646c4759552 100644 --- a/ui/selectors/accounts.ts +++ b/ui/selectors/accounts.ts @@ -1,8 +1,5 @@ -import { - EthAccountType, - BtcAccountType, - InternalAccount, -} from '@metamask/keyring-api'; +import { EthAccountType, BtcAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { AccountsControllerState } from '@metamask/accounts-controller'; import { isBtcMainnetAddress, diff --git a/ui/selectors/multichain.test.ts b/ui/selectors/multichain.test.ts index 110fdc3a5174..5b4b07a93a57 100644 --- a/ui/selectors/multichain.test.ts +++ b/ui/selectors/multichain.test.ts @@ -1,7 +1,7 @@ import { Cryptocurrency } from '@metamask/assets-controllers'; -import { InternalAccount } from '@metamask/keyring-api'; import { Hex } from '@metamask/utils'; import { NetworkConfiguration } from '@metamask/network-controller'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import { getCurrentCurrency, getNativeCurrency, diff --git a/ui/selectors/multichain.ts b/ui/selectors/multichain.ts index 2fd366ed4263..3fdea53414e9 100644 --- a/ui/selectors/multichain.ts +++ b/ui/selectors/multichain.ts @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; -import { InternalAccount, isEvmAccountType } from '@metamask/keyring-api'; +import { isEvmAccountType } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import type { RatesControllerState } from '@metamask/assets-controllers'; import { CaipChainId, Hex, KnownCaipNamespace } from '@metamask/utils'; import { createSelector } from 'reselect'; diff --git a/ui/selectors/selectors.types.ts b/ui/selectors/selectors.types.ts index 15e06b8262e9..4d2404e10f7c 100644 --- a/ui/selectors/selectors.types.ts +++ b/ui/selectors/selectors.types.ts @@ -1,4 +1,4 @@ -import type { InternalAccount } from '@metamask/keyring-api'; +import type { InternalAccount } from '@metamask/keyring-internal-api'; import { SubjectMetadata } from '@metamask/permission-controller'; type KeyringType = { diff --git a/ui/store/store.ts b/ui/store/store.ts index 8433511380e7..2d461a85eace 100644 --- a/ui/store/store.ts +++ b/ui/store/store.ts @@ -4,12 +4,12 @@ import devtoolsEnhancer from 'remote-redux-devtools'; import { ApprovalControllerState } from '@metamask/approval-controller'; import { GasEstimateType, GasFeeEstimates } from '@metamask/gas-fee-controller'; import { TransactionMeta } from '@metamask/transaction-controller'; -import { InternalAccount } from '@metamask/keyring-api'; import { NftControllerState, TokensControllerState, } from '@metamask/assets-controllers'; import { NotificationServicesControllerState } from '@metamask/notification-services-controller/notification-services'; +import { InternalAccount } from '@metamask/keyring-internal-api'; import rootReducer from '../ducks'; import { LedgerTransportTypes } from '../../shared/constants/hardware-wallets'; import type { NetworkStatus } from '../../shared/constants/network'; diff --git a/yarn.lock b/yarn.lock index 0359c83c1da9..033ff849acd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4877,14 +4877,15 @@ __metadata: languageName: node linkType: hard -"@metamask/accounts-controller@npm:^20.0.0": - version: 20.0.0 - resolution: "@metamask/accounts-controller@npm:20.0.0" +"@metamask/accounts-controller@npm:^20.0.2": + version: 20.0.2 + resolution: "@metamask/accounts-controller@npm:20.0.2" dependencies: "@ethereumjs/util": "npm:^8.1.0" "@metamask/base-controller": "npm:^7.0.2" - "@metamask/eth-snap-keyring": "npm:^5.0.1" - "@metamask/keyring-api": "npm:^10.1.0" + "@metamask/eth-snap-keyring": "npm:^7.0.0" + "@metamask/keyring-api": "npm:^12.0.0" + "@metamask/keyring-internal-api": "npm:^1.0.0" "@metamask/snaps-sdk": "npm:^6.7.0" "@metamask/snaps-utils": "npm:^8.3.0" "@metamask/utils": "npm:^10.0.0" @@ -4894,8 +4895,10 @@ __metadata: uuid: "npm:^8.3.2" peerDependencies: "@metamask/keyring-controller": ^19.0.0 + "@metamask/providers": ^18.1.0 "@metamask/snaps-controllers": ^9.7.0 - checksum: 10/36f42d5d7db47c15eef4a7b72d8b19bcd08579a26db452974e76b527e47ef71e63bea47a4f1992fd2eadce44be4020f596dc7049f59766d6aa1b857c4518664f + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/4376418913fcdebda251c00a2f373ada5c5b26e45617ece3a5624bb0d7440bbfb1fb8332cae0f5f4fa04751fe2ffd8cea40fab342d54591fe21d8cd34c14744c languageName: node linkType: hard @@ -5363,22 +5366,27 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-snap-keyring@npm:^5.0.1": - version: 5.0.1 - resolution: "@metamask/eth-snap-keyring@npm:5.0.1" +"@metamask/eth-snap-keyring@npm:^7.0.0": + version: 7.0.0 + resolution: "@metamask/eth-snap-keyring@npm:7.0.0" dependencies: "@ethereumjs/tx": "npm:^4.2.0" "@metamask/eth-sig-util": "npm:^8.0.0" + "@metamask/keyring-api": "npm:^12.0.0" + "@metamask/keyring-internal-api": "npm:^1.0.0" + "@metamask/keyring-internal-snap-client": "npm:^1.0.0" "@metamask/snaps-controllers": "npm:^9.10.0" "@metamask/snaps-sdk": "npm:^6.7.0" "@metamask/snaps-utils": "npm:^8.3.0" "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^9.2.1" + "@metamask/utils": "npm:^9.3.0" "@types/uuid": "npm:^9.0.8" uuid: "npm:^9.0.1" + webextension-polyfill: "npm:^0.12.0" peerDependencies: - "@metamask/keyring-api": ^10.1.0 - checksum: 10/4d9d700b7c2ecc1b17e92f716f7aeb04bbd03836601b5d37f639bed7fba4d5f00bafadf5359d2416c319cdf18eb2f9417c7353654737af87a6e8579d5e5bab79 + "@metamask/keyring-api": ^12.0.0 + "@metamask/providers": ^18.1.0 + checksum: 10/7a82cd2c19204776d31e29716844ac6f304ce4b136b36728be8e7b19ac2be6b46d0c72cc9707c48669a7a342994ce401aafbfe3f0b47769748ab86ae2169cbbd languageName: node linkType: hard @@ -5623,23 +5631,6 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-api@npm:^10.1.0": - version: 10.1.0 - resolution: "@metamask/keyring-api@npm:10.1.0" - dependencies: - "@metamask/snaps-sdk": "npm:^6.7.0" - "@metamask/superstruct": "npm:^3.1.0" - "@metamask/utils": "npm:^9.2.1" - "@types/uuid": "npm:^9.0.8" - bech32: "npm:^2.0.0" - uuid: "npm:^9.0.1" - webextension-polyfill: "npm:^0.12.0" - peerDependencies: - "@metamask/providers": ^18.1.0 - checksum: 10/de22b9f5f3aecc290210fa78161e157aa8358f8dad421a093c9f6dbe35c4755067472a732f10d1ddbfba789e871c64edd8ea1c4c7316a392b214a187efd46ebe - languageName: node - linkType: hard - "@metamask/keyring-api@npm:^12.0.0": version: 12.0.0 resolution: "@metamask/keyring-api@npm:12.0.0" @@ -5652,7 +5643,7 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-controller@npm:^19.0.0, @metamask/keyring-controller@npm:^19.0.2": +"@metamask/keyring-controller@npm:^19.0.2": version: 19.0.2 resolution: "@metamask/keyring-controller@npm:19.0.2" dependencies: @@ -5686,6 +5677,39 @@ __metadata: languageName: node linkType: hard +"@metamask/keyring-internal-snap-client@npm:^1.0.0": + version: 1.0.0 + resolution: "@metamask/keyring-internal-snap-client@npm:1.0.0" + dependencies: + "@metamask/keyring-api": "npm:^12.0.0" + "@metamask/keyring-snap-client": "npm:^1.0.0" + "@metamask/keyring-utils": "npm:^1.0.0" + "@metamask/snaps-controllers": "npm:^9.10.0" + "@metamask/snaps-sdk": "npm:^6.7.0" + "@metamask/snaps-utils": "npm:^8.3.0" + webextension-polyfill: "npm:^0.12.0" + peerDependencies: + "@metamask/providers": ^18.1.0 + checksum: 10/4c02429235bf5b3609fe2d728f0f976fc87cc276483c092d155b181eeb1f167953a96226c4f6b64f6700084f8a66e5b02944ba0accf201e3514e83df205389e1 + languageName: node + linkType: hard + +"@metamask/keyring-snap-client@npm:^1.0.0": + version: 1.0.0 + resolution: "@metamask/keyring-snap-client@npm:1.0.0" + dependencies: + "@metamask/keyring-api": "npm:^12.0.0" + "@metamask/keyring-utils": "npm:^1.0.0" + "@metamask/superstruct": "npm:^3.1.0" + "@types/uuid": "npm:^9.0.8" + uuid: "npm:^9.0.1" + webextension-polyfill: "npm:^0.12.0" + peerDependencies: + "@metamask/providers": ^18.1.0 + checksum: 10/7b3ee4ab6b39f8e06d55dee2c29f778eeb2eeb8bb311eccaab07d1f8a855fa920bf52e78bd2be0f3ddcb66dc475282d740de0cc7337ccd99e956302a706d76a0 + languageName: node + linkType: hard + "@metamask/keyring-utils@npm:^1.0.0": version: 1.0.0 resolution: "@metamask/keyring-utils@npm:1.0.0" @@ -26521,7 +26545,7 @@ __metadata: "@metamask-institutional/types": "npm:^1.2.0" "@metamask/abi-utils": "npm:^2.0.2" "@metamask/account-watcher": "npm:^4.1.2" - "@metamask/accounts-controller": "npm:^20.0.0" + "@metamask/accounts-controller": "npm:^20.0.2" "@metamask/address-book-controller": "npm:^6.0.0" "@metamask/announcement-controller": "npm:^7.0.0" "@metamask/api-specs": "npm:^0.9.3" @@ -26549,7 +26573,7 @@ __metadata: "@metamask/eth-ledger-bridge-keyring": "npm:^5.0.1" "@metamask/eth-query": "npm:^4.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/eth-snap-keyring": "npm:^5.0.1" + "@metamask/eth-snap-keyring": "npm:^7.0.0" "@metamask/eth-token-tracker": "npm:^9.0.0" "@metamask/eth-trezor-keyring": "npm:^3.1.3" "@metamask/etherscan-link": "npm:^3.0.0" @@ -26561,8 +26585,10 @@ __metadata: "@metamask/jazzicon": "npm:^2.0.0" "@metamask/json-rpc-engine": "npm:^10.0.0" "@metamask/json-rpc-middleware-stream": "npm:^8.0.4" - "@metamask/keyring-api": "npm:^10.1.0" - "@metamask/keyring-controller": "npm:^19.0.0" + "@metamask/keyring-api": "npm:^12.0.0" + "@metamask/keyring-controller": "npm:^19.0.2" + "@metamask/keyring-internal-api": "npm:^1.0.0" + "@metamask/keyring-snap-client": "npm:^1.0.0" "@metamask/logging-controller": "npm:^6.0.0" "@metamask/logo": "npm:^3.1.2" "@metamask/message-manager": "npm:^11.0.0"