Skip to content

Commit 7689c6e

Browse files
authored
Merge pull request #28503 from MetaMask/Version-v12.8.0
chore: Version v12.8.0
2 parents 040cb8d + d909bde commit 7689c6e

File tree

506 files changed

+23260
-15497
lines changed

Some content is hidden

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

506 files changed

+23260
-15497
lines changed

.circleci/config.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ workflows:
197197
requires:
198198
- prep-deps
199199
- test-e2e-chrome-webpack:
200+
<<: *develop_master_rc_only
200201
requires:
201202
- prep-build-test-webpack
202203
- get-changed-files-with-git-diff
@@ -205,6 +206,7 @@ workflows:
205206
- prep-build-test
206207
- get-changed-files-with-git-diff
207208
- test-e2e-firefox:
209+
<<: *develop_master_rc_only
208210
requires:
209211
- prep-build-test-mv2
210212
- get-changed-files-with-git-diff
@@ -234,6 +236,9 @@ workflows:
234236
- test-e2e-mmi-playwright:
235237
requires:
236238
- prep-build-test-mmi-playwright
239+
- test-e2e-swap-playwright - OPTIONAL:
240+
requires:
241+
- prep-build
237242
- test-e2e-chrome-rpc-mmi:
238243
requires:
239244
- prep-build-test-mmi
@@ -444,7 +449,7 @@ jobs:
444449
- gh/install
445450
- run:
446451
name: Install dependencies
447-
command: .circleci/scripts/install-dependencies.sh
452+
command: yarn --immutable
448453
- save_cache:
449454
key: dependency-cache-{{ checksum "/tmp/YARN_VERSION" }}-{{ checksum "yarn.lock" }}
450455
paths:
@@ -1192,7 +1197,7 @@ jobs:
11921197
at: .
11931198
- run:
11941199
name: test:e2e:single
1195-
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.js --browser chrome
1200+
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.ts --browser chrome
11961201
no_output_timeout: 5m
11971202
- store_artifacts:
11981203
path: test-artifacts

.circleci/scripts/git-diff-develop.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type PRInfo = {
2020
ref: string;
2121
};
2222
body: string;
23+
labels: { name: string }[];
2324
};
2425

2526
/**
@@ -123,7 +124,7 @@ async function storeGitDiffOutputAndPrBody() {
123124
fs.mkdirSync(CHANGED_FILES_DIR, { recursive: true });
124125

125126
console.log(
126-
`Determining whether this run is for a PR targeting ${MAIN_BRANCH}`,
127+
`Determining whether to run git diff...`,
127128
);
128129
if (!PR_NUMBER) {
129130
console.log('Not a PR, skipping git diff');
@@ -140,6 +141,9 @@ async function storeGitDiffOutputAndPrBody() {
140141
console.log(`This is for a PR targeting '${baseRef}', skipping git diff`);
141142
writePrBodyToFile(prInfo.body);
142143
return;
144+
} else if (prInfo.labels.some(label => label.name === 'skip-e2e-quality-gate')) {
145+
console.log('PR has the skip-e2e-quality-gate label, skipping git diff');
146+
return;
143147
}
144148

145149
console.log('Attempting to get git diff...');

.circleci/scripts/install-dependencies.sh

-42
This file was deleted.

.depcheckrc.yml

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ ignores:
7070
- 'crypto-browserify' # polyfill
7171
- 'process' # polyfill
7272
- 'stream-http' # polyfill
73-
- 'rimraf' # misc: install helper
7473
- 'json-schema-to-ts' # misc: typescript helper
7574
- 'https-browserify' # polyfill
7675
- 'path-browserify' # polyfill

.eslintrc.js

+25
Original file line numberDiff line numberDiff line change
@@ -472,5 +472,30 @@ module.exports = {
472472
'@metamask/design-tokens/color-no-hex': 'off',
473473
},
474474
},
475+
{
476+
files: ['ui/pages/confirmations/**/*.{js,ts,tsx}'],
477+
rules: {
478+
'no-restricted-syntax': [
479+
'error',
480+
{
481+
selector: `ImportSpecifier[imported.name=/${[
482+
'getConversionRate',
483+
'getCurrentChainId',
484+
'getNativeCurrency',
485+
'getNetworkIdentifier',
486+
'getNftContracts',
487+
'getNfts',
488+
'getProviderConfig',
489+
'getRpcPrefsForCurrentProvider',
490+
'getUSDConversionRate',
491+
'isCurrentProviderCustom',
492+
]
493+
.map((method) => `(${method})`)
494+
.join('|')}/]`,
495+
message: 'Avoid using global network selectors in confirmations',
496+
},
497+
],
498+
},
499+
},
475500
],
476501
};

