-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this prevents the need for 'unsafe-inline' in the CSP to talk to MM on Firefox
- Loading branch information
1 parent
b4d1056
commit a4a54c4
Showing
5 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { WindowPostMessageStream } from '@metamask/post-message-stream' | ||
import { initializeProvider } from '@metamask/providers' | ||
|
||
try { | ||
// setup background connection | ||
const metamaskStream = new WindowPostMessageStream({ | ||
name: 'inpage', | ||
target: 'contentscript' | ||
}) | ||
|
||
// this will initialize the provider and set it as window.ethereum | ||
initializeProvider({ | ||
connectionStream: metamaskStream as any | ||
}) | ||
} catch (e) { | ||
console.error('metamaskInpageProvider:', e) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters