fix: the address screen shows a token just added at its fetched balance, not 0.0000 (closes #516)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

A balance refresh that returns now draws the balances on AddressDetail or
AddressToken again when that screen is up, not only the wallet list. Their
transaction lists are left alone.

Every add path on AddToken and SettingsAddToken tracks a token through
trackToken(), which gives the tracked record `balanceNotFetched: true`. While
the field is set, the token's line reads `quantity unknown` instead of 0.0000,
and Send reads its balance as unknown. refreshBalances() now resolves with the
tracked tokens whose balance it read at every address. The popup's refresh
deletes the field from those tokens in the stored record and leaves the rest of
the stored list as it is. Removing the token removes the field, and each network
keeps its own records.

Model: opus-5-5
This commit was merged in pull request #664.
This commit is contained in:
2026-11-03 02:25:25 +01:00
parent 664629a1b6
commit d89099d90a
20 changed files with 699 additions and 66 deletions
+9 -2
View File
@@ -162,7 +162,9 @@ test("a token added by contract address on Sepolia is tracked on Sepolia only",
"sepolia",
expect.anything(),
);
expect(stored().trackedTokens).toEqual([SEPOLIA_TOKEN]);
// No refresh has read the new token's balance yet.
const added = { ...SEPOLIA_TOKEN, balanceNotFetched: true };
expect(stored().trackedTokens).toEqual([added]);
await boot.click("btn-settings");
await chooseNetwork(boot, "mainnet");
@@ -174,7 +176,7 @@ test("a token added by contract address on Sepolia is tracked on Sepolia only",
await chooseNetwork(boot, "sepolia");
expect(stored().networkId).toBe("sepolia");
expect(stored().trackedTokens).toEqual([SEPOLIA_TOKEN]);
expect(stored().trackedTokens).toEqual([added]);
const onSepolia = boot.node("settings-tracked-tokens").innerHTML;
expect(onSepolia).toContain("TST");
expect(onSepolia).not.toContain("DAI");
@@ -306,6 +308,7 @@ test("a token added before this page takes another page's switch is tracked on E
symbol: "NEW",
decimals: 18,
name: "New Token",
balanceNotFetched: true,
},
]);
});
@@ -343,6 +346,7 @@ test("a token added before this page takes another page's switch joins that page
symbol: "NEW",
decimals: 18,
name: "New Token",
balanceNotFetched: true,
},
]);
});
@@ -518,6 +522,7 @@ test("a token added while a switch in Settings waits for the lock stays tracked
symbol: "NEW",
decimals: 18,
name: "New Token",
balanceNotFetched: true,
},
]);
});
@@ -578,6 +583,7 @@ test("a token added while a switch in Settings waits for another page's switch s
symbol: "NEW",
decimals: 18,
name: "New Token",
balanceNotFetched: true,
},
]);
});
@@ -632,6 +638,7 @@ test("a token added while this page waits to take another page's switch stays tr
symbol: "NEW",
decimals: 18,
name: "New Token",
balanceNotFetched: true,
},
]);
});