Skip to content

Commit 5de5042

Browse files
committed
Merge remote-tracking branch 'origin/main' into refactor/app-components-v5-compat
2 parents b88e36c + 6759f3f commit 5de5042

File tree

84 files changed

+2350
-1200
lines changed

Some content is hidden

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

84 files changed

+2350
-1200
lines changed

CHANGELOG.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [13.6.0]
11+
12+
### Added
13+
14+
- Integrated Backend WebSocket Service and Account Activity Service for real-time balance updates (feature-flagged) (#36819)
15+
- Added Bitcoin provider feature flag support for runtime control via addBitcoinAccount flag (#36676)
16+
- Adds network logo and native token logo for Plasma Mainnet network (#36456)
17+
- Show skeleton loader when loading status for Shield Coverage (#36888)
18+
- Added support for the Irish (Gaeilge) language (#36088)
19+
- Added user's eligibility check for shield subscription Added an option to submit user subscription event from (#36835)
20+
the shield entry modal
21+
- Added support for Hourly, Bi-Weekly (14 days), Monthly (30 days), and Yearly (365 days) duration periods. (#36706)
22+
- Added shield subscription error toasts (#36718)
23+
- Create add funds modal (#36592)
24+
- Added new toast component (#36408)
25+
- Add file upload component (#35779)
26+
- Auto turn on some settings when shield is active (#36343)
27+
- Bitcoin v1.3.0 release. (#36753)
28+
- Integrated Shield Entry Modal with SubscriptionController (#36588)
29+
Upgraded SubscriptionController to `v1.0.0`.
30+
Added `ShieldSubscriptionContext` to watch subscription
31+
status
32+
- Added snap accounts link and account watcher option to multichain account list (#36717)
33+
- Added new label to BTC assets in the Tokens tab (#36574)
34+
- Added Bitcoin network support for Bridge functionality (#35597)
35+
- Enable BIP44 Bitcoin accounts (#36510)
36+
- Make token detail chart % change when changing time frames and hovering (#36664)
37+
- Add claims submission form (#35790)
38+
- Show user account instead of payer address in transaction shield (#36610)
39+
fix translation date for crypto insufficient funding
40+
- Adds hide and pin options to account item menu (#37012)
41+
42+
### Fixed
43+
44+
- Fixed a bug that was causing the same token to be added twice from search (#36727)
45+
- Improve perceived performance after importing a new SRP (#36882)
46+
- Empty select rpc modal (#36876)
47+
- Replace eye icon with a hover interaction to hide balances (#36543)
48+
- Fixed a bug causing users to still see tokens with zero balance when the setting "hideTokensWithZeroBalance" is enabled. (#36821)
49+
- Add changes to enable Snap accounts link to stable (#36770)
50+
- Fixed a bug that caused ENS content hashes not to resolve properly (#36812)
51+
- Correct transaction shield coverage text style (#36810)
52+
- Fixed `ShieldController.init` in `SubscriptionController:stateChange` event listener (#36779)
53+
fixed `SubscriptionController` polling
54+
refactor `useUserSubscription` hook usage.
55+
- Use template for dollar amount on locale (#36741)
56+
- Update notifications enabled by default feature flag to control rollout (#36724)
57+
- Increase our security posture by locking down `cross_origin_opener_policy` to `same-origin-allow-popups` openers only. (#36500)
58+
- Show correct available token amount in shield subscription plan (#36494)
59+
- Design team’s review have been implemented (#36523)
60+
- Helps with ongoing performance regressions when using Solana (#36613)
61+
- Fixes a bug where first permitting accounts via the EVM provider would cause all requests to the Solana Wallet Standard provider (#36434)
62+
to fail with an `The requested account and/or method has not been
63+
authorized by the user.` error until the user fully revoked dapp
64+
permissions and then permitted accounts using the Solana Wallet Standard
65+
provider first.
66+
- Patched ShieldController to `v0.3.2`. (#36809)
67+
- Fixes positioning issues for dropdowns, tooltips, and popovers (#36967)
68+
- Fixes a bug where the wallet would not prompt the user (#36963)
69+
for unlock and would silently drop personal_sign requests when the
70+
wallet was locked and the user was opted into MetaMetrics
71+
- Renders missing network row in transaction confirmations (#37048)
72+
- Adds address pattern matching to accounts list search (#37005)
73+
- Migrates user's existing pinned and hidden state to multichain account designs (#37017)
74+
- Tweaks messaging for degraded and unavailable networks (#37082)
75+
- When adding a network the selectedNetworkClientId was not being updated and many of our components still depend on it (#37062)
76+
- Ensures same toast avatar icon is displayed for the same account when switching to a different account that isn't connected (#37124)
77+
1078
## [13.5.0]
1179

1280
### Added
@@ -67,7 +135,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
67135
### Changed
68136

69137
- Removed `secure-your-wallet` page and updated `backup-seed-phrase` pages (#36152)
70-
71138
- Remove blockie-identicon and the 'blo' dependency (#36429)
72139
- Remove extra add network modal (#36309)
73140
- Changed account selector copy to read x network address(es) (#36293)
@@ -890,7 +957,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
890957
- This changelog was split off with 12.22.0
891958
- All older changes can be found in [docs/CHANGELOG_older.md](https://github.com/MetaMask/metamask-extension/blob/main/docs/CHANGELOG_older.md)
892959

893-
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v13.5.0...HEAD
960+
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v13.6.0...HEAD
961+
[13.6.0]: https://github.com/MetaMask/metamask-extension/compare/v13.5.0...v13.6.0
894962
[13.5.0]: https://github.com/MetaMask/metamask-extension/compare/v13.4.3...v13.5.0
895963
[13.4.3]: https://github.com/MetaMask/metamask-extension/compare/v13.4.2...v13.4.3
896964
[13.4.2]: https://github.com/MetaMask/metamask-extension/compare/v13.4.1...v13.4.2

app/_locales/en/messages.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/en_GB/messages.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/scripts/background.js

Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,30 @@ const sendReadyMessageToTabs = async () => {
272272
* @param {MetamaskController} theController
273273
*/
274274
function maybeDetectPhishing(theController) {
275+
/**
276+
* Redirects a tab to the phishing warning page.
277+
*
278+
* @param {number} tabId - The ID of the tab to redirect
279+
* @param {string} url - The URL to redirect to (phishing warning page)
280+
* @returns {Promise<boolean>} Returns true if the redirect was successful, false otherwise.
281+
* Returns false for Google pre-fetch requests or if the redirect fails.
282+
*/
275283
async function redirectTab(tabId, url) {
276284
try {
277-
return await browser.tabs.update(tabId, {
285+
const tab = await browser.tabs.get(tabId);
286+
287+
// Prevent redirect when due to Google pre-fetching
288+
if (tab.url && tab.url.startsWith('https://www.google.com/search')) {
289+
return false;
290+
}
291+
292+
await browser.tabs.update(tabId, {
278293
url,
279294
});
295+
return true;
280296
} catch (error) {
281-
return sentry?.captureException(error);
297+
sentry?.captureException(error);
298+
return false;
282299
}
283300
}
284301
// we can use the blocking API in MV2, but not in MV3
@@ -354,47 +371,59 @@ function maybeDetectPhishing(theController) {
354371
blockedUrl = details.initiator;
355372
}
356373

357-
if (!isFirefox) {
358-
theController.metaMetricsController.trackEvent(
359-
{
360-
// should we differentiate between background redirection and content script redirection?
361-
event: MetaMetricsEventName.PhishingPageDisplayed,
362-
category: MetaMetricsEventCategory.Phishing,
363-
properties: {
364-
url: blockedUrl,
365-
referrer: {
366-
url: blockedUrl,
367-
},
368-
reason: blockReason,
369-
requestDomain: blockedRequestResponse.result
370-
? hostname
371-
: undefined,
372-
},
373-
},
374-
{
375-
excludeMetaMetricsId: true,
376-
},
377-
);
378-
}
379374
const querystring = new URLSearchParams({ hostname, href });
380375
const redirectUrl = new URL(phishingPageHref);
381376
redirectUrl.hash = querystring.toString();
382377
const redirectHref = redirectUrl.toString();
383378

379+
// Helper function to track phishing page metrics
380+
const trackPhishingMetrics = () => {
381+
if (!isFirefox) {
382+
theController.metaMetricsController.trackEvent(
383+
{
384+
// should we differentiate between background redirection and content script redirection?
385+
event: MetaMetricsEventName.PhishingPageDisplayed,
386+
category: MetaMetricsEventCategory.Phishing,
387+
properties: {
388+
url: blockedUrl,
389+
referrer: {
390+
url: blockedUrl,
391+
},
392+
reason: blockReason,
393+
requestDomain: blockedRequestResponse.result
394+
? hostname
395+
: undefined,
396+
},
397+
},
398+
{
399+
excludeMetaMetricsId: true,
400+
},
401+
);
402+
}
403+
};
404+
384405
// blocking is better than tab redirection, as blocking will prevent
385406
// the browser from loading the page at all
386407
if (isManifestV2) {
387408
// We can redirect `main_frame` requests directly to the warning page.
388409
// For non-`main_frame` requests (e.g. `sub_frame` or WebSocket), we cancel them
389410
// and redirect the whole tab asynchronously so that the user sees the warning.
390411
if (details.type === 'main_frame') {
412+
trackPhishingMetrics();
391413
return { redirectUrl: redirectHref };
392414
}
393-
redirectTab(details.tabId, redirectHref);
415+
redirectTab(details.tabId, redirectHref).then((redirected) => {
416+
if (redirected) {
417+
trackPhishingMetrics();
418+
}
419+
});
394420
return { cancel: true };
395421
}
396-
// redirect the whole tab (even if it's a sub_frame request)
397-
redirectTab(details.tabId, redirectHref);
422+
redirectTab(details.tabId, redirectHref).then((redirected) => {
423+
if (redirected) {
424+
trackPhishingMetrics();
425+
}
426+
});
398427
return {};
399428
},
400429
{

app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { RpcEndpointType } from '@metamask/network-controller';
44
import { rpcErrors } from '@metamask/rpc-errors';
55
import { cloneDeep } from 'lodash';
66
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
7+
import { FEATURED_RPCS } from '../../../../../shared/constants/network';
78
import {
89
validateAddEthereumChainParams,
910
switchChain,
@@ -134,9 +135,6 @@ async function addEthereumChainHandler(
134135
rpcIndex = clonedNetwork.rpcEndpoints.length - 1;
135136
}
136137

137-
// The provided rpc endpoint becomes the default
138-
clonedNetwork.defaultRpcEndpointIndex = rpcIndex;
139-
140138
if (firstValidBlockExplorerUrl) {
141139
// If a block explorer was provided and it doesn't exist, add a new one
142140
if (blockExplorerIndex === -1) {
@@ -163,6 +161,13 @@ async function addEthereumChainHandler(
163161
);
164162
} else {
165163
// A network for this chain id does not exist, so add a new network
164+
165+
// If a featured RPC endpoint exists for this chain, include it and keep it as default
166+
const featured = FEATURED_RPCS.find((f) => f.chainId === chainId);
167+
const featuredEndpoint = featured
168+
? featured.rpcEndpoints[featured.defaultRpcEndpointIndex]
169+
: undefined;
170+
166171
updatedNetwork = await addNetwork({
167172
blockExplorerUrls: firstValidBlockExplorerUrl
168173
? [firstValidBlockExplorerUrl]
@@ -171,10 +176,12 @@ async function addEthereumChainHandler(
171176
? 0
172177
: undefined,
173178
chainId,
179+
// Keep featured (if present) as the first and default endpoint
174180
defaultRpcEndpointIndex: 0,
175181
name: chainName,
176182
nativeCurrency: ticker,
177183
rpcEndpoints: [
184+
...(featuredEndpoint ? [featuredEndpoint] : []),
178185
{
179186
url: firstValidRPCUrl,
180187
name: chainName,
@@ -188,8 +195,16 @@ async function addEthereumChainHandler(
188195
}
189196
}
190197

191-
const { networkClientId } =
192-
updatedNetwork.rpcEndpoints[updatedNetwork.defaultRpcEndpointIndex];
198+
const existingNetworkClientId =
199+
existingNetwork?.rpcEndpoints?.[existingNetwork.defaultRpcEndpointIndex]
200+
?.networkClientId;
201+
202+
const updatedNetworkClientId =
203+
updatedNetwork?.rpcEndpoints?.[updatedNetwork.defaultRpcEndpointIndex]
204+
?.networkClientId;
205+
206+
// Determines the specific RPC endpoint to use
207+
const networkClientId = existingNetworkClientId ?? updatedNetworkClientId;
193208

194209
return switchChain(res, end, chainId, networkClientId, {
195210
isAddFlow: true,

0 commit comments

Comments
 (0)