keep-network / tbtc-dapp

Deposit BTC and redeem TBTC
http://dapp.test.tbtc.network/
MIT License
33 stars 31 forks source link

Error when going straight to /deposit/new: "Lot size 0 is not permitted...." #294

Closed VinnyR closed 4 years ago

VinnyR commented 4 years ago

Description:

When going straight to the url

dapp.test.tbtc.network/deposit/new

an error message appears:

Lot size 0 is not permitted; only one of 100000,1000000,10000000,20000000,50000000,100000000 can be used.

This message appears even before being given the option to choose a lot size.

Steps to reproduce the behavior:

  1. Go to https://dapp.test.tbtc.network/deposit/new. The page that appears shows step 2/5 Initiating deposit.
  2. Click on 'Connect to a Wallet', select MetaMask. If not logged into MetaMask, login/unlock MetaMask.
  3. The page almost immediately shows:

Error initiating deposit

and

Lot size 0 is not permitted; only one of 100000,1000000,10000000,20000000,50000000,100000000 can be used.

Expected behavior:

When vistiting this URL, the app ought to recognise that I haven't chosen a lot size yet, and then give me the opportunity to choose a valid lot size. Or it could redirect me to dapp.test.tbtc.network if it can accurately identify that I haven't selected a lot size or completed step 1/5.

Environment details:

OS: Windows 10 Pro, Version 1909, build 18363.959, 64 bit OS
Web Browser: Google Chrome, Version 84.0.4147.89 (Official Build) (64-bit)
Wallet: Metamask (Chrome extension), Version 8.0.5

Screenshots

Console log file: dapp.test.tbtc.network-1595562195620.log Annotation 2020-07-24 044503

Shadowfiend commented 4 years ago

Thanks for the report! What's the use case in your mind here? /deposit/new is not currently linked from anywhere, and we only transition to it briefly during the deposit creation process, before we have a deposit address available. /deposit is the URL for the page where lot sizes are selected.

VinnyR commented 4 years ago

I suppose that there isn't a very strong use case here - I just happened to come accross this case when I was testing the app, and I refreshed the page while the browser was at that url.

I reproduced the issue myself by going straight to /deposit/new but originally I discovered it starting from dapp.test.tbtc.network and then I refreshed the page at step 2/5 (/deposit/new) because it was hanging (I should have probably mentioned this in the steps to reproduce).

Other than that I can only imagine that a user may visit this by accident since it's in their brower history and it may autocomplete in the address bar. I raised the issue not because I believe this page should be able to handle visits directly, but because I believe the error message could be more relevant or helpful to the user (since the message assumes a lot size of zero was selected when in reality the user hasn't chosen a lot size yet).

If the app thinks that lot size 0 has been selected, perhaps the error message could be something like "Go to step 1 to choose a lot size".

Shadowfiend commented 4 years ago

Yep, that makes a lot of sense. The reload use case in particular I think is very real. Redirecting to /deposit would be a good way to deal with this, I think.