diff --git a/.github/workflows/lint-build-test.yml b/.github/workflows/lint-build-test.yml index 48dd7f9490..c0db97f902 100644 --- a/.github/workflows/lint-build-test.yml +++ b/.github/workflows/lint-build-test.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] outputs: child-workspace-package-names: ${{ steps.workspace-package-names.outputs.child-workspace-package-names }} steps: @@ -105,7 +105,7 @@ jobs: needs: prepare strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] package-name: ${{ fromJson(needs.prepare.outputs.child-workspace-package-names) }} steps: - uses: actions/checkout@v3 diff --git a/.nvmrc b/.nvmrc index 6f7f377bf5..b009dfb9d9 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16 +lts/* diff --git a/constraints.pro b/constraints.pro index 985205b5a5..84cc63f1b5 100644 --- a/constraints.pro +++ b/constraints.pro @@ -408,8 +408,8 @@ gen_enforced_dependency(WorkspaceCwd, DependencyIdent, CorrectPeerDependencyRang atom_concat('^', CurrentDependencyVersion, CorrectPeerDependencyRange) ). -% All packages must specify a minimum Node version of 16. -gen_enforced_field(WorkspaceCwd, 'engines.node', '>=16.0.0'). +% All packages must specify a minimum Node version of 18. +gen_enforced_field(WorkspaceCwd, 'engines.node', '^18.18 || >=20'). % All published packages are public. gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public') :- diff --git a/docs/contributing.md b/docs/contributing.md index 788ec1cf19..88e9c1db71 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -2,8 +2,8 @@ ## Getting started -- Install [Node.js](https://nodejs.org) version 16. - - If you're using [NVM](https://github.com/creationix/nvm#installation) (recommended), `nvm use` will ensure that the right version is installed. +- Install the current LTS version of [Node.js](https://nodejs.org) + - If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm install` will install the latest version and running `nvm use` will automatically choose the right node version for you. - Install [Yarn v3](https://yarnpkg.com/getting-started/install). - Run `yarn install` to install dependencies and run any required post-install scripts. - Run `yarn simple-git-hooks` to add a [Git hook](https://github.com/toplenboren/simple-git-hooks#what-is-a-git-hook) to your local development environment which will ensure that all files pass linting before you push a branch. diff --git a/package.json b/package.json index 52539ab94c..506f407fac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/core-monorepo", - "version": "157.0.0", + "version": "159.0.0", "private": true, "description": "Monorepo for packages shared between MetaMask clients", "repository": { @@ -56,8 +56,8 @@ "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/eth-block-tracker": "^9.0.2", - "@metamask/eth-json-rpc-provider": "^3.0.2", - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/eth-json-rpc-provider": "^4.0.0", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/utils": "^8.3.0", "@types/jest": "^27.4.1", "@types/node": "^16.18.54", @@ -90,7 +90,7 @@ }, "packageManager": "yarn@3.3.0", "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "lavamoat": { "allowScripts": { diff --git a/packages/accounts-controller/CHANGELOG.md b/packages/accounts-controller/CHANGELOG.md index 2c8f9dcca2..2ec126b7d7 100644 --- a/packages/accounts-controller/CHANGELOG.md +++ b/packages/accounts-controller/CHANGELOG.md @@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [16.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump peer dependency `@metamask/keyring-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [15.0.0] + +### Added + +- Add `getNextAvailableAccountName` method and `AccountsController:getNextAvailableAccountName` controller action ([#4326](https://github.com/MetaMask/core/pull/4326)) +- Add `listMultichainAccounts` method for getting accounts on a specific chain or the default chain ([#4330](https://github.com/MetaMask/core/pull/4330)) +- Add `getSelectedMultichainAccount` method and `AccountsController:getSelectedMultichainAccount` controller action for getting the selected account on a specific chain or the default chain ([#4330](https://github.com/MetaMask/core/pull/4330)) + +### Changed + +- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` to `^8.1.1` ([#4262](https://github.com/MetaMask/core/pull/4262)) +- **BREAKING:** Bump peer dependency `@metamask/keyring-controller` to `^16.1.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** `listAccounts` now filters the list of accounts in state to EVM accounts ([#4330](https://github.com/MetaMask/core/pull/4330)) +- **BREAKING:** `getSelectedAccount` now throws if the selected account is not an EVM account ([#4330](https://github.com/MetaMask/core/pull/4330)) +- Bump `@metamask/eth-snap-keyring` to `^4.1.1` ([#4262](https://github.com/MetaMask/core/pull/4262)) +- Bump `@metamask/keyring-api` to `^6.1.1` ([#4262](https://github.com/MetaMask/core/pull/4262)) +- Bump `@metamask/snaps-sdk` to `^4.2.0` ([#4262](https://github.com/MetaMask/core/pull/4262)) +- Bump `@metamask/snaps-utils` to `^7.4.0` ([#4262](https://github.com/MetaMask/core/pull/4262)) + +### Fixed + +- Fix "Type instantiation is excessively deep and possibly infinite" TypeScript error ([#4331](https://github.com/MetaMask/core/pull/4331)) + ## [14.0.0] ### Changed @@ -171,7 +202,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release ([#1637](https://github.com/MetaMask/core/pull/1637)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@14.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@16.0.0...HEAD +[16.0.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@15.0.0...@metamask/accounts-controller@16.0.0 +[15.0.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@14.0.0...@metamask/accounts-controller@15.0.0 [14.0.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@13.0.0...@metamask/accounts-controller@14.0.0 [13.0.0]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@12.0.1...@metamask/accounts-controller@13.0.0 [12.0.1]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@12.0.0...@metamask/accounts-controller@12.0.1 diff --git a/packages/accounts-controller/jest.config.js b/packages/accounts-controller/jest.config.js index ca08413339..d6e04ca78a 100644 --- a/packages/accounts-controller/jest.config.js +++ b/packages/accounts-controller/jest.config.js @@ -14,6 +14,8 @@ module.exports = merge(baseConfig, { // The display name when running multiple projects displayName, + coveragePathIgnorePatterns: ['./src/tests'], + // An object that configures minimum threshold enforcement for coverage results coverageThreshold: { global: { diff --git a/packages/accounts-controller/package.json b/packages/accounts-controller/package.json index 3c59326eb2..2d754d4ce2 100644 --- a/packages/accounts-controller/package.json +++ b/packages/accounts-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/accounts-controller", - "version": "14.0.0", + "version": "16.0.0", "description": "Manages internal accounts", "keywords": [ "MetaMask", @@ -42,7 +42,7 @@ }, "dependencies": { "@ethereumjs/util": "^8.1.0", - "@metamask/base-controller": "^5.0.2", + "@metamask/base-controller": "^6.0.0", "@metamask/eth-snap-keyring": "^4.1.1", "@metamask/keyring-api": "^6.1.1", "@metamask/snaps-sdk": "^4.2.0", @@ -55,7 +55,7 @@ }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", - "@metamask/keyring-controller": "^16.0.0", + "@metamask/keyring-controller": "^17.0.0", "@metamask/snaps-controllers": "^8.1.1", "@types/jest": "^27.4.1", "@types/readable-stream": "^2.3.0", @@ -66,11 +66,11 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/keyring-controller": "^16.0.0", + "@metamask/keyring-controller": "^17.0.0", "@metamask/snaps-controllers": "^8.1.1" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/accounts-controller/src/AccountsController.test.ts b/packages/accounts-controller/src/AccountsController.test.ts index 270274973e..385bf21187 100644 --- a/packages/accounts-controller/src/AccountsController.test.ts +++ b/packages/accounts-controller/src/AccountsController.test.ts @@ -1,9 +1,19 @@ import { ControllerMessenger } from '@metamask/base-controller'; -import type { InternalAccount } from '@metamask/keyring-api'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import type { + InternalAccount, + InternalAccountType, +} from '@metamask/keyring-api'; +import { + BtcAccountType, + BtcMethod, + EthAccountType, + EthErc4337Method, + EthMethod, +} from '@metamask/keyring-api'; import { KeyringTypes } from '@metamask/keyring-controller'; import type { SnapControllerState } from '@metamask/snaps-controllers'; import { SnapStatus } from '@metamask/snaps-utils'; +import type { CaipChainId } from '@metamask/utils'; import * as uuid from 'uuid'; import type { V4Options } from 'uuid'; @@ -15,6 +25,7 @@ import type { AllowedEvents, } from './AccountsController'; import { AccountsController } from './AccountsController'; +import { createMockInternalAccount } from './tests/mocks'; import { getUUIDOptionsFromAddressOfNormalAccount, keyringTypeToName, @@ -145,6 +156,9 @@ class MockNormalAccountUUID { * @param props.keyringType - The type of the keyring associated with the account. * @param props.snapId - The id of the snap. * @param props.snapEnabled - The status of the snap + * @param props.type - Account Type to create + * @param props.importTime - The import time of the account. + * @param props.lastSelected - The last selected time of the account. * @returns The `InternalAccount` object created from the normal account properties. */ function createExpectedInternalAccount({ @@ -154,6 +168,9 @@ function createExpectedInternalAccount({ keyringType, snapId, snapEnabled = true, + type = EthAccountType.Eoa, + importTime, + lastSelected, }: { id: string; name: string; @@ -161,20 +178,32 @@ function createExpectedInternalAccount({ keyringType: string; snapId?: string; snapEnabled?: boolean; + type?: InternalAccountType; + importTime?: number; + lastSelected?: number; }): InternalAccount { - const account: InternalAccount = { + const accountTypeToMethods = { + [`${EthAccountType.Eoa}`]: [...Object.values(EthMethod)], + [`${EthAccountType.Erc4337}`]: [...Object.values(EthErc4337Method)], + [`${BtcAccountType.P2wpkh}`]: [...Object.values(BtcMethod)], + }; + + const methods = + accountTypeToMethods[type as unknown as keyof typeof accountTypeToMethods]; + + const account = { id, address, options: {}, - methods: [...EOA_METHODS], - type: EthAccountType.Eoa, + methods, + type, metadata: { name, keyring: { type: keyringType }, - importTime: expect.any(Number), - lastSelected: expect.any(Number), + importTime: importTime || expect.any(Number), + lastSelected: lastSelected || expect.any(Number), }, - }; + } as InternalAccount; if (snapId) { account.metadata.snap = { @@ -259,7 +288,13 @@ function setupAccountsController({ AccountsControllerActions | AllowedActions, AccountsControllerEvents | AllowedEvents >; -}): AccountsController { +}): { + accountsController: AccountsController; + messenger: ControllerMessenger< + AccountsControllerActions | AllowedActions, + AccountsControllerEvents | AllowedEvents + >; +} { const accountsControllerMessenger = buildAccountsControllerMessenger(messenger); @@ -267,7 +302,7 @@ function setupAccountsController({ messenger: accountsControllerMessenger, state: { ...defaultState, ...initialState }, }); - return accountsController; + return { accountsController, messenger }; } describe('AccountsController', () => { @@ -276,7 +311,7 @@ describe('AccountsController', () => { }); describe('onSnapStateChange', () => { - it('should be used enable an account if the snap is enabled and not blocked', async () => { + it('be used enable an account if the Snap is enabled and not blocked', async () => { const messenger = buildMessenger(); const mockSnapAccount = createExpectedInternalAccount({ id: 'mock-id', @@ -298,7 +333,7 @@ describe('AccountsController', () => { // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any as SnapControllerState; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -319,7 +354,7 @@ describe('AccountsController', () => { expect(updatedAccount.metadata.snap?.enabled).toBe(true); }); - it('should be used disable an account if the snap is disabled', async () => { + it('be used disable an account if the Snap is disabled', async () => { const messenger = buildMessenger(); const mockSnapAccount = createExpectedInternalAccount({ id: 'mock-id', @@ -340,7 +375,7 @@ describe('AccountsController', () => { // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any as SnapControllerState; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -361,7 +396,7 @@ describe('AccountsController', () => { expect(updatedAccount.metadata.snap?.enabled).toBe(false); }); - it('should be used disable an account if the snap is blocked', async () => { + it('be used disable an account if the Snap is blocked', async () => { const messenger = buildMessenger(); const mockSnapAccount = createExpectedInternalAccount({ id: 'mock-id', @@ -382,7 +417,7 @@ describe('AccountsController', () => { // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any as SnapControllerState; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -408,9 +443,9 @@ describe('AccountsController', () => { afterEach(() => { jest.clearAllMocks(); }); - it('should not update state when only keyring is unlocked without any keyrings', async () => { + it('not update state when only keyring is unlocked without any keyrings', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -431,7 +466,7 @@ describe('AccountsController', () => { expect(accounts).toStrictEqual([]); }); - it('should only update if the keyring is unlocked and when there are keyrings', async () => { + it('only update if the keyring is unlocked and when there are keyrings', async () => { const messenger = buildMessenger(); const mockNewKeyringState = { @@ -443,7 +478,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -465,7 +500,7 @@ describe('AccountsController', () => { }); describe('adding accounts', () => { - it('should add new accounts', async () => { + it('add new accounts', async () => { const messenger = buildMessenger(); mockUUID .mockReturnValueOnce('mock-id') // call to check if its a new account @@ -481,7 +516,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -508,7 +543,7 @@ describe('AccountsController', () => { ]); }); - it('should add snap accounts', async () => { + it('add Snap accounts', async () => { mockUUID.mockReturnValueOnce('mock-id'); // call to check if its a new account const messenger = buildMessenger(); @@ -539,7 +574,7 @@ describe('AccountsController', () => { ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -575,7 +610,7 @@ describe('AccountsController', () => { ]); }); - it('should handle the event when a snap deleted the account before the it was added', async () => { + it('handle the event when a Snap deleted the account before the it was added', async () => { mockUUID.mockReturnValueOnce('mock-id'); // call to check if its a new account const messenger = buildMessenger(); messenger.registerActionHandler( @@ -605,7 +640,7 @@ describe('AccountsController', () => { ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -632,7 +667,7 @@ describe('AccountsController', () => { ]); }); - it('should increment the default account number when adding an account', async () => { + it('increment the default account number when adding an account', async () => { const messenger = buildMessenger(); mockUUID .mockReturnValueOnce('mock-id') // call to check if its a new account @@ -653,7 +688,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -688,7 +723,7 @@ describe('AccountsController', () => { ]); }); - it('should use the next number after the total number of accounts of a keyring when adding an account, if the index is lower', async () => { + it('use the next number after the total number of accounts of a keyring when adding an account, if the index is lower', async () => { const messenger = buildMessenger(); mockUUID .mockReturnValueOnce('mock-id') // call to check if its a new account @@ -701,6 +736,8 @@ describe('AccountsController', () => { name: 'Custom Name', address: mockAccount2.address, keyringType: KeyringTypes.hd, + importTime: 1955565967656, + lastSelected: 1955565967656, }); const mockNewKeyringState = { @@ -716,7 +753,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -749,7 +786,7 @@ describe('AccountsController', () => { ]); }); - it('should handle when the account to set as selectedAccount is undefined', async () => { + it('handle when the account to set as selectedAccount is undefined', async () => { mockUUID.mockReturnValueOnce('mock-id'); // call to check if its a new account const messenger = buildMessenger(); @@ -777,7 +814,7 @@ describe('AccountsController', () => { ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -800,7 +837,7 @@ describe('AccountsController', () => { }); describe('deleting account', () => { - it('should delete accounts if its gone from the keyring state', async () => { + it('delete accounts if its gone from the keyring state', async () => { const messenger = buildMessenger(); mockUUID.mockReturnValueOnce('mock-id2'); @@ -813,7 +850,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -840,7 +877,7 @@ describe('AccountsController', () => { ); }); - it('should delete accounts and set the most recent lastSelected account', async () => { + it('delete accounts and set the most recent lastSelected account', async () => { const messenger = buildMessenger(); mockUUID .mockReturnValueOnce('mock-id') @@ -857,7 +894,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -896,7 +933,7 @@ describe('AccountsController', () => { ); }); - it('should delete accounts and set the most recent lastSelected account when there are accounts that have never been selected', async () => { + it('delete accounts and set the most recent lastSelected account when there are accounts that have never been selected', async () => { const messenger = buildMessenger(); mockUUID .mockReturnValueOnce('mock-id') @@ -920,7 +957,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -959,7 +996,7 @@ describe('AccountsController', () => { ); }); - it('should delete the account and select the account with the most recent lastSelected', async () => { + it('delete the account and select the account with the most recent lastSelected', async () => { const messenger = buildMessenger(); mockUUID.mockReturnValueOnce('mock-id').mockReturnValueOnce('mock-id2'); @@ -991,7 +1028,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -1023,16 +1060,16 @@ describe('AccountsController', () => { const accounts = accountsController.listAccounts(); expect(accounts).toStrictEqual([ - setLastSelectedAsAny(mockAccountWithoutLastSelected), + mockAccountWithoutLastSelected, mockAccount2WithoutLastSelected, ]); expect(accountsController.getSelectedAccount()).toStrictEqual( - setLastSelectedAsAny(mockAccountWithoutLastSelected), + mockAccountWithoutLastSelected, ); }); }); - it('should handle keyring reinitialization', async () => { + it('handle keyring reinitialization', async () => { const messenger = buildMessenger(); const mockInitialAccount = createExpectedInternalAccount({ id: 'mock-id', @@ -1059,7 +1096,7 @@ describe('AccountsController', () => { }, ], }; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -1084,6 +1121,90 @@ describe('AccountsController', () => { expect(selectedAccount).toStrictEqual(expectedAccount); expect(accounts).toStrictEqual([expectedAccount]); }); + + it.each([ + { + lastSelectedForAccount1: 1111, + lastSelectedForAccount2: 9999, + expectedSelectedId: 'mock-id2', + }, + { + lastSelectedForAccount1: undefined, + lastSelectedForAccount2: 9999, + expectedSelectedId: 'mock-id2', + }, + { + lastSelectedForAccount1: 1111, + lastSelectedForAccount2: undefined, + expectedSelectedId: 'mock-id', + }, + { + lastSelectedForAccount1: 1111, + lastSelectedForAccount2: 0, + expectedSelectedId: 'mock-id', + }, + ])( + 'handle keyring reinitialization with multiple accounts. Account 1 lastSelected $lastSelectedForAccount1, Account 2 lastSelected $lastSelectedForAccount2. Expected selected account: $expectedSelectedId', + async ({ + lastSelectedForAccount1, + lastSelectedForAccount2, + expectedSelectedId, + }) => { + const messenger = buildMessenger(); + const mockExistingAccount1 = createExpectedInternalAccount({ + id: 'mock-id', + name: 'Account 1', + address: '0x123', + keyringType: KeyringTypes.hd, + }); + mockExistingAccount1.metadata.lastSelected = lastSelectedForAccount1; + const mockExistingAccount2 = createExpectedInternalAccount({ + id: 'mock-id2', + name: 'Account 2', + address: '0x456', + keyringType: KeyringTypes.hd, + }); + mockExistingAccount2.metadata.lastSelected = lastSelectedForAccount2; + + mockUUID + .mockReturnValueOnce('mock-id') // call to check if its a new account + .mockReturnValueOnce('mock-id2'); // call to check if its a new account + + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockExistingAccount1.id]: mockExistingAccount1, + [mockExistingAccount2.id]: mockExistingAccount2, + }, + selectedAccount: 'unknown', + }, + }, + messenger, + }); + const mockNewKeyringState = { + isUnlocked: true, + keyrings: [ + { + type: KeyringTypes.hd, + accounts: [ + mockExistingAccount1.address, + mockExistingAccount2.address, + ], + }, + ], + }; + messenger.publish( + 'KeyringController:stateChange', + mockNewKeyringState, + [], + ); + + const selectedAccount = accountsController.getSelectedAccount(); + + expect(selectedAccount.id).toStrictEqual(expectedSelectedId); + }, + ); }); describe('updateAccounts', () => { @@ -1134,7 +1255,7 @@ describe('AccountsController', () => { jest.clearAllMocks(); }); - it('should update accounts with normal accounts', async () => { + it('update accounts with normal accounts', async () => { mockUUID.mockReturnValueOnce('mock-id').mockReturnValueOnce('mock-id2'); const messenger = buildMessenger(); messenger.registerActionHandler( @@ -1157,7 +1278,7 @@ describe('AccountsController', () => { ]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1186,7 +1307,7 @@ describe('AccountsController', () => { expect(accountsController.listAccounts()).toStrictEqual(expectedAccounts); }); - it('should update accounts with snap accounts when snap keyring is defined and has accounts', async () => { + it('update accounts with Snap accounts when snap keyring is defined and has accounts', async () => { const messenger = buildMessenger(); messenger.registerActionHandler( 'KeyringController:getAccounts', @@ -1203,7 +1324,7 @@ describe('AccountsController', () => { ]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1242,7 +1363,7 @@ describe('AccountsController', () => { ).toStrictEqual(expectedAccounts); }); - it('should return an empty array if the snap keyring is not defined', async () => { + it('return an empty array if the Snap keyring is not defined', async () => { const messenger = buildMessenger(); messenger.registerActionHandler( 'KeyringController:getAccounts', @@ -1254,7 +1375,7 @@ describe('AccountsController', () => { mockGetKeyringByType.mockReturnValueOnce([undefined]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1271,7 +1392,7 @@ describe('AccountsController', () => { expect(accountsController.listAccounts()).toStrictEqual(expectedAccounts); }); - it('should set the account with the correct index', async () => { + it('set the account with the correct index', async () => { mockUUID.mockReturnValueOnce('mock-id').mockReturnValueOnce('mock-id2'); const messenger = buildMessenger(); messenger.registerActionHandler( @@ -1294,7 +1415,7 @@ describe('AccountsController', () => { ]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -1320,7 +1441,7 @@ describe('AccountsController', () => { expect(accountsController.listAccounts()).toStrictEqual(expectedAccounts); }); - it('should filter snap accounts from normalAccounts', async () => { + it('filter Snap accounts from normalAccounts', async () => { mockUUID.mockReturnValueOnce('mock-id'); const messenger = buildMessenger(); messenger.registerActionHandler( @@ -1345,7 +1466,7 @@ describe('AccountsController', () => { .mockResolvedValueOnce({ type: KeyringTypes.snap }), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1375,7 +1496,7 @@ describe('AccountsController', () => { expect(accountsController.listAccounts()).toStrictEqual(expectedAccounts); }); - it('should filter snap accounts from normalAccounts even if the snap account is listed before normal accounts', async () => { + it('filter Snap accounts from normalAccounts even if the snap account is listed before normal accounts', async () => { mockUUID.mockReturnValue('mock-id'); const messenger = buildMessenger(); messenger.registerActionHandler( @@ -1400,7 +1521,7 @@ describe('AccountsController', () => { .mockResolvedValueOnce({ type: KeyringTypes.hd }), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1462,7 +1583,7 @@ describe('AccountsController', () => { ]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1488,7 +1609,7 @@ describe('AccountsController', () => { ).toStrictEqual(expectedAccounts); }); - it('should throw an error if the keyring type is unknown', async () => { + it('throw an error if the keyring type is unknown', async () => { mockUUID.mockReturnValue('mock-id'); const messenger = buildMessenger(); @@ -1511,7 +1632,7 @@ describe('AccountsController', () => { ]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1528,8 +1649,8 @@ describe('AccountsController', () => { }); describe('loadBackup', () => { - it('should load a backup', async () => { - const accountsController = setupAccountsController({ + it('load a backup', async () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: {}, @@ -1557,8 +1678,8 @@ describe('AccountsController', () => { }); }); - it('should not load backup if the data is undefined', () => { - const accountsController = setupAccountsController({ + it('not load backup if the data is undefined', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1582,8 +1703,8 @@ describe('AccountsController', () => { }); describe('getAccount', () => { - it('should return an account by ID', () => { - const accountsController = setupAccountsController({ + it('return an account by ID', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1598,8 +1719,8 @@ describe('AccountsController', () => { setLastSelectedAsAny(mockAccount as InternalAccount), ); }); - it('should return undefined for an unknown account ID', () => { - const accountsController = setupAccountsController({ + it('return undefined for an unknown account ID', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1614,32 +1735,260 @@ describe('AccountsController', () => { }); }); + describe('getSelectedAccount', () => { + const mockNonEvmAccount = createExpectedInternalAccount({ + id: 'mock-non-evm', + name: 'non-evm', + address: 'bc1qzqc2aqlw8nwa0a05ehjkk7dgt8308ac7kzw9a6', + keyringType: KeyringTypes.snap, + type: BtcAccountType.P2wpkh, + }); + + const mockOlderEvmAccount = createExpectedInternalAccount({ + id: 'mock-id-1', + name: 'mock account 1', + address: 'mock-address-1', + keyringType: KeyringTypes.hd, + lastSelected: 11111, + }); + const mockNewerEvmAccount = createExpectedInternalAccount({ + id: 'mock-id-2', + name: 'mock account 2', + address: 'mock-address-2', + keyringType: KeyringTypes.hd, + lastSelected: 22222, + }); + + it.each([ + { + lastSelectedAccount: mockNewerEvmAccount, + expected: mockNewerEvmAccount, + }, + { + lastSelectedAccount: mockOlderEvmAccount, + expected: mockOlderEvmAccount, + }, + { + lastSelectedAccount: mockNonEvmAccount, + expected: mockNewerEvmAccount, + }, + ])( + 'last selected account type is $lastSelectedAccount.type should return the selectedAccount with id $expected.id', + ({ lastSelectedAccount, expected }) => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockOlderEvmAccount.id]: mockOlderEvmAccount, + [mockNewerEvmAccount.id]: mockNewerEvmAccount, + [mockNonEvmAccount.id]: mockNonEvmAccount, + }, + selectedAccount: lastSelectedAccount.id, + }, + }, + }); + + expect(accountsController.getSelectedAccount()).toStrictEqual(expected); + }, + ); + + it("throw error if there aren't any EVM accounts", () => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockNonEvmAccount.id]: mockNonEvmAccount, + }, + selectedAccount: mockNonEvmAccount.id, + }, + }, + }); + + expect(() => accountsController.getSelectedAccount()).toThrow( + 'No EVM accounts', + ); + }); + }); + + describe('getSelectedMultichainAccount', () => { + const mockNonEvmAccount = createExpectedInternalAccount({ + id: 'mock-non-evm', + name: 'non-evm', + address: 'bc1qzqc2aqlw8nwa0a05ehjkk7dgt8308ac7kzw9a6', + keyringType: KeyringTypes.snap, + type: BtcAccountType.P2wpkh, + }); + + const mockOlderEvmAccount = createExpectedInternalAccount({ + id: 'mock-id-1', + name: 'mock account 1', + address: 'mock-address-1', + keyringType: KeyringTypes.hd, + lastSelected: 11111, + }); + const mockNewerEvmAccount = createExpectedInternalAccount({ + id: 'mock-id-2', + name: 'mock account 2', + address: 'mock-address-2', + keyringType: KeyringTypes.hd, + lastSelected: 22222, + }); + + it.each([ + { + chainId: undefined, + selectedAccount: mockNewerEvmAccount, + expected: mockNewerEvmAccount, + }, + { + chainId: undefined, + selectedAccount: mockNonEvmAccount, + expected: mockNonEvmAccount, + }, + { + chainId: 'eip155:1', + selectedAccount: mockNonEvmAccount, + expected: mockNewerEvmAccount, + }, + { + chainId: 'bip122:000000000019d6689c085ae165831e93', + selectedAccount: mockNonEvmAccount, + expected: mockNonEvmAccount, + }, + ])( + "chainId $chainId with selectedAccount '$selectedAccount.id' should return $expected.id", + ({ chainId, selectedAccount, expected }) => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockOlderEvmAccount.id]: mockOlderEvmAccount, + [mockNewerEvmAccount.id]: mockNewerEvmAccount, + [mockNonEvmAccount.id]: mockNonEvmAccount, + }, + selectedAccount: selectedAccount.id, + }, + }, + }); + + expect( + accountsController.getSelectedMultichainAccount( + chainId as CaipChainId, + ), + ).toStrictEqual(expected); + }, + ); + + // Testing error cases + it.each([['eip155.'], ['bip122'], ['bip122:...']])( + 'invalid chainId %s will throw', + (chainId) => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockOlderEvmAccount.id]: mockOlderEvmAccount, + [mockNewerEvmAccount.id]: mockNewerEvmAccount, + [mockNonEvmAccount.id]: mockNonEvmAccount, + }, + selectedAccount: mockNonEvmAccount.id, + }, + }, + }); + + expect(() => + accountsController.getSelectedMultichainAccount( + chainId as CaipChainId, + ), + ).toThrow(`Invalid CAIP-2 chain ID: ${chainId}`); + }, + ); + }); + describe('listAccounts', () => { - it('should return a list of accounts', () => { - const accountsController = setupAccountsController({ + it('returns a list of evm accounts', () => { + const mockNonEvmAccount = createMockInternalAccount({ + id: 'mock-id-non-evm', + address: 'mock-non-evm-address', + type: BtcAccountType.P2wpkh, + keyringType: KeyringTypes.snap, + }); + + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount, [mockAccount2.id]: mockAccount2, + [mockNonEvmAccount.id]: mockNonEvmAccount, }, selectedAccount: mockAccount.id, }, }, }); - const result = accountsController.listAccounts(); - - expect(result).toStrictEqual([ - setLastSelectedAsAny(mockAccount as InternalAccount), - setLastSelectedAsAny(mockAccount2 as InternalAccount), + expect(accountsController.listAccounts()).toStrictEqual([ + mockAccount, + mockAccount2, ]); }); }); + describe('listMultichainAccounts', () => { + const mockNonEvmAccount = createMockInternalAccount({ + id: 'mock-id-non-evm', + address: 'mock-non-evm-address', + type: BtcAccountType.P2wpkh, + keyringType: KeyringTypes.snap, + }); + + it.each([ + [undefined, [mockAccount, mockAccount2, mockNonEvmAccount]], + ['eip155:1', [mockAccount, mockAccount2]], + ['bip122:000000000019d6689c085ae165831e93', [mockNonEvmAccount]], + ])(`%s should return %s`, (chainId, expected) => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockAccount.id]: mockAccount, + [mockAccount2.id]: mockAccount2, + [mockNonEvmAccount.id]: mockNonEvmAccount, + }, + selectedAccount: mockAccount.id, + }, + }, + }); + expect( + accountsController.listMultichainAccounts(chainId as CaipChainId), + ).toStrictEqual(expected); + }); + + it('throw if invalid CAIP-2 was passed', () => { + const { accountsController } = setupAccountsController({ + initialState: { + internalAccounts: { + accounts: { + [mockAccount.id]: mockAccount, + [mockAccount2.id]: mockAccount2, + }, + selectedAccount: mockAccount.id, + }, + }, + }); + + const invalidCaip2 = 'ethereum'; + + expect(() => + // @ts-expect-error testing invalid caip2 + accountsController.listMultichainAccounts(invalidCaip2), + ).toThrow(`Invalid CAIP-2 chain ID: ${invalidCaip2}`); + }); + }); + describe('getAccountExpect', () => { - it('should return an account by ID', () => { - const accountsController = setupAccountsController({ + it('return an account by ID', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1654,9 +2003,9 @@ describe('AccountsController', () => { ); }); - it('should throw an error for an unknown account ID', () => { + it('throw an error for an unknown account ID', () => { const accountId = 'unknown id'; - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1670,8 +2019,8 @@ describe('AccountsController', () => { ); }); - it('should handle the edge case of undefined accountId during onboarding', async () => { - const accountsController = setupAccountsController({ + it('handle the edge case of undefined accountId during onboarding', async () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1698,49 +2047,72 @@ describe('AccountsController', () => { }); }); - describe('getSelectedAccount', () => { - it('should return the selected account', () => { - const accountsController = setupAccountsController({ + describe('setSelectedAccount', () => { + it('set the selected account', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { - accounts: { [mockAccount.id]: mockAccount }, + accounts: { + [mockAccount.id]: mockAccount, + [mockAccount2.id]: mockAccount2, + }, selectedAccount: mockAccount.id, }, }, }); - const result = accountsController.getAccountExpect(mockAccount.id); - expect(result).toStrictEqual( - setLastSelectedAsAny(mockAccount as InternalAccount), - ); + accountsController.setSelectedAccount(mockAccount2.id); + + expect( + accountsController.state.internalAccounts.selectedAccount, + ).toStrictEqual(mockAccount2.id); }); - }); - describe('setSelectedAccount', () => { - it('should set the selected account', () => { - const accountsController = setupAccountsController({ + it('not emit setSelectedEvmAccountChange if the account is non-EVM', () => { + const mockNonEvmAccount = createExpectedInternalAccount({ + id: 'mock-non-evm', + name: 'non-evm', + address: 'bc1qzqc2aqlw8nwa0a05ehjkk7dgt8308ac7kzw9a6', + keyringType: KeyringTypes.snap, + type: BtcAccountType.P2wpkh, + }); + const { accountsController, messenger } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount, - [mockAccount2.id]: mockAccount2, + [mockNonEvmAccount.id]: mockNonEvmAccount, }, selectedAccount: mockAccount.id, }, }, }); - accountsController.setSelectedAccount(mockAccount2.id); + const messengerSpy = jest.spyOn(messenger, 'publish'); + + accountsController.setSelectedAccount(mockNonEvmAccount.id); expect( accountsController.state.internalAccounts.selectedAccount, - ).toStrictEqual(mockAccount2.id); + ).toStrictEqual(mockNonEvmAccount.id); + + expect(messengerSpy.mock.calls).toHaveLength(2); // state change and then selectedAccountChange + + expect(messengerSpy).not.toHaveBeenCalledWith( + 'AccountsController:selectedEvmAccountChange', + mockNonEvmAccount, + ); + + expect(messengerSpy).toHaveBeenCalledWith( + 'AccountsController:selectedAccountChange', + mockNonEvmAccount, + ); }); }); describe('setAccountName', () => { - it('should set the name of an existing account', () => { - const accountsController = setupAccountsController({ + it('set the name of an existing account', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1755,8 +2127,8 @@ describe('AccountsController', () => { ).toBe('new name'); }); - it('should throw an error if the account name already exists', () => { - const accountsController = setupAccountsController({ + it('throw an error if the account name already exists', () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -1812,7 +2184,7 @@ describe('AccountsController', () => { }; }; - it('should return the next account number', async () => { + it('return the next account number', async () => { const messenger = buildMessenger(); mockUUID .mockReturnValueOnce('mock-id') // call to check if its a new account @@ -1821,7 +2193,7 @@ describe('AccountsController', () => { .mockReturnValueOnce('mock-id2') // call to add account .mockReturnValueOnce('mock-id3'); // call to add account - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -1850,7 +2222,7 @@ describe('AccountsController', () => { ]); }); - it('should return the next account number even with an index gap', async () => { + it('return the next account number even with an index gap', async () => { const messenger = buildMessenger(); const mockAccountUUIDs = new MockNormalAccountUUID([ mockAccount, @@ -1860,7 +2232,7 @@ describe('AccountsController', () => { ]); mockUUID.mockImplementation(mockAccountUUIDs.mock.bind(mockAccountUUIDs)); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { @@ -1909,8 +2281,8 @@ describe('AccountsController', () => { }); describe('getAccountByAddress', () => { - it('should return an account by address', async () => { - const accountsController = setupAccountsController({ + it('return an account by address', async () => { + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1927,7 +2299,7 @@ describe('AccountsController', () => { }); it("should return undefined if there isn't an account with the address", () => { - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1951,13 +2323,12 @@ describe('AccountsController', () => { jest.spyOn(AccountsController.prototype, 'getAccountByAddress'); jest.spyOn(AccountsController.prototype, 'getSelectedAccount'); jest.spyOn(AccountsController.prototype, 'getAccount'); - jest.spyOn(AccountsController.prototype, 'getNextAvailableAccountName'); }); describe('setSelectedAccount', () => { - it('should set the selected account', async () => { + it('set the selected account', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1975,9 +2346,9 @@ describe('AccountsController', () => { }); describe('listAccounts', () => { - it('should retrieve a list of accounts', async () => { + it('retrieve a list of accounts', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -1993,9 +2364,9 @@ describe('AccountsController', () => { }); describe('setAccountName', () => { - it('should set the account name', async () => { + it('set the account name', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -2018,7 +2389,7 @@ describe('AccountsController', () => { }); describe('updateAccounts', () => { - it('should update accounts', async () => { + it('update accounts', async () => { const messenger = buildMessenger(); messenger.registerActionHandler( 'KeyringController:getAccounts', @@ -2033,7 +2404,7 @@ describe('AccountsController', () => { mockGetKeyringForAccount.mockResolvedValueOnce([]), ); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -2049,10 +2420,10 @@ describe('AccountsController', () => { }); describe('getAccountByAddress', () => { - it('should get account by address', async () => { + it('get account by address', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -2074,10 +2445,10 @@ describe('AccountsController', () => { }); describe('getSelectedAccount', () => { - it('should get account by address', async () => { + it('get account by address', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, @@ -2094,10 +2465,10 @@ describe('AccountsController', () => { }); describe('getAccount', () => { - it('should get account by id', async () => { + it('get account by id', async () => { const messenger = buildMessenger(); - const accountsController = setupAccountsController({ + const { accountsController } = setupAccountsController({ initialState: { internalAccounts: { accounts: { [mockAccount.id]: mockAccount }, diff --git a/packages/accounts-controller/src/AccountsController.ts b/packages/accounts-controller/src/AccountsController.ts index 8fec7bc333..820ab6447f 100644 --- a/packages/accounts-controller/src/AccountsController.ts +++ b/packages/accounts-controller/src/AccountsController.ts @@ -6,7 +6,11 @@ import type { import { BaseController } from '@metamask/base-controller'; import { SnapKeyring } from '@metamask/eth-snap-keyring'; import type { InternalAccount } from '@metamask/keyring-api'; -import { EthAccountType, EthMethod } from '@metamask/keyring-api'; +import { + EthAccountType, + EthMethod, + isEvmAccountType, +} from '@metamask/keyring-api'; import { KeyringTypes } from '@metamask/keyring-controller'; import type { KeyringControllerState, @@ -21,7 +25,13 @@ import type { } from '@metamask/snaps-controllers'; import type { SnapId } from '@metamask/snaps-sdk'; import type { Snap } from '@metamask/snaps-utils'; -import type { Keyring, Json } from '@metamask/utils'; +import type { CaipChainId } from '@metamask/utils'; +import { + type Keyring, + type Json, + isCaipChainId, + parseCaipChainId, +} from '@metamask/utils'; import type { Draft } from 'immer'; import { @@ -70,6 +80,11 @@ export type AccountsControllerGetSelectedAccountAction = { handler: AccountsController['getSelectedAccount']; }; +export type AccountsControllerGetSelectedMultichainAccountAction = { + type: `${typeof controllerName}:getSelectedMultichainAccount`; + handler: AccountsController['getSelectedMultichainAccount']; +}; + export type AccountsControllerGetAccountByAddressAction = { type: `${typeof controllerName}:getAccountByAddress`; handler: AccountsController['getAccountByAddress']; @@ -99,7 +114,8 @@ export type AccountsControllerActions = | AccountsControllerGetAccountByAddressAction | AccountsControllerGetSelectedAccountAction | AccountsControllerGetNextAvailableAccountNameAction - | AccountsControllerGetAccountAction; + | AccountsControllerGetAccountAction + | AccountsControllerGetSelectedMultichainAccountAction; export type AccountsControllerChangeEvent = ControllerStateChangeEvent< typeof controllerName, @@ -111,11 +127,17 @@ export type AccountsControllerSelectedAccountChangeEvent = { payload: [InternalAccount]; }; +export type AccountsControllerSelectedEvmAccountChangeEvent = { + type: `${typeof controllerName}:selectedEvmAccountChange`; + payload: [InternalAccount]; +}; + export type AllowedEvents = SnapStateChange | KeyringControllerStateChangeEvent; export type AccountsControllerEvents = | AccountsControllerChangeEvent - | AccountsControllerSelectedAccountChangeEvent; + | AccountsControllerSelectedAccountChangeEvent + | AccountsControllerSelectedEvmAccountChangeEvent; export type AccountsControllerMessenger = RestrictedControllerMessenger< typeof controllerName, @@ -205,12 +227,34 @@ export class AccountsController extends BaseController< } /** - * Returns an array of all internal accounts. + * Returns an array of all evm internal accounts. * * @returns An array of InternalAccount objects. */ listAccounts(): InternalAccount[] { - return Object.values(this.state.internalAccounts.accounts); + const accounts = Object.values(this.state.internalAccounts.accounts); + return accounts.filter((account) => isEvmAccountType(account.type)); + } + + /** + * Returns an array of all internal accounts. + * + * @param chainId - The chain ID. + * @returns An array of InternalAccount objects. + */ + listMultichainAccounts(chainId?: CaipChainId): InternalAccount[] { + const accounts = Object.values(this.state.internalAccounts.accounts); + if (!chainId) { + return accounts; + } + + if (!isCaipChainId(chainId)) { + throw new Error(`Invalid CAIP-2 chain ID: ${String(chainId)}`); + } + + return accounts.filter((account) => + this.#isAccountCompatibleWithChain(account, chainId), + ); } /** @@ -248,12 +292,54 @@ export class AccountsController extends BaseController< } /** - * Returns the selected internal account. + * Returns the last selected evm account. * * @returns The selected internal account. */ getSelectedAccount(): InternalAccount { - return this.getAccountExpect(this.state.internalAccounts.selectedAccount); + const selectedAccount = this.getAccountExpect( + this.state.internalAccounts.selectedAccount, + ); + if (isEvmAccountType(selectedAccount.type)) { + return selectedAccount; + } + + const accounts = this.listAccounts(); + + if (!accounts.length) { + // ! Should never reach this. + throw new Error('No EVM accounts'); + } + + // This will never be undefined because we have already checked if accounts.length is > 0 + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this.#getLastSelectedAccount(accounts)!; + } + + /** + * __WARNING The return value may be undefined if there isn't an account for that chain id.__ + * + * Retrieves the last selected account by chain ID. + * + * @param chainId - The chain ID to filter the accounts. + * @returns The last selected account compatible with the specified chain ID or undefined. + */ + getSelectedMultichainAccount( + chainId?: CaipChainId, + ): InternalAccount | undefined { + if (!chainId) { + return this.getAccountExpect(this.state.internalAccounts.selectedAccount); + } + + if (!isCaipChainId(chainId)) { + throw new Error(`Invalid CAIP-2 chain ID: ${chainId as string}`); + } + + const accounts = Object.values(this.state.internalAccounts.accounts).filter( + (account) => this.#isAccountCompatibleWithChain(account, chainId), + ); + + return this.#getLastSelectedAccount(accounts); } /** @@ -282,6 +368,13 @@ export class AccountsController extends BaseController< currentState.internalAccounts.selectedAccount = account.id; }); + if (isEvmAccountType(account.type)) { + this.messagingSystem.publish( + 'AccountsController:selectedEvmAccountChange', + account, + ); + } + this.messagingSystem.publish( 'AccountsController:selectedAccountChange', account, @@ -707,6 +800,30 @@ export class AccountsController extends BaseController< }); } + /** + * Returns the last selected account from the given array of accounts. + * + * @param accounts - An array of InternalAccount objects. + * @returns The InternalAccount object that was last selected, or undefined if the array is empty. + */ + #getLastSelectedAccount( + accounts: InternalAccount[], + ): InternalAccount | undefined { + return accounts.reduce((prevAccount, currentAccount) => { + if ( + // When the account is added, lastSelected will be set + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + currentAccount.metadata.lastSelected! > + // When the account is added, lastSelected will be set + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + prevAccount.metadata.lastSelected! + ) { + return currentAccount; + } + return prevAccount; + }, accounts[0]); + } + /** * Returns the next account number for a given keyring type. * @param keyringType - The type of keyring. @@ -745,6 +862,22 @@ export class AccountsController extends BaseController< return `${keyringName} ${index}`; } + /** + * Checks if an account is compatible with a given chain namespace. + * @private + * @param account - The account to check compatibility for. + * @param chainId - The CAIP2 to check compatibility with. + * @returns Returns true if the account is compatible with the chain namespace, otherwise false. + */ + #isAccountCompatibleWithChain( + account: InternalAccount, + chainId: CaipChainId, + ): boolean { + // TODO: Change this logic to not use account's type + // Because we currently only use type, we can only use namespace for now. + return account.type.startsWith(parseCaipChainId(chainId).namespace); + } + /** * Handles the addition of a new account to the controller. * If the account is not a Snap Keyring account, generates an internal account for it and adds it to the controller. @@ -853,6 +986,11 @@ export class AccountsController extends BaseController< this.getSelectedAccount.bind(this), ); + this.messagingSystem.registerActionHandler( + `${controllerName}:getSelectedMultichainAccount`, + this.getSelectedMultichainAccount.bind(this), + ); + this.messagingSystem.registerActionHandler( `${controllerName}:getAccountByAddress`, this.getAccountByAddress.bind(this), diff --git a/packages/accounts-controller/src/index.ts b/packages/accounts-controller/src/index.ts index 274efa5d5b..29505118b6 100644 --- a/packages/accounts-controller/src/index.ts +++ b/packages/accounts-controller/src/index.ts @@ -11,8 +11,10 @@ export type { AccountsControllerActions, AccountsControllerChangeEvent, AccountsControllerSelectedAccountChangeEvent, + AccountsControllerSelectedEvmAccountChangeEvent, AccountsControllerEvents, AccountsControllerMessenger, } from './AccountsController'; export { AccountsController } from './AccountsController'; export { keyringTypeToName, getUUIDFromAddressOfNormalAccount } from './utils'; +export { createMockInternalAccount } from './tests/mocks'; diff --git a/packages/accounts-controller/src/tests/mocks.test.ts b/packages/accounts-controller/src/tests/mocks.test.ts new file mode 100644 index 0000000000..972b3356a5 --- /dev/null +++ b/packages/accounts-controller/src/tests/mocks.test.ts @@ -0,0 +1,77 @@ +import { BtcAccountType, EthAccountType } from '@metamask/keyring-api'; + +import { createMockInternalAccount } from './mocks'; + +describe('createMockInternalAccount', () => { + it('create a mock internal account', () => { + const account = createMockInternalAccount(); + expect(account).toStrictEqual({ + id: expect.any(String), + address: expect.any(String), + type: expect.any(String), + options: expect.any(Object), + methods: expect.any(Array), + metadata: { + name: expect.any(String), + keyring: { type: expect.any(String) }, + importTime: expect.any(Number), + lastSelected: expect.any(Number), + snap: undefined, + }, + }); + }); + + it('create a mock internal account with custom values', () => { + const customSnap = { + id: '1', + enabled: true, + name: 'Snap 1', + }; + const account = createMockInternalAccount({ + id: '1', + address: '0x123', + type: EthAccountType.Erc4337, + name: 'Custom Account', + snap: customSnap, + }); + expect(account).toStrictEqual({ + id: '1', + address: '0x123', + type: EthAccountType.Erc4337, + options: expect.any(Object), + methods: expect.any(Array), + metadata: { + name: 'Custom Account', + keyring: { type: expect.any(String) }, + importTime: expect.any(Number), + lastSelected: expect.any(Number), + snap: customSnap, + }, + }); + }); + + it('create a non-EVM account', () => { + const account = createMockInternalAccount({ type: BtcAccountType.P2wpkh }); + expect(account).toStrictEqual({ + id: expect.any(String), + address: expect.any(String), + type: BtcAccountType.P2wpkh, + options: expect.any(Object), + methods: expect.any(Array), + metadata: { + name: expect.any(String), + keyring: { type: expect.any(String) }, + importTime: expect.any(Number), + lastSelected: expect.any(Number), + snap: undefined, + }, + }); + }); + + it('will throw if an unknown account type was passed', () => { + // @ts-expect-error testing unknown account type + expect(() => createMockInternalAccount({ type: 'unknown' })).toThrow( + 'Unknown account type: unknown', + ); + }); +}); diff --git a/packages/accounts-controller/src/tests/mocks.ts b/packages/accounts-controller/src/tests/mocks.ts new file mode 100644 index 0000000000..59a9892a1a --- /dev/null +++ b/packages/accounts-controller/src/tests/mocks.ts @@ -0,0 +1,79 @@ +import type { + InternalAccount, + InternalAccountType, +} from '@metamask/keyring-api'; +import { + BtcAccountType, + BtcMethod, + EthAccountType, + EthErc4337Method, + EthMethod, +} from '@metamask/keyring-api'; +import { KeyringTypes } from '@metamask/keyring-controller'; +import { v4 } from 'uuid'; + +export const createMockInternalAccount = ({ + id = v4(), + address = '0x2990079bcdee240329a520d2444386fc119da21a', + type = EthAccountType.Eoa, + name = 'Account 1', + keyringType = KeyringTypes.hd, + snap, + importTime = Date.now(), + lastSelected = Date.now(), +}: { + id?: string; + address?: string; + type?: InternalAccountType; + name?: string; + keyringType?: KeyringTypes; + snap?: { + id: string; + enabled: boolean; + name: string; + }; + importTime?: number; + lastSelected?: number; +} = {}): InternalAccount => { + let methods; + + switch (type) { + case EthAccountType.Eoa: + methods = [ + EthMethod.PersonalSign, + EthMethod.Sign, + EthMethod.SignTransaction, + EthMethod.SignTypedDataV1, + EthMethod.SignTypedDataV3, + EthMethod.SignTypedDataV4, + ]; + break; + case EthAccountType.Erc4337: + methods = [ + EthErc4337Method.PatchUserOperation, + EthErc4337Method.PrepareUserOperation, + EthErc4337Method.SignUserOperation, + ]; + break; + case BtcAccountType.P2wpkh: + methods = [BtcMethod.SendMany]; + break; + default: + throw new Error(`Unknown account type: ${type as string}`); + } + + return { + id, + address, + options: {}, + methods, + type, + metadata: { + name, + keyring: { type: keyringType }, + importTime, + lastSelected, + snap, + }, + } as InternalAccount; +}; diff --git a/packages/address-book-controller/CHANGELOG.md b/packages/address-book-controller/CHANGELOG.md index 7d38702f94..0ce44eb48b 100644 --- a/packages/address-book-controller/CHANGELOG.md +++ b/packages/address-book-controller/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [4.0.2] + +### Changed + +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Fixed + +- Fix `delete` method to protect against prototype-polluting assignments ([#4041](https://github.com/MetaMask/core/pull/4041)) + ## [4.0.1] ### Fixed @@ -127,7 +146,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@4.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@5.0.0...HEAD +[5.0.0]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@4.0.2...@metamask/address-book-controller@5.0.0 +[4.0.2]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@4.0.1...@metamask/address-book-controller@4.0.2 [4.0.1]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@4.0.0...@metamask/address-book-controller@4.0.1 [4.0.0]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@3.1.7...@metamask/address-book-controller@4.0.0 [3.1.7]: https://github.com/MetaMask/core/compare/@metamask/address-book-controller@3.1.6...@metamask/address-book-controller@3.1.7 diff --git a/packages/address-book-controller/package.json b/packages/address-book-controller/package.json index c796063683..262ef3af82 100644 --- a/packages/address-book-controller/package.json +++ b/packages/address-book-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/address-book-controller", - "version": "4.0.1", + "version": "5.0.0", "description": "Manages a list of recipient addresses associated with nicknames", "keywords": [ "MetaMask", @@ -41,8 +41,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/utils": "^8.3.0" }, "devDependencies": { @@ -56,7 +56,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/announcement-controller/CHANGELOG.md b/packages/announcement-controller/CHANGELOG.md index 8ed50fe48a..7f4779d944 100644 --- a/packages/announcement-controller/CHANGELOG.md +++ b/packages/announcement-controller/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [7.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [6.1.1] + +### Changed + +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) + ## [6.1.0] ### Added @@ -129,7 +142,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@6.1.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@7.0.0...HEAD +[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@6.1.1...@metamask/announcement-controller@7.0.0 +[6.1.1]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@6.1.0...@metamask/announcement-controller@6.1.1 [6.1.0]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@6.0.1...@metamask/announcement-controller@6.1.0 [6.0.1]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@6.0.0...@metamask/announcement-controller@6.0.1 [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/announcement-controller@5.0.2...@metamask/announcement-controller@6.0.0 diff --git a/packages/announcement-controller/package.json b/packages/announcement-controller/package.json index f19f2ae7f5..8f5aee8e45 100644 --- a/packages/announcement-controller/package.json +++ b/packages/announcement-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/announcement-controller", - "version": "6.1.0", + "version": "7.0.0", "description": "Manages in-app announcements", "keywords": [ "MetaMask", @@ -41,7 +41,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2" + "@metamask/base-controller": "^6.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", @@ -54,7 +54,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/approval-controller/CHANGELOG.md b/packages/approval-controller/CHANGELOG.md index 8c8c356be1..ef5cf06d1c 100644 --- a/packages/approval-controller/CHANGELOG.md +++ b/packages/approval-controller/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [7.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + ## [6.0.2] ### Changed @@ -193,7 +200,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@7.0.0...HEAD +[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.2...@metamask/approval-controller@7.0.0 [6.0.2]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.1...@metamask/approval-controller@6.0.2 [6.0.1]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@6.0.0...@metamask/approval-controller@6.0.1 [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/approval-controller@5.1.3...@metamask/approval-controller@6.0.0 diff --git a/packages/approval-controller/package.json b/packages/approval-controller/package.json index d97a499ca6..f8f6e61aea 100644 --- a/packages/approval-controller/package.json +++ b/packages/approval-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/approval-controller", - "version": "6.0.2", + "version": "7.0.0", "description": "Manages requests that require user approval", "keywords": [ "MetaMask", @@ -41,7 +41,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", + "@metamask/base-controller": "^6.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/utils": "^8.3.0", "nanoid": "^3.1.31" @@ -58,7 +58,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/assets-controllers/CHANGELOG.md b/packages/assets-controllers/CHANGELOG.md index 5a282b3bdf..fad9153b82 100644 --- a/packages/assets-controllers/CHANGELOG.md +++ b/packages/assets-controllers/CHANGELOG.md @@ -7,8 +7,98 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- AssetsContractController now makes use of `selectedNetworkClientId` when responding to changes in NetworkController state to capture the currently selected chain rather than `providerConfig` ([#4315](https://github.com/MetaMask/core/pull/4315)) - - This should be functionally equivalent, but is being noted anyway. +## [32.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/accounts-controller` to `^16.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^7.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/keyring-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/preferences-controller` to `^13.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/polling-controller` to `^8.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [31.0.0] + +### Added + +- **BREAKING:** The `NftDetectionController` now takes a `messenger`, which can be used for communication ([#4312](https://github.com/MetaMask/core/pull/4312)) + - This messenger must allow the following actions `ApprovalController:addRequest`, `NetworkController:getState`, `NetworkController:getNetworkClientById`, and `PreferencesController:getState`, and must allow the events `PreferencesController:stateChange` and `NetworkController:stateChange` +- Add `NftDetectionControllerMessenger` type ([#4312](https://github.com/MetaMask/core/pull/4312)) +- Add `NftControllerGetStateAction`, `NftControllerActions`, `NftControllerStateChangeEvent`, and `NftControllerEvents` types ([#4310](https://github.com/MetaMask/core/pull/4310)) +- Add `NftController:getState` and `NftController:stateChange` as an available action and event to the `NftController` messenger ([#4310](https://github.com/MetaMask/core/pull/4310)) + +### Changed + +- **BREAKING:** Change `TokensController` to inherit from `BaseController` rather than `BaseControllerV1` ([#4304](https://github.com/MetaMask/core/pull/4304)) + - The constructor now takes a single options object rather than three arguments, and all properties in `config` are now part of options. +- **BREAKING:** Rename `TokensState` type to `TokensControllerState` ([#4304](https://github.com/MetaMask/core/pull/4304)) +- **BREAKING:** Make all `TokensController` methods and properties starting with `_` private ([#4304](https://github.com/MetaMask/core/pull/4304)) +- **BREAKING:** Convert `Token` from `interface` to `type` ([#4304](https://github.com/MetaMask/core/pull/4304)) +- **BREAKING:** Replace `balanceError` property in `Token` with `hasBalanceError`; update `TokenBalancesController` so that it no longer captures the error resulting from getting the balance of an ERC-20 token ([#4304](https://github.com/MetaMask/core/pull/4304)) +- **BREAKING:** Change `NftDetectionController` to inherit from `StaticIntervalPollingController` rather than `StaticIntervalPollingControllerV1` ([#4312](https://github.com/MetaMask/core/pull/4312)) + - The constructor now takes a single options object rather than three arguments, and all properties in `config` are now part of options. +- **BREAKING:** Convert `ApiNft`, `ApiNftContract`, `ApiNftLastSale`, and `ApiNftCreator` from `interface` to `type` ([#4312](https://github.com/MetaMask/core/pull/4312)) +- **BREAKING:** Change `NftController` to inherit from `BaseController` rather than `BaseControllerV1` ([#4310](https://github.com/MetaMask/core/pull/4310)) + - The constructor now takes a single options object rather than three arguments, and all properties in `config` are now part of options. +- **BREAKING:** Convert `Nft`, `NftContract`, and `NftMetadata` from `interface` to `type` ([#4310](https://github.com/MetaMask/core/pull/4310)) +- **BREAKING:** Rename `NftState` to `NftControllerState`, and convert to `type` ([#4310](https://github.com/MetaMask/core/pull/4310)) +- **BREAKING:** Rename `getDefaultNftState` to `getDefaultNftControllerState` ([#4310](https://github.com/MetaMask/core/pull/4310)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/accounts-controller` to `^15.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^6.0.2` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/keyring-controller` to `^16.1.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/preferences-controller` to `^12.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Change `NftDetectionController` method `detectNfts` so that `userAddress` option is optional ([#4312](https://github.com/MetaMask/core/pull/4312)) + - This will default to the currently selected address as kept by PreferencesController. +- Bump `async-mutex` to `^0.5.0` ([#4335](https://github.com/MetaMask/core/pull/4335)) +- Bump `@metamask/polling-controller` to `^7.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Removed + +- **BREAKING:** Remove `config` property and `configure` method from `TokensController` ([#4304](https://github.com/MetaMask/core/pull/4304)) + - The `TokensController` now takes a single options object which can be used for configuration, and configuration is now kept internally. +- **BREAKING:** Remove `notify`, `subscribe`, and `unsubscribe` methods from `TokensController` ([#4304](https://github.com/MetaMask/core/pull/4304)) + - Use the controller messenger for subscribing to and publishing events instead. +- **BREAKING:** Remove `TokensConfig` type ([#4304](https://github.com/MetaMask/core/pull/4304)) + - These properties have been merged into the options that `TokensController` takes. +- **BREAKING:** Remove `config` property and `configure` method from `TokensController` ([#4312](https://github.com/MetaMask/core/pull/4312)) + - `TokensController` now takes a single options object which can be used for configuration, and configuration is now kept internally. +- **BREAKING:** Remove `notify`, `subscribe`, and `unsubscribe` methods from `NftDetectionController` ([#4312](https://github.com/MetaMask/core/pull/4312)) + - Use the controller messenger for subscribing to and publishing events instead. +- **BREAKING:** Remove `chainId` as a `NftDetectionController` constructor argument ([#4312](https://github.com/MetaMask/core/pull/4312)) + - The controller will now read the `networkClientId` from the NetworkController state through the messenger when needed. +- **BREAKING:** Remove `getNetworkClientById` as a `NftDetectionController` constructor argument ([#4312](https://github.com/MetaMask/core/pull/4312)) + - The controller will now call `NetworkController:getNetworkClientId` through the messenger object. +- **BREAKING:** Remove `onPreferencesStateChange` as a `NftDetectionController` constructor argument ([#4312](https://github.com/MetaMask/core/pull/4312)) + - The controller will now call `PreferencesController:stateChange` through the messenger object. +- **BREAKING:** Remove `onNetworkStateChange` as a `NftDetectionController` constructor argument ([#4312](https://github.com/MetaMask/core/pull/4312)) + - The controller will now read the `networkClientId` from the NetworkController state through the messenger when needed. +- **BREAKING:** Remove `getOpenSeaApiKey` as a `NftDetectionController` constructor argument ([#4312](https://github.com/MetaMask/core/pull/4312)) + - This was never used. +- **BREAKING:** Remove `getNftApi` as a `NftDetectionController` constructor argument ([#4312](https://github.com/MetaMask/core/pull/4312)) + - This was never used. +- **BREAKING:** Remove `NftDetectionConfig` type ([#4312](https://github.com/MetaMask/core/pull/4312)) + - These properties have been merged into the options that `NftDetectionController` takes. +- **BREAKING:** Remove `config` property and `configure` method from `NftController` ([#4310](https://github.com/MetaMask/core/pull/4310)) + - `NftController` now takes a single options object which can be used for configuration, and configuration is now kept internally. +- **BREAKING:** Remove `notify`, `subscribe`, and `unsubscribe` methods from `NftController` ([#4310](https://github.com/MetaMask/core/pull/4310)) + - Use the controller messenger for subscribing to and publishing events instead. +- **BREAKING:** Remove `onPreferencesStateChange` as a `NftController` constructor argument ([#4310](https://github.com/MetaMask/core/pull/4310)) + - The controller will now call `PreferencesController:stateChange` through the messenger object. +- **BREAKING:** Remove `onNetworkStateChange` as a `NftController` constructor argument ([#4310](https://github.com/MetaMask/core/pull/4310)) + - The controller will now call `NetworkController:stateChange` through the messenger object. +- **BREAKING:** Remove `NftConfig` type ([#4310](https://github.com/MetaMask/core/pull/4310)) + - These properties have been merged into the options that `NftController` takes. +- **BREAKING:** Remove `config` property and `configure` method from `NftController` ([#4310](https://github.com/MetaMask/core/pull/4310)) + - `NftController` now takes a single options object which can be used for configuration, and configuration is now kept internally. +- **BREAKING:** Remove `hub` property from `NftController` ([#4310](https://github.com/MetaMask/core/pull/4310)) + - Use the controller messenger for subscribing to and publishing events instead. +- **BREAKING:** Modify `TokenListController` so that tokens fetched from the API and stored in state will no longer have `storage` and `erc20` properties ([#4235](https://github.com/MetaMask/core/pull/4235)) + - These properties were never officially supported, but they were present in state anyway. ## [30.0.0] @@ -799,7 +889,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@30.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@32.0.0...HEAD +[32.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@31.0.0...@metamask/assets-controllers@32.0.0 +[31.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@30.0.0...@metamask/assets-controllers@31.0.0 [30.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@29.0.0...@metamask/assets-controllers@30.0.0 [29.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@28.0.0...@metamask/assets-controllers@29.0.0 [28.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@27.2.0...@metamask/assets-controllers@28.0.0 diff --git a/packages/assets-controllers/package.json b/packages/assets-controllers/package.json index 7f7021740e..bd3b61d8e3 100644 --- a/packages/assets-controllers/package.json +++ b/packages/assets-controllers/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/assets-controllers", - "version": "30.0.0", + "version": "32.0.0", "description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)", "keywords": [ "MetaMask", @@ -47,22 +47,22 @@ "@ethersproject/contracts": "^5.7.0", "@ethersproject/providers": "^5.7.0", "@metamask/abi-utils": "^2.0.2", - "@metamask/accounts-controller": "^14.0.0", - "@metamask/approval-controller": "^6.0.2", - "@metamask/base-controller": "^5.0.2", + "@metamask/accounts-controller": "^16.0.0", + "@metamask/approval-controller": "^7.0.0", + "@metamask/base-controller": "^6.0.0", "@metamask/contract-metadata": "^2.4.0", - "@metamask/controller-utils": "^10.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/eth-query": "^4.0.0", - "@metamask/keyring-controller": "^16.0.0", + "@metamask/keyring-controller": "^17.0.0", "@metamask/metamask-eth-abis": "^3.1.1", - "@metamask/network-controller": "^18.1.2", - "@metamask/polling-controller": "^6.0.2", - "@metamask/preferences-controller": "^11.0.0", + "@metamask/network-controller": "^19.0.0", + "@metamask/polling-controller": "^8.0.0", + "@metamask/preferences-controller": "^13.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/utils": "^8.3.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", - "async-mutex": "^0.2.6", + "async-mutex": "^0.5.0", "bn.js": "^5.2.1", "cockatiel": "^3.1.2", "lodash": "^4.17.21", @@ -88,14 +88,14 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/accounts-controller": "^14.0.0", - "@metamask/approval-controller": "^6.0.0", - "@metamask/keyring-controller": "^16.0.0", - "@metamask/network-controller": "^18.1.2", - "@metamask/preferences-controller": "^11.0.0" + "@metamask/accounts-controller": "^16.0.0", + "@metamask/approval-controller": "^7.0.0", + "@metamask/keyring-controller": "^17.0.0", + "@metamask/network-controller": "^19.0.0", + "@metamask/preferences-controller": "^13.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/assets-controllers/src/TokenListController.test.ts b/packages/assets-controllers/src/TokenListController.test.ts index f52b91a0c7..163a4ab3b1 100644 --- a/packages/assets-controllers/src/TokenListController.test.ts +++ b/packages/assets-controllers/src/TokenListController.test.ts @@ -1343,5 +1343,5 @@ describe('TokenListController', () => { function getTokensPath(chainId: Hex) { return `/tokens/${convertHexToDecimal( chainId, - )}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`; + )}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`; } diff --git a/packages/assets-controllers/src/index.ts b/packages/assets-controllers/src/index.ts index d7387825f6..030ead94cc 100644 --- a/packages/assets-controllers/src/index.ts +++ b/packages/assets-controllers/src/index.ts @@ -13,7 +13,30 @@ export type { NftMetadata, } from './NftController'; export { getDefaultNftControllerState, NftController } from './NftController'; -export * from './NftDetectionController'; +export type { + NftDetectionControllerMessenger, + ApiNft, + ApiNftContract, + ApiNftLastSale, + ApiNftCreator, + ReservoirResponse, + TokensResponse, + BlockaidResultType, + Blockaid, + Market, + TokenResponse, + TopBid, + LastSale, + FeeBreakdown, + Attributes, + Collection, + Royalties, + Ownership, + FloorAsk, + Price, + Metadata, +} from './NftDetectionController'; +export { NftDetectionController } from './NftDetectionController'; export type { TokenBalancesControllerMessenger, TokenBalancesControllerActions, diff --git a/packages/assets-controllers/src/token-service.test.ts b/packages/assets-controllers/src/token-service.test.ts index 21908dd428..26ff3aa8fb 100644 --- a/packages/assets-controllers/src/token-service.test.ts +++ b/packages/assets-controllers/src/token-service.test.ts @@ -243,7 +243,7 @@ describe('Token service', () => { const { signal } = new AbortController(); nock(TOKEN_END_POINT_API) .get( - `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`, + `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`, ) .reply(200, sampleTokenList) .persist(); @@ -260,7 +260,7 @@ describe('Token service', () => { nock(TOKEN_END_POINT_API) .get( - `/tokens/${lineaChainId}?occurrenceFloor=1&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`, + `/tokens/${lineaChainId}?occurrenceFloor=1&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`, ) .reply(200, sampleTokenListLinea) .persist(); @@ -274,7 +274,7 @@ describe('Token service', () => { const abortController = new AbortController(); nock(TOKEN_END_POINT_API) .get( - `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`, + `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`, ) // well beyond time it will take to abort .delay(ONE_SECOND_IN_MILLISECONDS) @@ -294,7 +294,7 @@ describe('Token service', () => { const { signal } = new AbortController(); nock(TOKEN_END_POINT_API) .get( - `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`, + `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`, ) .replyWithError('Example network error') .persist(); @@ -308,7 +308,7 @@ describe('Token service', () => { const { signal } = new AbortController(); nock(TOKEN_END_POINT_API) .get( - `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`, + `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`, ) .reply(500) .persist(); @@ -322,7 +322,7 @@ describe('Token service', () => { const { signal } = new AbortController(); nock(TOKEN_END_POINT_API) .get( - `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`, + `/tokens/${sampleDecimalChainId}?occurrenceFloor=3&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`, ) // well beyond timeout .delay(ONE_SECOND_IN_MILLISECONDS) diff --git a/packages/assets-controllers/src/token-service.ts b/packages/assets-controllers/src/token-service.ts index becedb8200..dd3bc1f915 100644 --- a/packages/assets-controllers/src/token-service.ts +++ b/packages/assets-controllers/src/token-service.ts @@ -21,7 +21,7 @@ function getTokensURL(chainId: Hex) { const occurrenceFloor = chainId === ChainId['linea-mainnet'] ? 1 : 3; return `${TOKEN_END_POINT_API}/tokens/${convertHexToDecimal( chainId, - )}?occurrenceFloor=${occurrenceFloor}&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false`; + )}?occurrenceFloor=${occurrenceFloor}&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`; } /** diff --git a/packages/base-controller/CHANGELOG.md b/packages/base-controller/CHANGELOG.md index 47b9600fea..801dc144f6 100644 --- a/packages/base-controller/CHANGELOG.md +++ b/packages/base-controller/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [6.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) + ## [5.0.2] ### Changed @@ -207,7 +213,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/base-controller@5.0.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/base-controller@6.0.0...HEAD +[6.0.0]: https://github.com/MetaMask/core/compare/@metamask/base-controller@5.0.2...@metamask/base-controller@6.0.0 [5.0.2]: https://github.com/MetaMask/core/compare/@metamask/base-controller@5.0.1...@metamask/base-controller@5.0.2 [5.0.1]: https://github.com/MetaMask/core/compare/@metamask/base-controller@5.0.0...@metamask/base-controller@5.0.1 [5.0.0]: https://github.com/MetaMask/core/compare/@metamask/base-controller@4.1.1...@metamask/base-controller@5.0.0 diff --git a/packages/base-controller/package.json b/packages/base-controller/package.json index 22d1647183..8cb9641134 100644 --- a/packages/base-controller/package.json +++ b/packages/base-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/base-controller", - "version": "5.0.2", + "version": "6.0.0", "description": "Provides scaffolding for controllers as well a communication system for all controllers", "keywords": [ "MetaMask", @@ -56,7 +56,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/build-utils/CHANGELOG.md b/packages/build-utils/CHANGELOG.md index 5f51c311ba..2979089780 100644 --- a/packages/build-utils/CHANGELOG.md +++ b/packages/build-utils/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + ## [2.0.1] ### Fixed @@ -38,7 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release ([#3577](https://github.com/MetaMask/core/pull/3577) [#3588](https://github.com/MetaMask/core/pull/3588)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/build-utils@2.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/build-utils@3.0.0...HEAD +[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/build-utils@2.0.1...@metamask/build-utils@3.0.0 [2.0.1]: https://github.com/MetaMask/core/compare/@metamask/build-utils@2.0.0...@metamask/build-utils@2.0.1 [2.0.0]: https://github.com/MetaMask/core/compare/@metamask/build-utils@1.0.2...@metamask/build-utils@2.0.0 [1.0.2]: https://github.com/MetaMask/core/compare/@metamask/build-utils@1.0.1...@metamask/build-utils@1.0.2 diff --git a/packages/build-utils/package.json b/packages/build-utils/package.json index 4c5e55f27d..29b7eec38e 100644 --- a/packages/build-utils/package.json +++ b/packages/build-utils/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/build-utils", - "version": "2.0.1", + "version": "3.0.0", "description": "Utilities for building MetaMask applications", "keywords": [ "MetaMask", @@ -56,7 +56,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/chain-controller/package.json b/packages/chain-controller/package.json index 115469530e..6b2d71ca31 100644 --- a/packages/chain-controller/package.json +++ b/packages/chain-controller/package.json @@ -41,7 +41,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", + "@metamask/base-controller": "^6.0.0", "@metamask/chain-api": "^0.0.1", "@metamask/keyring-api": "^6.1.1", "@metamask/snaps-controllers": "^8.1.1", @@ -62,7 +62,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/composable-controller/CHANGELOG.md b/packages/composable-controller/CHANGELOG.md index ee846caee9..a074b1488b 100644 --- a/packages/composable-controller/CHANGELOG.md +++ b/packages/composable-controller/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [7.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [6.0.2] + ### Added - Adds and exports new types: ([#3952](https://github.com/MetaMask/core/pull/3952)) @@ -18,6 +28,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **BREAKING:** The `ComposableController` class is now a generic class that expects one generic argument `ComposableControllerState` ([#3952](https://github.com/MetaMask/core/pull/3952)). - **BREAKING:** For the `ComposableController` class to be typed correctly, any of its child controllers that extend `BaseControllerV1` must have an overridden `name` property that is defined using the `as const` assertion. +- **BREAKING:** The types `ComposableControllerStateChangeEvent`, `ComposableControllerEvents`, `ComposableControllerMessenger` are now generic types that expect one generic argument `ComposableControllerState` ([#3952](https://github.com/MetaMask/core/pull/3952)). +- Bump `@metamask/json-rpc-engine` to `^8.0.2` ([#4234](https://github.com/MetaMask/core/pull/4234)) +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) ## [6.0.1] @@ -134,7 +147,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@6.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@7.0.0...HEAD +[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@6.0.2...@metamask/composable-controller@7.0.0 +[6.0.2]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@6.0.1...@metamask/composable-controller@6.0.2 [6.0.1]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@6.0.0...@metamask/composable-controller@6.0.1 [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@5.0.1...@metamask/composable-controller@6.0.0 [5.0.1]: https://github.com/MetaMask/core/compare/@metamask/composable-controller@5.0.0...@metamask/composable-controller@5.0.1 diff --git a/packages/composable-controller/package.json b/packages/composable-controller/package.json index 6425c98e6e..9865ba373a 100644 --- a/packages/composable-controller/package.json +++ b/packages/composable-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/composable-controller", - "version": "6.0.1", + "version": "7.0.0", "description": "Consolidates the state from multiple controllers into one", "keywords": [ "MetaMask", @@ -41,11 +41,11 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2" + "@metamask/base-controller": "^6.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/json-rpc-engine": "^9.0.0", "@types/jest": "^27.4.1", "deepmerge": "^4.2.2", "immer": "^9.0.6", @@ -57,7 +57,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/controller-utils/CHANGELOG.md b/packages/controller-utils/CHANGELOG.md index 8b33dcfa94..fbbca40d6b 100644 --- a/packages/controller-utils/CHANGELOG.md +++ b/packages/controller-utils/CHANGELOG.md @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [11.0.0] + +### Added + +- Add `NFT_API_VERSION` and `NFT_API_TIMEOUT` constants ([#4312](https://github.com/MetaMask/core/pull/4312)) + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) + +### Removed + +- **BREAKING:** Remove `EthSign` from `ApprovalType` ([#4319](https://github.com/MetaMask/core/pull/4319)) + - This represented an `eth_sign` approval, but support for that RPC method is being removed, so this is no longer needed. + ## [10.0.0] ### Changed @@ -333,7 +348,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/controller-utils@10.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/controller-utils@11.0.0...HEAD +[11.0.0]: https://github.com/MetaMask/core/compare/@metamask/controller-utils@10.0.0...@metamask/controller-utils@11.0.0 [10.0.0]: https://github.com/MetaMask/core/compare/@metamask/controller-utils@9.1.0...@metamask/controller-utils@10.0.0 [9.1.0]: https://github.com/MetaMask/core/compare/@metamask/controller-utils@9.0.2...@metamask/controller-utils@9.1.0 [9.0.2]: https://github.com/MetaMask/core/compare/@metamask/controller-utils@9.0.1...@metamask/controller-utils@9.0.2 diff --git a/packages/controller-utils/package.json b/packages/controller-utils/package.json index f6fa0635b2..893a4bd1f3 100644 --- a/packages/controller-utils/package.json +++ b/packages/controller-utils/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/controller-utils", - "version": "10.0.0", + "version": "11.0.0", "description": "Data and convenience functions shared by multiple packages", "keywords": [ "MetaMask", @@ -63,7 +63,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/controller-utils/src/constants.ts b/packages/controller-utils/src/constants.ts index 1c4ae8d499..7bc07e0700 100644 --- a/packages/controller-utils/src/constants.ts +++ b/packages/controller-utils/src/constants.ts @@ -127,7 +127,6 @@ export enum ApprovalType { ConnectAccounts = 'connect_accounts', EthDecrypt = 'eth_decrypt', EthGetEncryptionPublicKey = 'eth_getEncryptionPublicKey', - EthSign = 'eth_sign', EthSignTypedData = 'eth_signTypedData', PersonalSign = 'personal_sign', ResultError = 'result_error', diff --git a/packages/ens-controller/CHANGELOG.md b/packages/ens-controller/CHANGELOG.md index d7b0e67a3b..89f1a1bfab 100644 --- a/packages/ens-controller/CHANGELOG.md +++ b/packages/ens-controller/CHANGELOG.md @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [12.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [11.0.0] + +### Changed + +- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Fixed + +- Fix `delete` method to protect against prototype-polluting assignments ([#4041](https://github.com/MetaMask/core/pull/4041) + ## [10.0.1] ### Fixed @@ -174,7 +195,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@10.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@12.0.0...HEAD +[12.0.0]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@11.0.0...@metamask/ens-controller@12.0.0 +[11.0.0]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@10.0.1...@metamask/ens-controller@11.0.0 [10.0.1]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@10.0.0...@metamask/ens-controller@10.0.1 [10.0.0]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@9.0.0...@metamask/ens-controller@10.0.0 [9.0.0]: https://github.com/MetaMask/core/compare/@metamask/ens-controller@8.0.0...@metamask/ens-controller@9.0.0 diff --git a/packages/ens-controller/package.json b/packages/ens-controller/package.json index f816ba74ad..1bc1316b78 100644 --- a/packages/ens-controller/package.json +++ b/packages/ens-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/ens-controller", - "version": "10.0.1", + "version": "12.0.0", "description": "Maps ENS names to their resolved addresses by chain id", "keywords": [ "MetaMask", @@ -42,14 +42,14 @@ }, "dependencies": { "@ethersproject/providers": "^5.7.0", - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/utils": "^8.3.0", "punycode": "^2.1.1" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", - "@metamask/network-controller": "^18.1.2", + "@metamask/network-controller": "^19.0.0", "@types/jest": "^27.4.1", "deepmerge": "^4.2.2", "jest": "^27.5.1", @@ -59,10 +59,10 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/network-controller": "^18.1.2" + "@metamask/network-controller": "^19.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/eth-json-rpc-provider/CHANGELOG.md b/packages/eth-json-rpc-provider/CHANGELOG.md index 85cd484db9..1e0e3ad584 100644 --- a/packages/eth-json-rpc-provider/CHANGELOG.md +++ b/packages/eth-json-rpc-provider/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + ## [3.0.2] ### Changed @@ -100,7 +107,8 @@ Release `v2.0.0` is identical to `v1.0.1` aside from Node.js version requirement - Initial release, including `providerFromEngine` and `providerFromMiddleware`. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@3.0.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@4.0.0...HEAD +[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@3.0.2...@metamask/eth-json-rpc-provider@4.0.0 [3.0.2]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@3.0.1...@metamask/eth-json-rpc-provider@3.0.2 [3.0.1]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@3.0.0...@metamask/eth-json-rpc-provider@3.0.1 [3.0.0]: https://github.com/MetaMask/core/compare/@metamask/eth-json-rpc-provider@2.3.2...@metamask/eth-json-rpc-provider@3.0.0 diff --git a/packages/eth-json-rpc-provider/package.json b/packages/eth-json-rpc-provider/package.json index 7702dfdd3c..8f70b98191 100644 --- a/packages/eth-json-rpc-provider/package.json +++ b/packages/eth-json-rpc-provider/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/eth-json-rpc-provider", - "version": "3.0.2", + "version": "4.0.0", "description": "Create an Ethereum provider using a JSON-RPC engine or middleware", "keywords": [ "MetaMask", @@ -46,7 +46,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^8.3.0" }, @@ -62,7 +62,7 @@ }, "packageManager": "yarn@3.3.0", "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/gas-fee-controller/CHANGELOG.md b/packages/gas-fee-controller/CHANGELOG.md index dfd93c08b5..19e0ef69e7 100644 --- a/packages/gas-fee-controller/CHANGELOG.md +++ b/packages/gas-fee-controller/CHANGELOG.md @@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [17.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/polling-controller` to `^8.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [16.0.0] + +### Changed + +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/polling-controller` to `^7.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [15.1.2] ### Fixed @@ -275,7 +293,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@15.1.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@17.0.0...HEAD +[17.0.0]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@16.0.0...@metamask/gas-fee-controller@17.0.0 +[16.0.0]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@15.1.2...@metamask/gas-fee-controller@16.0.0 [15.1.2]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@15.1.1...@metamask/gas-fee-controller@15.1.2 [15.1.1]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@15.1.0...@metamask/gas-fee-controller@15.1.1 [15.1.0]: https://github.com/MetaMask/core/compare/@metamask/gas-fee-controller@15.0.0...@metamask/gas-fee-controller@15.1.0 diff --git a/packages/gas-fee-controller/package.json b/packages/gas-fee-controller/package.json index c346c34038..61c1093a9d 100644 --- a/packages/gas-fee-controller/package.json +++ b/packages/gas-fee-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/gas-fee-controller", - "version": "15.1.2", + "version": "17.0.0", "description": "Periodically calculates gas fee estimates based on various gas limits as well as other data displayed on transaction confirm screens", "keywords": [ "MetaMask", @@ -41,12 +41,12 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/eth-query": "^4.0.0", "@metamask/ethjs-unit": "^0.3.0", - "@metamask/network-controller": "^18.1.2", - "@metamask/polling-controller": "^6.0.2", + "@metamask/network-controller": "^19.0.0", + "@metamask/polling-controller": "^8.0.0", "@metamask/utils": "^8.3.0", "@types/bn.js": "^5.1.5", "@types/uuid": "^8.3.0", @@ -67,10 +67,10 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/network-controller": "^18.1.2" + "@metamask/network-controller": "^19.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/json-rpc-engine/CHANGELOG.md b/packages/json-rpc-engine/CHANGELOG.md index 5a60611ac3..f160e2264a 100644 --- a/packages/json-rpc-engine/CHANGELOG.md +++ b/packages/json-rpc-engine/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [9.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) + ## [8.0.2] ### Changed @@ -156,7 +162,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 This change may affect consumers that depend on the eager execution of middleware _during_ request processing, _outside of_ middleware functions and request handlers. - In general, it is a bad practice to work with state that depends on middleware execution, while the middleware are executing. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-engine@8.0.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-engine@9.0.0...HEAD +[9.0.0]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-engine@8.0.2...@metamask/json-rpc-engine@9.0.0 [8.0.2]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-engine@8.0.1...@metamask/json-rpc-engine@8.0.2 [8.0.1]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-engine@8.0.0...@metamask/json-rpc-engine@8.0.1 [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-engine@7.3.3...@metamask/json-rpc-engine@8.0.0 diff --git a/packages/json-rpc-engine/package.json b/packages/json-rpc-engine/package.json index 642a649604..f306669f9a 100644 --- a/packages/json-rpc-engine/package.json +++ b/packages/json-rpc-engine/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/json-rpc-engine", - "version": "8.0.2", + "version": "9.0.0", "description": "A tool for processing JSON-RPC messages", "keywords": [ "MetaMask", @@ -67,7 +67,7 @@ }, "packageManager": "yarn@3.3.0", "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/json-rpc-middleware-stream/CHANGELOG.md b/packages/json-rpc-middleware-stream/CHANGELOG.md index 23f4e566e5..c72854d014 100644 --- a/packages/json-rpc-middleware-stream/CHANGELOG.md +++ b/packages/json-rpc-middleware-stream/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [8.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [7.0.2] + +### Changed + +- Bump `@metamask/json-rpc-engine` to `^8.0.2` ([#4234](https://github.com/MetaMask/core/pull/4234)) + ## [7.0.1] ### Fixed @@ -116,7 +129,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - TypeScript typings ([#11](https://github.com/MetaMask/json-rpc-middleware-stream/pull/11)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@7.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@8.0.0...HEAD +[8.0.0]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@7.0.2...@metamask/json-rpc-middleware-stream@8.0.0 +[7.0.2]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@7.0.1...@metamask/json-rpc-middleware-stream@7.0.2 [7.0.1]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@7.0.0...@metamask/json-rpc-middleware-stream@7.0.1 [7.0.0]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@6.0.2...@metamask/json-rpc-middleware-stream@7.0.0 [6.0.2]: https://github.com/MetaMask/core/compare/@metamask/json-rpc-middleware-stream@6.0.1...@metamask/json-rpc-middleware-stream@6.0.2 diff --git a/packages/json-rpc-middleware-stream/package.json b/packages/json-rpc-middleware-stream/package.json index d93179aed7..88d92353c6 100644 --- a/packages/json-rpc-middleware-stream/package.json +++ b/packages/json-rpc-middleware-stream/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/json-rpc-middleware-stream", - "version": "7.0.1", + "version": "8.0.0", "description": "A small toolset for streaming JSON-RPC data and matching requests and responses", "keywords": [ "MetaMask", @@ -41,7 +41,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^8.3.0", "readable-stream": "^3.6.2" @@ -61,7 +61,7 @@ "webextension-polyfill-ts": "^0.26.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/keyring-controller/CHANGELOG.md b/packages/keyring-controller/CHANGELOG.md index 3ed83289cb..7d7dd3d8fe 100644 --- a/packages/keyring-controller/CHANGELOG.md +++ b/packages/keyring-controller/CHANGELOG.md @@ -7,10 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [17.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/message-manager` to `^10.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [16.1.0] + ### Added -- Added `changePassword` method ([#4279](https://github.com/MetaMask/core/pull/4279)) - - This method can be used to change the password used to encrypt the vault +- Add `changePassword` method ([#4279](https://github.com/MetaMask/core/pull/4279)) + - This method can be used to change the password used to encrypt the vault. +- Add support for non-EVM account addresses to most methods ([#4282](https://github.com/MetaMask/core/pull/4282)) + - Previously, all addresses were assumed to be Ethereum addresses and normalized, but now only Ethereum addresses are treated as such. + - Relax type of `account` argument on `removeAccount` from `Hex` to `string` + +### Changed + +- Bump `@metamask/keyring-api` to `^6.1.1` ([#4262](https://github.com/MetaMask/core/pull/4262)) +- Bump `@keystonehq/metamask-airgapped-keyring` to `^0.14.1` ([#4277](https://github.com/MetaMask/core/pull/4277)) +- Bump `async-mutex` to `^0.5.0` ([#4335](https://github.com/MetaMask/core/pull/4335)) +- Bump `@metamask/message-manager` to `^9.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Fixed + +- Fix QR keyrings so that they are not initialized with invalid state ([#4256](https://github.com/MetaMask/core/pull/4256)) ## [16.0.0] @@ -445,7 +469,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@16.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@17.0.0...HEAD +[17.0.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@16.1.0...@metamask/keyring-controller@17.0.0 +[16.1.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@16.0.0...@metamask/keyring-controller@16.1.0 [16.0.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@15.0.0...@metamask/keyring-controller@16.0.0 [15.0.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@14.0.1...@metamask/keyring-controller@15.0.0 [14.0.1]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@14.0.0...@metamask/keyring-controller@14.0.1 diff --git a/packages/keyring-controller/package.json b/packages/keyring-controller/package.json index cec140eef9..102d1e9e91 100644 --- a/packages/keyring-controller/package.json +++ b/packages/keyring-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/keyring-controller", - "version": "16.0.0", + "version": "17.0.0", "description": "Stores identities seen in the wallet and manages interactions such as signing", "keywords": [ "MetaMask", @@ -43,15 +43,15 @@ "dependencies": { "@ethereumjs/util": "^8.1.0", "@keystonehq/metamask-airgapped-keyring": "^0.14.1", - "@metamask/base-controller": "^5.0.2", + "@metamask/base-controller": "^6.0.0", "@metamask/browser-passworder": "^4.3.0", "@metamask/eth-hd-keyring": "^7.0.1", "@metamask/eth-sig-util": "^7.0.1", "@metamask/eth-simple-keyring": "^6.0.1", "@metamask/keyring-api": "^6.1.1", - "@metamask/message-manager": "^8.0.2", + "@metamask/message-manager": "^10.0.0", "@metamask/utils": "^8.3.0", - "async-mutex": "^0.2.6", + "async-mutex": "^0.5.0", "ethereumjs-wallet": "^1.0.1", "immer": "^9.0.6" }, @@ -74,7 +74,7 @@ "uuid": "^8.3.2" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/logging-controller/CHANGELOG.md b/packages/logging-controller/CHANGELOG.md index be46c8c475..006f42b4e0 100644 --- a/packages/logging-controller/CHANGELOG.md +++ b/packages/logging-controller/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [4.0.0] + +### Changed + +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Removed + +- **BREAKING:** Remove `EthSign` from `SigningMethod` ([#4319](https://github.com/MetaMask/core/pull/4319)) + ## [3.0.1] ### Fixed @@ -87,7 +106,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial Release - Add logging controller ([#1089](https://github.com/MetaMask/core.git/pull/1089)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@3.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@5.0.0...HEAD +[5.0.0]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@4.0.0...@metamask/logging-controller@5.0.0 +[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@3.0.1...@metamask/logging-controller@4.0.0 [3.0.1]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@3.0.0...@metamask/logging-controller@3.0.1 [3.0.0]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@2.0.3...@metamask/logging-controller@3.0.0 [2.0.3]: https://github.com/MetaMask/core/compare/@metamask/logging-controller@2.0.2...@metamask/logging-controller@2.0.3 diff --git a/packages/logging-controller/package.json b/packages/logging-controller/package.json index b5248c2e34..5abe098c4f 100644 --- a/packages/logging-controller/package.json +++ b/packages/logging-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/logging-controller", - "version": "3.0.1", + "version": "5.0.0", "description": "Manages logging data to assist users and support staff", "keywords": [ "MetaMask", @@ -41,8 +41,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "uuid": "^8.3.2" }, "devDependencies": { @@ -56,7 +56,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/logging-controller/src/LoggingController.test.ts b/packages/logging-controller/src/LoggingController.test.ts index 54405b87b2..2799234e66 100644 --- a/packages/logging-controller/src/LoggingController.test.ts +++ b/packages/logging-controller/src/LoggingController.test.ts @@ -83,9 +83,9 @@ describe('LoggingController', () => { await unrestricted.call('LoggingController:add', { type: LogType.EthSignLog, data: { - signingMethod: SigningMethod.EthSign, + signingMethod: SigningMethod.PersonalSign, stage: SigningStage.Proposed, - signingData: '0x0000000000000', + signingData: 'hello', }, }), ).toBeUndefined(); @@ -97,9 +97,9 @@ describe('LoggingController', () => { log: expect.objectContaining({ type: LogType.EthSignLog, data: { - signingMethod: SigningMethod.EthSign, + signingMethod: SigningMethod.PersonalSign, stage: SigningStage.Proposed, - signingData: '0x0000000000000', + signingData: 'hello', }, }), }); @@ -167,9 +167,9 @@ describe('LoggingController', () => { await unrestricted.call('LoggingController:add', { type: LogType.EthSignLog, data: { - signingMethod: SigningMethod.EthSign, + signingMethod: SigningMethod.PersonalSign, stage: SigningStage.Proposed, - signingData: '0x0000000000000', + signingData: 'Heya', }, }), ).toBeUndefined(); diff --git a/packages/logging-controller/src/logTypes/EthSignLog.ts b/packages/logging-controller/src/logTypes/EthSignLog.ts index 9f4be36b51..4c90e49ce4 100644 --- a/packages/logging-controller/src/logTypes/EthSignLog.ts +++ b/packages/logging-controller/src/logTypes/EthSignLog.ts @@ -4,7 +4,6 @@ import type { LogType } from './LogType'; * An enum of the signing method types that we are interested in logging. */ export enum SigningMethod { - EthSign = 'eth_sign', PersonalSign = 'personal_sign', EthSignTypedData = 'eth_signTypedData', EthSignTypedDataV3 = 'eth_signTypedData_v3', diff --git a/packages/message-manager/CHANGELOG.md b/packages/message-manager/CHANGELOG.md index 5c1c1afacd..1cb9b3b848 100644 --- a/packages/message-manager/CHANGELOG.md +++ b/packages/message-manager/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [10.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [9.0.0] + +### Changed + +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Removed + +- **BREAKING:** Remove `Message`, `MessageParams`, `MessageParamsMetamask`, and `MessageManager` ([#4319](https://github.com/MetaMask/core/pull/4319)) + - Support for `eth_sign` is being removed, so these are no longer needed. + ## [8.0.2] ### Changed @@ -236,7 +255,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/message-manager@8.0.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/message-manager@10.0.0...HEAD +[10.0.0]: https://github.com/MetaMask/core/compare/@metamask/message-manager@9.0.0...@metamask/message-manager@10.0.0 +[9.0.0]: https://github.com/MetaMask/core/compare/@metamask/message-manager@8.0.2...@metamask/message-manager@9.0.0 [8.0.2]: https://github.com/MetaMask/core/compare/@metamask/message-manager@8.0.1...@metamask/message-manager@8.0.2 [8.0.1]: https://github.com/MetaMask/core/compare/@metamask/message-manager@8.0.0...@metamask/message-manager@8.0.1 [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/message-manager@7.3.9...@metamask/message-manager@8.0.0 diff --git a/packages/message-manager/package.json b/packages/message-manager/package.json index 1d436c727c..efbffd04d7 100644 --- a/packages/message-manager/package.json +++ b/packages/message-manager/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/message-manager", - "version": "8.0.2", + "version": "10.0.0", "description": "Stores and manages interactions with signing requests", "keywords": [ "MetaMask", @@ -41,8 +41,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/eth-sig-util": "^7.0.1", "@metamask/utils": "^8.3.0", "@types/uuid": "^8.3.0", @@ -60,7 +60,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/message-manager/src/AbstractMessageManager.ts b/packages/message-manager/src/AbstractMessageManager.ts index 849d9799f6..ee02662926 100644 --- a/packages/message-manager/src/AbstractMessageManager.ts +++ b/packages/message-manager/src/AbstractMessageManager.ts @@ -44,7 +44,7 @@ export interface AbstractMessage { } /** - * @type MessageParams + * @type AbstractMessageParams * * Represents the parameters to pass to the signing method once the signature request is approved. * @property from - Address from which the message is processed diff --git a/packages/message-manager/src/MessageManager.test.ts b/packages/message-manager/src/MessageManager.test.ts deleted file mode 100644 index abdc9075f8..0000000000 --- a/packages/message-manager/src/MessageManager.test.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { MessageManager } from './MessageManager'; - -describe('MessageManager', () => { - let controller: MessageManager; - - const fromMock = '0xc38bf1ad06ef69f0c04e29dbeb4152b4175f0a8d'; - beforeEach(() => { - controller = new MessageManager(); - }); - - it('should set default state', () => { - expect(controller.state).toStrictEqual({ - unapprovedMessages: {}, - unapprovedMessagesCount: 0, - }); - }); - - it('should set default config', () => { - expect(controller.config).toStrictEqual({}); - }); - - it('should add a valid message', async () => { - const messageId = '1'; - const from = '0x0123'; - const messageData = '0x123'; - const messageTime = Date.now(); - const messageStatus = 'unapproved'; - const messageType = 'eth_sign'; - await controller.addMessage({ - id: messageId, - messageParams: { - data: messageData, - from, - }, - status: messageStatus, - time: messageTime, - type: messageType, - }); - const message = controller.getMessage(messageId); - if (!message) { - throw new Error('"message" is falsy'); - } - expect(message.id).toBe(messageId); - expect(message.messageParams.from).toBe(from); - expect(message.messageParams.data).toBe(messageData); - expect(message.time).toBe(messageTime); - expect(message.status).toBe(messageStatus); - expect(message.type).toBe(messageType); - }); - - it('should add a valid unapproved message', async () => { - const messageStatus = 'unapproved'; - const messageType = 'eth_sign'; - const messageParams = { - data: '0x123', - from: fromMock, - }; - const originalRequest = { - origin: 'origin', - securityAlertResponse: { result_type: 'result_type', reason: 'reason' }, - }; - const messageId = await controller.addUnapprovedMessage( - messageParams, - originalRequest, - ); - expect(messageId).toBeDefined(); - const message = controller.getMessage(messageId); - if (!message) { - throw new Error('"message" is falsy'); - } - expect(message.messageParams.from).toBe(messageParams.from); - expect(message.messageParams.data).toBe(messageParams.data); - expect(message.time).toBeDefined(); - expect(message.status).toBe(messageStatus); - expect(message.type).toBe(messageType); - expect(message.securityAlertResponse?.result_type).toBe('result_type'); - expect(message.securityAlertResponse?.reason).toBe('reason'); - }); - - it('should throw when adding invalid message', async () => { - const from = 'foo'; - const messageData = '0x123'; - await expect( - controller.addUnapprovedMessage({ - data: messageData, - from, - }), - ).rejects.toThrow( - `Invalid "from" address: ${from} must be a valid string.`, - ); - }); - - it('should get correct unapproved messages', async () => { - const firstMessage = { - id: '1', - messageParams: { from: '0x1', data: '0x123' }, - status: 'unapproved', - time: 123, - type: 'eth_sign', - }; - const secondMessage = { - id: '2', - messageParams: { from: '0x1', data: '0x321' }, - status: 'unapproved', - time: 123, - type: 'eth_sign', - }; - await controller.addMessage(firstMessage); - await controller.addMessage(secondMessage); - expect(controller.getUnapprovedMessagesCount()).toBe(2); - expect(controller.getUnapprovedMessages()).toStrictEqual({ - [firstMessage.id]: firstMessage, - [secondMessage.id]: secondMessage, - }); - }); - - it('should approve message', async () => { - const firstMessage = { from: fromMock, data: '0x123' }; - const messageId = await controller.addUnapprovedMessage(firstMessage); - const messageParams = await controller.approveMessage({ - ...firstMessage, - metamaskId: messageId, - }); - const message = controller.getMessage(messageId); - expect(messageParams).toStrictEqual(firstMessage); - if (!message) { - throw new Error('"message" is falsy'); - } - expect(message.status).toBe('approved'); - }); - - it('should set message status signed', async () => { - const firstMessage = { from: fromMock, data: '0x123' }; - const rawSig = '0x5f7a0'; - const messageId = await controller.addUnapprovedMessage(firstMessage); - - controller.setMessageStatusSigned(messageId, rawSig); - const message = controller.getMessage(messageId); - if (!message) { - throw new Error('"message" is falsy'); - } - expect(message.rawSig).toStrictEqual(rawSig); - expect(message.status).toBe('signed'); - }); - - it('should reject message', async () => { - const firstMessage = { from: fromMock, data: '0x123' }; - const messageId = await controller.addUnapprovedMessage(firstMessage); - controller.rejectMessage(messageId); - const message = controller.getMessage(messageId); - if (!message) { - throw new Error('"message" is falsy'); - } - expect(message.status).toBe('rejected'); - }); -}); diff --git a/packages/message-manager/src/MessageManager.ts b/packages/message-manager/src/MessageManager.ts deleted file mode 100644 index 8a561cbfe6..0000000000 --- a/packages/message-manager/src/MessageManager.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { v1 as random } from 'uuid'; - -import type { - AbstractMessage, - AbstractMessageParams, - AbstractMessageParamsMetamask, - OriginalRequest, -} from './AbstractMessageManager'; -import { AbstractMessageManager } from './AbstractMessageManager'; -import { normalizeMessageData, validateSignMessageData } from './utils'; - -/** - * @type Message - * - * Represents and contains data about a 'eth_sign' type signature request. - * These are created when a signature for an eth_sign call is requested. - * @property id - An id to track and identify the message object - * @property messageParams - The parameters to pass to the eth_sign method once the signature request is approved - * @property type - The json-prc signing method for which a signature request has been made. - * A 'Message' which always has a 'eth_sign' type - * @property rawSig - Raw data of the signature request - */ -// This interface was created before this ESLint rule was added. -// Convert to a `type` in a future major version. -// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -export interface Message extends AbstractMessage { - messageParams: MessageParams; -} - -/** - * @type PersonalMessageParams - * - * Represents the parameters to pass to the eth_sign method once the signature request is approved. - * @property data - A hex string conversion of the raw buffer data of the signature request - * @property from - Address to sign this message from - * @property origin? - Added for request origin identification - */ -// This interface was created before this ESLint rule was added. -// Convert to a `type` in a future major version. -// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -export interface MessageParams extends AbstractMessageParams { - data: string; -} - -/** - * @type MessageParamsMetamask - * - * Represents the parameters to pass to the eth_sign method once the signature request is approved - * plus data added by MetaMask. - * @property metamaskId - Added for tracking and identification within MetaMask - * @property data - A hex string conversion of the raw buffer data of the signature request - * @property from - Address to sign this message from - * @property origin? - Added for request origin identification - */ -// This interface was created before this ESLint rule was added. -// Convert to a `type` in a future major version. -// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -export interface MessageParamsMetamask extends AbstractMessageParamsMetamask { - data: string; -} - -/** - * Controller in charge of managing - storing, adding, removing, updating - Messages. - */ -export class MessageManager extends AbstractMessageManager< - Message, - MessageParams, - MessageParamsMetamask -> { - /** - * Name of this controller used during composition - */ - override name = 'MessageManager' as const; - - /** - * Creates a new Message with an 'unapproved' status using the passed messageParams. - * this.addMessage is called to add the new Message to this.messages, and to save the - * unapproved Messages. - * - * @param messageParams - The params for the eth_sign call to be made after the message - * is approved. - * @param req - The original request object possibly containing the origin. - * @returns The id of the newly created message. - */ - async addUnapprovedMessage( - messageParams: MessageParams, - req?: OriginalRequest, - ): Promise { - validateSignMessageData(messageParams); - if (req) { - messageParams.origin = req.origin; - } - messageParams.data = normalizeMessageData(messageParams.data); - const messageId = random(); - const messageData: Message = { - id: messageId, - messageParams, - securityAlertResponse: req?.securityAlertResponse, - status: 'unapproved', - time: Date.now(), - type: 'eth_sign', - }; - await this.addMessage(messageData); - this.hub.emit(`unapprovedMessage`, { - ...messageParams, - ...{ metamaskId: messageId }, - }); - return messageId; - } - - /** - * Removes the metamaskId property from passed messageParams and returns a promise which - * resolves the updated messageParams. - * - * @param messageParams - The messageParams to modify. - * @returns Promise resolving to the messageParams with the metamaskId property removed. - */ - prepMessageForSigning( - messageParams: MessageParamsMetamask, - ): Promise { - // Using delete operation will throw an error on frozen messageParams - const { metamaskId: _metamaskId, ...messageParamsWithoutId } = - messageParams; - return Promise.resolve(messageParamsWithoutId); - } -} - -export default MessageManager; diff --git a/packages/message-manager/src/index.ts b/packages/message-manager/src/index.ts index 71e07950c7..3467359316 100644 --- a/packages/message-manager/src/index.ts +++ b/packages/message-manager/src/index.ts @@ -1,5 +1,4 @@ export * from './AbstractMessageManager'; -export * from './MessageManager'; export * from './PersonalMessageManager'; export * from './TypedMessageManager'; export * from './EncryptionPublicKeyManager'; diff --git a/packages/message-manager/src/utils.ts b/packages/message-manager/src/utils.ts index 39b1b4bcf2..0900c3a087 100644 --- a/packages/message-manager/src/utils.ts +++ b/packages/message-manager/src/utils.ts @@ -9,7 +9,6 @@ import { validate } from 'jsonschema'; import type { DecryptMessageParams } from './DecryptMessageManager'; import type { EncryptionPublicKeyParams } from './EncryptionPublicKeyManager'; -import type { MessageParams } from './MessageManager'; import type { PersonalMessageParams } from './PersonalMessageManager'; import type { TypedMessageParams } from './TypedMessageManager'; @@ -48,14 +47,12 @@ export function normalizeMessageData(data: string) { } /** - * Validates a PersonalMessageParams and MessageParams objects for required properties and throws in + * Validates a PersonalMessageParams objects for required properties and throws in * the event of any validation error. * * @param messageData - PersonalMessageParams object to validate. */ -export function validateSignMessageData( - messageData: PersonalMessageParams | MessageParams, -) { +export function validateSignMessageData(messageData: PersonalMessageParams) { const { from, data } = messageData; validateAddress(from, 'from'); diff --git a/packages/name-controller/CHANGELOG.md b/packages/name-controller/CHANGELOG.md index ee62ff7c76..1d76978d49 100644 --- a/packages/name-controller/CHANGELOG.md +++ b/packages/name-controller/CHANGELOG.md @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [8.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [7.0.0] + +### Changed + +- **BREAKING:** Changed token API endpoint from `*.metafi.codefi.network` to `*.api.cx.metamask.io` ([#4301](https://github.com/MetaMask/core/pull/4301)) +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) +- Bump `async-mutex` to `^0.5.0` ([#4335](https://github.com/MetaMask/core/pull/4335)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Fixed + +- Fix `setName` and `updateProposedNames` methods to protect against prototype-polluting assignments ([#4041](https://github.com/MetaMask/core/pull/4041) + ## [6.0.1] ### Fixed @@ -100,7 +121,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial Release ([#1647](https://github.com/MetaMask/core/pull/1647)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/name-controller@6.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/name-controller@8.0.0...HEAD +[8.0.0]: https://github.com/MetaMask/core/compare/@metamask/name-controller@7.0.0...@metamask/name-controller@8.0.0 +[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/name-controller@6.0.1...@metamask/name-controller@7.0.0 [6.0.1]: https://github.com/MetaMask/core/compare/@metamask/name-controller@6.0.0...@metamask/name-controller@6.0.1 [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/name-controller@5.0.0...@metamask/name-controller@6.0.0 [5.0.0]: https://github.com/MetaMask/core/compare/@metamask/name-controller@4.2.0...@metamask/name-controller@5.0.0 diff --git a/packages/name-controller/package.json b/packages/name-controller/package.json index d8e797a158..01fe50988e 100644 --- a/packages/name-controller/package.json +++ b/packages/name-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/name-controller", - "version": "6.0.1", + "version": "8.0.0", "description": "Stores and suggests names for values such as Ethereum addresses", "keywords": [ "MetaMask", @@ -42,10 +42,10 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/utils": "^8.3.0", - "async-mutex": "^0.2.6" + "async-mutex": "^0.5.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", @@ -58,7 +58,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/network-controller/CHANGELOG.md b/packages/network-controller/CHANGELOG.md index 1da5a057ef..8e76f49010 100644 --- a/packages/network-controller/CHANGELOG.md +++ b/packages/network-controller/CHANGELOG.md @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [19.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/eth-json-rpc-provider` to `^4.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [18.1.3] + +### Changed + +- Bump `async-mutex` to `^0.5.0` ([#4335](https://github.com/MetaMask/core/pull/4335)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [18.1.2] ### Fixed @@ -488,7 +505,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/network-controller@18.1.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/network-controller@19.0.0...HEAD +[19.0.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@18.1.3...@metamask/network-controller@19.0.0 +[18.1.3]: https://github.com/MetaMask/core/compare/@metamask/network-controller@18.1.2...@metamask/network-controller@18.1.3 [18.1.2]: https://github.com/MetaMask/core/compare/@metamask/network-controller@18.1.1...@metamask/network-controller@18.1.2 [18.1.1]: https://github.com/MetaMask/core/compare/@metamask/network-controller@18.1.0...@metamask/network-controller@18.1.1 [18.1.0]: https://github.com/MetaMask/core/compare/@metamask/network-controller@18.0.1...@metamask/network-controller@18.1.0 diff --git a/packages/network-controller/package.json b/packages/network-controller/package.json index 2c85ed9910..b720f8f4b6 100644 --- a/packages/network-controller/package.json +++ b/packages/network-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/network-controller", - "version": "18.1.2", + "version": "19.0.0", "description": "Provides an interface to the currently selected network via a MetaMask-compatible provider object", "keywords": [ "MetaMask", @@ -41,18 +41,18 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/eth-block-tracker": "^9.0.2", "@metamask/eth-json-rpc-infura": "^9.1.0", "@metamask/eth-json-rpc-middleware": "^12.1.1", - "@metamask/eth-json-rpc-provider": "^3.0.2", + "@metamask/eth-json-rpc-provider": "^4.0.0", "@metamask/eth-query": "^4.0.0", - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/swappable-obj-proxy": "^2.2.0", "@metamask/utils": "^8.3.0", - "async-mutex": "^0.2.6", + "async-mutex": "^0.5.0", "immer": "^9.0.6", "uuid": "^8.3.2" }, @@ -74,7 +74,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/network-controller/tests/provider-api-tests/shared-tests.ts b/packages/network-controller/tests/provider-api-tests/shared-tests.ts index 10e8d34ad6..473a0ff243 100644 --- a/packages/network-controller/tests/provider-api-tests/shared-tests.ts +++ b/packages/network-controller/tests/provider-api-tests/shared-tests.ts @@ -70,8 +70,6 @@ export function testsForProviderType(providerType: ProviderType) { { name: 'eth_sendRawTransaction', numberOfParameters: 1 }, { name: 'eth_sendTransaction', numberOfParameters: 1 }, - { name: 'eth_sign', numberOfParameters: 2 }, - { name: 'eth_createAccessList', numberOfParameters: 2 }, { name: 'eth_getLogs', numberOfParameters: 1 }, { name: 'eth_getProof', numberOfParameters: 3 }, diff --git a/packages/notification-controller/CHANGELOG.md b/packages/notification-controller/CHANGELOG.md index 84a2760316..182d9021cc 100644 --- a/packages/notification-controller/CHANGELOG.md +++ b/packages/notification-controller/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [6.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [5.0.2] + +### Changed + +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) + ## [5.0.1] ### Fixed @@ -110,7 +123,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@6.0.0...HEAD +[6.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.2...@metamask/notification-controller@6.0.0 +[5.0.2]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.1...@metamask/notification-controller@5.0.2 [5.0.1]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@5.0.0...@metamask/notification-controller@5.0.1 [5.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@4.0.2...@metamask/notification-controller@5.0.0 [4.0.2]: https://github.com/MetaMask/core/compare/@metamask/notification-controller@4.0.1...@metamask/notification-controller@4.0.2 diff --git a/packages/notification-controller/package.json b/packages/notification-controller/package.json index 0d8365856e..a95c51a01b 100644 --- a/packages/notification-controller/package.json +++ b/packages/notification-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/notification-controller", - "version": "5.0.1", + "version": "6.0.0", "description": "Manages display of notifications within MetaMask", "keywords": [ "MetaMask", @@ -41,7 +41,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", + "@metamask/base-controller": "^6.0.0", "@metamask/utils": "^8.3.0", "nanoid": "^3.1.31" }, @@ -56,7 +56,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/permission-controller/CHANGELOG.md b/packages/permission-controller/CHANGELOG.md index 146a959f9b..c768e0c80d 100644 --- a/packages/permission-controller/CHANGELOG.md +++ b/packages/permission-controller/CHANGELOG.md @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [10.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump peer dependency `@metamask/approval-controller` to `^7.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [9.1.1] + +### Changed + +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [9.1.0] ### Added @@ -226,7 +242,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@9.1.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@10.0.0...HEAD +[10.0.0]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@9.1.1...@metamask/permission-controller@10.0.0 +[9.1.1]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@9.1.0...@metamask/permission-controller@9.1.1 [9.1.0]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@9.0.2...@metamask/permission-controller@9.1.0 [9.0.2]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@9.0.1...@metamask/permission-controller@9.0.2 [9.0.1]: https://github.com/MetaMask/core/compare/@metamask/permission-controller@9.0.0...@metamask/permission-controller@9.0.1 diff --git a/packages/permission-controller/package.json b/packages/permission-controller/package.json index 4c5f91240d..eaff8633b6 100644 --- a/packages/permission-controller/package.json +++ b/packages/permission-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/permission-controller", - "version": "9.1.0", + "version": "10.0.0", "description": "Mediates access to JSON-RPC methods, used to interact with pieces of the MetaMask stack, via middleware for json-rpc-engine", "keywords": [ "MetaMask", @@ -41,9 +41,9 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/utils": "^8.3.0", "@types/deep-freeze-strict": "^1.1.0", @@ -52,7 +52,7 @@ "nanoid": "^3.1.31" }, "devDependencies": { - "@metamask/approval-controller": "^6.0.2", + "@metamask/approval-controller": "^7.0.0", "@metamask/auto-changelog": "^3.4.4", "@types/jest": "^27.4.1", "deepmerge": "^4.2.2", @@ -63,10 +63,10 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/approval-controller": "^6.0.0" + "@metamask/approval-controller": "^7.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/permission-log-controller/CHANGELOG.md b/packages/permission-log-controller/CHANGELOG.md index a49564a432..ad1ff6dd12 100644 --- a/packages/permission-log-controller/CHANGELOG.md +++ b/packages/permission-log-controller/CHANGELOG.md @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [2.0.2] + +### Changed + +- Bump `@metamask/base-controller` to `^5.0.2` ([#4234](https://github.com/MetaMask/core/pull/4234)) +- Bump `@metamask/json-rpc-engine` to `^8.0.2` ([#4232](https://github.com/MetaMask/core/pull/4232)) + ## [2.0.1] ### Fixed @@ -32,7 +47,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/permission-log-controller@2.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/permission-log-controller@3.0.0...HEAD +[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/permission-log-controller@2.0.2...@metamask/permission-log-controller@3.0.0 +[2.0.2]: https://github.com/MetaMask/core/compare/@metamask/permission-log-controller@2.0.1...@metamask/permission-log-controller@2.0.2 [2.0.1]: https://github.com/MetaMask/core/compare/@metamask/permission-log-controller@2.0.0...@metamask/permission-log-controller@2.0.1 [2.0.0]: https://github.com/MetaMask/core/compare/@metamask/permission-log-controller@1.0.0...@metamask/permission-log-controller@2.0.0 [1.0.0]: https://github.com/MetaMask/core/releases/tag/@metamask/permission-log-controller@1.0.0 diff --git a/packages/permission-log-controller/package.json b/packages/permission-log-controller/package.json index 76b31562d1..7310111406 100644 --- a/packages/permission-log-controller/package.json +++ b/packages/permission-log-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/permission-log-controller", - "version": "2.0.1", + "version": "3.0.0", "description": "Controller with middleware for logging requests and responses to restricted and permissions-related methods", "keywords": [ "MetaMask", @@ -41,8 +41,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/base-controller": "^6.0.0", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/utils": "^8.3.0" }, "devDependencies": { @@ -59,7 +59,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/phishing-controller/CHANGELOG.md b/packages/phishing-controller/CHANGELOG.md index d3c15c4dad..4c88127577 100644 --- a/packages/phishing-controller/CHANGELOG.md +++ b/packages/phishing-controller/CHANGELOG.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [10.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [9.0.4] + +### Changed + +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [9.0.3] ### Changed @@ -184,7 +198,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@9.0.3...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@10.0.0...HEAD +[10.0.0]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@9.0.4...@metamask/phishing-controller@10.0.0 +[9.0.4]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@9.0.3...@metamask/phishing-controller@9.0.4 [9.0.3]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@9.0.2...@metamask/phishing-controller@9.0.3 [9.0.2]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@9.0.1...@metamask/phishing-controller@9.0.2 [9.0.1]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@9.0.0...@metamask/phishing-controller@9.0.1 diff --git a/packages/phishing-controller/package.json b/packages/phishing-controller/package.json index 3b76b03224..c45dab905e 100644 --- a/packages/phishing-controller/package.json +++ b/packages/phishing-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/phishing-controller", - "version": "9.0.3", + "version": "10.0.0", "description": "Maintains a periodically updated list of approved and unapproved website origins", "keywords": [ "MetaMask", @@ -41,8 +41,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@types/punycode": "^2.1.0", "eth-phishing-detect": "^1.2.0", "punycode": "^2.1.1" @@ -60,7 +60,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/polling-controller/CHANGELOG.md b/packages/polling-controller/CHANGELOG.md index 5361880df4..35d0580fb3 100644 --- a/packages/polling-controller/CHANGELOG.md +++ b/packages/polling-controller/CHANGELOG.md @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [8.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [7.0.0] + +### Changed + +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Fixed + +- `StaticIntervalPollingControllerOnly`, `StaticIntervalPollingController`, and `StaticIntervalPollingControllerV1` now properly stops polling when a stop is requested while `_executePoll` has not yet resolved for the current loop ([#4230](https://github.com/MetaMask/core/pull/4230)) + ## [6.0.2] ### Changed @@ -123,7 +143,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@6.0.2...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@8.0.0...HEAD +[8.0.0]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@7.0.0...@metamask/polling-controller@8.0.0 +[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@6.0.2...@metamask/polling-controller@7.0.0 [6.0.2]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@6.0.1...@metamask/polling-controller@6.0.2 [6.0.1]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@6.0.0...@metamask/polling-controller@6.0.1 [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@5.0.1...@metamask/polling-controller@6.0.0 diff --git a/packages/polling-controller/package.json b/packages/polling-controller/package.json index 8d8ab0916f..7e312b70a0 100644 --- a/packages/polling-controller/package.json +++ b/packages/polling-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/polling-controller", - "version": "6.0.2", + "version": "8.0.0", "description": "Polling Controller is the base for controllers that polling by networkClientId", "keywords": [ "MetaMask", @@ -41,9 +41,9 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", - "@metamask/network-controller": "^18.1.2", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", + "@metamask/network-controller": "^19.0.0", "@metamask/utils": "^8.3.0", "@types/uuid": "^8.3.0", "fast-json-stable-stringify": "^2.1.0", @@ -61,10 +61,10 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/network-controller": "^18.1.2" + "@metamask/network-controller": "^19.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/preferences-controller/CHANGELOG.md b/packages/preferences-controller/CHANGELOG.md index 06b1701ba4..00f62607e9 100644 --- a/packages/preferences-controller/CHANGELOG.md +++ b/packages/preferences-controller/CHANGELOG.md @@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [13.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump peer dependency `@metamask/keyring-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [12.0.0] + +### Added + +- Add `smartTransactionsOptInStatus` preference ([#3815](https://github.com/MetaMask/core/pull/3815)) + - Add `smartTransactionsOptInStatus` property to the `PreferencesController` state (default: `false`) + - Add `setSmartTransactionOptInStatus` method to set this property +- Add `useTransactionSimulations` preference ([#4283](https://github.com/MetaMask/core/pull/4283)) + - Add `useTransactionSimulations` property to the `PreferencesController` state (default value: `false`) + - Add `setUseTransactionSimulations` method to set this property + +### Changed + +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Removed + +- **BREAKING:** Remove state property `disabledRpcMethodPreferences` along with `setDisabledRpcMethodPreferences` method ([#4319](https://github.com/MetaMask/core/pull/4319)) + - These were for disabling the `eth_sign` RPC method, but support for this method is being removed, so this preference is no longer needed. + ## [11.0.0] ### Added @@ -219,7 +248,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@11.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@13.0.0...HEAD +[13.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@12.0.0...@metamask/preferences-controller@13.0.0 +[12.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@11.0.0...@metamask/preferences-controller@12.0.0 [11.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@10.0.0...@metamask/preferences-controller@11.0.0 [10.0.0]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@9.0.1...@metamask/preferences-controller@10.0.0 [9.0.1]: https://github.com/MetaMask/core/compare/@metamask/preferences-controller@9.0.0...@metamask/preferences-controller@9.0.1 diff --git a/packages/preferences-controller/package.json b/packages/preferences-controller/package.json index bc3c3bc87c..d136b52d6d 100644 --- a/packages/preferences-controller/package.json +++ b/packages/preferences-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/preferences-controller", - "version": "11.0.0", + "version": "13.0.0", "description": "Manages user-configurable settings for MetaMask", "keywords": [ "MetaMask", @@ -41,12 +41,12 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0" + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", - "@metamask/keyring-controller": "^16.0.0", + "@metamask/keyring-controller": "^17.0.0", "@types/jest": "^27.4.1", "deepmerge": "^4.2.2", "jest": "^27.5.1", @@ -57,10 +57,10 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/keyring-controller": "^16.0.0" + "@metamask/keyring-controller": "^17.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/preferences-controller/src/PreferencesController.test.ts b/packages/preferences-controller/src/PreferencesController.test.ts index 16e3154319..28cb622a53 100644 --- a/packages/preferences-controller/src/PreferencesController.test.ts +++ b/packages/preferences-controller/src/PreferencesController.test.ts @@ -24,9 +24,6 @@ describe('PreferencesController', () => { useNftDetection: false, openSeaEnabled: false, securityAlertsEnabled: false, - disabledRpcMethodPreferences: { - eth_sign: false, - }, isMultiAccountBalancesEnabled: true, showTestNetworks: false, isIpfsGatewayEnabled: true, @@ -387,12 +384,6 @@ describe('PreferencesController', () => { expect(controller.state.securityAlertsEnabled).toBe(true); }); - it('should set disabledRpcMethodPreferences', () => { - const controller = setupPreferencesController(); - controller.setDisabledRpcMethodPreference('eth_sign', true); - expect(controller.state.disabledRpcMethodPreferences.eth_sign).toBe(true); - }); - it('should set isMultiAccountBalancesEnabled', () => { const controller = setupPreferencesController(); controller.setIsMultiAccountBalancesEnabled(true); diff --git a/packages/preferences-controller/src/PreferencesController.ts b/packages/preferences-controller/src/PreferencesController.ts index 151ebc604d..a59452e47d 100644 --- a/packages/preferences-controller/src/PreferencesController.ts +++ b/packages/preferences-controller/src/PreferencesController.ts @@ -48,12 +48,6 @@ export type EtherscanSupportedHexChainId = * Preferences controller state */ export type PreferencesState = { - /** - * A map of RPC method names to enabled state (true is enabled, false is disabled) - */ - disabledRpcMethodPreferences: { - [methodName: string]: boolean; - }; /** * Map of specific features to enable or disable */ @@ -119,7 +113,6 @@ export type PreferencesState = { }; const metadata = { - disabledRpcMethodPreferences: { persist: true, anonymous: true }, featureFlags: { persist: true, anonymous: true }, identities: { persist: true, anonymous: false }, ipfsGateway: { persist: true, anonymous: false }, @@ -170,9 +163,6 @@ export type PreferencesControllerMessenger = RestrictedControllerMessenger< */ export function getDefaultPreferencesState() { return { - disabledRpcMethodPreferences: { - eth_sign: false, - }, featureFlags: {}, identities: {}, ipfsGateway: 'https://ipfs.io/ipfs/', @@ -440,23 +430,6 @@ export class PreferencesController extends BaseController< }); } - /** - * A setter for the user preferences to enable/disable rpc methods. - * - * @param methodName - The RPC method name to change the setting of. - * @param isEnabled - true to enable the rpc method, false to disable it. - */ - setDisabledRpcMethodPreference(methodName: string, isEnabled: boolean) { - const { disabledRpcMethodPreferences } = this.state; - const newDisabledRpcMethods = { - ...disabledRpcMethodPreferences, - [methodName]: isEnabled, - }; - this.update((state) => { - state.disabledRpcMethodPreferences = newDisabledRpcMethods; - }); - } - /** * A setter for the user preferences to enable/disable fetch of multiple accounts balance. * diff --git a/packages/profile-sync-controller/package.json b/packages/profile-sync-controller/package.json index 20a0289d30..3a2ea77c52 100644 --- a/packages/profile-sync-controller/package.json +++ b/packages/profile-sync-controller/package.json @@ -59,7 +59,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/queued-request-controller/CHANGELOG.md b/packages/queued-request-controller/CHANGELOG.md index e51e951137..d714aae7a9 100644 --- a/packages/queued-request-controller/CHANGELOG.md +++ b/packages/queued-request-controller/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.12.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump peer dependency `@metamask/selected-network-controller` to `^15.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [0.11.0] + +### Changed + +- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/selected-network-controller` to `^14.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [0.10.0] ### Changed @@ -181,7 +200,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.10.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.12.0...HEAD +[0.12.0]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.11.0...@metamask/queued-request-controller@0.12.0 +[0.11.0]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.10.0...@metamask/queued-request-controller@0.11.0 [0.10.0]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.9.0...@metamask/queued-request-controller@0.10.0 [0.9.0]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.8.0...@metamask/queued-request-controller@0.9.0 [0.8.0]: https://github.com/MetaMask/core/compare/@metamask/queued-request-controller@0.7.0...@metamask/queued-request-controller@0.8.0 diff --git a/packages/queued-request-controller/package.json b/packages/queued-request-controller/package.json index 4e689f6b08..5328c9c74f 100644 --- a/packages/queued-request-controller/package.json +++ b/packages/queued-request-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/queued-request-controller", - "version": "0.10.0", + "version": "0.12.0", "description": "Includes a controller and middleware that implements a request queue", "keywords": [ "MetaMask", @@ -41,17 +41,17 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", - "@metamask/json-rpc-engine": "^8.0.2", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", + "@metamask/json-rpc-engine": "^9.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/swappable-obj-proxy": "^2.2.0", "@metamask/utils": "^8.3.0" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", - "@metamask/network-controller": "^18.1.2", - "@metamask/selected-network-controller": "^13.0.0", + "@metamask/network-controller": "^19.0.0", + "@metamask/selected-network-controller": "^15.0.0", "@types/jest": "^27.4.1", "deepmerge": "^4.2.2", "immer": "^9.0.6", @@ -65,11 +65,11 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/network-controller": "^18.1.2", - "@metamask/selected-network-controller": "^13.0.0" + "@metamask/network-controller": "^19.0.0", + "@metamask/selected-network-controller": "^15.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/rate-limit-controller/CHANGELOG.md b/packages/rate-limit-controller/CHANGELOG.md index 20f1954f4a..91da273a4d 100644 --- a/packages/rate-limit-controller/CHANGELOG.md +++ b/packages/rate-limit-controller/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [6.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [5.0.2] + +### Changed + +- Bump `@metamask/base-controller` to `^5.0.2` ([#4232](https://github.comMetaMask/core/pull/4232)) + ## [5.0.1] ### Fixed @@ -124,7 +137,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@5.0.1...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@6.0.0...HEAD +[6.0.0]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@5.0.2...@metamask/rate-limit-controller@6.0.0 +[5.0.2]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@5.0.1...@metamask/rate-limit-controller@5.0.2 [5.0.1]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@5.0.0...@metamask/rate-limit-controller@5.0.1 [5.0.0]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@4.0.2...@metamask/rate-limit-controller@5.0.0 [4.0.2]: https://github.com/MetaMask/core/compare/@metamask/rate-limit-controller@4.0.1...@metamask/rate-limit-controller@4.0.2 diff --git a/packages/rate-limit-controller/package.json b/packages/rate-limit-controller/package.json index f3954e9b4b..3d7e697610 100644 --- a/packages/rate-limit-controller/package.json +++ b/packages/rate-limit-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/rate-limit-controller", - "version": "5.0.1", + "version": "6.0.0", "description": "Contains logic for rate-limiting API endpoints by requesting origin", "keywords": [ "MetaMask", @@ -41,7 +41,7 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", + "@metamask/base-controller": "^6.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/utils": "^8.3.0" }, @@ -56,7 +56,7 @@ "typescript": "~4.9.5" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/selected-network-controller/CHANGELOG.md b/packages/selected-network-controller/CHANGELOG.md index dd7d0a901f..ce8f40861e 100644 --- a/packages/selected-network-controller/CHANGELOG.md +++ b/packages/selected-network-controller/CHANGELOG.md @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [15.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/permission-controller` to `^10.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/json-rpc-engine` to `^9.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [14.0.0] + +### Changed + +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/permission-controller` to `^9.1.1` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [13.0.0] ### Changed @@ -206,7 +223,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial Release ([#1643](https://github.com/MetaMask/core/pull/1643)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@13.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@15.0.0...HEAD +[15.0.0]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@14.0.0...@metamask/selected-network-controller@15.0.0 +[14.0.0]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@13.0.0...@metamask/selected-network-controller@14.0.0 [13.0.0]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@12.0.1...@metamask/selected-network-controller@13.0.0 [12.0.1]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@12.0.0...@metamask/selected-network-controller@12.0.1 [12.0.0]: https://github.com/MetaMask/core/compare/@metamask/selected-network-controller@11.0.0...@metamask/selected-network-controller@12.0.0 diff --git a/packages/selected-network-controller/package.json b/packages/selected-network-controller/package.json index 8b2f273e41..2896c0cbdb 100644 --- a/packages/selected-network-controller/package.json +++ b/packages/selected-network-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/selected-network-controller", - "version": "13.0.0", + "version": "15.0.0", "description": "Provides an interface to the currently selected networkClientId for a given domain", "keywords": [ "MetaMask", @@ -41,10 +41,10 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/base-controller": "^5.0.2", - "@metamask/json-rpc-engine": "^8.0.2", - "@metamask/network-controller": "^18.1.2", - "@metamask/permission-controller": "^9.1.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/json-rpc-engine": "^9.0.0", + "@metamask/network-controller": "^19.0.0", + "@metamask/permission-controller": "^10.0.0", "@metamask/swappable-obj-proxy": "^2.2.0", "@metamask/utils": "^8.3.0" }, @@ -63,11 +63,11 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/network-controller": "^18.1.2", - "@metamask/permission-controller": "^9.0.0" + "@metamask/network-controller": "^19.0.0", + "@metamask/permission-controller": "^10.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/signature-controller/CHANGELOG.md b/packages/signature-controller/CHANGELOG.md index d4f5dafc5b..10f37cd76f 100644 --- a/packages/signature-controller/CHANGELOG.md +++ b/packages/signature-controller/CHANGELOG.md @@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [18.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^7.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/keyring-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/logging-controller` to `^5.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/message-manager` to `^10.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [17.0.0] + +### Changed + +- **BREAKING:** Update `messages` getter to return `Record` instead of `Record` ([#4319](https://github.com/MetaMask/core/pull/4319)) +- **BREAKING** Bump `@metamask/keyring-controller` peer dependency to `^16.1.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING** Bump `@metamask/logging-controller` peer dependency to `^4.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/message-manager` to `^9.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Removed + +- **BREAKING:** Remove state properties `unapprovedMsgs` and `unapprovedMsgCount` ([#4319](https://github.com/MetaMask/core/pull/4319)) + - These properties were related to handling of the `eth_sign` RPC method, but support for that is being removed, so these are no longer needed. +- **BREAKING:** Remove `isEthSignEnabled` option from constructor ([#4319](https://github.com/MetaMask/core/pull/4319)) + - This option governed whether handling of the `eth_sign` RPC method was enabled, but support for that method is being removed, so this is no longer needed. +- **BREAKING:** Remove `newUnsignedMessage` method ([#4319](https://github.com/MetaMask/core/pull/4319)) + - This method was called when a dapp used the `eth_sign` RPC method, but support for that method is being removed, so this is no longer needed. + ## [16.0.0] ### Changed @@ -239,7 +270,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release ([#1214](https://github.com/MetaMask/core/pull/1214)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@16.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@18.0.0...HEAD +[18.0.0]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@17.0.0...@metamask/signature-controller@18.0.0 +[17.0.0]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@16.0.0...@metamask/signature-controller@17.0.0 [16.0.0]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@15.0.0...@metamask/signature-controller@16.0.0 [15.0.0]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@14.0.1...@metamask/signature-controller@15.0.0 [14.0.1]: https://github.com/MetaMask/core/compare/@metamask/signature-controller@14.0.0...@metamask/signature-controller@14.0.1 diff --git a/packages/signature-controller/package.json b/packages/signature-controller/package.json index 8140a6d95f..5abe6874d7 100644 --- a/packages/signature-controller/package.json +++ b/packages/signature-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/signature-controller", - "version": "16.0.0", + "version": "18.0.0", "description": "Processes signing requests in order to sign arbitrary and typed data", "keywords": [ "MetaMask", @@ -41,12 +41,12 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/approval-controller": "^6.0.2", - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", - "@metamask/keyring-controller": "^16.0.0", - "@metamask/logging-controller": "^3.0.1", - "@metamask/message-manager": "^8.0.2", + "@metamask/approval-controller": "^7.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", + "@metamask/keyring-controller": "^17.0.0", + "@metamask/logging-controller": "^5.0.0", + "@metamask/message-manager": "^10.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/utils": "^8.3.0", "lodash": "^4.17.21" @@ -62,12 +62,12 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/approval-controller": "^6.0.0", - "@metamask/keyring-controller": "^16.0.0", - "@metamask/logging-controller": "^3.0.0" + "@metamask/approval-controller": "^7.0.0", + "@metamask/keyring-controller": "^17.0.0", + "@metamask/logging-controller": "^5.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/signature-controller/src/SignatureController.test.ts b/packages/signature-controller/src/SignatureController.test.ts index 0fb258b17e..bb43dcaac1 100644 --- a/packages/signature-controller/src/SignatureController.test.ts +++ b/packages/signature-controller/src/SignatureController.test.ts @@ -9,7 +9,6 @@ import type { OriginalRequest, } from '@metamask/message-manager'; import { - MessageManager, PersonalMessageManager, TypedMessageManager, } from '@metamask/message-manager'; @@ -22,7 +21,6 @@ import type { import { SignatureController } from './SignatureController'; jest.mock('@metamask/message-manager', () => ({ - MessageManager: jest.fn(), PersonalMessageManager: jest.fn(), TypedMessageManager: jest.fn(), })); @@ -132,16 +130,11 @@ const createMessageManagerMock = (prototype?: any): jest.Mocked => { describe('SignatureController', () => { let signatureController: SignatureController; - const messageManagerConstructorMock = MessageManager as jest.MockedClass< - typeof MessageManager - >; const personalMessageManagerConstructorMock = PersonalMessageManager as jest.MockedClass; const typedMessageManagerConstructorMock = TypedMessageManager as jest.MockedClass; - const messageManagerMock = createMessageManagerMock( - MessageManager.prototype, - ); + const personalMessageManagerMock = createMessageManagerMock( PersonalMessageManager.prototype, @@ -184,7 +177,6 @@ describe('SignatureController', () => { addUnapprovedMessageMock.mockResolvedValue(messageIdMock); approveMessageMock.mockResolvedValue(messageParamsWithoutIdMock); - messageManagerConstructorMock.mockReturnValue(messageManagerMock); personalMessageManagerConstructorMock.mockReturnValue( personalMessageManagerMock, ); @@ -205,13 +197,6 @@ describe('SignatureController', () => { } as SignatureControllerOptions); }); - describe('unapprovedMsgCount', () => { - it('returns value from message manager getter', () => { - messageManagerMock.getUnapprovedMessagesCount.mockReturnValueOnce(10); - expect(signatureController.unapprovedMsgCount).toBe(10); - }); - }); - describe('unapprovedPersonalMessagesCount', () => { it('returns value from personal message manager getter', () => { personalMessageManagerMock.getUnapprovedMessagesCount.mockReturnValueOnce( @@ -235,16 +220,12 @@ describe('SignatureController', () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore signatureController.update(() => ({ - // TODO: Replace `any` with type - // eslint-disable-next-line @typescript-eslint/no-explicit-any - unapprovedMsgs: { [messageIdMock]: messageMock } as any, // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any unapprovedPersonalMsgs: { [messageIdMock]: messageMock } as any, // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any unapprovedTypedMessages: { [messageIdMock]: messageMock } as any, - unapprovedMsgCount: 1, unapprovedPersonalMsgCount: 2, unapprovedTypedMessagesCount: 3, })); @@ -252,10 +233,8 @@ describe('SignatureController', () => { signatureController.resetState(); expect(signatureController.state).toStrictEqual({ - unapprovedMsgs: {}, unapprovedPersonalMsgs: {}, unapprovedTypedMessages: {}, - unapprovedMsgCount: 0, unapprovedPersonalMsgCount: 0, unapprovedTypedMessagesCount: 0, }); @@ -269,11 +248,6 @@ describe('SignatureController', () => { [messageIdMock2]: messageMock, }; - messageManagerMock.getUnapprovedMessages.mockReturnValueOnce( - // TODO: Replace `any` with type - // eslint-disable-next-line @typescript-eslint/no-explicit-any - messages as any, - ); personalMessageManagerMock.getUnapprovedMessages.mockReturnValueOnce( // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -303,14 +277,6 @@ describe('SignatureController', () => { it('rejects all messages in all message managers', () => { signatureController.rejectUnapproved('Test Reason'); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledTimes(2); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledWith( - messageIdMock, - ); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledWith( - messageIdMock2, - ); - expect(personalMessageManagerMock.rejectMessage).toHaveBeenCalledTimes(2); expect(personalMessageManagerMock.rejectMessage).toHaveBeenCalledWith( messageIdMock, @@ -334,7 +300,7 @@ describe('SignatureController', () => { signatureController.rejectUnapproved('Test Reason'); - expect(listenerMock).toHaveBeenCalledTimes(6); + expect(listenerMock).toHaveBeenCalledTimes(4); expect(listenerMock).toHaveBeenLastCalledWith({ reason: 'Test Reason', message: messageMock, @@ -351,9 +317,6 @@ describe('SignatureController', () => { unapprovedMessagesCount: 0, }; - expect(messageManagerMock.update).toHaveBeenCalledTimes(1); - expect(messageManagerMock.update).toHaveBeenCalledWith(defaultState); - expect(personalMessageManagerMock.update).toHaveBeenCalledTimes(1); expect(personalMessageManagerMock.update).toHaveBeenCalledWith( defaultState, @@ -364,109 +327,6 @@ describe('SignatureController', () => { }); }); - describe('newUnsignedMessage', () => { - it('throws if eth_sign disabled', async () => { - isEthSignEnabledMock.mockReturnValueOnce(false); - - await expect( - signatureController.newUnsignedMessage(messageParamsMock, requestMock), - ).rejects.toThrow( - 'eth_sign has been disabled. You must enable it in the advanced settings', - ); - }); - - it('throws if data has wrong length', async () => { - await expect( - signatureController.newUnsignedMessage( - { ...messageParamsMock, data: '0xFF' }, - requestMock, - ), - ).rejects.toThrow('eth_sign requires 32 byte message hash'); - }); - - it('throws if data has wrong length and is unicode', async () => { - await expect( - signatureController.newUnsignedMessage( - { ...messageParamsMock, data: '1234' }, - requestMock, - ), - ).rejects.toThrow('eth_sign requires 32 byte message hash'); - }); - - it('adds message to message manager', async () => { - // Satisfy one of fallback branches - const { origin: _origin, ...messageParamsWithoutOrigin } = - messageParamsMock; - - await signatureController.newUnsignedMessage( - messageParamsWithoutOrigin, - requestMock, - ); - - expect(messageManagerMock.addUnapprovedMessage).toHaveBeenCalledTimes(1); - expect(messageManagerMock.addUnapprovedMessage).toHaveBeenCalledWith( - messageParamsWithoutOrigin, - requestMock, - undefined, - ); - - expect(messengerMock.call).toHaveBeenCalledTimes(4); - expect(messengerMock.call).toHaveBeenNthCalledWith( - 2, - 'ApprovalController:addRequest', - { - id: messageIdMock, - origin: ORIGIN_METAMASK, - type: 'eth_sign', - requestData: messageParamsWithoutOrigin, - expectsResult: true, - }, - true, - ); - }); - - it('throws if cannot get signature', async () => { - mockMessengerAction('KeyringController:signMessage', async () => { - throw keyringErrorMock; - }); - const listenerMock = jest.fn(); - signatureController.hub.on(`${messageIdMock}:signError`, listenerMock); - - // TODO: Replace `any` with type - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const error: any = await getError( - async () => - await signatureController.newUnsignedMessage( - messageParamsMock, - requestMock, - ), - ); - - expect(listenerMock).toHaveBeenCalledTimes(1); - expect(listenerMock).toHaveBeenCalledWith({ - error, - }); - expect(messengerMock.call).toHaveBeenCalledTimes(3); - expect(error.message).toBe(keyringErrorMessageMock); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledTimes(1); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledWith( - messageIdMock, - ); - }); - - it('calls success callback once message is signed', async () => { - const { origin: _origin, ...messageParamsWithoutOrigin } = - messageParamsMock; - - await signatureController.newUnsignedMessage( - messageParamsWithoutOrigin, - requestMock, - ); - - expect(resultCallbacksMock.success).toHaveBeenCalledTimes(1); - }); - }); - describe('newUnsignedPersonalMessage', () => { it('adds message to personal message manager', async () => { await signatureController.newUnsignedPersonalMessage( @@ -562,6 +422,10 @@ describe('SignatureController', () => { describe('newUnsignedTypedMessage', () => { it('adds message to typed message manager', async () => { + const messageParamsWithOriginUndefined = { + ...messageParamsMock, + origin: undefined, + }; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore signatureController.update(() => ({ @@ -571,7 +435,7 @@ describe('SignatureController', () => { })); await signatureController.newUnsignedTypedMessage( - messageParamsMock, + messageParamsWithOriginUndefined, requestMock, versionMock, { parseJsonData: false }, @@ -581,7 +445,7 @@ describe('SignatureController', () => { typedMessageManagerMock.addUnapprovedMessage, ).toHaveBeenCalledTimes(1); expect(typedMessageManagerMock.addUnapprovedMessage).toHaveBeenCalledWith( - messageParamsMock, + messageParamsWithOriginUndefined, requestMock, versionMock, ); @@ -592,9 +456,9 @@ describe('SignatureController', () => { 'ApprovalController:addRequest', { id: messageIdMock, - origin: messageParamsMock.origin, + origin: ORIGIN_METAMASK, type: 'eth_signTypedData', - requestData: messageParamsMock, + requestData: messageParamsWithOriginUndefined, expectsResult: true, }, true, @@ -743,20 +607,20 @@ describe('SignatureController', () => { messageParamsMock.data, ); - expect(messageManagerMock.setMetadata).toHaveBeenCalledTimes(1); - expect(messageManagerMock.setMetadata).toHaveBeenCalledWith( + expect(personalMessageManagerMock.setMetadata).toHaveBeenCalledTimes(1); + expect(personalMessageManagerMock.setMetadata).toHaveBeenCalledWith( messageIdMock, messageParamsWithoutIdMock.data, ); - - expect(personalMessageManagerMock.setMetadata).not.toHaveBeenCalled(); expect(typedMessageManagerMock.setMetadata).not.toHaveBeenCalled(); }); it('should return false when an error occurs', () => { - jest.spyOn(messageManagerMock, 'setMetadata').mockImplementation(() => { - throw new Error('mocked error'); - }); + jest + .spyOn(personalMessageManagerMock, 'setMetadata') + .mockImplementation(() => { + throw new Error('mocked error'); + }); const result = signatureController.setMessageMetadata( messageParamsMock.metamaskId, @@ -764,8 +628,8 @@ describe('SignatureController', () => { ); expect(result).toBeUndefined(); - expect(messageManagerMock.setMetadata).toHaveBeenCalledTimes(1); - expect(messageManagerMock.setMetadata).toHaveBeenCalledWith( + expect(personalMessageManagerMock.setMetadata).toHaveBeenCalledTimes(1); + expect(personalMessageManagerMock.setMetadata).toHaveBeenCalledWith( messageIdMock, messageParamsWithoutIdMock.data, ); @@ -779,25 +643,20 @@ describe('SignatureController', () => { messageParamsMock.data, ); - expect(messageManagerMock.setMessageStatusSigned).toHaveBeenCalledTimes( - 1, - ); - expect(messageManagerMock.setMessageStatusSigned).toHaveBeenCalledWith( - messageIdMock, - messageParamsWithoutIdMock.data, - ); - expect( personalMessageManagerMock.setMessageStatusSigned, - ).not.toHaveBeenCalled(); + ).toHaveBeenCalledTimes(1); + expect( + personalMessageManagerMock.setMessageStatusSigned, + ).toHaveBeenCalledWith(messageIdMock, messageParamsWithoutIdMock.data); expect( typedMessageManagerMock.setMessageStatusSigned, ).not.toHaveBeenCalled(); }); - it('should return false when an error occurs', () => { + it('should return undefined when an error occurs', () => { jest - .spyOn(messageManagerMock, 'setMessageStatusSigned') + .spyOn(personalMessageManagerMock, 'setMessageStatusSigned') .mockImplementation(() => { throw new Error('mocked error'); }); @@ -808,13 +667,12 @@ describe('SignatureController', () => { ); expect(result).toBeUndefined(); - expect(messageManagerMock.setMessageStatusSigned).toHaveBeenCalledTimes( - 1, - ); - expect(messageManagerMock.setMessageStatusSigned).toHaveBeenCalledWith( - messageIdMock, - messageParamsWithoutIdMock.data, - ); + expect( + personalMessageManagerMock.setMessageStatusSigned, + ).toHaveBeenCalledTimes(1); + expect( + personalMessageManagerMock.setMessageStatusSigned, + ).toHaveBeenCalledWith(messageIdMock, messageParamsWithoutIdMock.data); }); }); @@ -822,19 +680,20 @@ describe('SignatureController', () => { it('rejects a message by calling rejectMessage', () => { signatureController.setDeferredSignError(messageParamsMock.metamaskId); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledTimes(1); - expect(messageManagerMock.rejectMessage).toHaveBeenCalledWith( + expect(personalMessageManagerMock.rejectMessage).toHaveBeenCalledTimes(1); + expect(personalMessageManagerMock.rejectMessage).toHaveBeenCalledWith( messageIdMock, ); - expect(personalMessageManagerMock.rejectMessage).not.toHaveBeenCalled(); expect(typedMessageManagerMock.rejectMessage).not.toHaveBeenCalled(); }); it('rejects message on next message manager if first throws', () => { - jest.spyOn(messageManagerMock, 'rejectMessage').mockImplementation(() => { - throw new Error('mocked error'); - }); + jest + .spyOn(personalMessageManagerMock, 'rejectMessage') + .mockImplementation(() => { + throw new Error('mocked error'); + }); jest .spyOn(personalMessageManagerMock, 'rejectMessage') .mockImplementation(() => { @@ -847,9 +706,6 @@ describe('SignatureController', () => { }); it('should throw an error when tryForEachMessageManager fails', () => { - jest.spyOn(messageManagerMock, 'rejectMessage').mockImplementation(() => { - throw new Error('mocked error'); - }); jest .spyOn(personalMessageManagerMock, 'rejectMessage') .mockImplementation(() => { @@ -883,10 +739,9 @@ describe('SignatureController', () => { }, ]; - it('returns all the messages from typed, personal and messageManager', () => { + it('returns all the messages from TypedMessageManager and PersonalMessageManager', () => { typedMessageManagerMock.getAllMessages.mockReturnValueOnce(message); personalMessageManagerMock.getAllMessages.mockReturnValueOnce([]); - messageManagerMock.getAllMessages.mockReturnValueOnce([]); expect(signatureController.messages).toMatchObject({ '1': { id: '1', @@ -906,7 +761,6 @@ describe('SignatureController', () => { describe('message manager events', () => { it.each([ - ['message manager', messageManagerMock], ['personal message manager', personalMessageManagerMock], ['typed message manager', typedMessageManagerMock], ])('bubbles update badge event from %s', (_, messageManager) => { @@ -921,7 +775,7 @@ describe('SignatureController', () => { // eslint-disable-next-line jest/expect-expect it('does not throw if approval request promise throws', async () => { - const mockHub = messageManagerMock.hub.on as jest.Mock; + const mockHub = personalMessageManagerMock.hub.on as jest.Mock; messengerMock.call.mockRejectedValueOnce('Test Error'); @@ -929,7 +783,7 @@ describe('SignatureController', () => { }); it('updates state on message manager state change', async () => { - await messageManagerMock.subscribe.mock.calls[0][0]({ + await personalMessageManagerMock.subscribe.mock.calls[0][0]({ // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any unapprovedMessages: { [messageIdMock]: coreMessageMock as any }, @@ -939,11 +793,9 @@ describe('SignatureController', () => { expect(await signatureController.state).toStrictEqual({ // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - unapprovedMsgs: { [messageIdMock]: stateMessageMock as any }, - unapprovedPersonalMsgs: {}, + unapprovedPersonalMsgs: { [messageIdMock]: stateMessageMock as any }, unapprovedTypedMessages: {}, - unapprovedMsgCount: 3, - unapprovedPersonalMsgCount: 0, + unapprovedPersonalMsgCount: 3, unapprovedTypedMessagesCount: 0, }); }); @@ -957,12 +809,10 @@ describe('SignatureController', () => { }); expect(await signatureController.state).toStrictEqual({ - unapprovedMsgs: {}, // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any unapprovedPersonalMsgs: { [messageIdMock]: stateMessageMock as any }, unapprovedTypedMessages: {}, - unapprovedMsgCount: 0, unapprovedPersonalMsgCount: 4, unapprovedTypedMessagesCount: 0, }); @@ -977,12 +827,10 @@ describe('SignatureController', () => { }); expect(await signatureController.state).toStrictEqual({ - unapprovedMsgs: {}, unapprovedPersonalMsgs: {}, // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any unapprovedTypedMessages: { [messageIdMock]: stateMessageMock as any }, - unapprovedMsgCount: 0, unapprovedPersonalMsgCount: 0, unapprovedTypedMessagesCount: 5, }); diff --git a/packages/signature-controller/src/SignatureController.ts b/packages/signature-controller/src/SignatureController.ts index ee73ec4024..acd8158079 100644 --- a/packages/signature-controller/src/SignatureController.ts +++ b/packages/signature-controller/src/SignatureController.ts @@ -23,8 +23,6 @@ import { } from '@metamask/logging-controller'; import type { AddLog } from '@metamask/logging-controller'; import type { - MessageParams, - MessageParamsMetamask, PersonalMessageParams, PersonalMessageParamsMetamask, TypedMessageParams, @@ -37,35 +35,28 @@ import type { OriginalRequest, TypedMessage, PersonalMessage, - Message, } from '@metamask/message-manager'; import { - MessageManager, PersonalMessageManager, TypedMessageManager, } from '@metamask/message-manager'; -import { providerErrors, rpcErrors } from '@metamask/rpc-errors'; +import { providerErrors } from '@metamask/rpc-errors'; import type { Hex, Json } from '@metamask/utils'; -import { bytesToHex } from '@metamask/utils'; import EventEmitter from 'events'; import { cloneDeep } from 'lodash'; const controllerName = 'SignatureController'; const stateMetadata = { - unapprovedMsgs: { persist: false, anonymous: false }, unapprovedPersonalMsgs: { persist: false, anonymous: false }, unapprovedTypedMessages: { persist: false, anonymous: false }, - unapprovedMsgCount: { persist: false, anonymous: false }, unapprovedPersonalMsgCount: { persist: false, anonymous: false }, unapprovedTypedMessagesCount: { persist: false, anonymous: false }, }; const getDefaultState = () => ({ - unapprovedMsgs: {}, unapprovedPersonalMsgs: {}, unapprovedTypedMessages: {}, - unapprovedMsgCount: 0, unapprovedPersonalMsgCount: 0, unapprovedTypedMessagesCount: 0, }); @@ -79,10 +70,8 @@ type StateMessage = Required & { }; type SignatureControllerState = { - unapprovedMsgs: Record; unapprovedPersonalMsgs: Record; unapprovedTypedMessages: Record; - unapprovedMsgCount: number; unapprovedPersonalMsgCount: number; unapprovedTypedMessagesCount: number; }; @@ -145,14 +134,10 @@ export class SignatureController extends BaseController< > { hub: EventEmitter; - #isEthSignEnabled: () => boolean; - // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any #getAllState: () => any; - #messageManager: MessageManager; - #personalMessageManager: PersonalMessageManager; #typedMessageManager: TypedMessageManager; @@ -162,14 +147,12 @@ export class SignatureController extends BaseController< * * @param options - The controller options. * @param options.messenger - The restricted controller messenger for the sign controller. - * @param options.isEthSignEnabled - Callback to return true if eth_sign is enabled. * @param options.getAllState - Callback to retrieve all user state. * @param options.securityProviderRequest - A function for verifying a message, whether it is malicious or not. * @param options.getCurrentChainId - A function for retrieving the current chainId. */ constructor({ messenger, - isEthSignEnabled, getAllState, securityProviderRequest, getCurrentChainId, @@ -181,15 +164,9 @@ export class SignatureController extends BaseController< state: getDefaultState(), }); - this.#isEthSignEnabled = isEthSignEnabled; this.#getAllState = getAllState; this.hub = new EventEmitter(); - this.#messageManager = new MessageManager( - undefined, - undefined, - securityProviderRequest, - ); this.#personalMessageManager = new PersonalMessageManager( undefined, undefined, @@ -203,7 +180,6 @@ export class SignatureController extends BaseController< getCurrentChainId, ); - this.#handleMessageManagerEvents(this.#messageManager, 'unapprovedMessage'); this.#handleMessageManagerEvents( this.#personalMessageManager, 'unapprovedPersonalMessage', @@ -213,14 +189,6 @@ export class SignatureController extends BaseController< 'unapprovedTypedMessage', ); - this.#subscribeToMessageState( - this.#messageManager, - (state, newMessages, messageCount) => { - state.unapprovedMsgs = newMessages; - state.unapprovedMsgCount = messageCount; - }, - ); - this.#subscribeToMessageState( this.#personalMessageManager, (state, newMessages, messageCount) => { @@ -238,15 +206,6 @@ export class SignatureController extends BaseController< ); } - /** - * A getter for the number of 'unapproved' Messages in this.messages. - * - * @returns The number of 'unapproved' Messages in this.messages - */ - get unapprovedMsgCount(): number { - return this.#messageManager.getUnapprovedMessagesCount(); - } - /** * A getter for the number of 'unapproved' PersonalMessages in this.messages. * @@ -270,15 +229,14 @@ export class SignatureController extends BaseController< * * @returns The object containing all messages. */ - get messages(): { [id: string]: Message | PersonalMessage | TypedMessage } { + get messages(): { [id: string]: PersonalMessage | TypedMessage } { const messages = [ ...this.#typedMessageManager.getAllMessages(), ...this.#personalMessageManager.getAllMessages(), - ...this.#messageManager.getAllMessages(), ]; const messagesObject = messages.reduce<{ - [id: string]: Message | PersonalMessage | TypedMessage; + [id: string]: PersonalMessage | TypedMessage; }>((acc, message) => { acc[message.id] = message; return acc; @@ -300,7 +258,6 @@ export class SignatureController extends BaseController< * @param reason - A message to indicate why. */ rejectUnapproved(reason?: string) { - this.#rejectUnapproved(this.#messageManager, reason); this.#rejectUnapproved(this.#personalMessageManager, reason); this.#rejectUnapproved(this.#typedMessageManager, reason); } @@ -309,43 +266,14 @@ export class SignatureController extends BaseController< * Clears all unapproved messages from memory. */ clearUnapproved() { - this.#clearUnapproved(this.#messageManager); this.#clearUnapproved(this.#personalMessageManager); this.#clearUnapproved(this.#typedMessageManager); } - /** - * Called when a Dapp uses the eth_sign method, to request user approval. - * eth_sign is a pure signature of arbitrary data. It is on a deprecation - * path, since this data can be a transaction, or can leak private key - * information. - * - * @param messageParams - The params passed to eth_sign. - * @param [req] - The original request, containing the origin. - * @returns Promise resolving to the raw data of the signature request. - */ - async newUnsignedMessage( - messageParams: MessageParams, - req: OriginalRequest, - ): Promise { - return this.#newUnsignedAbstractMessage( - this.#messageManager, - ApprovalType.EthSign, - SigningMethod.EthSign, - 'Message', - this.#signMessage.bind(this), - messageParams, - req, - this.#validateUnsignedMessage.bind(this), - ); - } - /** * Called when a dapp uses the personal_sign method. - * This is identical to the Geth eth_sign method, and may eventually replace - * eth_sign. * - * We currently define our eth_sign and personal_sign mostly for legacy Dapps. + * We currently define personal_sign mostly for legacy Dapps. * * @param messageParams - The params of the message to sign & return to the Dapp. * @param req - The original request, containing the origin. @@ -391,7 +319,6 @@ export class SignatureController extends BaseController< this.#signTypedMessage.bind(this), messageParams, req, - undefined, version, signingOpts, ); @@ -444,21 +371,6 @@ export class SignatureController extends BaseController< this.#personalMessageManager.setMessageStatusInProgress(messageId); } - #validateUnsignedMessage(messageParams: MessageParamsMetamask): void { - if (!this.#isEthSignEnabled()) { - throw rpcErrors.methodNotFound( - 'eth_sign has been disabled. You must enable it in the advanced settings', - ); - } - const data = this.#normalizeMsgData(messageParams.data); - // 64 hex + "0x" at the beginning - // This is needed because Ethereum's EcSign works only on 32 byte numbers - // For 67 length see: https://github.com/MetaMask/metamask-extension/pull/12679/files#r749479607 - if (data.length !== 66 && data.length !== 67) { - throw rpcErrors.invalidParams('eth_sign requires 32 byte message hash'); - } - } - async #newUnsignedAbstractMessage< M extends AbstractMessage, P extends AbstractMessageParams, @@ -472,14 +384,9 @@ export class SignatureController extends BaseController< signMessage: (messageParams: PM, signingOpts?: SO) => void, messageParams: PM, req: OriginalRequest, - validateMessage?: (params: PM) => void, version?: string, signingOpts?: SO, ) { - if (validateMessage) { - validateMessage(messageParams); - } - let resultCallbacks: AcceptResultCallbacks | undefined; try { const messageId = await messageManager.addUnapprovedMessage( @@ -542,25 +449,6 @@ export class SignatureController extends BaseController< } } - /** - * Signifies user intent to complete an eth_sign method. - * - * @param msgParams - The params passed to eth_call. - * @returns Signature result from signing. - */ - async #signMessage(msgParams: MessageParamsMetamask) { - return await this.#signAbstractMessage( - this.#messageManager, - ApprovalType.EthSign, - msgParams, - async (cleanMsgParams) => - await this.messagingSystem.call( - 'KeyringController:signMessage', - cleanMsgParams, - ), - ); - } - /** * Signifies a user's approval to sign a personal_sign message in queue. * Triggers signing, and the callback function from newUnsignedPersonalMessage. @@ -630,7 +518,6 @@ export class SignatureController extends BaseController< ...args: any ) { const messageManagers = [ - this.#messageManager, this.#personalMessageManager, this.#typedMessageManager, ]; @@ -855,18 +742,8 @@ export class SignatureController extends BaseController< return stateMessage as StateMessage; } - #normalizeMsgData(data: string) { - if (data.startsWith('0x')) { - // data is already hex - return data; - } - // data is unicode, convert to hex - return bytesToHex(Buffer.from(data, 'utf8')); - } - #getMessage(messageId: string): StateMessage { return { - ...this.state.unapprovedMsgs, ...this.state.unapprovedPersonalMsgs, ...this.state.unapprovedTypedMessages, }[messageId]; diff --git a/packages/transaction-controller/CHANGELOG.md b/packages/transaction-controller/CHANGELOG.md index 5d5a2005b8..b13981cbee 100644 --- a/packages/transaction-controller/CHANGELOG.md +++ b/packages/transaction-controller/CHANGELOG.md @@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [32.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^7.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/gas-fee-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [31.0.0] + +### Changed + +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^6.0.2` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/gas-fee-controller` to `^16.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `async-mutex` to `^0.5.0` ([#4335](https://github.com/MetaMask/core/pull/4335)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + +### Removed + +- **BREAKING:** Remove `sign` from `TransactionType` ([#4319](https://github.com/MetaMask/core/pull/4319)) + - This represented an `eth_sign` transaction, but support for that RPC method is being removed, so this is no longer needed. + +### Fixed + +- Pass an unfrozen transaction to the `afterSign` hook so that it is able to modify the transaction ([#4343](https://github.com/MetaMask/core/pull/4343)) + ## [30.0.0] ### Fixed @@ -846,7 +876,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All changes listed after this point were applied to this package following the monorepo conversion. -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@30.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@32.0.0...HEAD +[32.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@31.0.0...@metamask/transaction-controller@32.0.0 +[31.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@30.0.0...@metamask/transaction-controller@31.0.0 [30.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@29.1.0...@metamask/transaction-controller@30.0.0 [29.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@29.0.2...@metamask/transaction-controller@29.1.0 [29.0.2]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@29.0.1...@metamask/transaction-controller@29.0.2 diff --git a/packages/transaction-controller/package.json b/packages/transaction-controller/package.json index ccd5d3d712..3bc8e97121 100644 --- a/packages/transaction-controller/package.json +++ b/packages/transaction-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/transaction-controller", - "version": "30.0.0", + "version": "32.0.0", "description": "Stores transactions alongside their periodically updated statuses and manages interactions such as approval and cancellation", "keywords": [ "MetaMask", @@ -47,17 +47,17 @@ "@ethersproject/abi": "^5.7.0", "@ethersproject/contracts": "^5.7.0", "@ethersproject/providers": "^5.7.0", - "@metamask/approval-controller": "^6.0.2", - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/approval-controller": "^7.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/eth-query": "^4.0.0", - "@metamask/gas-fee-controller": "^15.1.2", + "@metamask/gas-fee-controller": "^17.0.0", "@metamask/metamask-eth-abis": "^3.1.1", - "@metamask/network-controller": "^18.1.2", + "@metamask/network-controller": "^19.0.0", "@metamask/nonce-tracker": "^5.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/utils": "^8.3.0", - "async-mutex": "^0.2.6", + "async-mutex": "^0.5.0", "bn.js": "^5.2.1", "eth-method-registry": "^4.0.0", "fast-json-patch": "^3.1.1", @@ -83,12 +83,12 @@ }, "peerDependencies": { "@babel/runtime": "^7.23.9", - "@metamask/approval-controller": "^6.0.0", - "@metamask/gas-fee-controller": "^15.0.0", - "@metamask/network-controller": "^18.1.2" + "@metamask/approval-controller": "^7.0.0", + "@metamask/gas-fee-controller": "^17.0.0", + "@metamask/network-controller": "^19.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/transaction-controller/src/TransactionController.ts b/packages/transaction-controller/src/TransactionController.ts index 76a8158ddf..06010fc314 100644 --- a/packages/transaction-controller/src/TransactionController.ts +++ b/packages/transaction-controller/src/TransactionController.ts @@ -3289,9 +3289,10 @@ export class TransactionController extends BaseController< return undefined; } - if (!this.afterSign(transactionMeta, signedTx)) { + const transactionMetaFromHook = cloneDeep(transactionMeta); + if (!this.afterSign(transactionMetaFromHook, signedTx)) { this.updateTransaction( - transactionMeta, + transactionMetaFromHook, 'TransactionController#signTransaction - Update after sign', ); @@ -3301,7 +3302,7 @@ export class TransactionController extends BaseController< } const transactionMetaWithRsv = { - ...this.updateTransactionMetaRSV(transactionMeta, signedTx), + ...this.updateTransactionMetaRSV(transactionMetaFromHook, signedTx), status: TransactionStatus.signed as const, }; diff --git a/packages/transaction-controller/src/types.ts b/packages/transaction-controller/src/types.ts index 776e5ae559..0a24e53ab6 100644 --- a/packages/transaction-controller/src/types.ts +++ b/packages/transaction-controller/src/types.ts @@ -528,11 +528,6 @@ export enum TransactionType { */ simpleSend = 'simpleSend', - /** - * A transaction that is signing a message. - */ - sign = 'eth_sign', - /** * A transaction that is signing typed data. */ diff --git a/packages/user-operation-controller/CHANGELOG.md b/packages/user-operation-controller/CHANGELOG.md index b3f60aee3b..c6812db3ae 100644 --- a/packages/user-operation-controller/CHANGELOG.md +++ b/packages/user-operation-controller/CHANGELOG.md @@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [12.0.0] + +### Changed + +- **BREAKING:** Bump minimum Node version to 18.18 ([#3611](https://github.com/MetaMask/core/pull/3611)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^7.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/gas-fee-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/keyring-controller` to `^17.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^19.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/transaction-controller` to `^32.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/base-controller` to `^6.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/controller-utils` to `^11.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) +- Bump `@metamask/polling-controller` to `^8.0.0` ([#4352](https://github.com/MetaMask/core/pull/4352)) + +## [11.0.0] + +### Added + +- Add support for "swap+send" transactions ([#4298](https://github.com/MetaMask/core/pull/4298)) + - Add optional properties `destinationTokenAmount`, `sourceTokenAddress`, `sourceTokenAmount`, `sourceTokenDecimals`, and `swapAndSendRecipient` to `TransactionMeta` + - Add `swapAndSend` as a new entry in `TransactionType` enum + - When persisting this type of transaction, copy source tokens, destination tokens, and recipient from swap data, and emit `TransactionController:newSwapAndSend` controller event + +### Changed + +- **BREAKING:** Bump dependency and peer dependency `@metamask/approval-controller` to `^6.0.2` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/gas-fee-controller` to `^16.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/keyring-controller` to `^16.1.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/network-controller` to `^18.1.3` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- **BREAKING:** Bump dependency and peer dependency `@metamask/transaction-controller` to `^31.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/controller-utils` to `^10.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) +- Bump `@metamask/polling-controller` to `^7.0.0` ([#4342](https://github.com/MetaMask/core/pull/4342)) + ## [10.0.0] ### Changed @@ -130,7 +163,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial Release ([#3749](https://github.com/MetaMask/core/pull/3749)) -[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@10.0.0...HEAD +[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@12.0.0...HEAD +[12.0.0]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@11.0.0...@metamask/user-operation-controller@12.0.0 +[11.0.0]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@10.0.0...@metamask/user-operation-controller@11.0.0 [10.0.0]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@9.0.0...@metamask/user-operation-controller@10.0.0 [9.0.0]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@8.0.1...@metamask/user-operation-controller@9.0.0 [8.0.1]: https://github.com/MetaMask/core/compare/@metamask/user-operation-controller@8.0.0...@metamask/user-operation-controller@8.0.1 diff --git a/packages/user-operation-controller/package.json b/packages/user-operation-controller/package.json index a6d0ef0173..ea2e6338e4 100644 --- a/packages/user-operation-controller/package.json +++ b/packages/user-operation-controller/package.json @@ -1,6 +1,6 @@ { "name": "@metamask/user-operation-controller", - "version": "10.0.0", + "version": "12.0.0", "description": "Creates user operations and manages their life cycle", "keywords": [ "MetaMask", @@ -42,16 +42,16 @@ "test:watch": "jest --watch" }, "dependencies": { - "@metamask/approval-controller": "^6.0.2", - "@metamask/base-controller": "^5.0.2", - "@metamask/controller-utils": "^10.0.0", + "@metamask/approval-controller": "^7.0.0", + "@metamask/base-controller": "^6.0.0", + "@metamask/controller-utils": "^11.0.0", "@metamask/eth-query": "^4.0.0", - "@metamask/gas-fee-controller": "^15.1.2", - "@metamask/keyring-controller": "^16.0.0", - "@metamask/network-controller": "^18.1.2", - "@metamask/polling-controller": "^6.0.2", + "@metamask/gas-fee-controller": "^17.0.0", + "@metamask/keyring-controller": "^17.0.0", + "@metamask/network-controller": "^19.0.0", + "@metamask/polling-controller": "^8.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/transaction-controller": "^30.0.0", + "@metamask/transaction-controller": "^32.0.0", "@metamask/utils": "^8.3.0", "bn.js": "^5.2.1", "immer": "^9.0.6", @@ -70,14 +70,14 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@metamask/approval-controller": "^6.0.0", - "@metamask/gas-fee-controller": "^15.0.0", - "@metamask/keyring-controller": "^16.0.0", - "@metamask/network-controller": "^18.1.2", - "@metamask/transaction-controller": "^30.0.0" + "@metamask/approval-controller": "^7.0.0", + "@metamask/gas-fee-controller": "^17.0.0", + "@metamask/keyring-controller": "^17.0.0", + "@metamask/network-controller": "^19.0.0", + "@metamask/transaction-controller": "^32.0.0" }, "engines": { - "node": ">=16.0.0" + "node": "^18.18 || >=20" }, "publishConfig": { "access": "public", diff --git a/packages/user-operation-controller/src/utils/validation.test.ts b/packages/user-operation-controller/src/utils/validation.test.ts index fd78926518..54fcee6dbc 100644 --- a/packages/user-operation-controller/src/utils/validation.test.ts +++ b/packages/user-operation-controller/src/utils/validation.test.ts @@ -337,7 +337,7 @@ describe('validation', () => { 'type', 'wrong type', 123, - 'Expected one of `"cancel","contractInteraction","contractDeployment","eth_decrypt","eth_getEncryptionPublicKey","incoming","personal_sign","retry","simpleSend","eth_sign","eth_signTypedData","smart","swap","swapAndSend","swapApproval","approve","safetransferfrom","transfer","transferfrom","setapprovalforall","increaseAllowance"`, but received: 123', + 'Expected one of `"cancel","contractInteraction","contractDeployment","eth_decrypt","eth_getEncryptionPublicKey","incoming","personal_sign","retry","simpleSend","eth_signTypedData","smart","swap","swapAndSend","swapApproval","approve","safetransferfrom","transfer","transferfrom","setapprovalforall","increaseAllowance"`, but received: 123', ], ])( 'throws if %s is %s', diff --git a/yarn.lock b/yarn.lock index 8d20e9ec1c..e78b424eee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1609,16 +1609,16 @@ __metadata: languageName: node linkType: hard -"@metamask/accounts-controller@^14.0.0, @metamask/accounts-controller@workspace:packages/accounts-controller": +"@metamask/accounts-controller@^16.0.0, @metamask/accounts-controller@workspace:packages/accounts-controller": version: 0.0.0-use.local resolution: "@metamask/accounts-controller@workspace:packages/accounts-controller" dependencies: "@ethereumjs/util": ^8.1.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/eth-snap-keyring": ^4.1.1 "@metamask/keyring-api": ^6.1.1 - "@metamask/keyring-controller": ^16.0.0 + "@metamask/keyring-controller": ^17.0.0 "@metamask/snaps-controllers": ^8.1.1 "@metamask/snaps-sdk": ^4.2.0 "@metamask/snaps-utils": ^7.4.0 @@ -1635,7 +1635,7 @@ __metadata: typescript: ~4.9.5 uuid: ^8.3.2 peerDependencies: - "@metamask/keyring-controller": ^16.0.0 + "@metamask/keyring-controller": ^17.0.0 "@metamask/snaps-controllers": ^8.1.1 languageName: unknown linkType: soft @@ -1656,8 +1656,8 @@ __metadata: resolution: "@metamask/address-book-controller@workspace:packages/address-book-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 @@ -1674,7 +1674,7 @@ __metadata: resolution: "@metamask/announcement-controller@workspace:packages/announcement-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -1685,12 +1685,12 @@ __metadata: languageName: unknown linkType: soft -"@metamask/approval-controller@^6.0.2, @metamask/approval-controller@workspace:packages/approval-controller": +"@metamask/approval-controller@^7.0.0, @metamask/approval-controller@workspace:packages/approval-controller": version: 0.0.0-use.local resolution: "@metamask/approval-controller@workspace:packages/approval-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -1705,6 +1705,18 @@ __metadata: languageName: unknown linkType: soft +"@metamask/approval-controller@npm:^6.0.2": + version: 6.0.2 + resolution: "@metamask/approval-controller@npm:6.0.2" + dependencies: + "@metamask/base-controller": ^5.0.2 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/utils": ^8.3.0 + nanoid: ^3.1.31 + checksum: 662365ec460edc1e3839c2f9f427d44a707350ecca7fa3524d75da3652306b61fc69f7336154142b4a38657c272624232ea40bf218427ba15b11fd89c5a5ae42 + languageName: node + linkType: hard + "@metamask/assets-controllers@workspace:packages/assets-controllers": version: 0.0.0-use.local resolution: "@metamask/assets-controllers@workspace:packages/assets-controllers" @@ -1715,20 +1727,20 @@ __metadata: "@ethersproject/contracts": ^5.7.0 "@ethersproject/providers": ^5.7.0 "@metamask/abi-utils": ^2.0.2 - "@metamask/accounts-controller": ^14.0.0 - "@metamask/approval-controller": ^6.0.2 + "@metamask/accounts-controller": ^16.0.0 + "@metamask/approval-controller": ^7.0.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/contract-metadata": ^2.4.0 - "@metamask/controller-utils": ^10.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/eth-query": ^4.0.0 "@metamask/ethjs-provider-http": ^0.3.0 "@metamask/keyring-api": ^6.1.1 - "@metamask/keyring-controller": ^16.0.0 + "@metamask/keyring-controller": ^17.0.0 "@metamask/metamask-eth-abis": ^3.1.1 - "@metamask/network-controller": ^18.1.2 - "@metamask/polling-controller": ^6.0.2 - "@metamask/preferences-controller": ^11.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/polling-controller": ^8.0.0 + "@metamask/preferences-controller": ^13.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 "@types/bn.js": ^5.1.5 @@ -1736,7 +1748,7 @@ __metadata: "@types/lodash": ^4.14.191 "@types/node": ^16.18.54 "@types/uuid": ^8.3.0 - async-mutex: ^0.2.6 + async-mutex: ^0.5.0 bn.js: ^5.2.1 cockatiel: ^3.1.2 deepmerge: ^4.2.2 @@ -1753,11 +1765,11 @@ __metadata: typescript: ~4.9.5 uuid: ^8.3.2 peerDependencies: - "@metamask/accounts-controller": ^14.0.0 - "@metamask/approval-controller": ^6.0.0 - "@metamask/keyring-controller": ^16.0.0 - "@metamask/network-controller": ^18.1.2 - "@metamask/preferences-controller": ^11.0.0 + "@metamask/accounts-controller": ^16.0.0 + "@metamask/approval-controller": ^7.0.0 + "@metamask/keyring-controller": ^17.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/preferences-controller": ^13.0.0 languageName: unknown linkType: soft @@ -1791,7 +1803,7 @@ __metadata: languageName: node linkType: hard -"@metamask/base-controller@^5.0.2, @metamask/base-controller@workspace:packages/base-controller": +"@metamask/base-controller@^6.0.0, @metamask/base-controller@workspace:packages/base-controller": version: 0.0.0-use.local resolution: "@metamask/base-controller@workspace:packages/base-controller" dependencies: @@ -1810,6 +1822,16 @@ __metadata: languageName: unknown linkType: soft +"@metamask/base-controller@npm:^5.0.2": + version: 5.0.2 + resolution: "@metamask/base-controller@npm:5.0.2" + dependencies: + "@metamask/utils": ^8.3.0 + immer: ^9.0.6 + checksum: 22c43c3147c7da1c1b87de4d41948e275f8e0adcdb1210a55a62aa497db4fa82399750901729d9dc6285d89e68f18e5bd15095ee4d4c6cfc169035173e69a1d2 + languageName: node + linkType: hard + "@metamask/browser-passworder@npm:^4.3.0": version: 4.3.0 resolution: "@metamask/browser-passworder@npm:4.3.0" @@ -1852,7 +1874,7 @@ __metadata: resolution: "@metamask/chain-controller@workspace:packages/chain-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/chain-api": ^0.0.1 "@metamask/keyring-api": ^6.1.1 "@metamask/snaps-controllers": ^8.1.1 @@ -1876,8 +1898,8 @@ __metadata: resolution: "@metamask/composable-controller@workspace:packages/composable-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/json-rpc-engine": ^9.0.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 immer: ^9.0.6 @@ -1897,7 +1919,7 @@ __metadata: languageName: node linkType: hard -"@metamask/controller-utils@^10.0.0, @metamask/controller-utils@workspace:packages/controller-utils": +"@metamask/controller-utils@^11.0.0, @metamask/controller-utils@workspace:packages/controller-utils": version: 0.0.0-use.local resolution: "@metamask/controller-utils@workspace:packages/controller-utils" dependencies: @@ -1922,6 +1944,23 @@ __metadata: languageName: unknown linkType: soft +"@metamask/controller-utils@npm:^10.0.0": + version: 10.0.0 + resolution: "@metamask/controller-utils@npm:10.0.0" + dependencies: + "@ethereumjs/util": ^8.1.0 + "@metamask/eth-query": ^4.0.0 + "@metamask/ethjs-unit": ^0.3.0 + "@metamask/utils": ^8.3.0 + "@spruceid/siwe-parser": 2.1.0 + "@types/bn.js": ^5.1.5 + bn.js: ^5.2.1 + eth-ens-namehash: ^2.0.8 + fast-deep-equal: ^3.1.3 + checksum: da92b0c3650f2abae48742caa9162e8cb74e4f0bf9d1288072f2804d2b4f7497ae47c764a3e67321b1cb8c3a6023e26802599cd1f6c28cb3cbc73415f2da8832 + languageName: node + linkType: hard + "@metamask/core-monorepo@workspace:.": version: 0.0.0-use.local resolution: "@metamask/core-monorepo@workspace:." @@ -1936,8 +1975,8 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/eth-block-tracker": ^9.0.2 - "@metamask/eth-json-rpc-provider": ^3.0.2 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/eth-json-rpc-provider": ^4.0.0 + "@metamask/json-rpc-engine": ^9.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 "@types/node": ^16.18.54 @@ -1998,9 +2037,9 @@ __metadata: dependencies: "@ethersproject/providers": ^5.7.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 - "@metamask/network-controller": ^18.1.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 + "@metamask/network-controller": ^19.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 @@ -2011,7 +2050,7 @@ __metadata: typedoc-plugin-missing-exports: ^2.0.0 typescript: ~4.9.5 peerDependencies: - "@metamask/network-controller": ^18.1.2 + "@metamask/network-controller": ^19.0.0 languageName: unknown linkType: soft @@ -2121,12 +2160,12 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-json-rpc-provider@^3.0.2, @metamask/eth-json-rpc-provider@workspace:packages/eth-json-rpc-provider": +"@metamask/eth-json-rpc-provider@^4.0.0, @metamask/eth-json-rpc-provider@workspace:packages/eth-json-rpc-provider": version: 0.0.0-use.local resolution: "@metamask/eth-json-rpc-provider@workspace:packages/eth-json-rpc-provider" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/json-rpc-engine": ^9.0.0 "@metamask/safe-event-emitter": ^3.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2304,17 +2343,17 @@ __metadata: languageName: node linkType: hard -"@metamask/gas-fee-controller@^15.1.2, @metamask/gas-fee-controller@workspace:packages/gas-fee-controller": +"@metamask/gas-fee-controller@^17.0.0, @metamask/gas-fee-controller@workspace:packages/gas-fee-controller": version: 0.0.0-use.local resolution: "@metamask/gas-fee-controller@workspace:packages/gas-fee-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/eth-query": ^4.0.0 "@metamask/ethjs-unit": ^0.3.0 - "@metamask/network-controller": ^18.1.2 - "@metamask/polling-controller": ^6.0.2 + "@metamask/network-controller": ^19.0.0 + "@metamask/polling-controller": ^8.0.0 "@metamask/utils": ^8.3.0 "@types/bn.js": ^5.1.5 "@types/jest": ^27.4.1 @@ -2331,11 +2370,11 @@ __metadata: typescript: ~4.9.5 uuid: ^8.3.2 peerDependencies: - "@metamask/network-controller": ^18.1.2 + "@metamask/network-controller": ^19.0.0 languageName: unknown linkType: soft -"@metamask/json-rpc-engine@^8.0.1, @metamask/json-rpc-engine@^8.0.2, @metamask/json-rpc-engine@workspace:packages/json-rpc-engine": +"@metamask/json-rpc-engine@^9.0.0, @metamask/json-rpc-engine@workspace:packages/json-rpc-engine": version: 0.0.0-use.local resolution: "@metamask/json-rpc-engine@workspace:packages/json-rpc-engine" dependencies: @@ -2365,12 +2404,35 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@^7.0.1, @metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": +"@metamask/json-rpc-engine@npm:^8.0.1, @metamask/json-rpc-engine@npm:^8.0.2": + version: 8.0.2 + resolution: "@metamask/json-rpc-engine@npm:8.0.2" + dependencies: + "@metamask/rpc-errors": ^6.2.1 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^8.3.0 + checksum: c240d298ad503d93922a94a62cf59f0344b6d6644a523bc8ea3c0f321bea7172b89f2747a5618e2861b2e8152ae5086b76f391a10e4566529faa50b8850c051d + languageName: node + linkType: hard + +"@metamask/json-rpc-middleware-stream@npm:^7.0.1": + version: 7.0.2 + resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.2" + dependencies: + "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^8.3.0 + readable-stream: ^3.6.2 + checksum: ff11ad3ff0ec27530efc53c4e6543661648f437dacdd58797449307e20dbc428b479cd8d1e9767797268b98d0445bd6f1986820a8c855faeef01d5c03b55323b + languageName: node + linkType: hard + +"@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream": version: 0.0.0-use.local resolution: "@metamask/json-rpc-middleware-stream@workspace:packages/json-rpc-middleware-stream" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/json-rpc-engine": ^9.0.0 "@metamask/safe-event-emitter": ^3.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2417,7 +2479,7 @@ __metadata: languageName: node linkType: hard -"@metamask/keyring-controller@^16.0.0, @metamask/keyring-controller@workspace:packages/keyring-controller": +"@metamask/keyring-controller@^17.0.0, @metamask/keyring-controller@workspace:packages/keyring-controller": version: 0.0.0-use.local resolution: "@metamask/keyring-controller@workspace:packages/keyring-controller" dependencies: @@ -2428,17 +2490,17 @@ __metadata: "@keystonehq/metamask-airgapped-keyring": ^0.14.1 "@lavamoat/allow-scripts": ^3.0.4 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/browser-passworder": ^4.3.0 "@metamask/eth-hd-keyring": ^7.0.1 "@metamask/eth-sig-util": ^7.0.1 "@metamask/eth-simple-keyring": ^6.0.1 "@metamask/keyring-api": ^6.1.1 - "@metamask/message-manager": ^8.0.2 + "@metamask/message-manager": ^10.0.0 "@metamask/scure-bip39": ^2.1.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 - async-mutex: ^0.2.6 + async-mutex: ^0.5.0 deepmerge: ^4.2.2 ethereumjs-wallet: ^1.0.1 immer: ^9.0.6 @@ -2453,13 +2515,13 @@ __metadata: languageName: unknown linkType: soft -"@metamask/logging-controller@^3.0.1, @metamask/logging-controller@workspace:packages/logging-controller": +"@metamask/logging-controller@^5.0.0, @metamask/logging-controller@workspace:packages/logging-controller": version: 0.0.0-use.local resolution: "@metamask/logging-controller@workspace:packages/logging-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -2471,13 +2533,13 @@ __metadata: languageName: unknown linkType: soft -"@metamask/message-manager@^8.0.2, @metamask/message-manager@workspace:packages/message-manager": +"@metamask/message-manager@^10.0.0, @metamask/message-manager@workspace:packages/message-manager": version: 0.0.0-use.local resolution: "@metamask/message-manager@workspace:packages/message-manager" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/eth-sig-util": ^7.0.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2505,11 +2567,11 @@ __metadata: resolution: "@metamask/name-controller@workspace:packages/name-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 - async-mutex: ^0.2.6 + async-mutex: ^0.5.0 deepmerge: ^4.2.2 jest: ^27.5.1 ts-jest: ^27.1.4 @@ -2519,27 +2581,27 @@ __metadata: languageName: unknown linkType: soft -"@metamask/network-controller@^18.1.2, @metamask/network-controller@workspace:packages/network-controller": +"@metamask/network-controller@^19.0.0, @metamask/network-controller@workspace:packages/network-controller": version: 0.0.0-use.local resolution: "@metamask/network-controller@workspace:packages/network-controller" dependencies: "@json-rpc-specification/meta-schema": ^1.0.6 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/eth-block-tracker": ^9.0.2 "@metamask/eth-json-rpc-infura": ^9.1.0 "@metamask/eth-json-rpc-middleware": ^12.1.1 - "@metamask/eth-json-rpc-provider": ^3.0.2 + "@metamask/eth-json-rpc-provider": ^4.0.0 "@metamask/eth-query": ^4.0.0 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/json-rpc-engine": ^9.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/swappable-obj-proxy": ^2.2.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 "@types/jest-when": ^2.7.3 "@types/lodash": ^4.14.191 - async-mutex: ^0.2.6 + async-mutex: ^0.5.0 deepmerge: ^4.2.2 immer: ^9.0.6 jest: ^27.5.1 @@ -2572,7 +2634,7 @@ __metadata: resolution: "@metamask/notification-controller@workspace:packages/notification-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 @@ -2615,15 +2677,15 @@ __metadata: languageName: node linkType: hard -"@metamask/permission-controller@^9.0.2, @metamask/permission-controller@^9.1.0, @metamask/permission-controller@workspace:packages/permission-controller": +"@metamask/permission-controller@^10.0.0, @metamask/permission-controller@workspace:packages/permission-controller": version: 0.0.0-use.local resolution: "@metamask/permission-controller@workspace:packages/permission-controller" dependencies: - "@metamask/approval-controller": ^6.0.2 + "@metamask/approval-controller": ^7.0.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 + "@metamask/json-rpc-engine": ^9.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 "@types/deep-freeze-strict": ^1.1.0 @@ -2638,17 +2700,36 @@ __metadata: typedoc-plugin-missing-exports: ^2.0.0 typescript: ~4.9.5 peerDependencies: - "@metamask/approval-controller": ^6.0.0 + "@metamask/approval-controller": ^7.0.0 languageName: unknown linkType: soft +"@metamask/permission-controller@npm:^9.0.2": + version: 9.1.1 + resolution: "@metamask/permission-controller@npm:9.1.1" + dependencies: + "@metamask/base-controller": ^5.0.2 + "@metamask/controller-utils": ^10.0.0 + "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/rpc-errors": ^6.2.1 + "@metamask/utils": ^8.3.0 + "@types/deep-freeze-strict": ^1.1.0 + deep-freeze-strict: ^1.1.1 + immer: ^9.0.6 + nanoid: ^3.1.31 + peerDependencies: + "@metamask/approval-controller": ^6.0.0 + checksum: 98a0406570bcb7604806b91c037033a1f0a65e519a5da2157b80b3a38ec4990be94c84ac4eb495760f9acf9ebac41212ec201f04f9aba92477209d45ec2da0b2 + languageName: node + linkType: hard + "@metamask/permission-log-controller@workspace:packages/permission-log-controller": version: 0.0.0-use.local resolution: "@metamask/permission-log-controller@workspace:packages/permission-log-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/json-rpc-engine": ^8.0.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/json-rpc-engine": ^9.0.0 "@metamask/utils": ^8.3.0 "@types/deep-freeze-strict": ^1.1.0 "@types/jest": ^27.4.1 @@ -2663,13 +2744,26 @@ __metadata: languageName: unknown linkType: soft -"@metamask/phishing-controller@^9.0.1, @metamask/phishing-controller@workspace:packages/phishing-controller": +"@metamask/phishing-controller@npm:^9.0.1": + version: 9.0.4 + resolution: "@metamask/phishing-controller@npm:9.0.4" + dependencies: + "@metamask/base-controller": ^5.0.2 + "@metamask/controller-utils": ^10.0.0 + "@types/punycode": ^2.1.0 + eth-phishing-detect: ^1.2.0 + punycode: ^2.1.1 + checksum: 096361bcf2e95ab05578ee603a0be4b9982d65f72d156d7d43e36b4a11acb24d8e39ac266789b6584f6ab401149cdc0140468e4d9355fad4331fe6119af07287 + languageName: node + linkType: hard + +"@metamask/phishing-controller@workspace:packages/phishing-controller": version: 0.0.0-use.local resolution: "@metamask/phishing-controller@workspace:packages/phishing-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@types/jest": ^27.4.1 "@types/punycode": ^2.1.0 deepmerge: ^4.2.2 @@ -2685,14 +2779,14 @@ __metadata: languageName: unknown linkType: soft -"@metamask/polling-controller@^6.0.2, @metamask/polling-controller@workspace:packages/polling-controller": +"@metamask/polling-controller@^8.0.0, @metamask/polling-controller@workspace:packages/polling-controller": version: 0.0.0-use.local resolution: "@metamask/polling-controller@workspace:packages/polling-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 - "@metamask/network-controller": ^18.1.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 + "@metamask/network-controller": ^19.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 "@types/uuid": ^8.3.0 @@ -2706,7 +2800,7 @@ __metadata: typescript: ~4.9.5 uuid: ^8.3.2 peerDependencies: - "@metamask/network-controller": ^18.1.2 + "@metamask/network-controller": ^19.0.0 languageName: unknown linkType: soft @@ -2720,14 +2814,14 @@ __metadata: languageName: node linkType: hard -"@metamask/preferences-controller@^11.0.0, @metamask/preferences-controller@workspace:packages/preferences-controller": +"@metamask/preferences-controller@^13.0.0, @metamask/preferences-controller@workspace:packages/preferences-controller": version: 0.0.0-use.local resolution: "@metamask/preferences-controller@workspace:packages/preferences-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 - "@metamask/keyring-controller": ^16.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 + "@metamask/keyring-controller": ^17.0.0 "@types/jest": ^27.4.1 deepmerge: ^4.2.2 jest: ^27.5.1 @@ -2737,7 +2831,7 @@ __metadata: typedoc-plugin-missing-exports: ^2.0.0 typescript: ~4.9.5 peerDependencies: - "@metamask/keyring-controller": ^16.0.0 + "@metamask/keyring-controller": ^17.0.0 languageName: unknown linkType: soft @@ -2787,12 +2881,12 @@ __metadata: resolution: "@metamask/queued-request-controller@workspace:packages/queued-request-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 - "@metamask/json-rpc-engine": ^8.0.2 - "@metamask/network-controller": ^18.1.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 + "@metamask/json-rpc-engine": ^9.0.0 + "@metamask/network-controller": ^19.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/selected-network-controller": ^13.0.0 + "@metamask/selected-network-controller": ^15.0.0 "@metamask/swappable-obj-proxy": ^2.2.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2807,8 +2901,8 @@ __metadata: typedoc-plugin-missing-exports: ^2.0.0 typescript: ~4.9.5 peerDependencies: - "@metamask/network-controller": ^18.1.2 - "@metamask/selected-network-controller": ^13.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/selected-network-controller": ^15.0.0 languageName: unknown linkType: soft @@ -2817,7 +2911,7 @@ __metadata: resolution: "@metamask/rate-limit-controller@workspace:packages/rate-limit-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 + "@metamask/base-controller": ^6.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2857,15 +2951,15 @@ __metadata: languageName: node linkType: hard -"@metamask/selected-network-controller@^13.0.0, @metamask/selected-network-controller@workspace:packages/selected-network-controller": +"@metamask/selected-network-controller@^15.0.0, @metamask/selected-network-controller@workspace:packages/selected-network-controller": version: 0.0.0-use.local resolution: "@metamask/selected-network-controller@workspace:packages/selected-network-controller" dependencies: "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/json-rpc-engine": ^8.0.2 - "@metamask/network-controller": ^18.1.2 - "@metamask/permission-controller": ^9.1.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/json-rpc-engine": ^9.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/permission-controller": ^10.0.0 "@metamask/swappable-obj-proxy": ^2.2.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2880,8 +2974,8 @@ __metadata: typedoc-plugin-missing-exports: ^2.0.0 typescript: ~4.9.5 peerDependencies: - "@metamask/network-controller": ^18.1.2 - "@metamask/permission-controller": ^9.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/permission-controller": ^10.0.0 languageName: unknown linkType: soft @@ -2889,13 +2983,13 @@ __metadata: version: 0.0.0-use.local resolution: "@metamask/signature-controller@workspace:packages/signature-controller" dependencies: - "@metamask/approval-controller": ^6.0.2 + "@metamask/approval-controller": ^7.0.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 - "@metamask/keyring-controller": ^16.0.0 - "@metamask/logging-controller": ^3.0.1 - "@metamask/message-manager": ^8.0.2 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 + "@metamask/keyring-controller": ^17.0.0 + "@metamask/logging-controller": ^5.0.0 + "@metamask/message-manager": ^10.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 @@ -2907,9 +3001,9 @@ __metadata: typedoc-plugin-missing-exports: ^2.0.0 typescript: ~4.9.5 peerDependencies: - "@metamask/approval-controller": ^6.0.0 - "@metamask/keyring-controller": ^16.0.0 - "@metamask/logging-controller": ^3.0.0 + "@metamask/approval-controller": ^7.0.0 + "@metamask/keyring-controller": ^17.0.0 + "@metamask/logging-controller": ^5.0.0 languageName: unknown linkType: soft @@ -3036,7 +3130,7 @@ __metadata: languageName: node linkType: hard -"@metamask/transaction-controller@^30.0.0, @metamask/transaction-controller@workspace:packages/transaction-controller": +"@metamask/transaction-controller@^32.0.0, @metamask/transaction-controller@workspace:packages/transaction-controller": version: 0.0.0-use.local resolution: "@metamask/transaction-controller@workspace:packages/transaction-controller" dependencies: @@ -3047,22 +3141,22 @@ __metadata: "@ethersproject/abi": ^5.7.0 "@ethersproject/contracts": ^5.7.0 "@ethersproject/providers": ^5.7.0 - "@metamask/approval-controller": ^6.0.2 + "@metamask/approval-controller": ^7.0.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/eth-query": ^4.0.0 "@metamask/ethjs-provider-http": ^0.3.0 - "@metamask/gas-fee-controller": ^15.1.2 + "@metamask/gas-fee-controller": ^17.0.0 "@metamask/metamask-eth-abis": ^3.1.1 - "@metamask/network-controller": ^18.1.2 + "@metamask/network-controller": ^19.0.0 "@metamask/nonce-tracker": ^5.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/utils": ^8.3.0 "@types/bn.js": ^5.1.5 "@types/jest": ^27.4.1 "@types/node": ^16.18.54 - async-mutex: ^0.2.6 + async-mutex: ^0.5.0 bn.js: ^5.2.1 deepmerge: ^4.2.2 eth-method-registry: ^4.0.0 @@ -3079,9 +3173,9 @@ __metadata: uuid: ^8.3.2 peerDependencies: "@babel/runtime": ^7.23.9 - "@metamask/approval-controller": ^6.0.0 - "@metamask/gas-fee-controller": ^15.0.0 - "@metamask/network-controller": ^18.1.2 + "@metamask/approval-controller": ^7.0.0 + "@metamask/gas-fee-controller": ^17.0.0 + "@metamask/network-controller": ^19.0.0 languageName: unknown linkType: soft @@ -3089,17 +3183,17 @@ __metadata: version: 0.0.0-use.local resolution: "@metamask/user-operation-controller@workspace:packages/user-operation-controller" dependencies: - "@metamask/approval-controller": ^6.0.2 + "@metamask/approval-controller": ^7.0.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^5.0.2 - "@metamask/controller-utils": ^10.0.0 + "@metamask/base-controller": ^6.0.0 + "@metamask/controller-utils": ^11.0.0 "@metamask/eth-query": ^4.0.0 - "@metamask/gas-fee-controller": ^15.1.2 - "@metamask/keyring-controller": ^16.0.0 - "@metamask/network-controller": ^18.1.2 - "@metamask/polling-controller": ^6.0.2 + "@metamask/gas-fee-controller": ^17.0.0 + "@metamask/keyring-controller": ^17.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/polling-controller": ^8.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/transaction-controller": ^30.0.0 + "@metamask/transaction-controller": ^32.0.0 "@metamask/utils": ^8.3.0 "@types/jest": ^27.4.1 bn.js: ^5.2.1 @@ -3114,11 +3208,11 @@ __metadata: typescript: ~4.9.5 uuid: ^8.3.2 peerDependencies: - "@metamask/approval-controller": ^6.0.0 - "@metamask/gas-fee-controller": ^15.0.0 - "@metamask/keyring-controller": ^16.0.0 - "@metamask/network-controller": ^18.1.2 - "@metamask/transaction-controller": ^30.0.0 + "@metamask/approval-controller": ^7.0.0 + "@metamask/gas-fee-controller": ^17.0.0 + "@metamask/keyring-controller": ^17.0.0 + "@metamask/network-controller": ^19.0.0 + "@metamask/transaction-controller": ^32.0.0 languageName: unknown linkType: soft @@ -4506,15 +4600,6 @@ __metadata: languageName: node linkType: hard -"async-mutex@npm:^0.2.6": - version: 0.2.6 - resolution: "async-mutex@npm:0.2.6" - dependencies: - tslib: ^2.0.0 - checksum: f50102e0c57f6a958528cff7dff13da070897f17107b42274417a7248905b927b6e51c3387f8aed1f5cd6005b0e692d64a83a0789be602e4e7e7da4afe08b889 - languageName: node - linkType: hard - "async-mutex@npm:^0.3.1": version: 0.3.2 resolution: "async-mutex@npm:0.3.2" @@ -4524,6 +4609,15 @@ __metadata: languageName: node linkType: hard +"async-mutex@npm:^0.5.0": + version: 0.5.0 + resolution: "async-mutex@npm:0.5.0" + dependencies: + tslib: ^2.4.0 + checksum: be1587f4875f3bb15e34e9fcce82eac2966daef4432c8d0046e61947fb9a1b95405284601bc7ce4869319249bc07c75100880191db6af11d1498931ac2a2f9ea + languageName: node + linkType: hard + "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -11437,7 +11531,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.0, tslib@npm:^2.3.0, tslib@npm:^2.3.1, tslib@npm:^2.6.2": +"tslib@npm:^2.3.0, tslib@npm:^2.3.1, tslib@npm:^2.4.0, tslib@npm:^2.6.2": version: 2.6.2 resolution: "tslib@npm:2.6.2" checksum: 329ea56123005922f39642318e3d1f0f8265d1e7fcb92c633e0809521da75eeaca28d2cf96d7248229deb40e5c19adf408259f4b9640afd20d13aecc1430f3ad