diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 2a4df90e4c3a..dcf4adb624e1 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -2,11 +2,12 @@ import { draftTransactionInitialState } from '../ui/ducks/send'; import { KeyringType } from '../shared/constants/keyring'; import { NetworkType } from '@metamask/controller-utils'; import { NetworkStatus } from '@metamask/network-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { CHAIN_IDS } from '../shared/constants/network'; import { copyable, divider, heading, panel, text } from '@metamask/snaps-sdk'; import { getJsxElementFromComponent } from '@metamask/snaps-utils'; import { FirstTimeFlowType } from '../shared/constants/onboarding'; +import { ETH_EOA_METHODS } from '../shared/constants/eth-methods'; const state = { invalidCustomNetwork: { @@ -282,13 +283,15 @@ const state = { }, interfaces: { 'test-interface': { - content: getJsxElementFromComponent(panel([ - heading('Foo bar'), - text('Description'), - divider(), - text('More text'), - copyable('Text you can copy'), - ])), + content: getJsxElementFromComponent( + panel([ + heading('Foo bar'), + text('Description'), + divider(), + text('More text'), + copyable('Text you can copy'), + ]), + ), state: {}, snapId: 'local:http://localhost:8080/', }, @@ -324,7 +327,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -337,7 +340,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '15e69915-2a1a-4019-93b3-916e11fd432f': { @@ -350,7 +353,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '784225f4-d30b-4e77-a900-c8bbce735b88': { @@ -363,7 +366,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, 'b990b846-b384-4508-93d9-587461f1123e': { @@ -376,7 +379,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/app/scripts/controllers/mmi-controller.test.ts b/app/scripts/controllers/mmi-controller.test.ts index 50c7ef197fdf..e30e9a44aa00 100644 --- a/app/scripts/controllers/mmi-controller.test.ts +++ b/app/scripts/controllers/mmi-controller.test.ts @@ -10,7 +10,7 @@ import { SignatureController } from '@metamask/signature-controller'; import { NetworkController } from '@metamask/network-controller'; import { AccountsController } from '@metamask/accounts-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { CustodyController } from '@metamask-institutional/custody-controller'; import { @@ -30,6 +30,7 @@ jest.mock('@metamask-institutional/portfolio-dashboard', () => ({ })); import * as PortfolioDashboard from '@metamask-institutional/portfolio-dashboard'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; jest.mock('./permissions', () => ({ getPermissionBackgroundApiMethods: jest.fn().mockImplementation(() => { @@ -49,7 +50,7 @@ const mockAccount = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; const mockAccount2 = { @@ -62,7 +63,7 @@ const mockAccount2 = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; @@ -349,7 +350,7 @@ describe('MMIController', function () { }); describe('getAllCustodianAccountsWithToken', () => { - it('should return custodian accounts with tokens', async () => { }); + it('should return custodian accounts with tokens', async () => {}); }); describe('handleMmiDashboardData', () => { @@ -438,7 +439,11 @@ describe('MMIController', function () { getCustodianAccounts: mockCustodialKeyring, }); - await mmiController.getCustodianAccounts('token', 'neptune-custody', 'ECA3'); + await mmiController.getCustodianAccounts( + 'token', + 'neptune-custody', + 'ECA3', + ); expect(selectedAccountSpy).toHaveBeenCalledTimes(0); diff --git a/app/scripts/controllers/permissions/specifications.test.js b/app/scripts/controllers/permissions/specifications.test.js index 94312fa57881..9d07a90c0735 100644 --- a/app/scripts/controllers/permissions/specifications.test.js +++ b/app/scripts/controllers/permissions/specifications.test.js @@ -1,9 +1,10 @@ -import { EthMethod, EthAccountType } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { SnapCaveatType } from '@metamask/snaps-rpc-methods'; import { CaveatTypes, RestrictedMethods, } from '../../../../shared/constants/permissions'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import { getCaveatSpecifications, getPermissionSpecifications, @@ -149,7 +150,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -163,7 +164,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, ]; @@ -290,7 +291,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -303,7 +304,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -317,7 +318,7 @@ describe('PermissionController specifications', () => { lastSelected: 3, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -331,7 +332,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, ]; @@ -367,7 +368,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -381,7 +382,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, ]; @@ -415,7 +416,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -429,7 +430,7 @@ describe('PermissionController specifications', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, ]; diff --git a/app/scripts/lib/backup.test.js b/app/scripts/lib/backup.test.js index b9f209a9a408..9f994ec52d55 100644 --- a/app/scripts/lib/backup.test.js +++ b/app/scripts/lib/backup.test.js @@ -1,7 +1,8 @@ /** * @jest-environment node */ -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import Backup from './backup'; function getMockPreferencesController() { @@ -185,14 +186,7 @@ const jsonData = JSON.stringify({ lastSelected: 1693289751176, }, options: {}, - methods: [ - EthMethod.PersonalSign, - EthMethod.Sign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, - ], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/app/scripts/metamask-controller.test.js b/app/scripts/metamask-controller.test.js index 7014834587ef..22c24fcb7707 100644 --- a/app/scripts/metamask-controller.test.js +++ b/app/scripts/metamask-controller.test.js @@ -14,7 +14,7 @@ import { METAMASK_STALELIST_FILE, METAMASK_HOTLIST_DIFF_FILE, } from '@metamask/phishing-controller'; -import { EthMethod, EthAccountType } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { NetworkType } from '@metamask/controller-utils'; import { ControllerMessenger } from '@metamask/base-controller'; import { LoggingController, LogType } from '@metamask/logging-controller'; @@ -28,6 +28,7 @@ import { LOG_EVENT } from '../../shared/constants/logs'; import mockEncryptor from '../../test/lib/mock-encryptor'; import * as tokenUtils from '../../shared/lib/token-util'; import { flushPromises } from '../../test/lib/timer-helpers'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import { deferredPromise } from './lib/util'; import MetaMaskController from './metamask-controller'; @@ -141,7 +142,7 @@ const TEST_INTERNAL_ACCOUNT = { lastSelected: 0, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; diff --git a/app/scripts/migrations/105.test.ts b/app/scripts/migrations/105.test.ts index a57c422c8992..944606043075 100644 --- a/app/scripts/migrations/105.test.ts +++ b/app/scripts/migrations/105.test.ts @@ -1,6 +1,7 @@ import { v4 as uuid } from 'uuid'; import { sha256FromString } from 'ethereumjs-util'; -import { EthMethod, InternalAccount } from '@metamask/keyring-api'; +import { InternalAccount } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import { migrate } from './105'; const MOCK_ADDRESS = '0x0'; @@ -73,14 +74,7 @@ function expectedInternalAccount( lastSelected: lastSelected ? expect.any(Number) : undefined, }, options: {}, - methods: [ - EthMethod.Sign, - EthMethod.PersonalSign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, - ], + methods: ETH_EOA_METHODS, type: 'eip155:eoa', }; } diff --git a/app/scripts/migrations/105.ts b/app/scripts/migrations/105.ts index 8640d9c6c645..d4f5f2985215 100644 --- a/app/scripts/migrations/105.ts +++ b/app/scripts/migrations/105.ts @@ -1,11 +1,8 @@ -import { - EthAccountType, - InternalAccount, - EthMethod, -} from '@metamask/keyring-api'; +import { EthAccountType, InternalAccount } from '@metamask/keyring-api'; import { sha256FromString } from 'ethereumjs-util'; import { v4 as uuid } from 'uuid'; import { cloneDeep } from 'lodash'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; type VersionedData = { meta: { version: number }; @@ -107,14 +104,7 @@ function createInternalAccountsForAccountsController( type: 'HD Key Tree', }, }, - methods: [ - EthMethod.Sign, - EthMethod.PersonalSign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, - ], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; }); diff --git a/app/scripts/migrations/119.test.ts b/app/scripts/migrations/119.test.ts new file mode 100644 index 000000000000..c37a1e5919ae --- /dev/null +++ b/app/scripts/migrations/119.test.ts @@ -0,0 +1,125 @@ +import { createMockInternalAccount } from '../../../test/jest/mocks'; +import { migrate, version } from './119'; + +const mockTimeStamp = 1716972230; +jest.useFakeTimers().setSystemTime(new Date(mockTimeStamp)); + +const oldVersion = 118; +const newVersion = version; + +describe('migration #119', () => { + it('updates the version metadata', async () => { + const oldStorage = { + meta: { version: oldVersion }, + data: {}, + }; + + const newStorage = await migrate(oldStorage); + expect(newStorage.meta).toStrictEqual({ version }); + }); + + it('returns the default state if the AccountsController state is undefined', async () => { + const defaultState = { + internalAccounts: { + accounts: {}, + selectedAccount: '', + }, + }; + + const oldStorage = { + meta: { + version: oldVersion, + }, + data: { + AccountsController: defaultState, + }, + }; + + const newStorage = await migrate(oldStorage); + expect(newStorage).toStrictEqual({ + meta: { + version: newVersion, + }, + data: { + AccountsController: defaultState, + }, + }); + expect(newStorage); + }); + + it('adds importTime attribute to InternalAccount if it is not defined"', async () => { + const mockInternalAccount = createMockInternalAccount(); + // @ts-expect-error forcing the importTime to be undefined for migration test. + mockInternalAccount.metadata.importTime = undefined; + + const oldStorage = { + meta: { + version: oldVersion, + }, + data: { + AccountsController: { + internalAccounts: { + accounts: { + [mockInternalAccount.id]: mockInternalAccount, + }, + selectedAccount: mockInternalAccount.id, + }, + }, + }, + }; + + const newStorage = await migrate(oldStorage); + expect(newStorage).toStrictEqual({ + meta: { + version: newVersion, + }, + data: { + AccountsController: { + internalAccounts: { + accounts: { + [mockInternalAccount.id]: { + ...mockInternalAccount, + metadata: { + ...mockInternalAccount.metadata, + importTime: mockTimeStamp, + }, + }, + }, + selectedAccount: mockInternalAccount.id, + }, + }, + }, + }); + expect(newStorage); + }); + + it('does not change the importTime attribute if it already exists', async () => { + const mockInternalAccount = createMockInternalAccount(); + const mockAccountsControllerState = { + internalAccounts: { + accounts: { + [mockInternalAccount.id]: mockInternalAccount, + }, + selectedAccount: mockInternalAccount.id, + }, + }; + const oldStorage = { + meta: { + version: oldVersion, + }, + data: { + AccountsController: mockAccountsControllerState, + }, + }; + + const newStorage = await migrate(oldStorage); + expect(newStorage).toStrictEqual({ + meta: { + version: newVersion, + }, + data: { + AccountsController: mockAccountsControllerState, + }, + }); + }); +}); diff --git a/app/scripts/migrations/119.ts b/app/scripts/migrations/119.ts new file mode 100644 index 000000000000..6e0f66687350 --- /dev/null +++ b/app/scripts/migrations/119.ts @@ -0,0 +1,62 @@ +import { cloneDeep, isObject } from 'lodash'; +import { hasProperty } from '@metamask/utils'; +import { AccountsControllerState } from '@metamask/accounts-controller'; +import { InternalAccount } from '@metamask/keyring-api'; + +type VersionedData = { + meta: { version: number }; + data: Record; +}; + +export const version = 119; + +/** + * Add a default value for importTime in the InternalAccount + * + * @param originalVersionedData + */ +export async function migrate( + originalVersionedData: VersionedData, +): Promise { + const versionedData = cloneDeep(originalVersionedData); + versionedData.meta.version = version; + transformState(versionedData.data); + return versionedData; +} +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function transformState(state: Record) { + const accountsController = state?.AccountsController || {}; + + if ( + isObject(state.AccountsController) && + hasProperty(state.AccountsController, 'internalAccounts') && + hasProperty( + state.AccountsController + .internalAccounts as AccountsControllerState['internalAccounts'], + 'accounts', + ) && + Array.isArray( + Object.values( + (state.AccountsController as AccountsControllerState).internalAccounts + .accounts, + ), + ) && + Object.values( + (state.AccountsController as AccountsControllerState).internalAccounts + .accounts, + ).length > 0 + ) { + Object.values(accountsController.internalAccounts.accounts).forEach( + (internalAccount: InternalAccount) => { + if (!internalAccount.metadata?.importTime) { + internalAccount.metadata.importTime = Date.now(); + } + }, + ); + } + + return { + ...state, + AccountsController: accountsController, + }; +} diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index 9cd79ee18a35..bcd4fef72698 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -129,6 +129,7 @@ const migrations = [ require('./116'), require('./117'), require('./118'), + require('./119'), ]; export default migrations; diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 2f9449c8264c..c88fe81c8157 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -749,13 +749,21 @@ "packages": { "@ethereumjs/tx>@ethereumjs/util": true, "@ethereumjs/tx>ethereum-cryptography": true, - "@metamask/base-controller": true, + "@metamask/accounts-controller>@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "uuid": true } }, + "@metamask/accounts-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, "@metamask/address-book-controller": { "packages": { "@metamask/address-book-controller>@metamask/base-controller": true, @@ -1103,25 +1111,19 @@ }, "@metamask/eth-snap-keyring": { "globals": { + "URL": true, "console.error": true }, "packages": { "@ethereumjs/tx": true, "@metamask/eth-sig-util": true, - "@metamask/eth-snap-keyring>@metamask/keyring-api": true, "@metamask/eth-snap-keyring>uuid": true, + "@metamask/keyring-api": true, "@metamask/utils": true, "superstruct": true, "webpack>events": true } }, - "@metamask/eth-snap-keyring>@metamask/keyring-api": { - "packages": { - "@metamask/eth-snap-keyring>uuid": true, - "@metamask/utils": true, - "superstruct": true - } - }, "@metamask/eth-snap-keyring>uuid": { "globals": { "crypto": true @@ -1471,7 +1473,11 @@ } }, "@metamask/keyring-api": { + "globals": { + "URL": true + }, "packages": { + "@metamask/keyring-api>bech32": true, "@metamask/keyring-api>uuid": true, "@metamask/utils": true, "superstruct": true @@ -3363,13 +3369,13 @@ "@ethereumjs/tx>@ethereumjs/common>crc-32": true, "@ethersproject/abi": true, "@metamask/ethjs>js-sha3": true, + "@metamask/keyring-api>bech32": true, "@metamask/ppom-validator>elliptic": true, "bn.js": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx": true, "eth-lattice-keyring>gridplus-sdk>aes-js": true, - "eth-lattice-keyring>gridplus-sdk>bech32": true, "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 8e303a4e73c9..7c5d7ecd3dae 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -749,13 +749,21 @@ "packages": { "@ethereumjs/tx>@ethereumjs/util": true, "@ethereumjs/tx>ethereum-cryptography": true, - "@metamask/base-controller": true, + "@metamask/accounts-controller>@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "uuid": true } }, + "@metamask/accounts-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, "@metamask/address-book-controller": { "packages": { "@metamask/address-book-controller>@metamask/base-controller": true, @@ -1248,25 +1256,19 @@ }, "@metamask/eth-snap-keyring": { "globals": { + "URL": true, "console.error": true }, "packages": { "@ethereumjs/tx": true, "@metamask/eth-sig-util": true, - "@metamask/eth-snap-keyring>@metamask/keyring-api": true, "@metamask/eth-snap-keyring>uuid": true, + "@metamask/keyring-api": true, "@metamask/utils": true, "superstruct": true, "webpack>events": true } }, - "@metamask/eth-snap-keyring>@metamask/keyring-api": { - "packages": { - "@metamask/eth-snap-keyring>uuid": true, - "@metamask/utils": true, - "superstruct": true - } - }, "@metamask/eth-snap-keyring>uuid": { "globals": { "crypto": true @@ -1616,7 +1618,11 @@ } }, "@metamask/keyring-api": { + "globals": { + "URL": true + }, "packages": { + "@metamask/keyring-api>bech32": true, "@metamask/keyring-api>uuid": true, "@metamask/utils": true, "superstruct": true @@ -3670,13 +3676,13 @@ "@ethereumjs/tx>@ethereumjs/common>crc-32": true, "@ethersproject/abi": true, "@metamask/ethjs>js-sha3": true, + "@metamask/keyring-api>bech32": true, "@metamask/ppom-validator>elliptic": true, "bn.js": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx": true, "eth-lattice-keyring>gridplus-sdk>aes-js": true, - "eth-lattice-keyring>gridplus-sdk>bech32": true, "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 149ca7bf6a43..95538eded218 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -749,13 +749,21 @@ "packages": { "@ethereumjs/tx>@ethereumjs/util": true, "@ethereumjs/tx>ethereum-cryptography": true, - "@metamask/base-controller": true, + "@metamask/accounts-controller>@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "uuid": true } }, + "@metamask/accounts-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, "@metamask/address-book-controller": { "packages": { "@metamask/address-book-controller>@metamask/base-controller": true, @@ -1248,25 +1256,19 @@ }, "@metamask/eth-snap-keyring": { "globals": { + "URL": true, "console.error": true }, "packages": { "@ethereumjs/tx": true, "@metamask/eth-sig-util": true, - "@metamask/eth-snap-keyring>@metamask/keyring-api": true, "@metamask/eth-snap-keyring>uuid": true, + "@metamask/keyring-api": true, "@metamask/utils": true, "superstruct": true, "webpack>events": true } }, - "@metamask/eth-snap-keyring>@metamask/keyring-api": { - "packages": { - "@metamask/eth-snap-keyring>uuid": true, - "@metamask/utils": true, - "superstruct": true - } - }, "@metamask/eth-snap-keyring>uuid": { "globals": { "crypto": true @@ -1616,7 +1618,11 @@ } }, "@metamask/keyring-api": { + "globals": { + "URL": true + }, "packages": { + "@metamask/keyring-api>bech32": true, "@metamask/keyring-api>uuid": true, "@metamask/utils": true, "superstruct": true @@ -3722,13 +3728,13 @@ "@ethereumjs/tx>@ethereumjs/common>crc-32": true, "@ethersproject/abi": true, "@metamask/ethjs>js-sha3": true, + "@metamask/keyring-api>bech32": true, "@metamask/ppom-validator>elliptic": true, "bn.js": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx": true, "eth-lattice-keyring>gridplus-sdk>aes-js": true, - "eth-lattice-keyring>gridplus-sdk>bech32": true, "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 3161d99399f4..1a3958cffba7 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -749,13 +749,21 @@ "packages": { "@ethereumjs/tx>@ethereumjs/util": true, "@ethereumjs/tx>ethereum-cryptography": true, - "@metamask/base-controller": true, + "@metamask/accounts-controller>@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "uuid": true } }, + "@metamask/accounts-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, "@metamask/address-book-controller": { "packages": { "@metamask/address-book-controller>@metamask/base-controller": true, @@ -1103,25 +1111,19 @@ }, "@metamask/eth-snap-keyring": { "globals": { + "URL": true, "console.error": true }, "packages": { "@ethereumjs/tx": true, "@metamask/eth-sig-util": true, - "@metamask/eth-snap-keyring>@metamask/keyring-api": true, "@metamask/eth-snap-keyring>uuid": true, + "@metamask/keyring-api": true, "@metamask/utils": true, "superstruct": true, "webpack>events": true } }, - "@metamask/eth-snap-keyring>@metamask/keyring-api": { - "packages": { - "@metamask/eth-snap-keyring>uuid": true, - "@metamask/utils": true, - "superstruct": true - } - }, "@metamask/eth-snap-keyring>uuid": { "globals": { "crypto": true @@ -1471,7 +1473,11 @@ } }, "@metamask/keyring-api": { + "globals": { + "URL": true + }, "packages": { + "@metamask/keyring-api>bech32": true, "@metamask/keyring-api>uuid": true, "@metamask/utils": true, "superstruct": true @@ -3571,13 +3577,13 @@ "@ethereumjs/tx>@ethereumjs/common>crc-32": true, "@ethersproject/abi": true, "@metamask/ethjs>js-sha3": true, + "@metamask/keyring-api>bech32": true, "@metamask/ppom-validator>elliptic": true, "bn.js": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx": true, "eth-lattice-keyring>gridplus-sdk>aes-js": true, - "eth-lattice-keyring>gridplus-sdk>bech32": true, "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index e6abab647fa5..44e91993d391 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1034,13 +1034,21 @@ "packages": { "@ethereumjs/tx>@ethereumjs/util": true, "@ethereumjs/tx>ethereum-cryptography": true, - "@metamask/base-controller": true, + "@metamask/accounts-controller>@metamask/base-controller": true, "@metamask/eth-snap-keyring": true, "@metamask/keyring-api": true, "@metamask/keyring-controller": true, "uuid": true } }, + "@metamask/accounts-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, "@metamask/address-book-controller": { "packages": { "@metamask/address-book-controller>@metamask/base-controller": true, @@ -1388,25 +1396,19 @@ }, "@metamask/eth-snap-keyring": { "globals": { + "URL": true, "console.error": true }, "packages": { "@ethereumjs/tx": true, "@metamask/eth-sig-util": true, - "@metamask/eth-snap-keyring>@metamask/keyring-api": true, "@metamask/eth-snap-keyring>uuid": true, + "@metamask/keyring-api": true, "@metamask/utils": true, "superstruct": true, "webpack>events": true } }, - "@metamask/eth-snap-keyring>@metamask/keyring-api": { - "packages": { - "@metamask/eth-snap-keyring>uuid": true, - "@metamask/utils": true, - "superstruct": true - } - }, "@metamask/eth-snap-keyring>uuid": { "globals": { "crypto": true @@ -1756,7 +1758,11 @@ } }, "@metamask/keyring-api": { + "globals": { + "URL": true + }, "packages": { + "@metamask/keyring-api>bech32": true, "@metamask/keyring-api>uuid": true, "@metamask/utils": true, "superstruct": true @@ -3856,13 +3862,13 @@ "@ethereumjs/tx>@ethereumjs/common>crc-32": true, "@ethersproject/abi": true, "@metamask/ethjs>js-sha3": true, + "@metamask/keyring-api>bech32": true, "@metamask/ppom-validator>elliptic": true, "bn.js": true, "browserify>buffer": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/common": true, "eth-lattice-keyring>gridplus-sdk>@ethereumjs/tx": true, "eth-lattice-keyring>gridplus-sdk>aes-js": true, - "eth-lattice-keyring>gridplus-sdk>bech32": true, "eth-lattice-keyring>gridplus-sdk>bignumber.js": true, "eth-lattice-keyring>gridplus-sdk>bitwise": true, "eth-lattice-keyring>gridplus-sdk>borc": true, diff --git a/package.json b/package.json index 362e285724fd..56fd2df6ad52 100644 --- a/package.json +++ b/package.json @@ -283,7 +283,7 @@ "@metamask-institutional/sdk": "^0.1.27", "@metamask-institutional/transaction-update": "^0.2.2", "@metamask/abi-utils": "^2.0.2", - "@metamask/accounts-controller": "^11.0.0", + "@metamask/accounts-controller": "^14.0.0", "@metamask/address-book-controller": "^4.0.1", "@metamask/announcement-controller": "^6.1.0", "@metamask/approval-controller": "^6.0.1", @@ -300,7 +300,7 @@ "@metamask/eth-ledger-bridge-keyring": "^2.0.1", "@metamask/eth-query": "^4.0.0", "@metamask/eth-sig-util": "^7.0.1", - "@metamask/eth-snap-keyring": "^2.1.2", + "@metamask/eth-snap-keyring": "^4.2.1", "@metamask/eth-token-tracker": "^8.0.0", "@metamask/eth-trezor-keyring": "^3.1.0", "@metamask/etherscan-link": "^3.0.0", @@ -309,7 +309,7 @@ "@metamask/ethjs-query": "^0.7.1", "@metamask/gas-fee-controller": "^15.1.2", "@metamask/jazzicon": "^2.0.0", - "@metamask/keyring-api": "^3.0.0", + "@metamask/keyring-api": "^6.3.1", "@metamask/keyring-controller": "patch:@metamask/keyring-controller@npm%3A15.0.0#~/.yarn/patches/@metamask-keyring-controller-npm-15.0.0-fa070ce311.patch", "@metamask/logging-controller": "^3.0.1", "@metamask/logo": "^3.1.2", @@ -340,7 +340,7 @@ "@metamask/snaps-sdk": "^4.3.0", "@metamask/snaps-utils": "^7.4.0", "@metamask/transaction-controller": "^29.1.0", - "@metamask/user-operation-controller": "^8.0.1", + "@metamask/user-operation-controller": "^10.0.0", "@metamask/utils": "^8.2.1", "@ngraveio/bc-ur": "^1.1.12", "@noble/ciphers": "^0.5.2", diff --git a/shared/constants/eth-methods.ts b/shared/constants/eth-methods.ts new file mode 100644 index 000000000000..3eea6c662594 --- /dev/null +++ b/shared/constants/eth-methods.ts @@ -0,0 +1,16 @@ +import { EthMethod } from '@metamask/keyring-api'; + +export const ETH_EOA_METHODS = [ + EthMethod.PersonalSign, + EthMethod.Sign, + EthMethod.SignTransaction, + EthMethod.SignTypedDataV1, + EthMethod.SignTypedDataV3, + EthMethod.SignTypedDataV4, +]; + +export const ETH_4337_METHODS = [ + EthMethod.PrepareUserOperation, + EthMethod.PatchUserOperation, + EthMethod.SignUserOperation, +]; diff --git a/test/e2e/accounts/common.ts b/test/e2e/accounts/common.ts index 7cd62170641b..f90a80036c46 100644 --- a/test/e2e/accounts/common.ts +++ b/test/e2e/accounts/common.ts @@ -53,6 +53,7 @@ export async function installSnapSimpleKeyring( // navigate to test Snaps page and connect await driver.openNewPage(TEST_SNAPS_SIMPLE_KEYRING_WEBSITE_URL); + await driver.clickElement('#connectButton'); await driver.delay(500); @@ -217,7 +218,10 @@ export async function disconnectFromTestDapp(driver: Driver) { await driver.switchToWindowWithTitle(WINDOW_TITLES.ExtensionInFullScreenView); await driver.clickElement('[data-testid="account-options-menu-button"]'); await driver.clickElement({ text: 'All Permissions', tag: 'div' }); - await driver.clickElementAndWaitToDisappear({ text: 'Got it', tag: 'button' }); + await driver.clickElementAndWaitToDisappear({ + text: 'Got it', + tag: 'button', + }); await driver.clickElement({ text: '127.0.0.1:8080', tag: 'p', @@ -243,7 +247,7 @@ export async function approveOrRejectRequest(driver: Driver, flowType: string) { // get the JSON from the screen const requestJSON = await ( await driver.findElement({ - text: '"scope": "",', + text: '"scope":', tag: 'div', }) ).getText(); diff --git a/test/jest/mock-store.js b/test/jest/mock-store.js index 234a1316b94c..5cc7e5bb9325 100644 --- a/test/jest/mock-store.js +++ b/test/jest/mock-store.js @@ -1,8 +1,9 @@ import { NetworkType } from '@metamask/controller-utils'; import { NetworkStatus } from '@metamask/network-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { CHAIN_IDS, CURRENCY_SYMBOLS } from '../../shared/constants/network'; import { KeyringType } from '../../shared/constants/keyring'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; export const createGetSmartTransactionFeesApiResponse = () => { return { @@ -263,7 +264,7 @@ export const createSwapsMockStore = () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -276,7 +277,7 @@ export const createSwapsMockStore = () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '15e69915-2a1a-4019-93b3-916e11fd432f': { @@ -289,7 +290,7 @@ export const createSwapsMockStore = () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '784225f4-d30b-4e77-a900-c8bbce735b88': { @@ -302,7 +303,7 @@ export const createSwapsMockStore = () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '36eb02e0-7925-47f0-859f-076608f09b69': { @@ -319,7 +320,7 @@ export const createSwapsMockStore = () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/test/jest/mocks.js b/test/jest/mocks.js index 645597c51d78..7289f687bcd3 100644 --- a/test/jest/mocks.js +++ b/test/jest/mocks.js @@ -176,6 +176,7 @@ export function createMockInternalAccount({ id: uuidv4(), metadata: { name: name ?? `${keyringTypeToName(keyringType)} 1`, + importTime: Date.now(), keyring: { type: keyringType, }, diff --git a/ui/components/app/account-list-item/account-list-item-component.test.js b/ui/components/app/account-list-item/account-list-item-component.test.js index 4618e9b26c1e..3c7d033e6dfa 100644 --- a/ui/components/app/account-list-item/account-list-item-component.test.js +++ b/ui/components/app/account-list-item/account-list-item-component.test.js @@ -1,9 +1,10 @@ import React from 'react'; import configureStore from 'redux-mock-store'; import { fireEvent } from '@testing-library/react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; import mockState from '../../../../test/data/mock-state.json'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import AccountListItem from './account-list-item'; describe('AccountListItem Component', () => { @@ -22,7 +23,7 @@ describe('AccountListItem Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, className: 'mockClassName', @@ -77,7 +78,7 @@ describe('AccountListItem Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }; diff --git a/ui/components/app/account-list-item/account-list-item.stories.js b/ui/components/app/account-list-item/account-list-item.stories.js index 8e131c09013b..e4155b4312b9 100644 --- a/ui/components/app/account-list-item/account-list-item.stories.js +++ b/ui/components/app/account-list-item/account-list-item.stories.js @@ -1,5 +1,6 @@ import React from 'react'; -import { EthMethod, EthAccountType } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import README from './README.mdx'; import AccountListItem from './account-list-item'; @@ -31,7 +32,7 @@ const account = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, address: '0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e', balance: '0x2d3142f5000', diff --git a/ui/components/app/connected-accounts-list/connected-accounts-list.stories.js b/ui/components/app/connected-accounts-list/connected-accounts-list.stories.js index 398b2e88d1b3..9860047cd9fd 100644 --- a/ui/components/app/connected-accounts-list/connected-accounts-list.stories.js +++ b/ui/components/app/connected-accounts-list/connected-accounts-list.stories.js @@ -1,5 +1,6 @@ import React from 'react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import ConnectedAccountsList from '.'; export default { @@ -44,7 +45,7 @@ export default { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/app/modals/confirm-remove-account/confirm-remove-account.stories.js b/ui/components/app/modals/confirm-remove-account/confirm-remove-account.stories.js index 3c6ce0ae6497..1cf35240b59f 100644 --- a/ui/components/app/modals/confirm-remove-account/confirm-remove-account.stories.js +++ b/ui/components/app/modals/confirm-remove-account/confirm-remove-account.stories.js @@ -1,5 +1,6 @@ import React from 'react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../../../../shared/constants/eth-methods'; import ConfirmRemoveAccount from '.'; export default { @@ -22,14 +23,7 @@ export default { }, }, options: {}, - methods: [ - EthMethod.PersonalSign, - EthMethod.Sign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, - ], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/app/modals/confirm-remove-account/confirm-remove-account.test.js b/ui/components/app/modals/confirm-remove-account/confirm-remove-account.test.js index 64cf8f4513f5..51810a2554e9 100644 --- a/ui/components/app/modals/confirm-remove-account/confirm-remove-account.test.js +++ b/ui/components/app/modals/confirm-remove-account/confirm-remove-account.test.js @@ -1,8 +1,9 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import { fireEvent } from '@testing-library/react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { renderWithProvider } from '../../../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../../../shared/constants/eth-methods'; import ConfirmRemoveAccount from '.'; describe('Confirm Remove Account', () => { @@ -23,7 +24,7 @@ describe('Confirm Remove Account', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -45,7 +46,7 @@ describe('Confirm Remove Account', () => { }, }, options: {}, - mmethods: [...Object.values(EthMethod)], + mmethods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, chainId: '0x99', diff --git a/ui/components/app/nfts-tab/nfts-tab.test.js b/ui/components/app/nfts-tab/nfts-tab.test.js index 0ee9a7179e85..ae7ea6737ece 100644 --- a/ui/components/app/nfts-tab/nfts-tab.test.js +++ b/ui/components/app/nfts-tab/nfts-tab.test.js @@ -1,12 +1,13 @@ import React from 'react'; import { fireEvent, screen } from '@testing-library/react'; import reactRouterDom from 'react-router-dom'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import configureStore from '../../../store/store'; import { renderWithProvider } from '../../../../test/jest'; import { SECURITY_ROUTE } from '../../../helpers/constants/routes'; import { setBackgroundConnection } from '../../../store/background-connection'; import { CHAIN_IDS, NETWORK_TYPES } from '../../../../shared/constants/network'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import NftsTab from '.'; const ETH_BALANCE = '0x16345785d8a0000'; // 0.1 ETH @@ -191,7 +192,7 @@ const render = ({ }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/app/transaction-status-label/transaction-status-label.test.js b/ui/components/app/transaction-status-label/transaction-status-label.test.js index 57ef06c706b0..4fa8e832201f 100644 --- a/ui/components/app/transaction-status-label/transaction-status-label.test.js +++ b/ui/components/app/transaction-status-label/transaction-status-label.test.js @@ -1,9 +1,10 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionStatus } from '@metamask/transaction-controller'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import TransactionStatusLabel from '.'; describe('TransactionStatusLabel Component', () => { @@ -23,7 +24,7 @@ describe('TransactionStatusLabel Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -145,7 +146,7 @@ describe('TransactionStatusLabel Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -199,7 +200,7 @@ describe('TransactionStatusLabel Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -255,7 +256,7 @@ describe('TransactionStatusLabel Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/app/wallet-overview/eth-overview.test.js b/ui/components/app/wallet-overview/eth-overview.test.js index a17ee3cc499d..10151afe79c4 100644 --- a/ui/components/app/wallet-overview/eth-overview.test.js +++ b/ui/components/app/wallet-overview/eth-overview.test.js @@ -12,6 +12,7 @@ import { import { renderWithProvider } from '../../../../test/jest/rendering'; import { KeyringType } from '../../../../shared/constants/keyring'; import { useIsOriginalNativeTokenSymbol } from '../../../hooks/useIsOriginalNativeTokenSymbol'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import EthOverview from './eth-overview'; // Mock BUYABLE_CHAINS_MAP @@ -99,7 +100,7 @@ describe('EthOverview', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, 'e9b992f9-e151-4317-b8b7-c771bb73dd02': { @@ -112,7 +113,7 @@ describe('EthOverview', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/app/wallet-overview/token-overview.test.js b/ui/components/app/wallet-overview/token-overview.test.js index d852a58a9b7c..bd61ac5f2a6f 100644 --- a/ui/components/app/wallet-overview/token-overview.test.js +++ b/ui/components/app/wallet-overview/token-overview.test.js @@ -2,10 +2,11 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { fireEvent, waitFor } from '@testing-library/react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import { renderWithProvider } from '../../../../test/jest/rendering'; import { KeyringType } from '../../../../shared/constants/keyring'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import TokenOverview from './token-overview'; // Mock BUYABLE_CHAINS_MAP @@ -49,7 +50,7 @@ describe('TokenOverview', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.test.js b/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.test.js index a5cc0c435ac1..a4f45acbc831 100644 --- a/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.test.js +++ b/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.test.js @@ -2,11 +2,12 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { screen, fireEvent } from '@testing-library/react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { act } from 'react-dom/test-utils'; import { sha256 } from '../../../../shared/modules/hash.utils'; import { KeyringType } from '../../../../shared/constants/keyring'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import InteractiveReplacementTokenNotification from './interactive-replacement-token-notification'; jest.mock('../../../../shared/modules/hash.utils'); @@ -58,7 +59,7 @@ describe('Interactive Replacement Token Notification', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/institutional/wrong-network-notification/wrong-network-notification.test.js b/ui/components/institutional/wrong-network-notification/wrong-network-notification.test.js index 9e01b8b2bd93..c87f1399e7e7 100644 --- a/ui/components/institutional/wrong-network-notification/wrong-network-notification.test.js +++ b/ui/components/institutional/wrong-network-notification/wrong-network-notification.test.js @@ -1,9 +1,10 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { toHex } from '@metamask/controller-utils'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; import testData from '../../../../.storybook/test-data'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import WrongNetworkNotification from '.'; jest.mock('../../../../shared/modules/hash.utils'); @@ -40,7 +41,7 @@ describe('Wrong Network Notification', function () { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/multichain/account-list-menu/account-list-menu.test.js b/ui/components/multichain/account-list-menu/account-list-menu.test.js index 04596d0f71d0..aaeb95e05bfc 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.test.js +++ b/ui/components/multichain/account-list-menu/account-list-menu.test.js @@ -1,7 +1,7 @@ /* eslint-disable jest/require-top-level-describe */ import React from 'react'; import reactRouterDom from 'react-router-dom'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { fireEvent, renderWithProvider, waitFor } from '../../../../test/jest'; import configureStore from '../../../store/store'; import mockState from '../../../../test/data/mock-state.json'; @@ -9,6 +9,7 @@ import mockState from '../../../../test/data/mock-state.json'; import messages from '../../../../app/_locales/en/messages.json'; import { CONNECT_HARDWARE_ROUTE } from '../../../helpers/constants/routes'; ///: END:ONLY_INCLUDE_IF +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import { AccountListMenu } from '.'; ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) @@ -147,7 +148,7 @@ describe('AccountListMenu', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/multichain/connected-site-menu/connected-site-menu.test.js b/ui/components/multichain/connected-site-menu/connected-site-menu.test.js index 7cc519851601..67ea5a99efb5 100644 --- a/ui/components/multichain/connected-site-menu/connected-site-menu.test.js +++ b/ui/components/multichain/connected-site-menu/connected-site-menu.test.js @@ -1,6 +1,6 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { renderWithProvider } from '../../../../test/jest'; import { STATUS_CONNECTED, @@ -11,6 +11,7 @@ import { BackgroundColor, Color, } from '../../../helpers/constants/design-system'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import { ConnectedSiteMenu } from '.'; describe('Connected Site Menu', () => { @@ -26,7 +27,7 @@ describe('Connected Site Menu', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -39,7 +40,7 @@ describe('Connected Site Menu', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/components/multichain/pages/send/send.test.js b/ui/components/multichain/pages/send/send.test.js index 9d85893071e0..9b9fdefebc6f 100644 --- a/ui/components/multichain/pages/send/send.test.js +++ b/ui/components/multichain/pages/send/send.test.js @@ -2,7 +2,7 @@ import React from 'react'; import thunk from 'redux-thunk'; import configureMockStore from 'redux-mock-store'; import { NetworkType } from '@metamask/controller-utils'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { act } from '@testing-library/react'; import { renderWithProvider, @@ -22,6 +22,7 @@ import { import mockSendState from '../../../../../test/data/mock-send-state.json'; import { useIsOriginalNativeTokenSymbol } from '../../../../hooks/useIsOriginalNativeTokenSymbol'; import { KeyringType } from '../../../../../shared/constants/keyring'; +import { ETH_EOA_METHODS } from '../../../../../shared/constants/eth-methods'; import { SendPage } from '.'; jest.mock('@ethersproject/providers', () => { @@ -137,7 +138,7 @@ const baseStore = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, permissionHistory: { diff --git a/ui/ducks/metamask/metamask.test.js b/ui/ducks/metamask/metamask.test.js index c8cbacc74ce4..8cd2972eb97d 100644 --- a/ui/ducks/metamask/metamask.test.js +++ b/ui/ducks/metamask/metamask.test.js @@ -1,6 +1,6 @@ import { NetworkType } from '@metamask/controller-utils'; import { NetworkStatus } from '@metamask/network-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { GasFeeEstimateType, TransactionStatus, @@ -8,6 +8,7 @@ import { } from '@metamask/transaction-controller'; import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import * as actionConstants from '../../store/actionConstants'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import reduceMetamask, { getBlockGasLimit, getConversionRate, @@ -22,14 +23,6 @@ import reduceMetamask, { isNotEIP1559Network, } from './metamask'; -const EOA_EVM_METHODS = [ - EthMethod.PersonalSign, - EthMethod.Sign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, -]; jest.mock('@metamask/transaction-controller', () => ({ ...jest.requireActual('@metamask/transaction-controller'), mergeGasFeeEstimates: jest.fn(), @@ -77,7 +70,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -90,7 +83,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '15e69915-2a1a-4019-93b3-916e11fd432f': { @@ -103,7 +96,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '784225f4-d30b-4e77-a900-c8bbce735b88': { @@ -116,7 +109,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -431,7 +424,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -447,7 +440,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x37452b1315889f80', @@ -463,7 +456,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x30c9d71831c76efe', @@ -479,7 +472,7 @@ describe('MetaMask Reducers', () => { }, }, options: {}, - methods: EOA_EVM_METHODS, + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x0', diff --git a/ui/ducks/send/send.test.js b/ui/ducks/send/send.test.js index d0ad1eb8fbf1..ff8e0eb24026 100644 --- a/ui/ducks/send/send.test.js +++ b/ui/ducks/send/send.test.js @@ -4,7 +4,7 @@ import thunk from 'redux-thunk'; import { BigNumber } from '@ethersproject/bignumber'; import { NetworkType } from '@metamask/controller-utils'; import { NetworkStatus } from '@metamask/network-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionEnvelopeType } from '@metamask/transaction-controller'; import { waitFor } from '@testing-library/react'; import { @@ -34,6 +34,7 @@ import { getInitialSendStateWithExistingTxState, INITIAL_SEND_STATE_FOR_EXISTING_DRAFT, } from '../../../test/jest/mocks'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import sendReducer, { initialState, initializeSendState, @@ -1501,7 +1502,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -1688,7 +1689,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -1761,7 +1762,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -1828,7 +1829,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -1906,7 +1907,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -1978,7 +1979,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -2042,7 +2043,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -2336,7 +2337,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -2654,7 +2655,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -2888,7 +2889,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -3190,7 +3191,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -3270,7 +3271,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, balance: '0x0', }, @@ -3369,7 +3370,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -3451,7 +3452,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, balance: '0x0', }, @@ -3561,7 +3562,7 @@ describe('Send Slice', () => { address: mockAddress1, id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, metadata: { name: 'Test Account', @@ -3681,7 +3682,7 @@ describe('Send Slice', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, balance: '0x0', }, @@ -3787,7 +3788,7 @@ describe('Send Slice', () => { address: mockAddress1, id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, metadata: { name: 'Test Account', @@ -3934,9 +3935,6 @@ describe('Send Slice', () => { 'eth_signTypedData_v1', 'eth_signTypedData_v3', 'eth_signTypedData_v4', - 'eth_prepareUserOperation', - 'eth_patchUserOperation', - 'eth_signUserOperation', ], options: {}, type: 'eip155:eoa', diff --git a/ui/hooks/useAddressDetails.test.js b/ui/hooks/useAddressDetails.test.js index 4c723d318bba..2a4e03eee343 100644 --- a/ui/hooks/useAddressDetails.test.js +++ b/ui/hooks/useAddressDetails.test.js @@ -1,9 +1,10 @@ import React from 'react'; import { Provider } from 'react-redux'; import { renderHook } from '@testing-library/react-hooks'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import configureStore from '../store/store'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import useAddressDetails from './useAddressDetails'; const renderUseAddressDetails = (toAddress, stateVariables = {}) => { @@ -26,7 +27,7 @@ const renderUseAddressDetails = (toAddress, stateVariables = {}) => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -89,7 +90,7 @@ describe('useAddressDetails', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/hooks/useAssetDetails.test.js b/ui/hooks/useAssetDetails.test.js index 08b10ceefc58..f14725bdd4b8 100644 --- a/ui/hooks/useAssetDetails.test.js +++ b/ui/hooks/useAssetDetails.test.js @@ -1,12 +1,13 @@ import React from 'react'; import { Provider } from 'react-redux'; import { renderHook } from '@testing-library/react-hooks'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { useAssetDetails } from '../pages/confirmations/hooks/useAssetDetails'; import configureStore from '../store/store'; import * as Actions from '../store/actions'; import { TokenStandard } from '../../shared/constants/transaction'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; const renderUseAssetDetails = ({ tokenAddress, @@ -33,7 +34,7 @@ const renderUseAssetDetails = ({ }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.test.js b/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.test.js index 12cea388a40b..295625196ded 100644 --- a/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.test.js +++ b/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.test.js @@ -2,13 +2,14 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { fireEvent, screen } from '@testing-library/react'; import { ApprovalType } from '@metamask/controller-utils'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { resolvePendingApproval, rejectPendingApproval, } from '../../store/actions'; import configureStore from '../../store/store'; import { renderWithProvider } from '../../../test/jest/rendering'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import ConfirmAddSuggestedToken from '.'; const PENDING_APPROVALS = { @@ -81,7 +82,7 @@ const renderComponent = (tokens = []) => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirm-decrypt-message/confirm-decrypt-message.component.test.js b/ui/pages/confirm-decrypt-message/confirm-decrypt-message.component.test.js index bdd49dd21369..e073474d79fe 100644 --- a/ui/pages/confirm-decrypt-message/confirm-decrypt-message.component.test.js +++ b/ui/pages/confirm-decrypt-message/confirm-decrypt-message.component.test.js @@ -1,8 +1,9 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import mockState from '../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import ConfirmDecryptMessage from './confirm-decrypt-message.component'; const messageData = { @@ -89,7 +90,7 @@ const baseProps = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }; diff --git a/ui/pages/confirm-encryption-public-key/confirm-encryption-public-key.component.test.js b/ui/pages/confirm-encryption-public-key/confirm-encryption-public-key.component.test.js index 1cd76046bd4a..771a5a5f5ef7 100644 --- a/ui/pages/confirm-encryption-public-key/confirm-encryption-public-key.component.test.js +++ b/ui/pages/confirm-encryption-public-key/confirm-encryption-public-key.component.test.js @@ -1,8 +1,9 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import mockState from '../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import ConfirmEncryptionPublicKey from './confirm-encryption-public-key.component'; const baseProps = { @@ -38,7 +39,7 @@ const baseProps = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, name: 'Antonio', }, diff --git a/ui/pages/confirmations/components/edit-gas-fee-popover/edit-gas-fee-popover.test.js b/ui/pages/confirmations/components/edit-gas-fee-popover/edit-gas-fee-popover.test.js index 9a6472824c5c..35f01bf36f1b 100644 --- a/ui/pages/confirmations/components/edit-gas-fee-popover/edit-gas-fee-popover.test.js +++ b/ui/pages/confirmations/components/edit-gas-fee-popover/edit-gas-fee-popover.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { act, screen } from '@testing-library/react'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionStatus, @@ -16,6 +16,7 @@ import { CHAIN_IDS, GOERLI_DISPLAY_NAME, } from '../../../../../shared/constants/network'; +import { ETH_EOA_METHODS } from '../../../../../shared/constants/eth-methods'; import EditGasFeePopover from './edit-gas-fee-popover'; jest.mock('../../../../store/actions', () => ({ @@ -103,7 +104,7 @@ const render = async ({ txProps, contextProps } = {}) => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/components/signature-request-original/signature-request-original.test.js b/ui/pages/confirmations/components/signature-request-original/signature-request-original.test.js index bc3b732466bb..2d8ab54e6ce7 100644 --- a/ui/pages/confirmations/components/signature-request-original/signature-request-original.test.js +++ b/ui/pages/confirmations/components/signature-request-original/signature-request-original.test.js @@ -2,7 +2,7 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import { fireEvent, screen } from '@testing-library/react'; import { act } from 'react-dom/test-utils'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { MESSAGE_TYPE } from '../../../../../shared/constants/app'; import { SECURITY_PROVIDER_MESSAGE_SEVERITY } from '../../../../../shared/constants/security-provider'; import mockState from '../../../../../test/data/mock-state.json'; @@ -14,6 +14,7 @@ import { completedTx, } from '../../../../store/actions'; import { shortenAddress } from '../../../../helpers/utils/util'; +import { ETH_EOA_METHODS } from '../../../../../shared/constants/eth-methods'; import SignatureRequestOriginal from '.'; jest.mock('../../../../store/actions', () => ({ @@ -77,7 +78,7 @@ const props = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }; @@ -235,7 +236,7 @@ describe('SignatureRequestOriginal', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; const mismatchAccountText = `Your selected account (${shortenAddress( diff --git a/ui/pages/confirmations/components/signature-request/signature-request-data/signature-request-data.test.js b/ui/pages/confirmations/components/signature-request/signature-request-data/signature-request-data.test.js index c5b642ab3a77..8d7714361349 100644 --- a/ui/pages/confirmations/components/signature-request/signature-request-data/signature-request-data.test.js +++ b/ui/pages/confirmations/components/signature-request/signature-request-data/signature-request-data.test.js @@ -1,9 +1,10 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { renderWithProvider } from '../../../../../../test/lib/render-helpers'; import { sanitizeMessage } from '../../../../../helpers/utils/util'; import Identicon from '../../../../../components/ui/identicon'; +import { ETH_EOA_METHODS } from '../../../../../../shared/constants/eth-methods'; import SignatureRequestData from './signature-request-data'; describe('Signature Request Data', () => { @@ -51,7 +52,7 @@ describe('Signature Request Data', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -64,7 +65,7 @@ describe('Signature Request Data', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/components/signature-request/signature-request-header/signature-request-header.component.test.js b/ui/pages/confirmations/components/signature-request/signature-request-header/signature-request-header.component.test.js index 0f651f661045..2430640e6cb7 100644 --- a/ui/pages/confirmations/components/signature-request/signature-request-header/signature-request-header.component.test.js +++ b/ui/pages/confirmations/components/signature-request/signature-request-header/signature-request-header.component.test.js @@ -1,8 +1,9 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import mockState from '../../../../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../../../../shared/constants/eth-methods'; import SignatureRequestHeader from './signature-request-header.component'; describe('SignatureRequestHeader', () => { @@ -19,7 +20,7 @@ describe('SignatureRequestHeader', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; diff --git a/ui/pages/confirmations/components/signature-request/signature-request.test.js b/ui/pages/confirmations/components/signature-request/signature-request.test.js index 1756ffa36219..52ebe747d9be 100644 --- a/ui/pages/confirmations/components/signature-request/signature-request.test.js +++ b/ui/pages/confirmations/components/signature-request/signature-request.test.js @@ -2,7 +2,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { fireEvent } from '@testing-library/react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import mockState from '../../../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../../../test/lib/render-helpers'; import { SECURITY_PROVIDER_MESSAGE_SEVERITY } from '../../../../../shared/constants/security-provider'; @@ -24,6 +24,7 @@ import { getMemoizedMetaMaskInternalAccounts, getSelectedInternalAccount, } from '../../../../selectors'; +import { ETH_EOA_METHODS } from '../../../../../shared/constants/eth-methods'; import SignatureRequest from './signature-request'; const baseProps = { @@ -65,14 +66,7 @@ const mockStore = { }, }, options: {}, - methods: [ - EthMethod.PersonalSign, - EthMethod.Sign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, - ], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -507,7 +501,7 @@ describe('Signature Request Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3': { @@ -520,7 +514,7 @@ describe('Signature Request Component', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/confirm-signature-request/index.test.js b/ui/pages/confirmations/confirm-signature-request/index.test.js index 8f9376e83911..7ca14941ccb6 100644 --- a/ui/pages/confirmations/confirm-signature-request/index.test.js +++ b/ui/pages/confirmations/confirm-signature-request/index.test.js @@ -1,7 +1,8 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import ConfTx from '.'; const mockState = { @@ -46,7 +47,7 @@ const mockState = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.test.js b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.test.js index e567aca60397..5cf90c0da6cb 100644 --- a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.test.js +++ b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.test.js @@ -5,7 +5,7 @@ import { fireEvent } from '@testing-library/react'; import { NetworkType } from '@metamask/controller-utils'; import { NetworkStatus } from '@metamask/network-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionStatus, TransactionType, @@ -27,6 +27,7 @@ import { BlockaidReason, BlockaidResultType, } from '../../../../shared/constants/security-provider'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import ConfirmTransactionBase from './confirm-transaction-base.container'; jest.mock('../components/simulation-details/useSimulationMetrics'); @@ -151,7 +152,7 @@ const baseStore = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/hooks/useBalance.test.js b/ui/pages/confirmations/hooks/useBalance.test.js index ea4c3b384081..1909f1a6410f 100644 --- a/ui/pages/confirmations/hooks/useBalance.test.js +++ b/ui/pages/confirmations/hooks/useBalance.test.js @@ -1,9 +1,10 @@ import React from 'react'; import { Provider } from 'react-redux'; import { renderHook } from '@testing-library/react-hooks'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import configureStore from '../../../store/store'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import { useBalance } from './useBalance'; const renderUseBalance = (fromAddress, stateVariables = {}) => { @@ -33,7 +34,7 @@ const renderUseBalance = (fromAddress, stateVariables = {}) => { 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3': { address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/send/send.test.js b/ui/pages/confirmations/send/send.test.js index f8b17cfb627f..d0dab0516116 100644 --- a/ui/pages/confirmations/send/send.test.js +++ b/ui/pages/confirmations/send/send.test.js @@ -3,7 +3,7 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { useLocation } from 'react-router-dom'; import { NetworkType } from '@metamask/controller-utils'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { SEND_STAGES, startNewDraftTransaction } from '../../../ducks/send'; import { domainInitialState } from '../../../ducks/domains'; import { setBackgroundConnection } from '../../../store/background-connection'; @@ -16,6 +16,7 @@ import { renderWithProvider } from '../../../../test/jest'; import { GasEstimateTypes } from '../../../../shared/constants/gas'; import { KeyringType } from '../../../../shared/constants/keyring'; import { INITIAL_SEND_STATE_FOR_EXISTING_DRAFT } from '../../../../test/jest/mocks'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import Send from './send'; const middleware = [thunk]; @@ -93,7 +94,7 @@ const baseStore = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/confirmations/token-allowance/token-allowance.test.js b/ui/pages/confirmations/token-allowance/token-allowance.test.js index 37e8a58b5e5c..d727b89b25a8 100644 --- a/ui/pages/confirmations/token-allowance/token-allowance.test.js +++ b/ui/pages/confirmations/token-allowance/token-allowance.test.js @@ -4,9 +4,10 @@ import { act, fireEvent } from '@testing-library/react'; import thunk from 'redux-thunk'; import { NetworkType } from '@metamask/controller-utils'; import { NetworkStatus } from '@metamask/network-controller'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; import { KeyringType } from '../../../../shared/constants/keyring'; +import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods'; import TokenAllowance from './token-allowance'; const testTokenAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F'; @@ -34,7 +35,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -47,7 +48,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/pages/connected-accounts/connected-accounts.stories.js b/ui/pages/connected-accounts/connected-accounts.stories.js index be492597b5e8..a93b385ae95f 100644 --- a/ui/pages/connected-accounts/connected-accounts.stories.js +++ b/ui/pages/connected-accounts/connected-accounts.stories.js @@ -1,6 +1,7 @@ import React from 'react'; import { action } from '@storybook/addon-actions'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import ConnectedAccounts from './connected-accounts.component'; export default { @@ -66,7 +67,7 @@ const accounts = [ }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -79,7 +80,7 @@ const accounts = [ }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, ]; diff --git a/ui/pages/token-details/token-details-page.test.js b/ui/pages/token-details/token-details-page.test.js index a2f00370a9bf..033e8418a711 100644 --- a/ui/pages/token-details/token-details-page.test.js +++ b/ui/pages/token-details/token-details-page.test.js @@ -1,10 +1,11 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { fireEvent } from '@testing-library/react'; import { renderWithProvider } from '../../../test/lib/render-helpers'; import Identicon from '../../components/ui/identicon'; import { isEqualCaseInsensitive } from '../../../shared/modules/string-utils'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import TokenDetailsPage from './token-details-page'; const testTokenAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F'; @@ -22,7 +23,7 @@ const state = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/selectors/institutional/selectors.test.js b/ui/selectors/institutional/selectors.test.js index 4645b59ad633..3e399ad8746f 100644 --- a/ui/selectors/institutional/selectors.test.js +++ b/ui/selectors/institutional/selectors.test.js @@ -1,7 +1,8 @@ import { toChecksumAddress } from 'ethereumjs-util'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { toHex } from '@metamask/controller-utils'; import { createMockInternalAccount } from '../../../test/jest/mocks'; +import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import { getConfiguredCustodians, getCustodianIconForAddress, @@ -38,14 +39,8 @@ function buildState(overrides = {}) { }, }, options: {}, - methods: [ - EthMethod.PersonalSign, - EthMethod.Sign, - EthMethod.SignTransaction, - EthMethod.SignTypedDataV1, - EthMethod.SignTypedDataV3, - EthMethod.SignTypedDataV4, - ], + methods: ETH_EOA_METHODS, + type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -196,7 +191,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -237,7 +232,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -289,7 +284,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -319,7 +314,7 @@ describe('Institutional selectors', () => { name: 'Custody Account A', }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -355,7 +350,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -396,7 +391,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -441,7 +436,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -488,7 +483,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', @@ -535,7 +530,7 @@ describe('Institutional selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, code: '0x', balance: '0x47c9d71831c76efe', diff --git a/ui/selectors/nonce-sorted-transactions-selector.test.js b/ui/selectors/nonce-sorted-transactions-selector.test.js index a3488a20a13b..f4b41a982c1b 100644 --- a/ui/selectors/nonce-sorted-transactions-selector.test.js +++ b/ui/selectors/nonce-sorted-transactions-selector.test.js @@ -1,10 +1,11 @@ import { head, last } from 'lodash'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionStatus, TransactionType, } from '@metamask/transaction-controller'; import { CHAIN_IDS } from '../../shared/constants/network'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import { nonceSortedTransactionsSelector } from './transactions'; const RECIPIENTS = { @@ -98,7 +99,7 @@ const getStateTree = ({ }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/selectors/permissions.test.js b/ui/selectors/permissions.test.js index 9bf5b1a0aa96..5c10c9b27e3a 100644 --- a/ui/selectors/permissions.test.js +++ b/ui/selectors/permissions.test.js @@ -1,6 +1,7 @@ -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { CHAIN_IDS } from '../../shared/constants/network'; import { createMockInternalAccount } from '../../test/jest/mocks'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import { getConnectedSubjectsForSelectedAddress, getLastConnectedInfo, @@ -25,7 +26,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -234,7 +235,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -249,7 +250,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '15e69915-2a1a-4019-93b3-916e11fd432f': { @@ -264,7 +265,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '784225f4-d30b-4e77-a900-c8bbce735b88': { @@ -279,7 +280,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, 'f9305241-c50f-4725-ad0f-cbd3f24ac7ab': { @@ -292,7 +293,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -382,7 +383,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -397,7 +398,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -413,7 +414,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -428,7 +429,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, { @@ -444,7 +445,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, ]); @@ -499,7 +500,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '07c2cfec-36c9-46c4-8115-3836d3ac9047': { @@ -514,7 +515,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '15e69915-2a1a-4019-93b3-916e11fd432f': { @@ -529,7 +530,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, '784225f4-d30b-4e77-a900-c8bbce735b88': { @@ -544,7 +545,7 @@ describe('selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index d3fce24142f0..875551a8618b 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -13,6 +13,7 @@ import { import { SURVEY_DATE, SURVEY_GMT } from '../helpers/constants/survey'; import { PRIVACY_POLICY_DATE } from '../helpers/constants/privacy-policy'; import { createMockInternalAccount } from '../../test/jest/mocks'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import * as selectors from './selectors'; jest.mock('../../app/scripts/lib/util', () => ({ @@ -87,7 +88,7 @@ describe('Selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }; expect( diff --git a/ui/selectors/transactions.test.js b/ui/selectors/transactions.test.js index 88fcbe63a44a..3f8593bc06a4 100644 --- a/ui/selectors/transactions.test.js +++ b/ui/selectors/transactions.test.js @@ -1,7 +1,11 @@ import { ApprovalType } from '@metamask/controller-utils'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionStatus } from '@metamask/transaction-controller'; import { CHAIN_IDS } from '../../shared/constants/network'; +import { + ETH_4337_METHODS, + ETH_EOA_METHODS, +} from '../../shared/constants/eth-methods'; import { unapprovedMessagesSelector, transactionsSelector, @@ -48,7 +52,7 @@ describe('Transaction Selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -146,7 +150,7 @@ describe('Transaction Selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -293,7 +297,7 @@ describe('Transaction Selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -396,7 +400,7 @@ describe('Transaction Selectors', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_4337_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/ui/store/actions.test.js b/ui/store/actions.test.js index 7aa1e340bbb5..e43c02e4bcb4 100644 --- a/ui/store/actions.test.js +++ b/ui/store/actions.test.js @@ -1,7 +1,7 @@ import sinon from 'sinon'; import configureStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { EthAccountType } from '@metamask/keyring-api'; import { TransactionStatus } from '@metamask/transaction-controller'; import enLocale from '../../app/_locales/en/messages.json'; import MetaMaskController from '../../app/scripts/metamask-controller'; @@ -10,6 +10,7 @@ import { GAS_LIMITS } from '../../shared/constants/gas'; import { ORIGIN_METAMASK } from '../../shared/constants/app'; import { MetaMetricsNetworkEventSource } from '../../shared/constants/metametrics'; import { TRIGGER_TYPES } from '../../app/scripts/controllers/metamask-notifications/constants/notification-schema'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import * as actions from './actions'; import * as actionConstants from './actionConstants'; import { setBackgroundConnection } from './background-connection'; @@ -36,7 +37,7 @@ const defaultState = { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -264,7 +265,7 @@ describe('Actions', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, @@ -2074,7 +2075,7 @@ describe('Actions', () => { }, }, options: {}, - methods: [...Object.values(EthMethod)], + methods: ETH_EOA_METHODS, type: EthAccountType.Eoa, }, }, diff --git a/yarn.lock b/yarn.lock index 9a7916e08d40..2fa690649d51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4601,28 +4601,6 @@ __metadata: languageName: node linkType: hard -"@metamask/accounts-controller@npm:^11.0.0": - version: 11.0.0 - resolution: "@metamask/accounts-controller@npm:11.0.0" - dependencies: - "@ethereumjs/util": "npm:^8.1.0" - "@metamask/base-controller": "npm:^4.1.1" - "@metamask/eth-snap-keyring": "npm:^2.1.1" - "@metamask/keyring-api": "npm:^3.0.0" - "@metamask/snaps-sdk": "npm:^1.3.2" - "@metamask/snaps-utils": "npm:^5.1.2" - "@metamask/utils": "npm:^8.3.0" - deepmerge: "npm:^4.2.2" - ethereum-cryptography: "npm:^2.1.2" - immer: "npm:^9.0.6" - uuid: "npm:^8.3.2" - peerDependencies: - "@metamask/keyring-controller": ^13.0.0 - "@metamask/snaps-controllers": ^4.0.0 - checksum: 10/3d57f8763a0553ca22b492534cbb6b3ee40f61f434386f567965127382e2049919e9a5101eb97eb5e00d81f4b8e691c7a7f7ab0c177aee879a3e4da9cef3e8c1 - languageName: node - linkType: hard - "@metamask/accounts-controller@npm:^14.0.0": version: 14.0.0 resolution: "@metamask/accounts-controller@npm:14.0.0" @@ -4665,18 +4643,6 @@ __metadata: languageName: node linkType: hard -"@metamask/approval-controller@npm:^5.1.1": - version: 5.1.3 - resolution: "@metamask/approval-controller@npm:5.1.3" - dependencies: - "@metamask/base-controller": "npm:^4.1.1" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.3.0" - nanoid: "npm:^3.1.31" - checksum: 10/6d13cae814ee2a7301a6c17d071fef9c7bcdf9a3499c090178052a659be7d9d7bc93b609ec0f84a139ce873be0aff62e0b235b50d2f327c354d0d4e4fa19cea1 - languageName: node - linkType: hard - "@metamask/approval-controller@npm:^6.0.1, @metamask/approval-controller@npm:^6.0.2": version: 6.0.2 resolution: "@metamask/approval-controller@npm:6.0.2" @@ -4755,7 +4721,7 @@ __metadata: languageName: node linkType: hard -"@metamask/base-controller@npm:^4.0.0, @metamask/base-controller@npm:^4.0.1, @metamask/base-controller@npm:^4.1.0, @metamask/base-controller@npm:^4.1.1": +"@metamask/base-controller@npm:^4.1.0, @metamask/base-controller@npm:^4.1.1": version: 4.1.1 resolution: "@metamask/base-controller@npm:4.1.1" dependencies: @@ -4801,7 +4767,7 @@ __metadata: languageName: node linkType: hard -"@metamask/controller-utils@npm:^8.0.1, @metamask/controller-utils@npm:^8.0.2, @metamask/controller-utils@npm:^8.0.4": +"@metamask/controller-utils@npm:^8.0.1, @metamask/controller-utils@npm:^8.0.4": version: 8.0.4 resolution: "@metamask/controller-utils@npm:8.0.4" dependencies: @@ -5098,39 +5064,21 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-snap-keyring@npm:^2.1.1, @metamask/eth-snap-keyring@npm:^2.1.2": - version: 2.1.2 - resolution: "@metamask/eth-snap-keyring@npm:2.1.2" - dependencies: - "@ethereumjs/tx": "npm:^4.2.0" - "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/keyring-api": "npm:^2.0.0" - "@metamask/snaps-controllers": "npm:^4.1.0" - "@metamask/snaps-sdk": "npm:^1.4.0" - "@metamask/snaps-utils": "npm:^5.2.0" - "@metamask/utils": "npm:^8.1.0" - "@types/uuid": "npm:^9.0.1" - superstruct: "npm:^1.0.3" - uuid: "npm:^9.0.0" - checksum: 10/f2106954475c4f6bcbae5ba371b84963bf12b3a1540790bf9e9941eed82b3ad7cf52e3ee70c632691f363e6e3179b5d54aeb6567933ffa4d6790613e708459aa - languageName: node - linkType: hard - -"@metamask/eth-snap-keyring@npm:^4.0.0": - version: 4.0.0 - resolution: "@metamask/eth-snap-keyring@npm:4.0.0" +"@metamask/eth-snap-keyring@npm:^4.0.0, @metamask/eth-snap-keyring@npm:^4.2.1": + version: 4.2.1 + resolution: "@metamask/eth-snap-keyring@npm:4.2.1" dependencies: "@ethereumjs/tx": "npm:^4.2.0" "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/keyring-api": "npm:^6.0.0" - "@metamask/snaps-controllers": "npm:^7.0.1" - "@metamask/snaps-sdk": "npm:^4.0.1" - "@metamask/snaps-utils": "npm:^7.0.3" + "@metamask/keyring-api": "npm:^6.3.1" + "@metamask/snaps-controllers": "npm:^8.1.1" + "@metamask/snaps-sdk": "npm:^4.2.0" + "@metamask/snaps-utils": "npm:^7.4.0" "@metamask/utils": "npm:^8.4.0" "@types/uuid": "npm:^9.0.1" superstruct: "npm:^1.0.3" uuid: "npm:^9.0.0" - checksum: 10/6f5a89ae400356a0f545f798d61d3cf1deb2dc17a24a9ab7304a5851a06be946573fe594787321d12cd1599ad86b61570bd43d7f700a23fb1aa65e52f981e118 + checksum: 10/96bccfe67fc490ea7891a7ef54839dc5bab6d6ffd4107fa05342045fc25e9045338df058b07c2942248e437c98279ae9addd13f632530cdca4f7cdeabcae0497 languageName: node linkType: hard @@ -5298,7 +5246,7 @@ __metadata: languageName: node linkType: hard -"@metamask/gas-fee-controller@npm:^15.0.0, @metamask/gas-fee-controller@npm:^15.1.0, @metamask/gas-fee-controller@npm:^15.1.2": +"@metamask/gas-fee-controller@npm:^15.1.0, @metamask/gas-fee-controller@npm:^15.1.1, @metamask/gas-fee-controller@npm:^15.1.2": version: 15.1.2 resolution: "@metamask/gas-fee-controller@npm:15.1.2" dependencies: @@ -5329,7 +5277,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^7.1.0, @metamask/json-rpc-engine@npm:^7.1.1, @metamask/json-rpc-engine@npm:^7.3.1, @metamask/json-rpc-engine@npm:^7.3.2": +"@metamask/json-rpc-engine@npm:^7.1.0, @metamask/json-rpc-engine@npm:^7.1.1, @metamask/json-rpc-engine@npm:^7.3.2": version: 7.3.3 resolution: "@metamask/json-rpc-engine@npm:7.3.3" dependencies: @@ -5363,7 +5311,7 @@ __metadata: languageName: node linkType: hard -"@metamask/key-tree@npm:^9.0.0, @metamask/key-tree@npm:^9.1.0": +"@metamask/key-tree@npm:^9.1.0": version: 9.1.1 resolution: "@metamask/key-tree@npm:9.1.1" dependencies: @@ -5376,36 +5324,6 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-api@npm:^2.0.0": - version: 2.0.0 - resolution: "@metamask/keyring-api@npm:2.0.0" - dependencies: - "@metamask/providers": "npm:^14.0.1" - "@metamask/snaps-controllers": "npm:^3.4.1" - "@metamask/snaps-sdk": "npm:^1.2.0" - "@metamask/snaps-utils": "npm:^5.0.0" - "@metamask/utils": "npm:^8.1.0" - "@types/uuid": "npm:^9.0.1" - superstruct: "npm:^1.0.3" - uuid: "npm:^9.0.0" - checksum: 10/65dcca4d7f94102fafbccbb3ee79647f94f92985e8e3dab795fde5ee563fd3ff050ec59ee16c0276d06bb7d474a2281c504d2dc7cac60df3b2bfc918aa17615f - languageName: node - linkType: hard - -"@metamask/keyring-api@npm:^3.0.0": - version: 3.0.0 - resolution: "@metamask/keyring-api@npm:3.0.0" - dependencies: - "@metamask/providers": "npm:^14.0.1" - "@metamask/snaps-sdk": "npm:^1.3.2" - "@metamask/utils": "npm:^8.1.0" - "@types/uuid": "npm:^9.0.1" - superstruct: "npm:^1.0.3" - uuid: "npm:^9.0.0" - checksum: 10/ca07392e2cef1f5f7056e73c7a5d0a4092234b3d794aa3bca1ce3a1df0dc40832ec3fc0026965b54c07aec0ee175267de365033b028909484bc6d9fe4fb4c329 - languageName: node - linkType: hard - "@metamask/keyring-api@npm:^5.1.0": version: 5.1.0 resolution: "@metamask/keyring-api@npm:5.1.0" @@ -5421,23 +5339,23 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-api@npm:^6.0.0": - version: 6.1.0 - resolution: "@metamask/keyring-api@npm:6.1.0" +"@metamask/keyring-api@npm:^6.0.0, @metamask/keyring-api@npm:^6.3.1": + version: 6.3.1 + resolution: "@metamask/keyring-api@npm:6.3.1" dependencies: - "@metamask/snaps-sdk": "npm:^4.0.0" - "@metamask/utils": "npm:^8.3.0" - "@types/uuid": "npm:^9.0.1" + "@metamask/snaps-sdk": "npm:^4.2.0" + "@metamask/utils": "npm:^8.4.0" + "@types/uuid": "npm:^9.0.8" bech32: "npm:^2.0.0" superstruct: "npm:^1.0.3" - uuid: "npm:^9.0.0" + uuid: "npm:^9.0.1" peerDependencies: "@metamask/providers": ">=15 <17" - checksum: 10/a1fc89907f462dcfdf6d9ed63953f73d98f5b1b3277754b77ca3a1787ba4b422e2b251949cdda26f2b7b0840ba482f1a1a42f0543bbc130e4077b949ba9db8ee + checksum: 10/f2fd6e5a8c4f7c1f24c9a029f30f3c8cfa4394556eaa045e4bc98993583007c783c4124289569e3f49aa1cc7dceb49a2d2656d6e385ee5a44daaeeea8edc00c8 languageName: node linkType: hard -"@metamask/keyring-controller@npm:15.0.0, @metamask/keyring-controller@npm:^15.0.0": +"@metamask/keyring-controller@npm:15.0.0": version: 15.0.0 resolution: "@metamask/keyring-controller@npm:15.0.0" dependencies: @@ -5723,25 +5641,6 @@ __metadata: languageName: node linkType: hard -"@metamask/permission-controller@npm:^7.0.0, @metamask/permission-controller@npm:^7.1.0": - version: 7.1.0 - resolution: "@metamask/permission-controller@npm:7.1.0" - dependencies: - "@metamask/base-controller": "npm:^4.0.1" - "@metamask/controller-utils": "npm:^8.0.1" - "@metamask/json-rpc-engine": "npm:^7.3.1" - "@metamask/rpc-errors": "npm:^6.1.0" - "@metamask/utils": "npm:^8.2.0" - "@types/deep-freeze-strict": "npm:^1.1.0" - deep-freeze-strict: "npm:^1.1.1" - immer: "npm:^9.0.6" - nanoid: "npm:^3.1.31" - peerDependencies: - "@metamask/approval-controller": ^5.1.1 - checksum: 10/c438048533512e52083171fc81fe364fd108e8219250a43409a085e960ecb0241c649824c1f05a2272b10ef0ea44fc4df283c0fa32acf2df73db6a0b1cae6487 - languageName: node - linkType: hard - "@metamask/permission-controller@npm:^9.0.1, @metamask/permission-controller@npm:^9.0.2": version: 9.0.2 resolution: "@metamask/permission-controller@npm:9.0.2" @@ -5772,19 +5671,6 @@ __metadata: languageName: node linkType: hard -"@metamask/phishing-controller@npm:^8.0.1": - version: 8.0.2 - resolution: "@metamask/phishing-controller@npm:8.0.2" - dependencies: - "@metamask/base-controller": "npm:^4.1.1" - "@metamask/controller-utils": "npm:^8.0.2" - "@types/punycode": "npm:^2.1.0" - eth-phishing-detect: "npm:^1.2.0" - punycode: "npm:^2.1.1" - checksum: 10/f00b70a7b50d2093c035c1c974ffb42d61cc998efbab35f0bc7d9ea406388cf2b8b9303aa3c14def12a0f7eefb47fb24a0938ed734525f2bc1d6bf9b24aa85c1 - languageName: node - linkType: hard - "@metamask/phishing-controller@npm:^9.0.1, @metamask/phishing-controller@npm:^9.0.2": version: 9.0.2 resolution: "@metamask/phishing-controller@npm:9.0.2" @@ -5880,7 +5766,7 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^14.0.1, @metamask/providers@npm:^14.0.2": +"@metamask/providers@npm:^14.0.2": version: 14.0.2 resolution: "@metamask/providers@npm:14.0.2" dependencies: @@ -5948,7 +5834,7 @@ __metadata: languageName: node linkType: hard -"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.1.0, @metamask/rpc-errors@npm:^6.2.1": +"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.2.1": version: 6.2.1 resolution: "@metamask/rpc-errors@npm:6.2.1" dependencies: @@ -6049,115 +5935,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-controllers@npm:^3.4.1": - version: 3.6.0 - resolution: "@metamask/snaps-controllers@npm:3.6.0" - dependencies: - "@metamask/approval-controller": "npm:^5.1.1" - "@metamask/base-controller": "npm:^4.0.0" - "@metamask/json-rpc-engine": "npm:^7.3.1" - "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/permission-controller": "npm:^7.0.0" - "@metamask/phishing-controller": "npm:^8.0.1" - "@metamask/post-message-stream": "npm:^7.0.0" - "@metamask/rpc-errors": "npm:^6.1.0" - "@metamask/snaps-registry": "npm:^3.0.0" - "@metamask/snaps-rpc-methods": "npm:^4.1.0" - "@metamask/snaps-sdk": "npm:^1.3.1" - "@metamask/snaps-utils": "npm:^5.1.1" - "@metamask/utils": "npm:^8.2.1" - "@xstate/fsm": "npm:^2.0.0" - browserify-zlib: "npm:^0.2.0" - concat-stream: "npm:^2.0.0" - get-npm-tarball-url: "npm:^2.0.3" - immer: "npm:^9.0.6" - json-rpc-middleware-stream: "npm:^5.0.0" - nanoid: "npm:^3.1.31" - readable-stream: "npm:^3.6.2" - readable-web-to-node-stream: "npm:^3.0.2" - tar-stream: "npm:^3.1.6" - peerDependencies: - "@metamask/snaps-execution-environments": ^3.4.3 - peerDependenciesMeta: - "@metamask/snaps-execution-environments": - optional: true - checksum: 10/1aae53533ff6317bcc775a8e40f76b0e2a6ef519d3f8553390ed9bde65ceeb0ec914cd9c7439514404a5688c5b16d527ce757eb0ff24adfcb33cac2b59f5268f - languageName: node - linkType: hard - -"@metamask/snaps-controllers@npm:^4.1.0": - version: 4.1.0 - resolution: "@metamask/snaps-controllers@npm:4.1.0" - dependencies: - "@metamask/approval-controller": "npm:^5.1.1" - "@metamask/base-controller": "npm:^4.1.0" - "@metamask/json-rpc-engine": "npm:^7.3.1" - "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/permission-controller": "npm:^7.1.0" - "@metamask/phishing-controller": "npm:^8.0.1" - "@metamask/post-message-stream": "npm:^7.0.0" - "@metamask/rpc-errors": "npm:^6.1.0" - "@metamask/snaps-registry": "npm:^3.0.0" - "@metamask/snaps-rpc-methods": "npm:^5.0.0" - "@metamask/snaps-sdk": "npm:^1.4.0" - "@metamask/snaps-utils": "npm:^5.2.0" - "@metamask/utils": "npm:^8.3.0" - "@xstate/fsm": "npm:^2.0.0" - browserify-zlib: "npm:^0.2.0" - concat-stream: "npm:^2.0.0" - get-npm-tarball-url: "npm:^2.0.3" - immer: "npm:^9.0.6" - json-rpc-middleware-stream: "npm:^5.0.0" - nanoid: "npm:^3.1.31" - readable-stream: "npm:^3.6.2" - readable-web-to-node-stream: "npm:^3.0.2" - tar-stream: "npm:^3.1.6" - peerDependencies: - "@metamask/snaps-execution-environments": ^3.5.0 - peerDependenciesMeta: - "@metamask/snaps-execution-environments": - optional: true - checksum: 10/d84843ca91d6e525c42c11000c69c392cb0e7cc24e347c55c9c8e9660addebb91f6ff1b931b1be69e3b99f9b31e37ef48bef099986918eb2e18f62f67b299c41 - languageName: node - linkType: hard - -"@metamask/snaps-controllers@npm:^7.0.1": - version: 7.0.1 - resolution: "@metamask/snaps-controllers@npm:7.0.1" - dependencies: - "@metamask/approval-controller": "npm:^6.0.1" - "@metamask/base-controller": "npm:^5.0.1" - "@metamask/json-rpc-engine": "npm:^8.0.1" - "@metamask/json-rpc-middleware-stream": "npm:^7.0.1" - "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/permission-controller": "npm:^9.0.2" - "@metamask/phishing-controller": "npm:^9.0.1" - "@metamask/post-message-stream": "npm:^8.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/snaps-registry": "npm:^3.1.0" - "@metamask/snaps-rpc-methods": "npm:^8.0.0" - "@metamask/snaps-sdk": "npm:^4.0.0" - "@metamask/snaps-utils": "npm:^7.1.0" - "@metamask/utils": "npm:^8.3.0" - "@xstate/fsm": "npm:^2.0.0" - browserify-zlib: "npm:^0.2.0" - concat-stream: "npm:^2.0.0" - get-npm-tarball-url: "npm:^2.0.3" - immer: "npm:^9.0.6" - nanoid: "npm:^3.1.31" - readable-stream: "npm:^3.6.2" - readable-web-to-node-stream: "npm:^3.0.2" - tar-stream: "npm:^3.1.7" - peerDependencies: - "@metamask/snaps-execution-environments": ^6.0.0 - peerDependenciesMeta: - "@metamask/snaps-execution-environments": - optional: true - checksum: 10/4c8208aee45635f206e0663caaaa32c64a48aa78a6fcc6b3507d2214c1740db186ae750d8e9eb972283fd89d3a8f4f054b4ddf77443519fdd1bd35e97f6141d2 - languageName: node - linkType: hard - -"@metamask/snaps-controllers@npm:^8.2.0": +"@metamask/snaps-controllers@npm:^8.1.1, @metamask/snaps-controllers@npm:^8.2.0": version: 8.2.0 resolution: "@metamask/snaps-controllers@npm:8.2.0" dependencies: @@ -6213,7 +5991,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.0.0, @metamask/snaps-registry@npm:^3.1.0": +"@metamask/snaps-registry@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/snaps-registry@npm:3.1.0" dependencies: @@ -6225,54 +6003,6 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-rpc-methods@npm:^4.1.0": - version: 4.1.0 - resolution: "@metamask/snaps-rpc-methods@npm:4.1.0" - dependencies: - "@metamask/key-tree": "npm:^9.0.0" - "@metamask/permission-controller": "npm:^7.0.0" - "@metamask/rpc-errors": "npm:^6.1.0" - "@metamask/snaps-sdk": "npm:^1.3.1" - "@metamask/snaps-utils": "npm:^5.1.1" - "@metamask/utils": "npm:^8.2.1" - "@noble/hashes": "npm:^1.3.1" - superstruct: "npm:^1.0.3" - checksum: 10/1e3f0bcb407b1bf53ed045a1914ee70f4e692c4d8cb453bf0d9e9ff7519a24adb695181d2eb336e010e908f7e4198e76b498dc3510e3271a75c2c5a3db98068f - languageName: node - linkType: hard - -"@metamask/snaps-rpc-methods@npm:^5.0.0": - version: 5.0.0 - resolution: "@metamask/snaps-rpc-methods@npm:5.0.0" - dependencies: - "@metamask/key-tree": "npm:^9.0.0" - "@metamask/permission-controller": "npm:^7.1.0" - "@metamask/rpc-errors": "npm:^6.1.0" - "@metamask/snaps-sdk": "npm:^1.4.0" - "@metamask/snaps-utils": "npm:^5.2.0" - "@metamask/utils": "npm:^8.3.0" - "@noble/hashes": "npm:^1.3.1" - superstruct: "npm:^1.0.3" - checksum: 10/6d8e0727782b1c25858916c6892cd83acc7a5a26babbd0ef0f402e1af6e065a72abeb48b5cc8031eb7f3729f7d023ba80a657b0d21501033e6cfb0dc39154cd6 - languageName: node - linkType: hard - -"@metamask/snaps-rpc-methods@npm:^8.0.0": - version: 8.1.0 - resolution: "@metamask/snaps-rpc-methods@npm:8.1.0" - dependencies: - "@metamask/key-tree": "npm:^9.0.0" - "@metamask/permission-controller": "npm:^9.0.2" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/snaps-sdk": "npm:^4.1.0" - "@metamask/snaps-utils": "npm:^7.3.0" - "@metamask/utils": "npm:^8.3.0" - "@noble/hashes": "npm:^1.3.1" - superstruct: "npm:^1.0.3" - checksum: 10/08ceb8582c3d8671b9eebc963ba834d56d48c207f26cdf2b969976e36e4db21f602e6ac743216fb4da5c7c2b7e1d3f677617ee37a8be13fb38b679b5e1975970 - languageName: node - linkType: hard - "@metamask/snaps-rpc-methods@npm:^9.1.0": version: 9.1.0 resolution: "@metamask/snaps-rpc-methods@npm:9.1.0" @@ -6303,37 +6033,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils@npm:^5.0.0, @metamask/snaps-utils@npm:^5.1.1, @metamask/snaps-utils@npm:^5.1.2, @metamask/snaps-utils@npm:^5.2.0": - version: 5.2.0 - resolution: "@metamask/snaps-utils@npm:5.2.0" - dependencies: - "@babel/core": "npm:^7.23.2" - "@babel/types": "npm:^7.23.0" - "@metamask/base-controller": "npm:^4.1.0" - "@metamask/key-tree": "npm:^9.0.0" - "@metamask/permission-controller": "npm:^7.1.0" - "@metamask/rpc-errors": "npm:^6.1.0" - "@metamask/slip44": "npm:^3.1.0" - "@metamask/snaps-registry": "npm:^3.0.0" - "@metamask/snaps-sdk": "npm:^1.4.0" - "@metamask/utils": "npm:^8.3.0" - "@noble/hashes": "npm:^1.3.1" - "@scure/base": "npm:^1.1.1" - chalk: "npm:^4.1.2" - cron-parser: "npm:^4.5.0" - fast-deep-equal: "npm:^3.1.3" - fast-json-stable-stringify: "npm:^2.1.0" - is-svg: "npm:^4.4.0" - rfdc: "npm:^1.3.0" - semver: "npm:^7.5.4" - ses: "npm:^1.1.0" - superstruct: "npm:^1.0.3" - validate-npm-package-name: "npm:^5.0.0" - checksum: 10/bd3aa8212e7c79923769fe4102c19313ba0b55a58cc87bad3fb22e308e32faa9de80f0f36f0e3420f931115edc0b1ccac205e8a2e09247f37802b545110c48bb - languageName: node - linkType: hard - -"@metamask/snaps-utils@npm:^7.0.3, @metamask/snaps-utils@npm:^7.1.0, @metamask/snaps-utils@npm:^7.3.0, @metamask/snaps-utils@npm:^7.4.0": +"@metamask/snaps-utils@npm:^7.1.0, @metamask/snaps-utils@npm:^7.4.0": version: 7.4.0 resolution: "@metamask/snaps-utils@npm:7.4.0" dependencies: @@ -6435,7 +6135,7 @@ __metadata: languageName: node linkType: hard -"@metamask/transaction-controller@npm:^29.1.0": +"@metamask/transaction-controller@npm:^29.0.0, @metamask/transaction-controller@npm:^29.1.0": version: 29.1.0 resolution: "@metamask/transaction-controller@npm:29.1.0" dependencies: @@ -6470,20 +6170,20 @@ __metadata: languageName: node linkType: hard -"@metamask/user-operation-controller@npm:^8.0.1": - version: 8.0.1 - resolution: "@metamask/user-operation-controller@npm:8.0.1" +"@metamask/user-operation-controller@npm:^10.0.0": + version: 10.0.0 + resolution: "@metamask/user-operation-controller@npm:10.0.0" dependencies: - "@metamask/approval-controller": "npm:^6.0.1" - "@metamask/base-controller": "npm:^5.0.1" + "@metamask/approval-controller": "npm:^6.0.2" + "@metamask/base-controller": "npm:^5.0.2" "@metamask/controller-utils": "npm:^9.1.0" "@metamask/eth-query": "npm:^4.0.0" - "@metamask/gas-fee-controller": "npm:^15.0.0" - "@metamask/keyring-controller": "npm:^15.0.0" + "@metamask/gas-fee-controller": "npm:^15.1.1" + "@metamask/keyring-controller": "npm:^16.0.0" "@metamask/network-controller": "npm:^18.1.0" - "@metamask/polling-controller": "npm:^6.0.1" + "@metamask/polling-controller": "npm:^6.0.2" "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/transaction-controller": "npm:^28.1.0" + "@metamask/transaction-controller": "npm:^29.0.0" "@metamask/utils": "npm:^8.3.0" bn.js: "npm:^5.2.1" immer: "npm:^9.0.6" @@ -6493,10 +6193,10 @@ __metadata: peerDependencies: "@metamask/approval-controller": ^6.0.0 "@metamask/gas-fee-controller": ^15.0.0 - "@metamask/keyring-controller": ^15.0.0 + "@metamask/keyring-controller": ^16.0.0 "@metamask/network-controller": ^18.0.0 - "@metamask/transaction-controller": ^28.0.0 - checksum: 10/b489706430c526a795d408e0d719f2a0d7f79586ea5f556f1a737c61eb61319022e168b65527e5be061bb7bb9a3fa56a58ff50d78fce8eab89ba8663c6877ab0 + "@metamask/transaction-controller": ^29.0.0 + checksum: 10/b1b6fb1c9eba5880a9ebe2ea68897de85f788ca961ec2add0b2c0313e992c3f9053e6113e789b4823b71454fb42b424af010d03e7a39f183c828e7897bb30498 languageName: node linkType: hard @@ -10530,10 +10230,10 @@ __metadata: languageName: node linkType: hard -"@types/uuid@npm:^9.0.0, @types/uuid@npm:^9.0.1": - version: 9.0.2 - resolution: "@types/uuid@npm:9.0.2" - checksum: 10/1754bcf3444e1e3aeadd6e774fc328eb53bc956665e2e8fb6ec127aa8e1f43d9a224c3d22a9a6233dca8dd81a12dc7fed4d84b8876dd5ec82d40f574f7ff8b68 +"@types/uuid@npm:^9.0.0, @types/uuid@npm:^9.0.1, @types/uuid@npm:^9.0.8": + version: 9.0.8 + resolution: "@types/uuid@npm:9.0.8" + checksum: 10/b8c60b7ba8250356b5088302583d1704a4e1a13558d143c549c408bf8920535602ffc12394ede77f8a8083511b023704bc66d1345792714002bfa261b17c5275 languageName: node linkType: hard @@ -10657,14 +10357,14 @@ __metadata: linkType: hard "@typescript-eslint/eslint-plugin@npm:^7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.10.0" + version: 7.11.0 + resolution: "@typescript-eslint/eslint-plugin@npm:7.11.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.10.0" - "@typescript-eslint/type-utils": "npm:7.10.0" - "@typescript-eslint/utils": "npm:7.10.0" - "@typescript-eslint/visitor-keys": "npm:7.10.0" + "@typescript-eslint/scope-manager": "npm:7.11.0" + "@typescript-eslint/type-utils": "npm:7.11.0" + "@typescript-eslint/utils": "npm:7.11.0" + "@typescript-eslint/visitor-keys": "npm:7.11.0" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" natural-compare: "npm:^1.4.0" @@ -10675,7 +10375,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/dfe505cdf718dd29e8637b902e4c544c6b7d246d2051fd1936090423eb3dadfe2bd757de51e565e6fd80e74cf1918e191c26fee6df515100484ec3efd9b8d111 + checksum: 10/be95ed0bbd5b34c47239677ea39d531bcd8a18717a67d70a297bed5b0050b256159856bb9c1e894ac550d011c24bb5b4abf8056c5d70d0d5895f0cc1accd14ea languageName: node linkType: hard @@ -10698,20 +10398,20 @@ __metadata: linkType: hard "@typescript-eslint/parser@npm:^7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/parser@npm:7.10.0" + version: 7.11.0 + resolution: "@typescript-eslint/parser@npm:7.11.0" dependencies: - "@typescript-eslint/scope-manager": "npm:7.10.0" - "@typescript-eslint/types": "npm:7.10.0" - "@typescript-eslint/typescript-estree": "npm:7.10.0" - "@typescript-eslint/visitor-keys": "npm:7.10.0" + "@typescript-eslint/scope-manager": "npm:7.11.0" + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/typescript-estree": "npm:7.11.0" + "@typescript-eslint/visitor-keys": "npm:7.11.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10/1fa71049b2debf2f7f5366fb433e3d4c8e1591c2061a15fa8797d14623a2b6984340a59e7717acc013ce8c6a2ed32c5c0e811fe948b5936d41c2a5a09b61d130 + checksum: 10/0a32417aec62d7de04427323ab3fc8159f9f02429b24f739d8748e8b54fc65b0e3dbae8e4779c4b795f0d8e5f98a4d83a43b37ea0f50ebda51546cdcecf73caa languageName: node linkType: hard @@ -10735,22 +10435,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/scope-manager@npm:7.10.0" +"@typescript-eslint/scope-manager@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/scope-manager@npm:7.11.0" dependencies: - "@typescript-eslint/types": "npm:7.10.0" - "@typescript-eslint/visitor-keys": "npm:7.10.0" - checksum: 10/838a7a9573577d830b2f65801ce045abe6fad08ac7e04bac4cc9b2e5b7cbac07e645de9c79b9485f4cc361fe25da5319025aa0336fad618023fff62e4e980638 + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/visitor-keys": "npm:7.11.0" + checksum: 10/79eff310405c6657ff092641e3ad51c6698c6708b915ecef945ebdd1737bd48e1458c5575836619f42dec06143ec0e3a826f3e551af590d297367da3d08f329e languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/type-utils@npm:7.10.0" +"@typescript-eslint/type-utils@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/type-utils@npm:7.11.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.10.0" - "@typescript-eslint/utils": "npm:7.10.0" + "@typescript-eslint/typescript-estree": "npm:7.11.0" + "@typescript-eslint/utils": "npm:7.11.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" peerDependencies: @@ -10758,7 +10458,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/e62db9ffbfbccce60258108f7ed025005e04df18da897ff1b30049e3c10a47150e94c2fb5ac0ab9711ebb60517521213dcccbea6d08125107a87a67088a79042 + checksum: 10/ab6ebeff68a60fc40d0ace88e03d6b4242b8f8fe2fa300db161780d58777b57f69fa077cd482e1b673316559459bd20b8cc89a7f9f30e644bfed8293f77f0e4b languageName: node linkType: hard @@ -10783,10 +10483,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/types@npm:7.10.0" - checksum: 10/76075a7b87ddfff8e7e4aebf3d225e67bf79ead12a7709999d4d5c31611d9c0813ca69a9298f320efb018fe493ce3763c964a0e670a4c953d8eff000f10672c0 +"@typescript-eslint/types@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/types@npm:7.11.0" + checksum: 10/c6a0b47ef43649a59c9d51edfc61e367b55e519376209806b1c98385a8385b529e852c7a57e081fb15ef6a5dc0fc8e90bd5a508399f5ac2137f4d462e89cdc30 languageName: node linkType: hard @@ -10827,12 +10527,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/typescript-estree@npm:7.10.0" +"@typescript-eslint/typescript-estree@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.11.0" dependencies: - "@typescript-eslint/types": "npm:7.10.0" - "@typescript-eslint/visitor-keys": "npm:7.10.0" + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/visitor-keys": "npm:7.11.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -10842,7 +10542,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/d11d0c45749c9bd4a187b6dfdf5600e36ba8c87667cd2020d9158667c47c32ec0bcb1ef3b7eee5577b667def5f7f33d8131092a0f221b3d3e8105078800f923f + checksum: 10/b98b101e42d3b91003510a5c5a83f4350b6c1cf699bf2e409717660579ffa71682bc280c4f40166265c03f9546ed4faedc3723e143f1ab0ed7f5990cc3dff0ae languageName: node linkType: hard @@ -10864,17 +10564,17 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/utils@npm:7.10.0" +"@typescript-eslint/utils@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/utils@npm:7.11.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.10.0" - "@typescript-eslint/types": "npm:7.10.0" - "@typescript-eslint/typescript-estree": "npm:7.10.0" + "@typescript-eslint/scope-manager": "npm:7.11.0" + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/typescript-estree": "npm:7.11.0" peerDependencies: eslint: ^8.56.0 - checksum: 10/62327b585295f9c3aa2508aefac639d562b6f7f270a229aa3a2af8dbd055f4a4d230a8facae75a8a53bb8222b0041162072d259add56b541f8bdfda8da36ea5f + checksum: 10/fbef14e166a70ccc4527c0731e0338acefa28218d1a018aa3f5b6b1ad9d75c56278d5f20bda97cf77da13e0a67c4f3e579c5b2f1c2e24d676960927921b55851 languageName: node linkType: hard @@ -10926,13 +10626,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.10.0": - version: 7.10.0 - resolution: "@typescript-eslint/visitor-keys@npm:7.10.0" +"@typescript-eslint/visitor-keys@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.11.0" dependencies: - "@typescript-eslint/types": "npm:7.10.0" + "@typescript-eslint/types": "npm:7.11.0" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10/44b555a075bdff38e3e13c454ceaac50aa2546635e81f907d1ea84822c8887487d1d6bb4ff690f627da9585dc19ad07e228847c162c30bb06c46fb119899d8cc + checksum: 10/1f2cf1214638e9e78e052393c9e24295196ec4781b05951659a3997e33f8699a760ea3705c17d770e10eda2067435199e0136ab09e5fac63869e22f2da184d89 languageName: node linkType: hard @@ -18428,7 +18128,7 @@ __metadata: languageName: node linkType: hard -"fast-xml-parser@npm:^4.1.3, fast-xml-parser@npm:^4.3.4": +"fast-xml-parser@npm:^4.3.4": version: 4.3.4 resolution: "fast-xml-parser@npm:4.3.4" dependencies: @@ -21972,15 +21672,6 @@ __metadata: languageName: node linkType: hard -"is-svg@npm:^4.4.0": - version: 4.4.0 - resolution: "is-svg@npm:4.4.0" - dependencies: - fast-xml-parser: "npm:^4.1.3" - checksum: 10/cd5a0ba1af653e4897721913b0b80de968fa5b19eb1a592412f4672d3a1203935d183c2a9dbf61d68023739ee43d3761ea795ae1a9f618c6098a9e89eacdd256 - languageName: node - linkType: hard - "is-symbol@npm:^1.0.2, is-symbol@npm:^1.0.3": version: 1.0.4 resolution: "is-symbol@npm:1.0.4" @@ -23237,7 +22928,7 @@ __metadata: languageName: node linkType: hard -"json-rpc-middleware-stream@npm:^5.0.0, json-rpc-middleware-stream@npm:^5.0.1": +"json-rpc-middleware-stream@npm:^5.0.1": version: 5.0.1 resolution: "json-rpc-middleware-stream@npm:5.0.1" dependencies: @@ -25069,7 +24760,7 @@ __metadata: "@metamask-institutional/sdk": "npm:^0.1.27" "@metamask-institutional/transaction-update": "npm:^0.2.2" "@metamask/abi-utils": "npm:^2.0.2" - "@metamask/accounts-controller": "npm:^11.0.0" + "@metamask/accounts-controller": "npm:^14.0.0" "@metamask/address-book-controller": "npm:^4.0.1" "@metamask/announcement-controller": "npm:^6.1.0" "@metamask/approval-controller": "npm:^6.0.1" @@ -25094,7 +24785,7 @@ __metadata: "@metamask/eth-ledger-bridge-keyring": "npm:^2.0.1" "@metamask/eth-query": "npm:^4.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" - "@metamask/eth-snap-keyring": "npm:^2.1.2" + "@metamask/eth-snap-keyring": "npm:^4.2.1" "@metamask/eth-token-tracker": "npm:^8.0.0" "@metamask/eth-trezor-keyring": "npm:^3.1.0" "@metamask/etherscan-link": "npm:^3.0.0" @@ -25104,7 +24795,7 @@ __metadata: "@metamask/forwarder": "npm:^1.1.0" "@metamask/gas-fee-controller": "npm:^15.1.2" "@metamask/jazzicon": "npm:^2.0.0" - "@metamask/keyring-api": "npm:^3.0.0" + "@metamask/keyring-api": "npm:^6.3.1" "@metamask/keyring-controller": "patch:@metamask/keyring-controller@npm%3A15.0.0#~/.yarn/patches/@metamask-keyring-controller-npm-15.0.0-fa070ce311.patch" "@metamask/logging-controller": "npm:^3.0.1" "@metamask/logo": "npm:^3.1.2" @@ -25138,7 +24829,7 @@ __metadata: "@metamask/test-bundler": "npm:^1.0.0" "@metamask/test-dapp": "npm:^8.4.0" "@metamask/transaction-controller": "npm:^29.1.0" - "@metamask/user-operation-controller": "npm:^8.0.1" + "@metamask/user-operation-controller": "npm:^10.0.0" "@metamask/utils": "npm:^8.2.1" "@ngraveio/bc-ur": "npm:^1.1.12" "@noble/ciphers": "npm:^0.5.2" @@ -33261,7 +32952,7 @@ __metadata: languageName: node linkType: hard -"tar-stream@npm:^3.1.6, tar-stream@npm:^3.1.7": +"tar-stream@npm:^3.1.7": version: 3.1.7 resolution: "tar-stream@npm:3.1.7" dependencies: