fix: the address screen shows a token just added at its fetched balance, not 0.0000 (closes #516)
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. The popup's refresh deletes the field once it has read the token's balance at every address. refreshBalances() now resolves with those tokens. The field is part of the tracked record, so removing the token removes it, and each network keeps its own records. Model: opus-5-5
This commit is contained in:
@@ -1481,7 +1481,9 @@ send-screen token selector, the address total and the remove-address warning
|
||||
(`isBelowOneMillionth()` in `src/shared/amountDisplay.js`). The Send and
|
||||
confirmation screens show it when its token is the one being sent. Tracked
|
||||
tokens with a zero balance are listed as well while "Show tracked tokens with
|
||||
zero balance" is on.
|
||||
zero balance" is on. While that setting is on, a token just added reads
|
||||
`quantity unknown` until a refresh has read its balance at every address (see
|
||||
AddToken).
|
||||
|
||||
#### Stored state and its version
|
||||
|
||||
@@ -1665,6 +1667,13 @@ network switch (below). That popup then redraws its top screen as a reopened
|
||||
popup would. A screen that a reopened popup cannot render, such as Send, is
|
||||
replaced by Home.
|
||||
|
||||
The popup refreshes balances every ten seconds while it is open
|
||||
(`doRefreshAndRender()` in `src/popup/index.js`). Each refresh that returns
|
||||
draws the wallet list again. When AddressDetail or AddressToken is up, the
|
||||
refresh also draws that screen's USD total and balance lines again, but not its
|
||||
transaction list. A refresh draws no other screen again, DeleteAddress and its
|
||||
balance lines included.
|
||||
|
||||
A network switch leaves every screen on the page showing the previous network.
|
||||
The user makes it in Settings, or approves a site's request and the background
|
||||
saves it. Any other popup open meanwhile takes the switch from the stored
|
||||
@@ -2221,7 +2230,15 @@ view would leave a wallet one click from deletion.
|
||||
- "Add" button
|
||||
- **Transitions**:
|
||||
- "Add" (valid contract) → tracks the token, pops the stack, and re-renders
|
||||
**AddressDetail**
|
||||
**AddressDetail**. Until a balance refresh on the token's network has read
|
||||
the token's balance at every address, its line never reads `0.0000`. The
|
||||
line reads `quantity unknown` instead, or is left out while "Show tracked
|
||||
tokens with zero balance" is off. Where Blockscout already listed a
|
||||
holding of the token, the line shows that holding. Until that refresh, the
|
||||
tracked token's record carries `balanceNotFetched`, so the line still
|
||||
reads `quantity unknown` after the popup closes and opens again. A refresh
|
||||
that returns draws AddressDetail's balances again (see Navigation), so the
|
||||
fetched balance shows without the screen being reopened
|
||||
- "Add" with a token already tracked, a scam-listed address, or a failed
|
||||
contract lookup → flash message, no screen change
|
||||
- "Add", then a network switch in Settings before the contract lookup
|
||||
@@ -2522,7 +2539,9 @@ view would leave a wallet one click from deletion.
|
||||
add path
|
||||
- **Transitions**:
|
||||
- Any of the add paths shown, on success → adds the token and shows an
|
||||
"Added SYMBOL" flash message (no screen change)
|
||||
"Added SYMBOL" flash message (no screen change). Until a refresh has read
|
||||
the token's balance, its line reads `quantity unknown`, as after "Add" on
|
||||
AddToken
|
||||
- A duplicate, a scam-listed address, or a failed contract lookup → flash
|
||||
message, no screen change
|
||||
- "Add" by contract address, then a network switch in Settings before the
|
||||
|
||||
Reference in New Issue
Block a user