fix: every balance is cut to four decimals (closes #757)
The balance lists and Home's ETH line rounded with toFixed(4), so 0.99996 ETH read 1.0000 there and 0.9999 on Send. Send's current balance and ConfirmTx's balance line kept the nonzero floor, so 0.00004 USDC read 0.0000 in the lists and 0.00004 on Send. All four now cut the stored decimal string with truncateAmount(), as the history rows do. balanceLine() takes the stored balance string instead of a parsed number, and escapes the quantity cell. The amounts, fees and allowances a screen asks the user to approve keep the floor of truncateAmountNeverZero(). Disclosure: for a holding below 0.0001, ConfirmTx shows the amount sent beside a balance that reads 0.0000. Model: opus-5-5
This commit was merged in pull request #768.
This commit is contained in:
1 parent
32b232db60
commit
d909567ab9
15 files changed
+208
-89
No files matched your search
@@ -43,9 +43,12 @@ const {
|
||||
transferAmountUnits,
|
||||
} = require("../../shared/transferAmount");
|
||||
const { assertWithinCeilings } = require("../../shared/approvalVerify");
|
||||
// The amount, the balance line and the fee reserve go through it, as the
|
||||
// approval screen's amounts do.
|
||||
const { truncateAmountNeverZero } = require("../../shared/amountDisplay");
|
||||
// The amount and the fee reserve keep the nonzero floor, as the approval
|
||||
// screen's amounts do. The balance line is cut as the balance lists cut it.
|
||||
const {
|
||||
truncateAmount,
|
||||
truncateAmountNeverZero,
|
||||
} = require("../../shared/amountDisplay");
|
||||
const {
|
||||
CODES,
|
||||
FEE_PENDING,
|
||||
@@ -160,7 +163,7 @@ function renderBalance(txInfo) {
|
||||
const price = getPrice(txInfo.token, txInfo.chainId);
|
||||
const balUsd = price ? parseFloat(bal) * price : null;
|
||||
$("confirm-balance").textContent = valueWithUsd(
|
||||
truncateAmountNeverZero(bal) + " " + symbol,
|
||||
truncateAmount(bal) + " " + symbol,
|
||||
balUsd,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user