web icon indicating copy to clipboard operation
web copied to clipboard

Consistent handling of Tx fees/minimum amounts

Open gomesalexandre opened this issue 2 years ago • 4 comments

Overview

Currently, handling Tx fees and minimum amounts across the app is either inconsistent, or not implemented at all.

We should implement a consistent way to handle:

  • minimum amounts to send/stake
    • depending on to the asset precision
    • depending on the account's balance
  • max possible amounts to send/stake, including deducted gas fees

This way, we will be able to have guarantees in validating send/staking forms and never product an invalid Tx/ (from e.g percentages) or allow to continue with user input that would result in a failing Tx.

References and additional details

This is taking over #1703 in a systematic, specced way vs. just tackling it for Cosmos.

Acceptance Criteria

  • Minimum amounts are handled across all send and staking modals
  • Max sends are working across all send and staking modals, and do not produce errors on max sends because of the lack of network fees subtraction
  • When the resulting amount is effectively negative, it is zero'd out

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

gomesalexandre avatar Jun 06 '22 21:06 gomesalexandre

Blocked by DeFi UI PR https://github.com/shapeshift/web/issues/2219 We could start work on this after the aforementioned PR is merged

gomesalexandre avatar Jul 30 '22 11:07 gomesalexandre

With #2219 merged, I'm removing the blocked and low priority tags and recommend prioritizing this. Cosmos staking is one of our strongest rev streams, and often users want to stake the Max amount, but currently this happy path results in an error.

willyogo avatar Oct 02 '22 16:10 willyogo

@willyogo The max. ATOM issue has been fixed on the lib side, meaning users can now send max. amount of ATOM with the conservative fee properly deducted

image image

IMO, with this now fixed, we should be able to close this issue. The issue with having some amount of ATOM less than the fee is still present but IMO really is just an edge case encountered during development as we're talking sub-penny amounts

image image

gomesalexandre avatar Oct 03 '22 12:10 gomesalexandre

nice! that's awesome that we've got it fixed for sending @gomesalexandre. Do we need to do anything else to make 'Max' work for staking? I just tested and am still getting "Not enough ATOM to cover gas" when attempting to stake max.

2022-10-07 13 45 34

willyogo avatar Oct 07 '22 18:10 willyogo