1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-28 23:06:37 +01:00
metamask-extension/ui
Mark Stacey 3bd5d714f7 Allow editing max spend limit (#7919)
In the case where the initial spend limit for the `approve` function
was set to the maximum amount, editing this value would result in the
new limit being silently ignored. The transaction would be submitted
with the original max spend limit.

This occurred because function to generate the new custom data would
look for the expected spend limit in the existing data, then bail if
it was not found (and in these cases, it was never found).

The reason the value was not found is that it was erroneously being
converted to a `Number`. A JavaScript `Number` is not precise enough to
represent larger spend limits, so it would give the wrong hex value
(after rounding had taken place in the conversion to a floating-point
number).

The data string is now updated without relying upon the original token
value; the new value is inserted after the `spender` argument instead,
as the remainder of the `data` string is guaranteed to be the original
limit. Additionally, the conversion to a `Number` is now omitted so
that the custom spend limit is encoded correctly.

Fixes #7915
2020-01-29 00:46:44 -04:00
..
app Allow editing max spend limit (#7919) 2020-01-29 00:46:44 -04:00
lib Revert "Merge pull request #7599 from MetaMask/Version-v7.7.0" (#7648) 2019-12-05 10:23:43 -10:00
index.js Fix batch transaction UX (#7473) 2020-01-10 11:10:35 -04:00