harden: resolve the swap approval screen's token scale, or refuse to format (closes #340)
tokenInfo() in src/shared/uniswap.js returned decimals: 18 for any token absent from the bundled token list, the same guessed scale that issue 306 removed from the ERC-20 amount line of the same screen. A 1,000-token swap of a 6-decimal token was therefore stated as 0.000000001, a wrong number rather than an imprecise one, and every newly listed token reached it. The swap's Amount and Min. received lines now resolve the scale through resolveTokenDecimals() -- the bundled list, then the tokens the user tracks, then the decimals the block explorer reported -- and where none of those answers they render unknownDecimalsAmount(), the base-unit integer with the scale stated, which is the same refusal the ERC-20 line already makes. No new data source and no network call: the scale comes only from what the wallet already holds, so the screen still makes no request before showing what is being signed. uniswap.decode() takes those sources as a third argument, supplied by decodeCalldata() from state alongside the ones the ERC-20 path already used. An unbounded permit needs no scale to describe and is still shown as Unlimited. README.md records the rule as a Display Consistency exception.
This commit is contained in:
14
TODO.md
14
TODO.md
@@ -45,6 +45,20 @@ but the review is broader than any of them.
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-08-23: The swap approval screen no longer guesses 18 decimals for a token
|
||||
outside the bundled list
|
||||
([#340](https://git.eeqj.de/sneak/AutistMask/issues/340)). `tokenInfo()` in
|
||||
`src/shared/uniswap.js` returned `decimals: 18` for any such token — the same
|
||||
assumption [#306](https://git.eeqj.de/sneak/AutistMask/issues/306) removed
|
||||
from the ERC-20 amount line — so a 1,000-unit swap of a 6-decimal token was
|
||||
stated as `0.000000001`, and every newly listed token reached it. The swap's
|
||||
`Amount` and `Min. received` lines now resolve the scale through
|
||||
`resolveTokenDecimals()`, the same bundled-list-then-tracked-then-explorer
|
||||
order the ERC-20 line uses, and where nothing knows it they render
|
||||
`unknownDecimalsAmount()` — base units with the scale stated — instead of a
|
||||
number. No new data source and no network call: the scale comes only from what
|
||||
the wallet already holds. An unbounded permit is still shown as `Unlimited`.
|
||||
`README.md` records the rule as a Display Consistency exception.
|
||||
- 2026-08-23: A failed release build no longer leaves a loadable debug bundle in
|
||||
`dist/` ([#333](https://git.eeqj.de/sneak/AutistMask/issues/333)). With
|
||||
`AUTISTMASK_DEBUG=1` exported, `make build` compiled a debug bundle and failed
|
||||
|
||||
Reference in New Issue
Block a user