fix: every screen cuts amounts the same way (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, and 0.00004 USDC read 0.0000. They now show the stored decimal string through truncateAmountNeverZero(), as Send and the approval screens do. History rows take the same floor. truncateAmount() is no longer exported. balanceLine() now takes the stored balance string instead of a parsed number. Model: opus-5-5
This commit is contained in:
1 parent
c150b83322
commit
2c5364f7bf
12 files changed
+164
-79
No files matched your search
@@ -1361,6 +1361,31 @@ describe("fetchRecentTransactions merge and dedup", () => {
|
||||
expect(txs[0].holders).toBe(3500000);
|
||||
});
|
||||
|
||||
// README.md, Amounts: a nonzero amount never reads as zero.
|
||||
test("a token transfer below 0.0001 shows its first nonzero digit", async () => {
|
||||
respondWith(
|
||||
[],
|
||||
[
|
||||
{
|
||||
transaction_hash: "0x" + "4".repeat(64),
|
||||
block_number: 21000040,
|
||||
timestamp: TS,
|
||||
from: { hash: ORDINARY_PEER },
|
||||
to: { hash: VICTIM },
|
||||
total: { value: "40", decimals: "6" },
|
||||
token: {
|
||||
symbol: "USDC",
|
||||
address_hash: USDC_CONTRACT,
|
||||
holders_count: "3500000",
|
||||
},
|
||||
},
|
||||
],
|
||||
);
|
||||
|
||||
const txs = await fetchRecentTransactions(VICTIM, BLOCKSCOUT, "0x1");
|
||||
expect(txs[0].value).toBe("0.00004");
|
||||
});
|
||||
|
||||
test("two transfers of the same token in one transaction collapse to one entry", async () => {
|
||||
const hash = "0x" + "3".repeat(64);
|
||||
const leg = (value) => ({
|
||||
|
||||
Reference in new issue
Block a user