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

Warn users when using Test Dapp on Mainnet #134

Merged
merged 2 commits into from
Nov 10, 2021
Merged

Warn users when using Test Dapp on Mainnet #134

merged 2 commits into from
Nov 10, 2021

Conversation

filipsekulic
Copy link
Contributor

Fixes: #56

If a user uses Test Dapp on Mainnet, a warning will be shown.

Screencast.2021-11-05.09.34.11.mp4

@filipsekulic filipsekulic self-assigned this Nov 5, 2021
@ghost
Copy link

ghost commented Nov 5, 2021

Verified by QA

@filipsekulic filipsekulic marked this pull request as ready for review November 5, 2021 12:20
@filipsekulic filipsekulic requested a review from a team as a code owner November 5, 2021 12:20
david0xd
david0xd previously approved these changes Nov 5, 2021
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple of minor requests.

src/index.js Outdated
Comment on lines 1071 to 1076

if (networkId === '1') {
warningDiv.classList.remove('warning-invisible');
} else {
warningDiv.classList.add('warning-invisible');
}
Copy link
Member

Choose a reason for hiding this comment

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

We're trying to avoid using the networkId as much as possible. We should move this logic to handleNewChain and check against the chainId instead, which will always be 0x1 for Mainnet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rekmarks
Resolved - f7844d1

src/index.html Outdated
class="error-message-icon
"
/>
<div class="error-message-text">You are using Test Dapp on Mainnet</div>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div class="error-message-text">You are using Test Dapp on Mainnet</div>
<div class="error-message-text">You are on the Ethereum Mainnet.</div>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rekmarks
Resolved - f7844d1

src/index.css Outdated

.warning-invisible {
display:none;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could we add a newline at the end of the file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ryanml
Resolved - f7844d1

src/index.css Outdated
}

.warning-invisible {
display:none;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
display:none;
display: none;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ryanml
Resolved - f7844d1

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@danjm danjm merged commit 0cc5b4f into MetaMask:main Nov 10, 2021
@brad-decker brad-decker mentioned this pull request Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn users when using test-dapp on Mainnet
5 participants