pendulum-chain / portal

The Pendulum/Amplitude portal UI
GNU General Public License v3.0
1 stars 1 forks source link

Bridge back to stellar - max amount chosen by the user allow for the amount that is incompatible #506

Open Sharqiewicz opened 1 week ago

Sharqiewicz commented 1 week ago

What:

Context When choosing 'Back to Stellar' and entering 'Max,' the amount prefilled by the system is half the available funds and correct, but the error message after the transaction is signed indicates that the amount is incompatible.

How:

✅ Implement maxDecimal to be also applied for StandardFrom AvailableActions

netlify[bot] commented 1 week ago

Deploy Preview for rococo-souffle-a625f5 ready!

Name Link
Latest commit b2174b06a87e432ca3ebcff150f23c8714bf62b2
Latest deploy log https://app.netlify.com/sites/rococo-souffle-a625f5/deploys/667c476d17bae900083eece9
Deploy Preview https://deploy-preview-506--rococo-souffle-a625f5.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

ebma commented 1 week ago

I noticed another bug:

  1. Enter any amount with 7 decimals in the input field for issuing/redeeming with Spacewalk. Let's say: 1.1234567
  2. Put the input cursor anywhere in the input field.
  3. When entering a new digit, the cursor will jump to the end and replace the last digit. However, I should be able to add/change the digits in front of the ., even if the number already has 7 decimals.
Sharqiewicz commented 6 days ago

@ebma Excellent catch, I am working on it ✅

annatekl commented 6 days ago

@vadaynujra can you please test once done?

Sharqiewicz commented 6 days ago

@ebma I refactored the whole implementation of NumericInput events handling.

Please take a look and let me know if everything is right.

annatekl commented 6 days ago

I was testing again on the same deployment link @Sharqiewicz and while manual input is correct the error with the cursor jumping to the last digit is still there and additionally when clicking on max there is the infinit number as in the attachementScreenshot 2024-06-26 at 19.27.24.png

Sharqiewicz commented 6 days ago

@annatekl The photo isn't loading. The cursor jumps to the end of the number only if the number already has a maximum decimal and the user overwrites a new number in decimal part (without using backspace first) - otherwise the cursor doesn't jump around. What is the expected behaviour here?

Now it works like this: (max decimals is 7) ( | is the cursor )

As the user tries to exceed the maximum number of decimal places, the decimal part of the number (starting from the changed second position) is moved by one. Therefore, the cursor has moved to the end, because the entire decimal part is changed

If user uses the backspace case:

vadaynujra commented 5 days ago

Based on the explanation, I could imagine this to be the expected behavior. @ebma do you expect the cursor to stay at the same place also in the first case?

ebma commented 5 days ago

I think the input field works great now. @annatekl shared a screenshot where the input was filled with 2.5164e-8 after clicking the MAX button. I can't reproduce because I don't have an account with that balance.

@Sharqiewicz can we maybe have a test that simulates the behaviour of MAX when a user has a balance of 0.000000025164 (decimal) ie. a raw balance of 25,164 units?