bitbox-wallet-app icon indicating copy to clipboard operation
bitbox-wallet-app copied to clipboard

Block explorer selection

Open NicolaLS opened this issue 2 years ago • 4 comments

Allow users to configure their preferred block explorer (from predefined selection) in the settings.

Block explorers need to be added to the AvailableExplorers struct and whitelisted in the backend. The frontend learns all available options by calling the /available-explorers endpoint. Adding options will only need a change in the backend the frontend will always show all available selections.

notes:

  • I chose to keep it simple by statically defining the AvailableExplorers of course we could also implement an interface instead that each coin can implement, this would be more elegant but I did not see the need for that.
  • I really don't like the implementation of the disable/enable "save" button (compare the json configs) see here. I don't know how to do it differently though..
  • I had to fetch the initialConfig in a different place than the config because it would always update alongside config if they were initialized in the same place loadConfig see here. I don't understand why it behaves like this, I just fetch the config again to initialize initialConfig maybe there is a better way avoiding two get requests...

Right now the frontend uses the /supported-coins endpoint to decide how many/which selection to show in the setting. This requires a keystore to be connected which is weird UX. We can fix this later by introducing a separate check for a multicoin, or bitcoin only user/wallet in the config.

Please let me know if you have suggestions for more block explorers, I just added the most popular. In case they deviate from host.com/tx/xxx (e.g. host.com?tx=xx) there needs to be more refactoring in the backend, maybe then it would make sense to define an interface rather than a static stuct for the AvailableExplorers.

NicolaLS avatar Feb 26 '24 12:02 NicolaLS

addressed your comments @benma , please resolve the threads if satisfied. also noticed I can remove GOETH and SEPETH from the config again, will wait for more feedback and do it in the next push.

NicolaLS avatar Feb 26 '24 16:02 NicolaLS

I added another commit that uses accounts instead of supported-coins, but now there will not be any changes/additions anymore.

NicolaLS avatar Mar 07 '24 09:03 NicolaLS

force pushed rebase for clean diff

NicolaLS avatar Mar 27 '24 08:03 NicolaLS

Please let me know if I should add something to the CHANGELOG.md. Everything should be ready, the change requests are addressed but I leave it to @benma to resolve them. @thisconnect could you review the frontend?

NicolaLS avatar Mar 27 '24 08:03 NicolaLS