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

[Bug]: Error defining custom network when the wallet is connected #15

Open
jorgemmsilva opened this issue Jun 29, 2023 · 6 comments
Open
Labels
bug Something isn't working

Comments

@jorgemmsilva
Copy link
Contributor

jorgemmsilva commented Jun 29, 2023

Bug description

when wallet is connected, if you try to save a new custom network, it will fail with:

: Expected an array with at least one valid string HTTPS url 'rpcUrls', Received:
undefined

Expected behavior

it should disconnect the wallet instead of erroring.

Furthermore:

  • There could be a textbox to specify a wasp-api, if that is specified, the wallet should be prompted to switch to that new jsonrpc.

Can the issue reliably be reproduced?

Yes

@jorgemmsilva jorgemmsilva added the bug Something isn't working label Jun 29, 2023
@jorgemmsilva jorgemmsilva changed the title [Bug]: [Bug]: Error defining custom network when the wallet is connected Jun 29, 2023
@begonaalvarezd
Copy link
Member

Hi @jorgemmsilva, thanks for reporting this error.

I feel like the form doesnt have the right label, where it says "network url" is where the rpc url goes
image
we could rename the label so its more clear, the network can not switch if you dont provide an rpc, so instead of allowing you to switch, we just keep you in the same network you were previously connected and display the error you mentioned

wdyt? would renaming the label be enough or are you referring to something else?

@jorgemmsilva
Copy link
Contributor Author

renaming that would be nice, I agree.

But the main issue stands, if you're connected to the testnet with a wallet and try to set a new custom network without a rpc url, it will error and not let you

@begonaalvarezd
Copy link
Member

begonaalvarezd commented Jul 3, 2023

renaming that would be nice, I agree.

But the main issue stands, if you're connected to the testnet with a wallet and try to set a new custom network without a rpc url, it will error and not let you

rpcs is a required param, the error we display is thrown by metamask, you cant connect to a network without specifying at least 1 rpc https://docs.metamask.io/wallet/reference/rpc-api/#wallet_addethereumchain thats why we dont disconnect from the current connection

@jorgemmsilva
Copy link
Contributor Author

🤷 but why not just save the custom network anyway? as it stands the modal just keeps opened for no reason.

@begonaalvarezd
Copy link
Member

🤷 but why not just save the custom network anyway? as it stands the modal just keeps opened for no reason.

I dont think that saving something that is not complete or correct is right. In this case, because the form validation is not succesful it doesnt get saved, hence the popup doesnt close, it is not great UX closing an reseting form popups when the action didnt succeed because you will need to open it again and fill it again to complete it correctly

@jorgemmsilva
Copy link
Contributor Author

It works perfectly if you're not connected, that field is not even mandatory...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants