fix: say an unknown-scale balance the same way on Send and on confirm (closes #377)
When two addresses' explorer reports disagree on a token's decimals, the Send screen showed the stored figure while the confirmation screen said the balance was unknown. One function in send.js now gives both the balance and scale, so both read `unknown (SYMBOL)`. The confirmation screen's fee-unknown message names its cause: for an unknown scale it says the wallet does not know the token's decimal places and the transaction cannot be sent, instead of asking for a retry that cannot help. Other causes keep the old sentence. Model: opus-5-5
This commit was merged in pull request #425.
This commit is contained in:
@@ -949,6 +949,13 @@ and compare against. Reading the stored field directly instead answers `null`
|
||||
for a bundled or tracked token the explorer merely omitted, which is not a
|
||||
refusal the wallet has any reason to make.
|
||||
|
||||
The Send screen also consults every address's explorer reports, so a contract
|
||||
two addresses report different `decimals` for has no scale there, and the stored
|
||||
balance, formatted at one of those scales, is withdrawn with it. The Send
|
||||
screen's `Current balance` and the confirmation screen's balance line then both
|
||||
read `unknown (SYMBOL)`. The balance list formats each explorer row as it is
|
||||
fetched, without that cross-address check, and shows the row's figure.
|
||||
|
||||
**Decoded amount lines on the transaction approval screen:** the `Amount` line
|
||||
of a decoded ERC-20 call, and the `Amount` and `Min. received` lines of a
|
||||
decoded swap (see TxApproval below), do not always read as a number. They can
|
||||
@@ -1409,7 +1416,9 @@ view would leave a wallet one click from deletion.
|
||||
- What to send: token dropdown (or static display with contract address when
|
||||
locked from AddressToken)
|
||||
- To: address or ENS name input, with an inline validation message
|
||||
- Amount input with current balance display
|
||||
- Amount input with current balance display, which reads
|
||||
`Current balance: unknown (SYMBOL)` for a token whose scale is unknown, as
|
||||
ConfirmTx's balance line does (see Unknown token scale)
|
||||
- "Review" button, disabled until the recipient validates
|
||||
- **Transitions**:
|
||||
- "Review" (valid inputs, ENS resolved) → **ConfirmTx**
|
||||
@@ -1427,7 +1436,8 @@ view would leave a wallet one click from deletion.
|
||||
- From: blockie + color dot + full address + etherscan link + wallet title
|
||||
- To: blockie + color dot + full address + etherscan link + ENS name
|
||||
- Amount: value + symbol (USD in parentheses)
|
||||
- Your balance: value + symbol (USD in parentheses)
|
||||
- Your balance: value + symbol (USD in parentheses), or `unknown (SYMBOL)`
|
||||
for a token whose scale is unknown
|
||||
- Network fee: "Estimating..." then two lines, or "Unable to estimate",
|
||||
fetched async. The first line is what the transfer is expected to cost,
|
||||
`gasLimit * gasPrice` (USD in parentheses); the second is the
|
||||
@@ -1443,7 +1453,11 @@ view would leave a wallet one click from deletion.
|
||||
amount plus the fee exceeds the balance (ETH transfers), not enough ETH to
|
||||
pay the fee for the transfer (ERC-20 transfers), and the fee could not be
|
||||
estimated. The first two are mutually exclusive per transfer type, so only
|
||||
the applicable one holds space
|
||||
the applicable one holds space. The last names its cause: for a token
|
||||
whose scale is unknown the fee can never be estimated, and it says the
|
||||
wallet does not know how many decimal places the token uses and that the
|
||||
transaction cannot be sent; for any other failure it asks the user to go
|
||||
back and try again
|
||||
- Password: an inline field on this screen, not a modal, with its own error
|
||||
line
|
||||
- "Sign & Send" button (disabled if errors, and while the network fee
|
||||
|
||||
Reference in New Issue
Block a user