nano-wallet-company / nano-wallet-desktop

An ambitious Nano wallet for desktop and web.
https://nanowalletcompany.com
BSD 2-Clause "Simplified" License
36 stars 24 forks source link

Amounts over 1000 seem to be considered invalid #62

Closed ghost closed 4 years ago

ghost commented 6 years ago

Describe the bug It seems any amount over 999 (1000+) triggers an invalid amount error, even if the selected account has enough funds: Invalid amount

Amounts 999 and below react normally - triggering the error Amount is greater than total account balance

To Reproduce Steps to reproduce the behavior:

  1. Try to send from an account with more than 1000 balance.

Platform (please complete the following information):

Additional context Another note is that changing the account doesn't seem to trigger a refresh of the input field / re-check.

So having 999 in the send field, then changing to an account with only 300 in it doesn't trigger any update / warning. It does change the max value for the input field, so when focusing again it requires a change to register that there is an issue.

ghost commented 6 years ago

It is line 33 of account-send/component.js

intl.formatNumber(amount) will return 1,000 if input 1000 which bricks BigNumber.

Removing it solves the problem, but not sure if there's a small chance it would have a flow on affect down at toAmount - looking at it there was a chance it would have thrown a bug in future with conversions to/from raw

    const intl = this.get('intl');
    const number = BigNumber(amount);
    if (number.isNaN() || number.isNegative()) {
      changeset.pushErrors('amount', intl.t('wallets.accounts.send.invalidAmount'));
      return false;
    }
zhyatt commented 4 years ago

The NanoWalletCompany is no longer supporting this app. See https://nanowalletcompany.com/ for details. Closing.