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. 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 is contained in:
@@ -279,10 +279,11 @@ async function bootPopup(stored, options) {
|
||||
getAddressValue: () => ({ usd: null, partial: false }),
|
||||
}));
|
||||
// scanForAddresses() answers in the real one's shape, a scan that found
|
||||
// no used address: AddWallet reads `addresses` from it.
|
||||
// no used address: AddWallet reads `addresses` from it. refreshBalances()
|
||||
// answers as a refresh that read no tracked token's balance.
|
||||
jest.doMock("../../src/shared/balances", () => ({
|
||||
fetchTokenBalances: jest.fn(async () => []),
|
||||
refreshBalances: jest.fn(async () => {}),
|
||||
refreshBalances: jest.fn(async () => []),
|
||||
dropUntrackedTokens: jest.requireActual("../../src/shared/balances")
|
||||
.dropUntrackedTokens,
|
||||
lookupTokenInfo: jest.fn(async () => null),
|
||||
|
||||
Reference in New Issue
Block a user