.github/workflows/add-team-label.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77

88
jobs:
99
add-team-label:
10-
uses: metamask/github-tools/.github/workflows/add-team-label.yml@058012b49ff2fbd9649c566ba43b29497f93b21d
11-
permissions:
12-
pull-requests: write
10+
uses: metamask/github-tools/.github/workflows/add-team-label.yml@18af6e4b56a18230d1792480e249ebc50b324927
1311
secrets:
14-
PERSONAL_ACCESS_TOKEN: ${{ secrets.RELEASE_LABEL_TOKEN }}
12+
TEAM_LABEL_TOKEN: ${{ secrets.TEAM_LABEL_TOKEN }}

.storybook/preview.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import MetaMetricsProviderStorybook from './metametrics';
1515
import testData from './test-data.js';
1616
import { Router } from 'react-router-dom';
1717
import { createBrowserHistory } from 'history';
18+
import { MemoryRouter } from 'react-router-dom';
1819
import { setBackgroundConnection } from '../ui/store/background-connection';
1920
import { metamaskStorybookTheme } from './metamask-storybook-theme';
2021
import { DocsContainer } from '@storybook/addon-docs';
@@ -147,7 +148,7 @@ const metamaskDecorator = (story, context) => {
147148

148149
return (
149150
<Provider store={store}>
150-
<Router history={history}>
151+
<MemoryRouter>
151152
<MetaMetricsProviderStorybook>
152153
<AlertMetricsProvider
153154
metrics={{
@@ -165,7 +166,7 @@ const metamaskDecorator = (story, context) => {
165166
</I18nProvider>
166167
</AlertMetricsProvider>
167168
</MetaMetricsProviderStorybook>
168-
</Router>
169+
</MemoryRouter>
169170
</Provider>
170171
);
171172
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/lib/message/EIP712/index.js b/lib/message/EIP712/index.js
2+
index 5443ac06d4ef29028e3acce98210949da2ef9263..57ec8615340a9285290ad5d2c2522ed19af2d0fc 100644
3+
--- a/lib/message/EIP712/index.js
4+
+++ b/lib/message/EIP712/index.js
5+
@@ -28,8 +28,8 @@ const ethers_1 = require("ethers");
6+
const axios_1 = __importDefault(require("axios"));
7+
const sha224_1 = __importDefault(require("crypto-js/sha224"));
8+
const live_env_1 = require("@ledgerhq/live-env");
9+
-const eip712_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/data/eip712"));
10+
-const eip712_v2_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/data/eip712_v2"));
11+
+const eip712_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/lib/data/eip712"));
12+
+const eip712_v2_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/lib/data/eip712_v2"));
13+
// As defined in [spec](https://eips.ethereum.org/EIPS/eip-712), the properties below are all required.
14+
function isEIP712Message(message) {
15+
return (!!message &&
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
diff --git a/lib/modules/EIP712/index.js b/lib/modules/EIP712/index.js
2+
index bbca23c9a596b2b300aca0f323bad277a4190def..c85cb18c3d6ff049c442d358b4d834c04a49951f 100644
3+
--- a/lib/modules/EIP712/index.js
4+
+++ b/lib/modules/EIP712/index.js
5+
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.signEIP712HashedMessage = exports.signEIP712Message = void 0;
7+
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
8+
const semver_1 = __importDefault(require("semver"));
9+
-const index_1 = require("@ledgerhq/evm-tools/message/EIP712/index");
10+
+const index_1 = require("@ledgerhq/evm-tools/lib/message/EIP712/index");
11+
const erc20_1 = require("../../services/ledger/erc20");
12+
const utils_1 = require("../../utils");
13+
const loadConfig_1 = require("../../services/ledger/loadConfig");
14+
diff --git a/lib/modules/EIP712/utils.js b/lib/modules/EIP712/utils.js
15+
index 4f09ea8a24ae4f175f1a4d2d40999d36ffa2a915..1cc7de0d5ffd2b980741ad6d85a75792085c031b 100644
16+
--- a/lib/modules/EIP712/utils.js
17+
+++ b/lib/modules/EIP712/utils.js
18+
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19+
Object.defineProperty(exports, "__esModule", { value: true });
20+
exports.getPayloadForFilterV2 = exports.getFilterDisplayNameAndSigBuffers = exports.getAppAndVersion = exports.getCoinRefTokensMap = exports.makeTypeEntryStructBuffer = exports.constructTypeDescByteString = exports.destructTypeFromString = exports.EIP712_TYPE_ENCODERS = exports.EIP712_TYPE_PROPERTIES = void 0;
21+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
22+
-const index_1 = require("@ledgerhq/evm-tools/message/index");
23+
+const index_1 = require("@ledgerhq/evm-tools/lib/message/index");
24+
const utils_1 = require("../../utils");
25+
/**
26+
* @ignore for the README
27+
diff --git a/lib/services/ledger/erc20.js b/lib/services/ledger/erc20.js
28+
index 8fdedf8037b2684ab6d48fd279a0c014b074b676..c10cea22504a4d3cd72bfac51463e5664639d20e 100644
29+
--- a/lib/services/ledger/erc20.js
30+
+++ b/lib/services/ledger/erc20.js
31+
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
32+
exports.byContractAddressAndChainId = exports.findERC20SignaturesInfo = void 0;
33+
const axios_1 = __importDefault(require("axios"));
34+
const logs_1 = require("@ledgerhq/logs");
35+
-const index_1 = require("@ledgerhq/cryptoassets-evm-signatures/data/evm/index");
36+
+const index_1 = require("@ledgerhq/cryptoassets-evm-signatures/lib/data/evm/index");
37+
const loadConfig_1 = require("./loadConfig");
38+
const asContractAddress = (addr) => {
39+
const a = addr.toLowerCase();
40+
diff --git a/lib/services/ledger/index.js b/lib/services/ledger/index.js
41+
index 8385537236dfc98902376b29f712e9f7b605091a..6641b951b0c7e477fe5622c724ee22b9e5272213 100644
42+
--- a/lib/services/ledger/index.js
43+
+++ b/lib/services/ledger/index.js
44+
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
45+
// This implements the resolution of a Transaction using Ledger's own API
46+
const logs_1 = require("@ledgerhq/logs");
47+
const abi_1 = require("@ethersproject/abi");
48+
-const index_1 = require("@ledgerhq/domain-service/signers/index");
49+
+const index_1 = require("@ledgerhq/domain-service/lib/signers/index");
50+
const erc20_1 = require("./erc20");
51+
const contracts_1 = require("./contracts");
52+
const nfts_1 = require("./nfts");
53+
diff --git a/lib/utils.js b/lib/utils.js
54+
index 027089bf09c047b34af79e3dea253d5335d336f3..1c5da628db47a33099532973de9ea634a1ee65df 100644
55+
--- a/lib/utils.js
56+
+++ b/lib/utils.js
57+
@@ -2,7 +2,7 @@
58+
Object.defineProperty(exports, "__esModule", { value: true });
59+
exports.mergeResolutions = exports.nftSelectors = exports.tokenSelectors = exports.intAsHexBytes = exports.decodeTxInfo = exports.maybeHexBuffer = exports.hexBuffer = exports.splitPath = exports.padHexString = exports.ERC1155_CLEAR_SIGNED_SELECTORS = exports.ERC721_CLEAR_SIGNED_SELECTORS = exports.ERC20_CLEAR_SIGNED_SELECTORS = void 0;
60+
const bignumber_js_1 = require("bignumber.js");
61+
-const index_1 = require("@ledgerhq/evm-tools/selectors/index");
62+
+const index_1 = require("@ledgerhq/evm-tools/lib/selectors/index");
63+
Object.defineProperty(exports, "ERC20_CLEAR_SIGNED_SELECTORS", { enumerable: true, get: function () { return index_1.ERC20_CLEAR_SIGNED_SELECTORS; } });
64+
Object.defineProperty(exports, "ERC721_CLEAR_SIGNED_SELECTORS", { enumerable: true, get: function () { return index_1.ERC721_CLEAR_SIGNED_SELECTORS; } });
65+
Object.defineProperty(exports, "ERC1155_CLEAR_SIGNED_SELECTORS", { enumerable: true, get: function () { return index_1.ERC1155_CLEAR_SIGNED_SELECTORS; } });

.yarn/patches/@metamask-assets-controllers-npm-41.0.0-57b3d695bb.patch renamed to .yarn/patches/@metamask-assets-controllers-npm-43.1.1-c223d56176.patch

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
diff --git a/dist/assetsUtil.cjs b/dist/assetsUtil.cjs
2-
index e90a1b6767bc8ac54b7a4d580035cf5db6861dca..a5e0f03d2541b4e3540431ef2e6e4b60fb7ae9fe 100644
2+
index c2e83cf6caee19152aa164f1333cfef7b681e900..590b6de6e9d20ca402b82ac56b0929ab8c16c932 100644
33
--- a/dist/assetsUtil.cjs
44
+++ b/dist/assetsUtil.cjs
55
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
66
return (mod && mod.__esModule) ? mod : { "default": mod };
77
};
88
Object.defineProperty(exports, "__esModule", { value: true });
99
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
10-
exports.fetchTokenContractExchangeRates = exports.reduceInBatchesSerially = exports.divideIntoBatches = exports.ethersBigNumberToBN = exports.addUrlProtocolPrefix = exports.getFormattedIpfsUrl = exports.getIpfsCIDv1AndPath = exports.removeIpfsProtocolPrefix = exports.isTokenListSupportedForNetwork = exports.isTokenDetectionSupportedForNetwork = exports.SupportedTokenDetectionNetworks = exports.formatIconUrlWithProxy = exports.formatAggregatorNames = exports.hasNewCollectionFields = exports.compareNftMetadata = exports.TOKEN_PRICES_BATCH_SIZE = void 0;
10+
exports.fetchTokenContractExchangeRates = exports.reduceInBatchesSerially = exports.divideIntoBatches = exports.ethersBigNumberToBN = exports.addUrlProtocolPrefix = exports.getFormattedIpfsUrl = exports.getIpfsCIDv1AndPath = exports.removeIpfsProtocolPrefix = exports.isTokenListSupportedForNetwork = exports.isTokenDetectionSupportedForNetwork = exports.SupportedStakedBalanceNetworks = exports.SupportedTokenDetectionNetworks = exports.formatIconUrlWithProxy = exports.formatAggregatorNames = exports.hasNewCollectionFields = exports.compareNftMetadata = exports.TOKEN_PRICES_BATCH_SIZE = void 0;
1111
const controller_utils_1 = require("@metamask/controller-utils");
1212
const utils_1 = require("@metamask/utils");
13-
@@ -221,7 +222,7 @@ async function getIpfsCIDv1AndPath(ipfsUrl) {
13+
@@ -233,7 +234,7 @@ async function getIpfsCIDv1AndPath(ipfsUrl) {
1414
const index = url.indexOf('/');
1515
const cid = index !== -1 ? url.substring(0, index) : url;
1616
const path = index !== -1 ? url.substring(index) : undefined;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs
2+
index ab23c95d667357db365f925c4c4acce4736797f8..8fd5efde7a3c24080f8a43f79d10300e8c271245 100644
3+
--- a/dist/TokenDetectionController.cjs
4+
+++ b/dist/TokenDetectionController.cjs
5+
@@ -204,13 +204,10 @@ class TokenDetectionController extends (0, polling_controller_1.StaticIntervalPo
6+
// Try detecting tokens via Account API first if conditions allow
7+
if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) {
8+
const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks);
9+
- // If API succeeds and no chains are left for RPC detection, we can return early
10+
- if (apiResult?.result === 'success' &&
11+
- chainsToDetectUsingRpc.length === 0) {
12+
- return;
13+
+ // If the account API call failed, have those chains fall back to RPC detection
14+
+ if (apiResult?.result === 'failed') {
15+
+ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
16+
}
17+
- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection
18+
- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
19+
}
20+
// Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc
21+
if (chainsToDetectUsingRpc.length > 0) {
22+
@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre
23+
const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f")
24+
.getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks)
25+
.catch(() => null);
26+
- if (!tokenBalancesByChain ||
27+
- Object.keys(tokenBalancesByChain).length === 0) {
28+
+ if (tokenBalancesByChain === null) {
29+
return { result: 'failed' };
30+
}
31+
// Process each chain ID individually
32+
diff --git a/dist/TokenDetectionController.mjs b/dist/TokenDetectionController.mjs
33+
index f75eb5c2c74f2a9d15a79760985111171dc938e1..ebc30bb915cc39dabf49f9e0da84a7948ae1ed48 100644
34+
--- a/dist/TokenDetectionController.mjs
35+
+++ b/dist/TokenDetectionController.mjs
36+
@@ -205,13 +205,10 @@ export class TokenDetectionController extends StaticIntervalPollingController()
37+
// Try detecting tokens via Account API first if conditions allow
38+
if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) {
39+
const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks);
40+
- // If API succeeds and no chains are left for RPC detection, we can return early
41+
- if (apiResult?.result === 'success' &&
42+
- chainsToDetectUsingRpc.length === 0) {
43+
- return;
44+
+ // If the account API call failed, have those chains fall back to RPC detection
45+
+ if (apiResult?.result === 'failed') {
46+
+ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
47+
}
48+
- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection
49+
- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
50+
}
51+
// Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc
52+
if (chainsToDetectUsingRpc.length > 0) {
53+
@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre
54+
const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f")
55+
.getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks)
56+
.catch(() => null);
57+
- if (!tokenBalancesByChain ||
58+
- Object.keys(tokenBalancesByChain).length === 0) {
59+
+ if (tokenBalancesByChain === null) {
60+
return { result: 'failed' };
61+
}
62+
// Process each chain ID individually

0 commit comments

Comments
 (0)