fix: tracked tokens are kept per network, and bundled picks are offered on mainnet only (closes #523)
A network switch now puts the outgoing network's tracked tokens away in a new persisted field, networkTrackedTokens, and brings back the incoming network's list, or an empty one, the way endpoints are already kept per network. trackedTokens stays the active network's list, so its readers are unchanged, and the background's switch keeps the lists too because it goes through the same function. The two add-token screens show their common-token picks, which come from the bundled list of mainnet contracts, on Ethereum Mainnet only; adding by contract address works on every network. Settings redraws its tracked-token list after a switch. Model: opus-5-5
This commit is contained in:
@@ -1898,7 +1898,8 @@ view would leave a wallet one click from deletion.
|
||||
- Contract address input
|
||||
- Status line ("Looking up token...", cleared or replaced on failure)
|
||||
- Common token quick-pick buttons (top 25 by market cap), which fill the
|
||||
contract address input
|
||||
contract address input. Shown on Ethereum Mainnet only, because the
|
||||
bundled token list holds mainnet contracts
|
||||
- "Add" button
|
||||
- **Transitions**:
|
||||
- "Add" (valid contract) → tracks the token, pops the stack, and re-renders
|
||||
@@ -1915,16 +1916,19 @@ view would leave a wallet one click from deletion.
|
||||
- Wallets: one row per wallet with its name (tap to rename inline), a
|
||||
`[recovery phrase]` button on HD wallets only, and an `[x]` delete button,
|
||||
plus a "+ Add wallet" button
|
||||
- Tracked Tokens: one row per tracked token with an `[x]` remove button,
|
||||
plus a "+ Add token" button
|
||||
- Tracked Tokens: one row per token tracked on the active network with an
|
||||
`[x]` remove button, plus a "+ Add token" button
|
||||
- Display: "Show tracked tokens with zero balance" checkbox, "UTC
|
||||
Timestamps" checkbox, and a Theme selector (System / Light / Dark)
|
||||
- Network: network selector (Ethereum Mainnet / Sepolia Testnet). The
|
||||
network changes only here, or when the user approves a site's request on
|
||||
**NetworkApproval**; either way, switching restores the RPC and Blockscout
|
||||
endpoints last used on that network, or that network's defaults if it has
|
||||
none, and sends `chainChanged` with the new chain id to every open tab.
|
||||
Choosing the network already active changes nothing and sends nothing
|
||||
none, and the tokens tracked on that network, and sends `chainChanged`
|
||||
with the new chain id to every open tab. A token is tracked only on the
|
||||
network it was added on, because a contract address names a token on one
|
||||
network only. Choosing the network already active changes nothing and
|
||||
sends nothing
|
||||
- Ethereum RPC: endpoint URL input + "Save" button (validated against
|
||||
`eth_chainId` before being saved)
|
||||
- Blockscout API: endpoint URL input + "Save" button (validated against
|
||||
@@ -2148,7 +2152,8 @@ view would leave a wallet one click from deletion.
|
||||
#### SettingsAddToken (`settings-addtoken`)
|
||||
|
||||
- **When**: User tapped "+ Add token" in Settings. Tokens added here are tracked
|
||||
across every address, unlike AddToken which is reached from one address.
|
||||
across every address on the active network, unlike AddToken which is reached
|
||||
from one address.
|
||||
- **Elements**:
|
||||
- "Back" button, "Add Token" heading
|
||||
- Instruction text
|
||||
@@ -2157,8 +2162,12 @@ view would leave a wallet one click from deletion.
|
||||
- "Or pick from top 100:" dropdown (already-tracked tokens are disabled) +
|
||||
"Add selected" button
|
||||
- "Or enter contract address:" input, a status line, and an "Add" button
|
||||
- The two lists from the bundled token list, "Top tokens:" and "Or pick from
|
||||
top 100:", are shown on Ethereum Mainnet only, because that list holds
|
||||
mainnet contracts. On any other network the contract address is the only
|
||||
add path
|
||||
- **Transitions**:
|
||||
- Any of the three add paths, on success → adds the token and shows an
|
||||
- Any of the add paths shown, on success → adds the token and shows an
|
||||
"Added SYMBOL" flash message (no screen change)
|
||||
- A duplicate, a scam-listed address, or a failed contract lookup → flash
|
||||
message, no screen change
|
||||
@@ -2376,8 +2385,9 @@ view would leave a wallet one click from deletion.
|
||||
- **Transitions**:
|
||||
- "Switch" → closes popup; the background switches the network as
|
||||
**Settings** does, restoring the RPC and Blockscout endpoints last used on
|
||||
that network (or that network's defaults if it has none), sends
|
||||
`chainChanged` to every open tab, and answers the site with success
|
||||
that network (or that network's defaults if it has none) and the tokens
|
||||
tracked on that network, sends `chainChanged` to every open tab, and
|
||||
answers the site with success
|
||||
- "Reject" → closes popup; the site is answered with EIP-1193 code 4001 and
|
||||
nothing changes
|
||||
- Popup window closed without answering → the same as "Reject"
|
||||
|
||||
Reference in New Issue
Block a user