Skip to content

Commit 42bb475

Browse files
committed
Merge branch 'main' into feat/make-chainId-mandatory-in-nft-controller
2 parents ec8d03f + 48e81ce commit 42bb475

File tree

208 files changed

+21209
-2013
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+21209
-2013
lines changed

.github/CODEOWNERS

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
## Portfolio Team
4949
/packages/token-search-discovery-controller @MetaMask/portfolio
5050

51+
## Vault Team
52+
/packages/delegation-controller @MetaMask/vault
53+
5154
## Wallet API Platform Team
5255
/packages/chain-agnostic-permission @MetaMask/wallet-api-platform-engineers
5356
/packages/eip1193-permission-middleware @MetaMask/wallet-api-platform-engineers
@@ -92,6 +95,8 @@
9295
/packages/assets-controllers/CHANGELOG.md @MetaMask/metamask-assets @MetaMask/wallet-framework-engineers
9396
/packages/chain-agnostic-permission/package.json @MetaMask/wallet-api-platform-engineers @MetaMask/wallet-framework-engineers
9497
/packages/chain-agnostic-permission/CHANGELOG.md @MetaMask/wallet-api-platform-engineers @MetaMask/wallet-framework-engineers
98+
/packages/delegation-controller/package.json @MetaMask/vault @MetaMask/wallet-framework-engineers
99+
/packages/delegation-controller/CHANGELOG.md @MetaMask/vault @MetaMask/wallet-framework-engineers
95100
/packages/earn-controller/package.json @MetaMask/earn @MetaMask/wallet-framework-engineers
96101
/packages/earn-controller/CHANGELOG.md @MetaMask/earn @MetaMask/wallet-framework-engineers
97102
/packages/eip1193-permission-middleware/package.json @MetaMask/wallet-api-platform-engineers @MetaMask/wallet-framework-engineers

.github/workflows/add-wallet-framework-team-prs-and-issues-to-project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
pull-requests: write
1515
contents: read
1616
repository-projects: write
17-
uses: metamask/github-tools/.github/workflows/add-item-to-project.yml@bce51a03da4736bef72f67b71ca77714a38fc067
17+
uses: metamask/github-tools/.github/workflows/add-item-to-project.yml@56a094ccb23085b708eacbfbcc0b4fdf024491c0
1818
with:
1919
project-url: 'https://github.com/orgs/MetaMask/projects/113'
2020
team-name: 'wallet-framework-engineers'

.github/workflows/changelog-check.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ on:
66

77
jobs:
88
check_changelog:
9-
uses: MetaMask/github-tools/.github/workflows/changelog-check.yml@fd5f71cd6cb3c64e4fab7db56ce6b53c75732f95
9+
uses: MetaMask/github-tools/.github/workflows/changelog-check.yml@91e349d177db2c569e03c7aa69d2acb404b62f75
1010
with:
1111
base-branch: ${{ github.event.pull_request.base.ref }}
1212
head-ref: ${{ github.head_ref }}
1313
labels: ${{ toJSON(github.event.pull_request.labels) }}
14+
pr-number: ${{ github.event.pull_request.number }}
1415
repo: ${{ github.repository }}
1516
secrets:
1617
gh-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches: [main]
66
pull_request:
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
check-workflows:
1014
name: Check workflows

eslint-warning-thresholds.json

