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

prompt switch network only before transaction signing #518

Merged
merged 2 commits into from
Feb 4, 2024

Conversation

Viterbo
Copy link
Collaborator

@Viterbo Viterbo commented Jan 30, 2024

Fixes #515

Description

This PR includes a new function assertNetworkConnection for the account store that will prompt the user to change the network and block the code until the user either refuses or accepts and effectively changes the network.

It also removes the code responsible for warning the user that a network switch has been detected because we don't need it if we are only displaying data. However, when the user tries to sign a transaction we need to explicitly check the network and prompt the user to change it.

Test scenarios

  • Login using Metamask
  • Once logged, open Metamask, change the network and come back to the web app
    • you should not get any notification
    • you should be able to explore all sections and your data should be correct
  • got to any transaction page and try to perform one: e.g. liquid staking (STLOS)
    • you should be prompted to change the network
    • if you refuse to switch the network, the transaction cancels quietly
    • if you cancel the switch you get a neutral notification
    • if you accept and continue until effectively change the network, the transaction should go on without the need for you to hit the action button again.

Screnn captures

teloscan--switch-chains.webm

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have cleaned up the code in the areas my change touches
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • I have removed any unnecessary console messages
  • I have included all english text to the translation file and/or created a new issue with the required translations for the currently supported languages
  • I have tested for mobile functionality and responsiveness
  • I have added appropriate test coverage

@Viterbo Viterbo linked an issue Jan 30, 2024 that may be closed by this pull request
2 tasks
Copy link

netlify bot commented Jan 30, 2024

Deploy Preview for teloscan-stage ready!

Name Link
🔨 Latest commit 3bd8f19
🔍 Latest deploy log https://app.netlify.com/sites/teloscan-stage/deploys/65b97c59989f6c0008a209ff
😎 Deploy Preview https://deploy-preview-518--teloscan-stage.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 30, 2024

Deploy Preview for dev-mainnet-teloscan ready!

Name Link
🔨 Latest commit 3bd8f19
🔍 Latest deploy log https://app.netlify.com/sites/dev-mainnet-teloscan/deploys/65b97c5928ff3b000890f780
😎 Deploy Preview https://deploy-preview-518--dev-mainnet-teloscan.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@donnyquixotic donnyquixotic self-requested a review January 30, 2024 05:53
Copy link
Contributor

@donnyquixotic donnyquixotic left a comment

Choose a reason for hiding this comment

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

@Viterbo

  • Remove the switch notification altogether, add a network check and switch prompt to any signed transaction

  • remove network switch prompt on autologin

@Viterbo Viterbo self-assigned this Jan 30, 2024
@ezra-sg ezra-sg changed the title promt switch network only before transaction signing prompt switch network only before transaction signing Jan 30, 2024
Copy link
Contributor

@ezra-sg ezra-sg left a comment

Choose a reason for hiding this comment

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

👌 very nice

@donnyquixotic donnyquixotic merged commit 2272dff into dev Feb 4, 2024
9 checks passed
@donnyquixotic donnyquixotic deleted the 515-switch-chains-prompt branch February 4, 2024 00:37
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.

switch chains prompt
3 participants