Skip to content

Commit

Permalink
Merge branch 'develop' into improv/account_syncing_various_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuartu committed Nov 19, 2024
2 parents 8a6691c + 3c51786 commit 5346252
Show file tree
Hide file tree
Showing 56 changed files with 1,582 additions and 789 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,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
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
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [12.7.0]
### Added
- Added Token Network Filter UI, allowing users to filter tokens by network (behind a feature flag) ([#27884](https://github.com/MetaMask/metamask-extension/pull/27884))
- Added Ape token icon for mainnet ([#27974](https://github.com/MetaMask/metamask-extension/pull/27974))
- Implemented redesigned native asset transfer for both wallet-initiated and dApp-initiated confirmations ([#27979](https://github.com/MetaMask/metamask-extension/pull/27979))
- Enabled the Security Alerts API with a fallback mechanism to ensure user experience is not disrupted ([#28040](https://github.com/MetaMask/metamask-extension/pull/28040))
- Added re-simulation logic to the transaction controller ([#28104](https://github.com/MetaMask/metamask-extension/pull/28104))
- Made the message section in the signature page collapsible and added a copy option ([#28038](https://github.com/MetaMask/metamask-extension/pull/28038))
- Added token transfer confirmation for ERC721 and ERC1155 tokens ([#27955](https://github.com/MetaMask/metamask-extension/pull/27955))
- Added support for external links in feature announcements ([#26491](https://github.com/MetaMask/metamask-extension/pull/26491))
- Added a Notifications option to the settings page ([#26843](https://github.com/MetaMask/metamask-extension/pull/26843))
- Enabled the use of a preview token to view unpublished content from Contentful ([#27809](https://github.com/MetaMask/metamask-extension/pull/27809))
- Added account syncing to MetaMask, allowing users to synchronize accounts and account names across devices ([#28120](https://github.com/MetaMask/metamask-extension/pull/28120))
- Introduced a new phishing warning UI with improved design ([#27942](https://github.com/MetaMask/metamask-extension/pull/27942))
- Added a privacy mode toggle to hide and show sensitive information and token balances ([#28021](https://github.com/MetaMask/metamask-extension/pull/28021))
- Added test network to the default selected networks list if it is the globally selected network during a connection request ([#27980](https://github.com/MetaMask/metamask-extension/pull/27980))

### Changed
- Allowed users to remove Linea from the networks list and added it to the Popular Networks section ([#27512](https://github.com/MetaMask/metamask-extension/pull/27512))
- Updated transaction controller to reduce gas limit fallback and remove global network usage from transaction simulation ([#27954](https://github.com/MetaMask/metamask-extension/pull/27954))
- Reduced usage of scientific notation by implementing a decimals rounding strategy and added tooltips for full values ([#27992](https://github.com/MetaMask/metamask-extension/pull/27992))
- Improved visibility of decrypted messages and added a "scroll to bottom" button ([#27622](https://github.com/MetaMask/metamask-extension/pull/27622))
- Updated network message to show the full network name on the Review Permission and Connections pages ([#28126](https://github.com/MetaMask/metamask-extension/pull/28126))
- Removed the feature flag for the confirmations screen ([#27877](https://github.com/MetaMask/metamask-extension/pull/27877))

### Fixed
- Fixed issue where token balance showed as 0 during send flow when navigating from the token details page ([#28136](https://github.com/MetaMask/metamask-extension/pull/28136))
- Fixed issue where small spending caps were coerced to zero on the approve screen ([#28179](https://github.com/MetaMask/metamask-extension/pull/28179))
- Fixed gas calculations for low Max base fee and Priority fee ([#28037](https://github.com/MetaMask/metamask-extension/pull/28037))
- Disabled notifications when Basic functionality is turned off ([#28045])
- Fixed alignment issues of custom UI links in Snaps ([#27957](https://github.com/MetaMask/metamask-extension/pull/27957))
- Fixed misalignment of the quote rate in swaps ([#28016](https://github.com/MetaMask/metamask-extension/pull/28016))
- Prevented scrolling to the account list item on the send page to keep the relevant UI in view ([#27934](https://github.com/MetaMask/metamask-extension/pull/27934))
- Improved handling of network switching and adding networks to prevent issues with queued transactions ([#28090](https://github.com/MetaMask/metamask-extension/pull/28090))
- Prevented redirect after adding a network in Onboarding Settings ([#28165](https://github.com/MetaMask/metamask-extension/pull/28165))

## [12.6.1]
### Fixed
- Fixed gas limit estimation on Base and BNB chains ([#28327](https://github.com/MetaMask/metamask-extension/pull/28327))

## [12.6.0]
### Added
- Added the APE network icon ([#27841](https://github.com/MetaMask/metamask-extension/pull/27841))
Expand Down Expand Up @@ -5303,7 +5343,9 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
- Added the ability to restore accounts from seed words.


[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.6.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.7.0...HEAD
[12.7.0]: https://github.com/MetaMask/metamask-extension/compare/v12.6.1...v12.7.0
[12.6.1]: https://github.com/MetaMask/metamask-extension/compare/v12.6.0...v12.6.1
[12.6.0]: https://github.com/MetaMask/metamask-extension/compare/v12.5.1...v12.6.0
[12.5.1]: https://github.com/MetaMask/metamask-extension/compare/v12.5.0...v12.5.1
[12.5.0]: https://github.com/MetaMask/metamask-extension/compare/v12.4.2...v12.5.0
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/constants/sentry-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ export const SENTRY_BACKGROUND_STATE = {
[AllProperties]: false,
},
},
TokenBalancesController: {
tokenBalances: false,
},
TokenRatesController: {
marketData: false,
},
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/lib/ppom/security-alerts-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function request(endpoint: string, options?: RequestInit) {
);
}

return response.json();
return await response.json();
}

function getUrl(endpoint: string) {
Expand Down
Loading

0 comments on commit 5346252

Please sign in to comment.