Skip to content

Commit

Permalink
Merge pull request #28503 from MetaMask/Version-v12.8.0
Browse files Browse the repository at this point in the history
chore: Version v12.8.0
  • Loading branch information
danjm authored Dec 3, 2024
2 parents 040cb8d + d909bde commit 7689c6e
Show file tree
Hide file tree
Showing 506 changed files with 23,260 additions and 15,497 deletions.
9 changes: 7 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ workflows:
requires:
- prep-deps
- test-e2e-chrome-webpack:
<<: *develop_master_rc_only
requires:
- prep-build-test-webpack
- get-changed-files-with-git-diff
Expand All @@ -205,6 +206,7 @@ workflows:
- prep-build-test
- get-changed-files-with-git-diff
- test-e2e-firefox:
<<: *develop_master_rc_only
requires:
- prep-build-test-mv2
- get-changed-files-with-git-diff
Expand Down Expand Up @@ -234,6 +236,9 @@ workflows:
- test-e2e-mmi-playwright:
requires:
- prep-build-test-mmi-playwright
- test-e2e-swap-playwright - OPTIONAL:
requires:
- prep-build
- test-e2e-chrome-rpc-mmi:
requires:
- prep-build-test-mmi
Expand Down Expand Up @@ -444,7 +449,7 @@ jobs:
- gh/install
- run:
name: Install dependencies
command: .circleci/scripts/install-dependencies.sh
command: yarn --immutable
- save_cache:
key: dependency-cache-{{ checksum "/tmp/YARN_VERSION" }}-{{ checksum "yarn.lock" }}
paths:
Expand Down Expand Up @@ -1192,7 +1197,7 @@ jobs:
at: .
- run:
name: test:e2e:single
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.js --browser chrome
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.ts --browser chrome
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand Down
6 changes: 5 additions & 1 deletion .circleci/scripts/git-diff-develop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type PRInfo = {
ref: string;
};
body: string;
labels: { name: string }[];
};

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

console.log(
`Determining whether this run is for a PR targeting ${MAIN_BRANCH}`,
`Determining whether to run git diff...`,
);
if (!PR_NUMBER) {
console.log('Not a PR, skipping git diff');
Expand All @@ -140,6 +141,9 @@ async function storeGitDiffOutputAndPrBody() {
console.log(`This is for a PR targeting '${baseRef}', skipping git diff`);
writePrBodyToFile(prInfo.body);
return;
} else if (prInfo.labels.some(label => label.name === 'skip-e2e-quality-gate')) {
console.log('PR has the skip-e2e-quality-gate label, skipping git diff');
return;
}

console.log('Attempting to get git diff...');
Expand Down
42 changes: 0 additions & 42 deletions .circleci/scripts/install-dependencies.sh

This file was deleted.

1 change: 0 additions & 1 deletion .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ ignores:
- 'crypto-browserify' # polyfill
- 'process' # polyfill
- 'stream-http' # polyfill
- 'rimraf' # misc: install helper
- 'json-schema-to-ts' # misc: typescript helper
- 'https-browserify' # polyfill
- 'path-browserify' # polyfill
Expand Down
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,5 +472,30 @@ module.exports = {
'@metamask/design-tokens/color-no-hex': 'off',
},
},
{
files: ['ui/pages/confirmations/**/*.{js,ts,tsx}'],
rules: {
'no-restricted-syntax': [
'error',
{
selector: `ImportSpecifier[imported.name=/${[
'getConversionRate',
'getCurrentChainId',
'getNativeCurrency',
'getNetworkIdentifier',
'getNftContracts',
'getNfts',
'getProviderConfig',
'getRpcPrefsForCurrentProvider',
'getUSDConversionRate',
'isCurrentProviderCustom',
]
.map((method) => `(${method})`)
.join('|')}/]`,
message: 'Avoid using global network selectors in confirmations',
},
],
},
},
],
};
6 changes: 2 additions & 4 deletions .github/workflows/add-team-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:

