pendulum-chain/pendulum-webapp

Show menu to select which node to connect to

Closed this issue · 3 comments

Motivation
Since we are planning to have a self-hosted Rococo testnet and also connect to the live Rococo chain, it comes in handy to select the node to connect to. In addition, for general purposes, this is a nice feature to have.

Tasks

  • Include a menu below the pendulum logo that indicates to which node you're connecting to.
  • This menu is a dropdown, which shows a list of up to the 3 last connected nodes, and at the bottom an input field.
  • When entering text in the field, we should validate it is a ws URL, and try to connect to it.
  • While connecting, show a loading spinner.
  • If success, show a success toast message "Connected to ws://....."
  • If error, show an error toast message "Could not connect to ..."
ebma commented

We probably also need to offer something to enter a custom AMM address since the address of the deployed on-chain contract also varies for every node.

While I agree that this could be more flexible, I think it should be a privileged operation (if not, anyone could just break it), and so far we can't handle different permissions.
Considering that if we don't re-deploy any of the nodes, then the AMM address on each will remain the same, we can handle it by having two different addresses by config. Would that be enough?

I am thinking of something like:

"node1": {
    "wss_endpoint": "...",
    "amm_address": "..."
},
"node2": {
    "wss_endpoint": "...",
    "amm_address": "..."
}