+4-8
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@
102102
"import-x/order": 3
103103
},
104104
"packages/assets-controllers/src/TokenRatesController.ts": {
105-
"@typescript-eslint/prefer-readonly": 2,
106-
"jsdoc/check-tag-names": 11,
107-
"no-unused-private-class-members": 1
105+
"@typescript-eslint/prefer-readonly": 1,
106+
"jsdoc/check-tag-names": 11
108107
},
109108
"packages/assets-controllers/src/TokensController.test.ts": {
110109
"import-x/namespace": 1,
@@ -228,7 +227,7 @@
228227
"jest/no-conditional-in-test": 8
229228
},
230229
"packages/keyring-controller/src/KeyringController.ts": {
231-
"@typescript-eslint/no-unsafe-enum-comparison": 5,
230+
"@typescript-eslint/no-unsafe-enum-comparison": 4,
232231
"@typescript-eslint/no-unused-vars": 1
233232
},
234233
"packages/keyring-controller/tests/mocks/mockKeyring.ts": {
@@ -414,11 +413,8 @@
414413
"packages/permission-log-controller/tests/PermissionLogController.test.ts": {
415414
"import-x/order": 1
416415
},
417-
"packages/phishing-controller/src/PhishingController.test.ts": {
418-
"import-x/no-named-as-default-member": 1
419-
},
420416
"packages/phishing-controller/src/PhishingController.ts": {
421-
"jsdoc/check-tag-names": 42,
417+
"jsdoc/check-tag-names": 38,
422418
"jsdoc/tag-lines": 1
423419
},
424420
"packages/phishing-controller/src/PhishingDetector.ts": {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "356.0.0",
3+
"version": "377.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {
@@ -54,7 +54,7 @@
5454
"@babel/preset-typescript": "^7.23.3",
5555
"@lavamoat/allow-scripts": "^3.0.4",
5656
"@lavamoat/preinstall-always-fail": "^2.1.0",
57-
"@metamask/create-release-branch": "^4.1.1",
57+
"@metamask/create-release-branch": "^4.1.2",
5858
"@metamask/eslint-config": "^14.0.0",
5959
"@metamask/eslint-config-jest": "^14.0.0",
6060
"@metamask/eslint-config-nodejs": "^14.0.0",

packages/accounts-controller/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **BREAKING:** Bump `@metamask/snaps-controllers` peer dependency from ^9.19.0 to ^11.0.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
13+
- **BREAKING:** Bump `@metamask/providers` peer dependency from ^18.1.0 to ^21.0.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
14+
- Bump `@metamask/snaps-sdk` from ^6.17.1 to ^6.22.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
15+
- Bump `@metamask/snaps-utils` from ^8.10.0 to ^9.2.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
16+
1017
## [27.0.0]
1118

1219
### Changed

packages/accounts-controller/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
"@metamask/keyring-api": "^17.4.0",
5454
"@metamask/keyring-internal-api": "^6.0.1",
5555
"@metamask/keyring-utils": "^3.0.0",
56-
"@metamask/snaps-sdk": "^6.17.1",
57-
"@metamask/snaps-utils": "^8.10.0",
56+
"@metamask/snaps-sdk": "^6.22.0",
57+
"@metamask/snaps-utils": "^9.2.0",
5858
"@metamask/utils": "^11.2.0",
5959
"deepmerge": "^4.2.2",
6060
"ethereum-cryptography": "^2.1.2",
@@ -63,10 +63,10 @@
6363
},
6464
"devDependencies": {
6565
"@metamask/auto-changelog": "^3.4.4",
66-
"@metamask/keyring-controller": "^21.0.2",
66+
"@metamask/keyring-controller": "^21.0.4",
6767
"@metamask/network-controller": "^23.2.0",
68-
"@metamask/providers": "^18.1.1",
69-
"@metamask/snaps-controllers": "^9.19.0",
68+
"@metamask/providers": "^21.0.0",
69+
"@metamask/snaps-controllers": "^11.2.1",
7070
"@types/jest": "^27.4.1",
7171
"@types/readable-stream": "^2.3.0",
7272
"jest": "^27.5.1",
@@ -79,8 +79,8 @@
7979
"peerDependencies": {
8080
"@metamask/keyring-controller": "^21.0.0",
8181
"@metamask/network-controller": "^23.0.0",
82-
"@metamask/providers": "^18.1.0",
83-
"@metamask/snaps-controllers": "^9.19.0",
82+
"@metamask/providers": "^21.0.0",
83+
"@metamask/snaps-controllers": "^11.0.0",
8484
"webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0"
8585
},
8686
"engines": {

packages/assets-controllers/CHANGELOG.md

+73-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Updated `NftController` and `NftDetectionController` to eliminate the dependency on the current chain.
1313
- All functions that previously accepted networkClientId as an optional parameter now require it as a mandatory parameter
14+
- Refactor `TokensController` to remove reliance on a single selected network ([#5659](https://github.com/MetaMask/core/pull/5659))
15+
- `TokensController` methods now require `networkClientId` as an explicit parameter.
16+
- Token management logic is fully parameterized by `chainId`, allowing multi-chain token handling and improving reliability across network changes.
17+
- Internal state updates and token metadata fetching are scoped to the corresponding `chainId`
18+
19+
### Removed
20+
21+
- **BREAKING:** Remove deprecated `chainId` instance property from `TokensController` ([#5659](https://github.com/MetaMask/core/pull/5659))
22+
- All chain context is now derived from `networkClientId` at the method level.
23+
24+
## [59.0.0]
25+
26+
### Added
27+
28+
- Add support for 'Sonic Mainnet' chainId in the list of SUPPORTED_CHAIN_IDS. ([#5711](https://github.com/MetaMask/core/pull/5711))
29+
- Add `SEI` network support ([#5610](https://github.com/MetaMask/core/pull/5610))
30+
- Add token detection support
31+
- Add NFT detection support
32+
33+
### Changed
34+
35+
- Refactor `TokenRatesController` to support processing multiple chains simultaneously ([#5645](https://github.com/MetaMask/core/pull/5645))
36+
- The controller now supports an array of chain IDs rather than a single value, simplifying the polling process by allowing iteration over all chains in a single loop
37+
- Refactor `AccountTrackerController` to support processing multiple chains simultaneously ([#5680](https://github.com/MetaMask/core/pull/5680))
38+
- The controller now accepts an array of chain IDs instead of a single value, streamlining the polling process by iterating over all chains in one loop
39+
40+
### Removed
41+
42+
- **BREAKING:** Eliminate legacy network dependency handling in `TokenRatesController` ([#5645](https://github.com/MetaMask/core/pull/5645))
43+
- We're no longer relying on the currently selected network.
44+
- **BREAKING:** Eliminate legacy network dependency handling in `AccountTrackerController` ([#5680](https://github.com/MetaMask/core/pull/5680))
45+
- We're no longer relying on the currently selected network.
46+
47+
## [58.0.0]
48+
49+
### Added
50+
51+
- Added `includeMarketData` to the params of the `OnAssetsConversion` handler ([#5639](https://github.com/MetaMask/core/pull/5639))
52+
- Added `fetchHistoricalPricesForAsset` method to `MultichainAssetsRatesController` ([#5639](https://github.com/MetaMask/core/pull/5639))
53+
- Added `getSelectedMultichainAccount` action to `multichainAssetsRatesController` ([#5639](https://github.com/MetaMask/core/pull/5639))
54+
- Added new state field `historicalPrices` to `MultichainAssetsRatesController` ([#5639](https://github.com/MetaMask/core/pull/5639))
55+
56+
### Changed
57+
58+
- **BREAKING:** Bump `@metamask/snaps-controllers` peer dependency from ^9.19.0 to ^11.0.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
59+
- **BREAKING:** Bump `@metamask/providers` peer dependency from ^18.1.0 to ^21.0.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
60+
- Bump `@metamask/snaps-utils` from ^8.10.0 to ^9.2.0 ([#5639](https://github.com/MetaMask/core/pull/5639))
61+
62+
## [57.0.0]
63+
64+
### Added
65+
66+
- Add a new `DeFiPositionsController` that maintains an updated list of DeFi positions for EVM accounts ([#5400](https://github.com/MetaMask/core/pull/5400))
67+
- Export `DeFiPositionsController`
68+
- Export the following types
69+
- `DeFiPositionsControllerState`
70+
- `DeFiPositionsControllerActions`
71+
- `DeFiPositionsControllerEvents`
72+
- `DeFiPositionsControllerGetStateAction`
73+
- `DeFiPositionsControllerStateChangeEvent`
74+
- `DeFiPositionsControllerMessenger`
75+
- `GroupedDeFiPositions`
76+
77+
### Changed
78+
79+
- **BREAKING** Add `@metamask/transaction-controller` as a peer dependency at `^54.0.0` ([#5400](https://github.com/MetaMask/core/pull/5400))
1480

1581
## [56.0.0]
1682

@@ -26,9 +92,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2692
- **BREAKING:** Remove deprecated state fields scoped to the current chain ([#5310](https://github.com/MetaMask/core/pull/5310))
2793
- This change removes the following state fields from the following controllers:
2894
- `TokensControllerState`
29-
- `detectedTokens` (replaced by `detectedTokensByChainId`)
30-
- `ignoredTokens` (replaced by `ignoredTokensByChainId`)
31-
- `tokens` (replaced by `tokensByChainId`)
95+
- `detectedTokens` (replaced by `allDetectedTokens`)
96+
- `ignoredTokens` (replaced by `allIgnoredTokens`)
97+
- `tokens` (replaced by `allTokens`)
3298
- `TokenListControllerState`
3399
- `tokenList` (replaced by `tokensChainsCache`)
34100
- `AccountTrackerControllerState`
@@ -1525,7 +1591,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15251591
15261592
- Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))
15271593
1528-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
1594+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
1595+
[59.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
1596+
[58.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
1597+
[57.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
15291598
[56.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
15301599
[55.0.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
15311600
[55.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]

packages/assets-controllers/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This package features the following controllers:
1919
- [**CollectibleDetectionController**](src/CollectibleDetectionController.ts) keeps a periodically updated list of ERC-721 tokens assigned to the currently selected address.
2020
- [**CollectiblesController**](src/CollectiblesController.ts) tracks ERC-721 and ERC-1155 tokens assigned to the currently selected address, using OpenSea to retrieve token information.
2121
- [**CurrencyRateController**](src/CurrencyRateController.ts) keeps a periodically updated value of the exchange rate from the currently selected "native" currency to another (handling testnet tokens specially).
22+
- [**DeFiPositionsController**](src/DeFiPositionsController/DeFiPositionsController.ts.ts) keeps a periodically updated value of the DeFi positions for the owner EVM addresses.
2223
- [**RatesController**](src/RatesController/RatesController.ts) keeps a periodically updated value for the exchange rates for different cryptocurrencies. The difference between the `RatesController` and `CurrencyRateController` is that the second one is coupled to the `NetworksController` and is EVM specific, whilst the first one can handle different blockchain currencies like BTC and SOL.
2324
- [**TokenBalancesController**](src/TokenBalancesController.ts) keeps a periodically updated set of balances for the current set of ERC-20 tokens.
2425
- [**TokenDetectionController**](src/TokenDetectionController.ts) keeps a periodically updated list of ERC-20 tokens assigned to the currently selected address.

packages/assets-controllers/jest.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ module.exports = merge(baseConfig, {
1414
// The display name when running multiple projects
1515
displayName,
1616

17+
// An array of regexp pattern strings used to skip coverage collection
18+
coveragePathIgnorePatterns: [
19+
...baseConfig.coveragePathIgnorePatterns,
20+
'/__fixtures__/',
21+
],
22+
1723
// An object that configures minimum threshold enforcement for coverage results
1824
coverageThreshold: {
1925
global: {

packages/assets-controllers/package.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/assets-controllers",
3-
"version": "56.0.0",
3+
"version": "59.0.0",
44
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
55
"keywords": [
66
"MetaMask",
@@ -62,7 +62,7 @@
6262
"@metamask/metamask-eth-abis": "^3.1.1",
6363
"@metamask/polling-controller": "^13.0.0",
6464
"@metamask/rpc-errors": "^7.0.2",
65-
"@metamask/snaps-utils": "^8.10.0",
65+
"@metamask/snaps-utils": "^9.2.0",
6666
"@metamask/utils": "^11.2.0",
6767
"@types/bn.js": "^5.1.5",
6868
"@types/uuid": "^8.3.0",
@@ -81,15 +81,16 @@
8181
"@metamask/approval-controller": "^7.1.3",
8282
"@metamask/auto-changelog": "^3.4.4",
8383
"@metamask/ethjs-provider-http": "^0.3.0",
84-
"@metamask/keyring-controller": "^21.0.2",
84+
"@metamask/keyring-controller": "^21.0.4",
8585
"@metamask/keyring-internal-api": "^6.0.1",
8686
"@metamask/keyring-snap-client": "^4.1.0",
8787
"@metamask/network-controller": "^23.2.0",
8888
"@metamask/permission-controller": "^11.0.6",
8989
"@metamask/preferences-controller": "^17.0.0",
90-
"@metamask/providers": "^18.1.1",
91-
"@metamask/snaps-controllers": "^9.19.0",
92-
"@metamask/snaps-sdk": "^6.17.1",
90+
"@metamask/providers": "^21.0.0",
91+
"@metamask/snaps-controllers": "^11.2.1",
92+
"@metamask/snaps-sdk": "^6.22.0",
93+
"@metamask/transaction-controller": "^54.2.0",
9394
"@types/jest": "^27.4.1",
9495
"@types/lodash": "^4.14.191",
9596
"@types/node": "^16.18.54",
@@ -111,8 +112,9 @@
111112
"@metamask/network-controller": "^23.0.0",
112113
"@metamask/permission-controller": "^11.0.0",
113114
"@metamask/preferences-controller": "^17.0.0",
114-
"@metamask/providers": "^18.1.0",
115-
"@metamask/snaps-controllers": "^9.19.0",
115+
"@metamask/providers": "^21.0.0",
116+
"@metamask/snaps-controllers": "^11.0.0",
117+
"@metamask/transaction-controller": "^54.0.0",
116118
"webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0"
117119
},
118120
"engines": {

0 commit comments

Comments
 (0)