fix: the ETH line reads unknown at an address no refresh has read (closes #736)
An address's ETH balance is now null until a refresh has read it. That covers a new address, a new wallet, addresses a wallet scan finds, and every address after a network switch. Its line reads `quantity unknown`, Home's balance `unknown (ETH)`, and Send `Current balance: unknown (ETH)`. Max says the balance is unknown. Send is no longer refused as zero. The address has no total, and DeleteAddress keeps its warning. A refresh also deletes `balanceNotFetched` only when it read every address in the stored record. Model: opus-5-5
This commit is contained in:
@@ -432,6 +432,27 @@ describe("Max on an ETH send", () => {
|
||||
},
|
||||
);
|
||||
|
||||
test("says so when no refresh has read the ETH balance", async () => {
|
||||
await refreshWith(BALANCE_WEI);
|
||||
state.wallets[0].addresses[0].balance = null;
|
||||
openSend();
|
||||
await pressMax();
|
||||
expect(el("send-amount").value).toBe("");
|
||||
expect(text("flash-msg")).toBe("This token's balance is unknown.");
|
||||
});
|
||||
|
||||
test("fills nothing in and says nothing when a network switch cleared the balance while the fee was estimated", async () => {
|
||||
await refreshWith(BALANCE_WEI);
|
||||
openSend();
|
||||
const release = holdFeeEstimate();
|
||||
const pressed = pressMax();
|
||||
state.wallets[0].addresses[0].balance = null;
|
||||
release();
|
||||
await pressed;
|
||||
expect(el("send-amount").value).toBe("");
|
||||
expect(text("flash-msg")).toBe("");
|
||||
});
|
||||
|
||||
test("fills nothing in and says nothing once Send was left while the fee was estimated", async () => {
|
||||
// 0.0001 ETH, which does not cover the fee: a result that landed
|
||||
// would say so on whichever screen is shown.
|
||||
|
||||
Reference in New Issue
Block a user