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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.0000until a refresh has read it.applyChainSwitchFields()sets each address'sbalanceto"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
addr.balancetreat it as unknown too, never as zero.next.Model: opus-5-5
Plan: one PR to
next, after #718, which shareshome.js,addressDetail.jsandaddressToken.js.An address's
balanceisnulluntil a refresh has read it, the same way a token balance that nothing knows already is.nullis set where the balance is reset or starts:applyChainSwitchFields(),copyChainSwitchFields()andsrc/shared/chainSwitch.jsfor a switch, andaddWallet.jsandhome.jsfor a new address.addr.balancestates it as unknown, never as zero.balanceLinesForAddress(),addressToken.jsand Home's row useunknownableAmount(). Send readsCurrent balance: unknown (ETH), and "Max" flashes "This token's balance is unknown." The USD total insrc/shared/prices.jstreats it as a part it cannot count.addressHoldsFunds()treats it as may hold funds, so the remove warning stays.home.js,addressDetail.jsandaddressToken.jsdo not readnullas zero.normalizePersisted()keepsnull.Also, from the review of #735:
doRefreshAndRender()also requires an entry inrefreshedfor every address instored.walletsbefore deletingbalanceNotFetched, 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