Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding edge-chromium support for createExternalExtensionProvider #318

Merged
merged 9 commits into from
Oct 3, 2024
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Added support for edge-chromium to `createExternalExtensionProvider` ([#318](https://github.com/MetaMask/providers/pull/318))

## [17.1.0]

### Changed
Expand Down
17 changes: 15 additions & 2 deletions src/extension-provider/createExternalExtensionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,20 @@ export function createExternalExtensionProvider(
* @returns The extension ID.
*/
function getExtensionId(typeOrId: ExtensionType) {
const ids =
browser?.name === 'firefox' ? config.firefoxIds : config.chromeIds;
let ids: {
stable: string;
beta: string;
flask: string;
};
switch (browser?.name) {
case 'edge-chromium':
ids = config.edgeChromiumIds;
break;
case 'firefox':
ids = config.firefoxIds;
break;
default:
ids = config.chromeIds;
}
return ids[typeOrId as keyof typeof ids] ?? typeOrId;
}
5 changes: 5 additions & 0 deletions src/extension-provider/external-extension-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"beta": "pbbkamfgmaedccnfkmjcofcecjhfgldn",
"flask": "ljfoeinjpaedjfecbmggjgodbgkmjkjk"
},
"edgeChromiumIds": {
"stable": "ejbalbakoplchlghecdalmeeeajnimhm",
"beta": "pbbkamfgmaedccnfkmjcofcecjhfgldn",
"flask": "ljfoeinjpaedjfecbmggjgodbgkmjkjk"
},
"firefoxIds": {
"stable": "webextension@metamask.io",
"beta": "webextension-beta@metamask.io",
Expand Down
Loading