-
Notifications
You must be signed in to change notification settings - Fork 34
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
Handle repeated AddToMetaMask clicks #869
Conversation
✅ Deploy Preview for oasisprotocol-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I suggest a slightly more sophisticated message.
src/AddToMetaMask.tsx
Outdated
@@ -33,6 +33,8 @@ const AddToMetaMask = (props: { | |||
blockExplorerUrls: props.be, | |||
}, | |||
], | |||
}).then(response => { | |||
if (response === null) alert('Added') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change the alert to something like:
The RPC endpoint for Chain ID {props.chainId} already exists.
If you want to replace it, please remove the old RPC endpoint first and then add the new one.
if (response === null) alert('Added') | |
if (response === null) alert('Added') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This message is shown when you first add Sapphire too. We would need to measure how quickly null is returned to differentiate "already exists" vs "added first time".
- If you have OPF sapphire RPC added and you click 1RPC: metamask will ask you if you want to add 1RPC as a separate entry. No need to remove first. (if we really wanted to, I guess we could detect any existing entries with wallet_switchEthereumChain)
2a43fa7
to
fa63772
Compare
fa63772
to
55f352e
Compare
If user already has a chain added in metamask, then button does nothing. Added a message
Before, After:
before.after.webm