The ETH line reads 0.0000 at an address no refresh has read #736

Closed
opened 2026-11-03 08:04:21 +01:00 by clawbot · 1 comment
Collaborator

Where

The ETH balance line on Home, AddressDetail and AddressToken, for an address no refresh has read.

What happens

Found by the review of #735. At an address just added, and at every address after a network switch, the ETH line reads 0.0000 until a refresh has read it. applyChainSwitchFields() sets each address's balance to "0", and a new address starts at "0.0000".

What should happen

README's balance rules say an amount that is really there is never printed as 0.0000. The ETH line at an address no refresh has read does not state zero.

Severity: minor

Definition of done

  • The ETH line at an address just added, and after a network switch, reads as unknown until a refresh has read that address, then the fetched balance.
  • Send and the other readers of addr.balance treat it as unknown too, never as zero.
  • A Jest test for a new address and for a switch, each failing on next.

Model: opus-5-5

## Where The ETH balance line on Home, AddressDetail and AddressToken, for an address no refresh has read. ## What happens Found by the review of https://git.eeqj.de/sneak/AutistMask/pulls/735. At an address just added, and at every address after a network switch, the ETH line reads `0.0000` until a refresh has read it. `applyChainSwitchFields()` sets each address's `balance` to `"0"`, and a new address starts at `"0.0000"`. ## What should happen README's balance rules say an amount that is really there is never printed as `0.0000`. The ETH line at an address no refresh has read does not state zero. Severity: minor ## Definition of done - [ ] The ETH line at an address just added, and after a network switch, reads as unknown until a refresh has read that address, then the fetched balance. - [ ] Send and the other readers of `addr.balance` treat it as unknown too, never as zero. - [ ] A Jest test for a new address and for a switch, each failing on `next`. Model: opus-5-5
clawbot self-assigned this 2026-11-03 08:04:21 +01:00
Author
Collaborator

Plan: one PR to next, after #718, which shares home.js, addressDetail.js and addressToken.js.

An address's balance is null until a refresh has read it, the same way a token balance that nothing knows already is.

  • null is set where the balance is reset or starts: applyChainSwitchFields(), copyChainSwitchFields() and src/shared/chainSwitch.js for a switch, and addWallet.js and home.js for a new address.
  • Each reader of addr.balance states it as unknown, never as zero. balanceLinesForAddress(), addressToken.js and Home's row use unknownableAmount(). Send reads Current balance: unknown (ETH), and "Max" flashes "This token's balance is unknown." The USD total in src/shared/prices.js treats it as a part it cannot count. addressHoldsFunds() treats it as may hold funds, so the remove warning stays.
  • The "no ETH" checks in home.js, addressDetail.js and addressToken.js do not read null as zero.
  • normalizePersisted() keeps null.

Also, from the review of #735: doRefreshAndRender() also requires an entry in refreshed for every address in stored.wallets before deleting balanceNotFetched, with a test, and README's sentence reads "until a refresh in the popup has read".

Tests as in the definition of done.

Model: opus-5-5

Plan: one PR to `next`, after https://git.eeqj.de/sneak/AutistMask/issues/718, which shares `home.js`, `addressDetail.js` and `addressToken.js`. An address's `balance` is `null` until a refresh has read it, the same way a token balance that nothing knows already is. - `null` is set where the balance is reset or starts: `applyChainSwitchFields()`, `copyChainSwitchFields()` and `src/shared/chainSwitch.js` for a switch, and `addWallet.js` and `home.js` for a new address. - Each reader of `addr.balance` states it as unknown, never as zero. `balanceLinesForAddress()`, `addressToken.js` and Home's row use `unknownableAmount()`. Send reads `Current balance: unknown (ETH)`, and "Max" flashes "This token's balance is unknown." The USD total in `src/shared/prices.js` treats it as a part it cannot count. `addressHoldsFunds()` treats it as may hold funds, so the remove warning stays. - The "no ETH" checks in `home.js`, `addressDetail.js` and `addressToken.js` do not read `null` as zero. - `normalizePersisted()` keeps `null`. Also, from the review of https://git.eeqj.de/sneak/AutistMask/pulls/735: `doRefreshAndRender()` also requires an entry in `refreshed` for every address in `stored.wallets` before deleting `balanceNotFetched`, with a test, and README's sentence reads "until a refresh in the popup has read". Tests as in the definition of done. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#736