fix: Send refuses every amount the confirmation screen would refuse (closes #532)
Send accepted any amount parseFloat() read as above zero, so "1e-3", "1abc" and an amount with a nonzero digit past the token's decimal places reached ConfirmTx, which then refused them. isValidAmount() in src/shared/txValidation.js is now the one check: Review and Max on Send call it with the token's decimal places, and validateTransfer() calls it for ConfirmTx, which now also refuses a zero amount and a token amount with a nonzero digit past the token's places. Zeros past those places are accepted, since the amount encoded for the transfer is the same. Model: opus-5-5
This commit is contained in:
@@ -1686,7 +1686,13 @@ view would leave a wallet one click from deletion.
|
||||
- **Transitions**:
|
||||
- "Review" (valid inputs, ENS resolved) → **ConfirmTx**
|
||||
- "Review" with an unresolvable ENS name or an invalid amount → flash
|
||||
message, no screen change
|
||||
message, no screen change. An amount is valid when it is a number above
|
||||
zero, written as digits with at most one decimal point, with nothing but
|
||||
zeros after the token's last decimal place. ETH has 18 places, and a token
|
||||
with more, or with an unknown number, is held to 18. Zeros past those
|
||||
places leave the amount unchanged, so `1.0000000` of a 6-place token
|
||||
passes and is sent as exactly 1. ConfirmTx makes the same check before
|
||||
anything can be sent
|
||||
- "Back" → previous screen (Home, AddressDetail, or AddressToken)
|
||||
|
||||
#### ConfirmTx (`confirm-tx`)
|
||||
|
||||
Reference in New Issue
Block a user