jobs:
add-team-label:
uses: metamask/github-tools/.github/workflows/add-team-label.yml@058012b49ff2fbd9649c566ba43b29497f93b21d
permissions:
pull-requests: write
uses: metamask/github-tools/.github/workflows/add-team-label.yml@18af6e4b56a18230d1792480e249ebc50b324927
secrets:
PERSONAL_ACCESS_TOKEN: ${{ secrets.RELEASE_LABEL_TOKEN }}
TEAM_LABEL_TOKEN: ${{ secrets.TEAM_LABEL_TOKEN }}
5 changes: 3 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import MetaMetricsProviderStorybook from './metametrics';
import testData from './test-data.js';
import { Router } from 'react-router-dom';
import { createBrowserHistory } from 'history';
import { MemoryRouter } from 'react-router-dom';
import { setBackgroundConnection } from '../ui/store/background-connection';
import { metamaskStorybookTheme } from './metamask-storybook-theme';
import { DocsContainer } from '@storybook/addon-docs';
Expand Down Expand Up @@ -147,7 +148,7 @@ const metamaskDecorator = (story, context) => {

return (
<Provider store={store}>
<Router history={history}>
<MemoryRouter>
<MetaMetricsProviderStorybook>
<AlertMetricsProvider
metrics={{
Expand All @@ -165,7 +166,7 @@ const metamaskDecorator = (story, context) => {
</I18nProvider>
</AlertMetricsProvider>
</MetaMetricsProviderStorybook>
</Router>
</MemoryRouter>
</Provider>
);
};
Expand Down
15 changes: 15 additions & 0 deletions .yarn/patches/@ledgerhq-evm-tools-npm-1.2.3-414f44baa9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/lib/message/EIP712/index.js b/lib/message/EIP712/index.js
index 5443ac06d4ef29028e3acce98210949da2ef9263..57ec8615340a9285290ad5d2c2522ed19af2d0fc 100644
--- a/lib/message/EIP712/index.js
+++ b/lib/message/EIP712/index.js
@@ -28,8 +28,8 @@ const ethers_1 = require("ethers");
const axios_1 = __importDefault(require("axios"));
const sha224_1 = __importDefault(require("crypto-js/sha224"));
const live_env_1 = require("@ledgerhq/live-env");
-const eip712_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/data/eip712"));
-const eip712_v2_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/data/eip712_v2"));
+const eip712_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/lib/data/eip712"));
+const eip712_v2_1 = __importDefault(require("@ledgerhq/cryptoassets-evm-signatures/lib/data/eip712_v2"));
// As defined in [spec](https://eips.ethereum.org/EIPS/eip-712), the properties below are all required.
function isEIP712Message(message) {
return (!!message &&
65 changes: 65 additions & 0 deletions .yarn/patches/@ledgerhq-hw-app-eth-npm-6.39.0-866309bbbe.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
diff --git a/lib/modules/EIP712/index.js b/lib/modules/EIP712/index.js
index bbca23c9a596b2b300aca0f323bad277a4190def..c85cb18c3d6ff049c442d358b4d834c04a49951f 100644
--- a/lib/modules/EIP712/index.js
+++ b/lib/modules/EIP712/index.js
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.signEIP712HashedMessage = exports.signEIP712Message = void 0;
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
const semver_1 = __importDefault(require("semver"));
-const index_1 = require("@ledgerhq/evm-tools/message/EIP712/index");
+const index_1 = require("@ledgerhq/evm-tools/lib/message/EIP712/index");
const erc20_1 = require("../../services/ledger/erc20");
const utils_1 = require("../../utils");
const loadConfig_1 = require("../../services/ledger/loadConfig");
diff --git a/lib/modules/EIP712/utils.js b/lib/modules/EIP712/utils.js
index 4f09ea8a24ae4f175f1a4d2d40999d36ffa2a915..1cc7de0d5ffd2b980741ad6d85a75792085c031b 100644
--- a/lib/modules/EIP712/utils.js
+++ b/lib/modules/EIP712/utils.js
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPayloadForFilterV2 = exports.getFilterDisplayNameAndSigBuffers = exports.getAppAndVersion = exports.getCoinRefTokensMap = exports.makeTypeEntryStructBuffer = exports.constructTypeDescByteString = exports.destructTypeFromString = exports.EIP712_TYPE_ENCODERS = exports.EIP712_TYPE_PROPERTIES = void 0;
const bignumber_js_1 = __importDefault(require("bignumber.js"));
-const index_1 = require("@ledgerhq/evm-tools/message/index");
+const index_1 = require("@ledgerhq/evm-tools/lib/message/index");
const utils_1 = require("../../utils");
/**
* @ignore for the README
diff --git a/lib/services/ledger/erc20.js b/lib/services/ledger/erc20.js
index 8fdedf8037b2684ab6d48fd279a0c014b074b676..c10cea22504a4d3cd72bfac51463e5664639d20e 100644
--- a/lib/services/ledger/erc20.js
+++ b/lib/services/ledger/erc20.js
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.byContractAddressAndChainId = exports.findERC20SignaturesInfo = void 0;
const axios_1 = __importDefault(require("axios"));
const logs_1 = require("@ledgerhq/logs");
-const index_1 = require("@ledgerhq/cryptoassets-evm-signatures/data/evm/index");
+const index_1 = require("@ledgerhq/cryptoassets-evm-signatures/lib/data/evm/index");
const loadConfig_1 = require("./loadConfig");
const asContractAddress = (addr) => {
const a = addr.toLowerCase();
diff --git a/lib/services/ledger/index.js b/lib/services/ledger/index.js
index 8385537236dfc98902376b29f712e9f7b605091a..6641b951b0c7e477fe5622c724ee22b9e5272213 100644
--- a/lib/services/ledger/index.js
+++ b/lib/services/ledger/index.js
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
// This implements the resolution of a Transaction using Ledger's own API
const logs_1 = require("@ledgerhq/logs");
const abi_1 = require("@ethersproject/abi");
-const index_1 = require("@ledgerhq/domain-service/signers/index");
+const index_1 = require("@ledgerhq/domain-service/lib/signers/index");
const erc20_1 = require("./erc20");
const contracts_1 = require("./contracts");
const nfts_1 = require("./nfts");
diff --git a/lib/utils.js b/lib/utils.js
index 027089bf09c047b34af79e3dea253d5335d336f3..1c5da628db47a33099532973de9ea634a1ee65df 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
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;
const bignumber_js_1 = require("bignumber.js");
-const index_1 = require("@ledgerhq/evm-tools/selectors/index");
+const index_1 = require("@ledgerhq/evm-tools/lib/selectors/index");
Object.defineProperty(exports, "ERC20_CLEAR_SIGNED_SELECTORS", { enumerable: true, get: function () { return index_1.ERC20_CLEAR_SIGNED_SELECTORS; } });
Object.defineProperty(exports, "ERC721_CLEAR_SIGNED_SELECTORS", { enumerable: true, get: function () { return index_1.ERC721_CLEAR_SIGNED_SELECTORS; } });
Object.defineProperty(exports, "ERC1155_CLEAR_SIGNED_SELECTORS", { enumerable: true, get: function () { return index_1.ERC1155_CLEAR_SIGNED_SELECTORS; } });
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
diff --git a/dist/assetsUtil.cjs b/dist/assetsUtil.cjs
index e90a1b6767bc8ac54b7a4d580035cf5db6861dca..a5e0f03d2541b4e3540431ef2e6e4b60fb7ae9fe 100644
index c2e83cf6caee19152aa164f1333cfef7b681e900..590b6de6e9d20ca402b82ac56b0929ab8c16c932 100644
--- a/dist/assetsUtil.cjs
+++ b/dist/assetsUtil.cjs
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
+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; } }
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;
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;
const controller_utils_1 = require("@metamask/controller-utils");
const utils_1 = require("@metamask/utils");
@@ -221,7 +222,7 @@ async function getIpfsCIDv1AndPath(ipfsUrl) {
@@ -233,7 +234,7 @@ async function getIpfsCIDv1AndPath(ipfsUrl) {
const index = url.indexOf('/');
const cid = index !== -1 ? url.substring(0, index) : url;
const path = index !== -1 ? url.substring(index) : undefined;
Expand Down
62 changes: 62 additions & 0 deletions .yarn/patches/@metamask-assets-controllers-patch-9e00573eb4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs
index ab23c95d667357db365f925c4c4acce4736797f8..8fd5efde7a3c24080f8a43f79d10300e8c271245 100644
--- a/dist/TokenDetectionController.cjs
+++ b/dist/TokenDetectionController.cjs
@@ -204,13 +204,10 @@ class TokenDetectionController extends (0, polling_controller_1.StaticIntervalPo
// Try detecting tokens via Account API first if conditions allow
if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) {
const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks);
- // If API succeeds and no chains are left for RPC detection, we can return early
- if (apiResult?.result === 'success' &&
- chainsToDetectUsingRpc.length === 0) {
- return;
+ // If the account API call failed, have those chains fall back to RPC detection
+ if (apiResult?.result === 'failed') {
+ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
}
- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection
- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
}
// Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc
if (chainsToDetectUsingRpc.length > 0) {
@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre
const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f")
.getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks)
.catch(() => null);
- if (!tokenBalancesByChain ||
- Object.keys(tokenBalancesByChain).length === 0) {
+ if (tokenBalancesByChain === null) {
return { result: 'failed' };
}
// Process each chain ID individually
diff --git a/dist/TokenDetectionController.mjs b/dist/TokenDetectionController.mjs
index f75eb5c2c74f2a9d15a79760985111171dc938e1..ebc30bb915cc39dabf49f9e0da84a7948ae1ed48 100644
--- a/dist/TokenDetectionController.mjs
+++ b/dist/TokenDetectionController.mjs
@@ -205,13 +205,10 @@ export class TokenDetectionController extends StaticIntervalPollingController()
// Try detecting tokens via Account API first if conditions allow
if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) {
const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks);
- // If API succeeds and no chains are left for RPC detection, we can return early
- if (apiResult?.result === 'success' &&
- chainsToDetectUsingRpc.length === 0) {
- return;
+ // If the account API call failed, have those chains fall back to RPC detection
+ if (apiResult?.result === 'failed') {
+ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
}
- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection
- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks);
}
// Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc
if (chainsToDetectUsingRpc.length > 0) {
@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre
const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f")
.getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks)
.catch(() => null);
- if (!tokenBalancesByChain ||
- Object.keys(tokenBalancesByChain).length === 0) {
+ if (tokenBalancesByChain === null) {
return { result: 'failed' };
}
// Process each chain ID individually
Loading

0 comments on commit 7689c6e

Please sign in to comment.