Skip to content

Commit

Permalink
adding edge-chromium support for createExternalExtensionProvider (#318)
Browse files Browse the repository at this point in the history
* adding edge-chromium support for createExternalExtensionProvider

* Update package.json version

Co-authored-by: legobeat <[email protected]>

* Update CHANGELOG.md

Co-authored-by: legobeat <[email protected]>

* Update CHANGELOG.md

Change link to file to link to pr

Co-authored-by: Elliot Winkler <[email protected]>

* chore: update test coverage thresholds

---------

Co-authored-by: legobeat <[email protected]>
Co-authored-by: Elliot Winkler <[email protected]>
Co-authored-by: legobt <[email protected]>
Co-authored-by: Maarten Zuidhoorn <[email protected]>
  • Loading branch information
5 people authored Oct 3, 2024
1 parent 5175349 commit 8ccf228
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
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.2.0]

### Changed
Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ const baseConfig = {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 64.95,
branches: 64.65,
functions: 65.65,
lines: 66.04,
statements: 66.13,
lines: 65.51,
statements: 65.61,
},
},

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": "[email protected]",
"beta": "[email protected]",
Expand Down

0 comments on commit 8ccf228

Please sign in to comment.