Skip to content

Commit

Permalink
Merge pull request #851 from makerdao/develop
Browse files Browse the repository at this point in the history
release 0.11.10
  • Loading branch information
tyler17 authored Jan 10, 2024
2 parents a5ee44e + 9c691a4 commit e563b97
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on: [push]
jobs:
unit:
runs-on: ubuntu-latest
container: cypress/browsers:node16.18.0-chrome107-ff106-edge
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function middleware(request: NextRequest) {
const cspHeader = `
default-src 'self' https://*.makerdao.com;
script-src 'self' ${
dev ? ` 'unsafe-eval' 'unsafe-inline'` : ''
dev ? "'unsafe-eval' 'unsafe-inline'" : ''
} cdn.vercel-insights.com 'nonce-${nonce}';
style-src 'self' 'unsafe-inline';
frame-src https://connect.trezor.io https://www.youtube-nocookie.com https://player.vimeo.com https://vercel.live https://verify.walletconnect.com;
Expand Down
4 changes: 4 additions & 0 deletions modules/app/components/layout/header/AccountSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { getIsMetaMask } from 'modules/web3/helpers/getIsMetaMask';
import logger from 'lib/logger';
import useSelectedConnectionStore from 'modules/app/stores/selectedConnection';
import { DialogContent, DialogOverlay } from '../../Dialog';
import { checkInjectedProvider } from 'modules/web3/helpers/checkInjectedProvider';

const closeButtonStyle: ThemeUICSSObject = {
height: 4,
Expand Down Expand Up @@ -90,6 +91,9 @@ const AccountSelect = (): React.ReactElement => {
// Temporarily close the connections modal to move focus to the WalletConnect modal
handleModalToggle(connectionType, false);

// This is needed because of this issue https://github.com/MetaMask/metamask-extension/issues/3133
checkInjectedProvider();

await connection.connector.activate();

setSelectedConnection(connection.type);
Expand Down
19 changes: 18 additions & 1 deletion modules/tags/constants/poll-tags-mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -1025,5 +1025,22 @@
"1047": ["high-impact", "risk-parameter"],
"1048": ["high-impact", "risk-parameter", "spark"],
"1049": ["high-impact", "collateral-onboard", "risk-parameter", "spark"],
"1050": ["high-impact", "collateral-onboard", "risk-parameter", "spark"]
"1050": ["high-impact", "collateral-onboard", "risk-parameter", "spark"],
"1051": ["medium-impact", "greenlight"],
"1052": ["high-impact", "risk-parameter", "spark"],
"1053": ["low-impact", "risk-parameter", "spark"],
"1054": ["medium-impact", "spark"],
"1055": ["high-impact", "risk-parameter", "d3m", "spark"],
"1056": ["high-impact", "risk-parameter", "spark"],
"1057": ["high-impact", "risk-parameter", "spark"],
"1058": ["high-impact", "ratification", "mips", "endgame"],
"1059": ["high-impact", "ratification", "mips", "endgame"],
"1060": ["high-impact", "ratification", "mips", "endgame"],
"1061": ["high-impact", "ratification", "mips", "endgame"],
"1062": ["high-impact", "risk-parameter", "spark"],
"1063": ["high-impact", "risk-parameter", "spark"],
"1064": ["high-impact", "risk-parameter", "spark"],
"1065": ["high-impact", "spark"],
"1066": ["medium-impact", "spark"],
"1067": ["high-impact", "risk-parameter", "spark"]
}
23 changes: 23 additions & 0 deletions modules/web3/helpers/checkInjectedProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { detect as detectBrowser } from 'detect-browser';
import { WindowPostMessageStream } from '@metamask/post-message-stream';
import { initializeProvider } from '@metamask/providers';

export function checkInjectedProvider() {
if (!window.ethereum) {
const browser = detectBrowser();
if (browser && browser.name === 'firefox') {
// Due to https://github.com/MetaMask/metamask-extension/issues/3133
// setup background connection
const metamaskStream = new WindowPostMessageStream({
name: 'metamask-inpage',
target: 'metamask-contentscript'
});

// this will initialize the provider and set it as window.ethereum
initializeProvider({
connectionStream: metamaskStream,
shouldShimWeb3: true
});
}
}
}
4 changes: 4 additions & 0 deletions modules/web3/hooks/useEagerlyConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import { Connector } from '@web3-react/types';
import { useEffect } from 'react';
import { useOrderedConnections } from 'modules/web3/hooks/useOrderedConnections';
import logger from 'lib/logger';
import { checkInjectedProvider } from '../helpers/checkInjectedProvider';

export async function connect(connector: Connector) {
try {
// This is needed because of this issue https://github.com/MetaMask/metamask-extension/issues/3133
checkInjectedProvider();

if (connector.connectEagerly) {
await connector.connectEagerly();
} else {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "governance-portal-v2",
"license": "AGPL-3.0-only",
"version": "0.11.8",
"version": "0.11.10",
"engines": {
"node": ">=16.0.0"
},
Expand Down Expand Up @@ -41,6 +41,8 @@
"@makerdao/dai-ui-icons": "^0.0.39",
"@makerdao/dai-ui-icons-branding": "^0.0.39",
"@makerdao/i18n-helper": "^0.1.8",
"@metamask/post-message-stream": "^7.0.0",
"@metamask/providers": "^14.0.2",
"@octokit/core": "^4.0.5",
"@reach/dialog": "^0.16.2",
"@reach/listbox": "^0.18.0",
Expand Down
Loading

1 comment on commit e563b97

@vercel
Copy link

@vercel vercel bot commented on e563b97 Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.