fix: a tracked token reads quantity unknown at an address no refresh has read (closes #720)
A new address, a new wallet and a network switch each leave tracked tokens with no balance entry, so their lines read 0.0000 before any refresh had read them. Each of these now sets `balanceNotFetched` on the tracked tokens, and a refresh already clears it. Their lines read `quantity unknown` until then. Addresses that the wallet scan finds get the same. A refresh that did not read every address the page now holds leaves the field set. Model: opus-5-5
This commit was merged in pull request #735.
This commit is contained in:
@@ -48,9 +48,14 @@ function applyChainSwitchFields(s, newNetworkId) {
|
||||
// It is a copy because a save writes a changed s.networkTrackedTokens whole,
|
||||
// over any list another page stored. An add or removal on the active network
|
||||
// must change only s.trackedTokens.
|
||||
//
|
||||
// Each token of the copy gets `balanceNotFetched`, because the balances are
|
||||
// cleared below and no refresh has read this network's yet. Each reads
|
||||
// `quantity unknown` until one has, not 0.0000.
|
||||
if (!s.networkTrackedTokens) s.networkTrackedTokens = {};
|
||||
s.networkTrackedTokens[s.networkId] = s.trackedTokens;
|
||||
s.trackedTokens = structuredClone(s.networkTrackedTokens[net.id] || []);
|
||||
for (const token of s.trackedTokens) token.balanceNotFetched = true;
|
||||
|
||||
s.networkId = net.id;
|
||||
s.rpcUrl = remembered.rpcUrl || net.defaultRpcUrl;
|
||||
|
||||
Reference in New Issue
Block a user