Skip to content

Commit 1e7abc4

Browse files
adonesky1jiexi
andauthored
chore: cp-12.18.0 - Remove MULTICHAIN_API feature flag and expose Multichain API on all build types (#32351)
Previously the Multichain API was only available on Flask and Beta builds. Starting in 12.18.0 we are releasing the Multichain API to all build types including `stable` [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/32351?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#4779 ## **Manual testing steps** 1. Build this branch in a normal stable build (`yarn start`) 2. Go to https://metamask.github.io/test-dapp-multichain/latest/ 3. Enter your extensionId (watch video below to see where) -> Detection on `stable` blocked by MetaMask/providers#420 4. See that you're able to connect and interact with the multichain api ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/282cfd24-428f-4eff-ab27-1a9424c27ad0 ### **After** https://github.com/user-attachments/assets/7af12e3c-05a8-4277-a439-5c54fefdd13d ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: jiexi <jiexiluan@gmail.com>
1 parent b90b376 commit 1e7abc4

10 files changed

Lines changed: 199 additions & 249 deletions

File tree

app/manifest/v2/brave.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"content_security_policy": "frame-ancestors 'none'; script-src 'self' 'wasm-unsafe-eval'; object-src 'none'; font-src 'self';",
33
"externally_connectable": {
4-
"matches": ["https://metamask.io/*"],
4+
"matches": ["http://*/*", "https://*/*"],
55
"ids": ["*"]
66
}
77
}

app/manifest/v2/chrome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"content_security_policy": "frame-ancestors 'none'; script-src 'self' 'wasm-unsafe-eval'; object-src 'none'; font-src 'self';",
33
"externally_connectable": {
4-
"matches": ["https://metamask.io/*"],
4+
"matches": ["http://*/*", "https://*/*"],
55
"ids": ["*"]
66
},
77
"minimum_chrome_version": "89"

app/manifest/v3/chrome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"sandbox": "sandbox allow-scripts; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'none'; default-src 'none'; connect-src *; font-src 'self';"
55
},
66
"externally_connectable": {
7-
"matches": ["https://metamask.io/*"],
7+
"matches": ["http://*/*", "https://*/*"],
88
"ids": ["*"]
99
},
1010
"minimum_chrome_version": "89"

app/scripts/background.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ export function setupController(
10451045

10461046
connectEip1193(portStream, remotePort.sender);
10471047

1048-
if (process.env.MULTICHAIN_API && isFirefox) {
1048+
if (isFirefox) {
10491049
const mux = setupMultiplex(portStream);
10501050
mux.ignoreStream(METAMASK_EIP_1193_PROVIDER);
10511051

@@ -1062,7 +1062,7 @@ export function setupController(
10621062
overrides?.getPortStream?.(remotePort) || new PortStream(remotePort);
10631063

10641064
const isDappConnecting = remotePort.sender.tab?.id;
1065-
if (isDappConnecting && process.env.MULTICHAIN_API) {
1065+
if (isDappConnecting) {
10661066
if (metamaskBlockedPorts.includes(remotePort.name)) {
10671067
return;
10681068
}
@@ -1084,10 +1084,6 @@ export function setupController(
10841084
};
10851085

10861086
connectCaipMultichain = (connectionStream, sender) => {
1087-
if (!process.env.MULTICHAIN_API) {
1088-
return;
1089-
}
1090-
10911087
controller.setupUntrustedCommunicationCaip({
10921088
connectionStream,
10931089
sender,

app/scripts/inpage.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,11 @@ import { initializeProvider } from '@metamask/providers/initializeInpageProvider
3838
import ObjectMultiplex from '@metamask/object-multiplex';
3939
import { pipeline } from 'readable-stream';
4040

41-
// this is currently equivalent to process.env.MULTICHAIN_API
42-
// which can't be used for conditional imports
43-
///: BEGIN:ONLY_INCLUDE_IF(build-beta,build-flask)
4441
import {
4542
getMultichainClient,
4643
getDefaultTransport,
4744
} from '@metamask/multichain-api-client';
4845
import { registerSolanaWalletStandard } from '@metamask/solana-wallet-standard';
49-
///: END:ONLY_INCLUDE_IF
5046

5147
import shouldInjectProvider from '../../shared/modules/provider-injection';
5248
import { METAMASK_EIP_1193_PROVIDER } from './constants/stream';
@@ -91,12 +87,9 @@ if (shouldInjectProvider()) {
9187
},
9288
});
9389

94-
// this is currently equivalent to process.env.MULTICHAIN_API
95-
///: BEGIN:ONLY_INCLUDE_IF(build-beta,build-flask)
9690
getMultichainClient({
9791
transport: getDefaultTransport(),
9892
}).then((client) => {
9993
registerSolanaWalletStandard({ client });
10094
});
101-
///: END:ONLY_INCLUDE_IF
10295
}

0 commit comments

Comments
 (0)