Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f44cba1248 |
No files matched your search
@@ -23,8 +23,8 @@ Out of the box the extension contacts two services:
|
||||
- a public CoinDesk API (no API key), for realtime prices. The API receives
|
||||
token symbols and nothing else.
|
||||
|
||||
Two more services are sent none of the user's data until the user ticks a
|
||||
checkbox for each. Welcome and Settings both offer the two checkboxes:
|
||||
Two more services are sent none of the user's data until the user turns them on.
|
||||
Each has a checkbox on the Welcome screen and in Settings:
|
||||
|
||||
- "Use Blockscout": a Blockscout block-explorer API, used for:
|
||||
- transaction history
|
||||
@@ -440,13 +440,13 @@ It also covers what a new install sends to Blockscout and Etherscan
|
||||
a route handler before the first popup page opens. From then on, the handler
|
||||
records every request the extension makes, from its pages and from its
|
||||
background worker. The background worker also makes requests while it starts up.
|
||||
Those come before the handler is installed, so they are not recorded. The tests
|
||||
take these steps in order:
|
||||
Those come earlier, so they are not recorded. The tests take these steps in
|
||||
order:
|
||||
|
||||
- Welcome must offer "Use Blockscout" and "Check recipients on Etherscan"
|
||||
unticked.
|
||||
- With neither ticked, Home, AddressDetail, AddressToken and ConfirmTx must each
|
||||
show the line saying what is off.
|
||||
- With neither ticked, each of these screens must show the line saying what is
|
||||
off: Home, AddressDetail, AddressToken and ConfirmTx.
|
||||
- The popup is then closed until the background has run a balance refresh of its
|
||||
own. No recorded request may have gone to Blockscout or Etherscan.
|
||||
- "Use Blockscout" is ticked from AddressDetail's gear. On "Back", AddressDetail
|
||||
@@ -459,11 +459,11 @@ take these steps in order:
|
||||
The setting is then ticked again.
|
||||
- "Check recipients on Etherscan" is ticked from ConfirmTx's gear. On "Back",
|
||||
ConfirmTx must ask Etherscan about the recipient and show the label the stub
|
||||
page gives the recipient.
|
||||
page gives it.
|
||||
|
||||
Both settings stay on for the rest of the run. TransactionDetail with "Use
|
||||
Blockscout" off is not driven here: while the setting is off, there is no
|
||||
history row to open it from. The unit tests cover that case.
|
||||
Blockscout" off is not driven here, because no history row leads to it then. The
|
||||
unit tests cover that case.
|
||||
|
||||
It also covers the confirmation screen, for both a native ETH send and an ERC-20
|
||||
send: Send disabled while the fee estimate is in flight, enabled once it lands,
|
||||
@@ -897,7 +897,7 @@ src/
|
||||
scamlist.js — known fraud contract addresses
|
||||
state.js — persisted state (extension storage)
|
||||
storedSettings.js — "Use Blockscout" and "Check recipients on Etherscan",
|
||||
read from storage for the requests those settings gate
|
||||
read from storage by the requests they gate
|
||||
symbolSpoof.js — the known-symbol spoof rule, shared by all surfaces
|
||||
tokenList.js — top ERC-20 tokens by market cap (hardcoded)
|
||||
transactions.js — tx history fetching + anti-poisoning filters
|
||||
@@ -1179,10 +1179,10 @@ The wallet takes the `decimals` from these sources, in this order
|
||||
`src/popup/views/helpers.js`).
|
||||
|
||||
The token's name comes from the same sources. While "Use Blockscout" is off, a
|
||||
token gets a line under it when the bundled list and the tracked tokens lack its
|
||||
name or decimals. The line says "Blockscout's report of your balances is not
|
||||
used to name this token, because "Use Blockscout" is off in Settings." These
|
||||
screens show the line:
|
||||
token's name or decimals may be missing from the bundled list and the tracked
|
||||
tokens. Then a line under the token says "Blockscout's report of your balances
|
||||
is not used to name this token, because "Use Blockscout" is off in Settings."
|
||||
These screens show the line:
|
||||
|
||||
- TxApproval and SignApproval
|
||||
- WaitTx, SuccessTx and ErrorTx, which follow TxApproval
|
||||
@@ -1224,12 +1224,12 @@ for a bundled or tracked token the explorer merely omitted, which is not a
|
||||
refusal the wallet has any reason to make.
|
||||
|
||||
While "Use Blockscout" is on, the Send screen also consults every address's
|
||||
explorer reports. The reports for two addresses may give different `decimals`
|
||||
for one contract. That token then has no scale on Send. Its stored balance is
|
||||
withdrawn as well. The Send screen's `Current balance` and the confirmation
|
||||
screen's balance line then both read `unknown (SYMBOL)`. The balance list
|
||||
formats each explorer row as it is fetched, without that cross-address check,
|
||||
and shows the row's figure.
|
||||
explorer reports. Two addresses may report different `decimals` for one
|
||||
contract. That token then has no scale on Send. Its stored balance is withdrawn
|
||||
as well. The Send screen's `Current balance` and the confirmation screen's
|
||||
balance line then both read `unknown (SYMBOL)`. The balance list formats each
|
||||
explorer row as it is fetched, without that cross-address check, and shows the
|
||||
row's figure.
|
||||
|
||||
**Decoded amount lines on the transaction approval screen:** the `Amount` line
|
||||
of a decoded ERC-20 call, and the `Amount` and `Min. received` lines of a
|
||||
@@ -1657,15 +1657,14 @@ while the user was away from it.
|
||||
|
||||
Changing "Use Blockscout" or "Check recipients on Etherscan" in Settings makes
|
||||
every screen but Settings count as not yet rendered. "Back" then renders again
|
||||
any screen that a reopened popup can render. A change to "Use Blockscout" also
|
||||
cuts the stack, as a network switch does (below). The cut drops Send, whose
|
||||
token dropdown was filled under the old setting. "Back" cannot render Send
|
||||
again. A change to "Check recipients on Etherscan" leaves the stack as it is.
|
||||
any screen a reopened popup can render. A change to "Use Blockscout" also cuts
|
||||
the stack, as a network switch does (below). The cut drops Send, whose token
|
||||
dropdown was filled under the old setting. "Back" cannot render Send again. A
|
||||
change to "Check recipients on Etherscan" leaves the stack as it is.
|
||||
|
||||
Any other open popup takes either change from the stored record, as it takes a
|
||||
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.
|
||||
popup would. So Home takes the place of a screen such as Send.
|
||||
|
||||
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
|
||||
@@ -1708,13 +1707,12 @@ view would leave a wallet one click from deletion.
|
||||
screen in that case.
|
||||
- **Elements**:
|
||||
- "Welcome! To get started, add a wallet." text
|
||||
- A well. Its first line says that the wallet sends the user's data only to
|
||||
the Ethereum RPC endpoint unless one of the two checkboxes below is
|
||||
ticked, and that both can be changed later in Settings
|
||||
- A well with a line about the user's data. The wallet sends that data only
|
||||
to the Ethereum RPC endpoint, unless one of the two checkboxes below is
|
||||
ticked
|
||||
- In the well, the "Use Blockscout" and "Check recipients on Etherscan"
|
||||
checkboxes, the same two as in Settings. Under each, a sentence says what
|
||||
the setting sends and to which service. Both are unticked until the user
|
||||
ticks them
|
||||
checkboxes, the same two as in Settings. Each has a sentence saying what
|
||||
it sends and where. Both are unticked until the user ticks them
|
||||
- "Add wallet" button
|
||||
- **Transitions**:
|
||||
- Ticking or unticking either checkbox → stores the setting, as Settings
|
||||
@@ -2073,9 +2071,9 @@ view would leave a wallet one click from deletion.
|
||||
`Unknown (could not be decoded)` with no symbol, not the transaction's ETH
|
||||
value. When that swap's `Token In` is `ETH (native)`, the transaction's
|
||||
ETH value in the network's currency, as for any other transaction
|
||||
- A line under the amount, worded as on TxApproval. The line shows while
|
||||
"Use Blockscout" is off and the bundled list and the tracked tokens lack
|
||||
the token's name or decimals.
|
||||
- A line under the amount, worded as on TxApproval. It shows while "Use
|
||||
Blockscout" is off and the token's name or decimals are missing from the
|
||||
bundled list and the tracked tokens.
|
||||
- To: color dot + full address + etherscan link; for a contract creation,
|
||||
which has no recipient, "This transaction creates a new contract. It has
|
||||
no recipient." instead
|
||||
@@ -2109,8 +2107,7 @@ view would leave a wallet one click from deletion.
|
||||
- "Transaction Confirmed" heading
|
||||
- Decoded action well (shown when the transaction carried recognized
|
||||
calldata; the top-level Amount and To are hidden in that case). Each token
|
||||
in the well gets TxApproval's line under it whenever TxApproval would show
|
||||
that line.
|
||||
in the well gets TxApproval's line under it, in the same case.
|
||||
- Amount + symbol
|
||||
- To: color dot + full address + etherscan link, or for a contract creation
|
||||
the same sentence as on WaitTx
|
||||
@@ -2260,9 +2257,9 @@ view would leave a wallet one click from deletion.
|
||||
- A sentence saying what the setting shows and what it sends. With the
|
||||
setting on, the wallet sends the Blockscout API the user's addresses
|
||||
and the hash of each transaction opened
|
||||
- Endpoint URL input + "Save" button. "Save" asks the URL for `/stats`
|
||||
and saves the URL only if that request succeeds. The request carries
|
||||
no user data and is made whether or not "Use Blockscout" is ticked.
|
||||
- Endpoint URL input + "Save" button. "Save" checks the URL by asking it
|
||||
for `/stats` before saving it. That request carries no user data. It
|
||||
is made whether or not "Use Blockscout" is ticked.
|
||||
- Etherscan:
|
||||
- "Check recipients on Etherscan" checkbox, unticked until the user
|
||||
ticks it
|
||||
@@ -2294,9 +2291,10 @@ view would leave a wallet one click from deletion.
|
||||
turns on the red banner and verbose logging
|
||||
- **Transitions**:
|
||||
- Ticking or unticking "Use Blockscout" or "Check recipients on Etherscan" →
|
||||
stores the setting (no screen change). From then on, every screen drawn
|
||||
and every balance refresh uses the new setting. Unticking "Use Blockscout"
|
||||
also drops every token the user has not tracked from every address
|
||||
stores the setting (no screen change). The next balance refresh uses the
|
||||
new setting. So does every screen drawn after that. Unticking "Use
|
||||
Blockscout" also drops every token the user has not tracked from every
|
||||
address
|
||||
- "+ Add wallet" → **AddWallet**
|
||||
- "+ Add token" → **SettingsAddToken**
|
||||
- `[recovery phrase]` on an HD wallet → **ShowRecoveryPhrase**
|
||||
@@ -2609,10 +2607,10 @@ view would leave a wallet one click from deletion.
|
||||
unknown (see Transaction Decoding)
|
||||
- A line under each token of the decoded action: "Blockscout's report of
|
||||
your balances is not used to name this token, because "Use Blockscout" is
|
||||
off in Settings." The line shows while "Use Blockscout" is off and the
|
||||
bundled list and the tracked tokens lack the token's name or decimals.
|
||||
While the setting is on, Blockscout's report of the user's balances is a
|
||||
third source of a token's name and decimals (see Unknown token scale).
|
||||
off in Settings." It shows while "Use Blockscout" is off and the token's
|
||||
name or decimals are missing from the bundled list and the tracked tokens.
|
||||
Blockscout's report of the user's balances gives a token's name and
|
||||
decimals only while the setting is on (see Unknown token scale).
|
||||
- From: color dot + full address + etherscan link
|
||||
- Contract: color dot + full address + etherscan link, token symbol label if
|
||||
known; for a contract creation, the same sentence as on WaitTx
|
||||
@@ -2693,9 +2691,9 @@ view would leave a wallet one click from deletion.
|
||||
domain's `verifyingContract`; any those fields do not give is shown as
|
||||
`Unknown`, and the domain, type and message lines still follow. Only typed
|
||||
data that cannot be read at all is shown as raw text. A token gets the
|
||||
same line under it as on TxApproval, whenever TxApproval would show that
|
||||
line. As there, Blockscout's report of the user's balances is a source of
|
||||
a token's name and decimals only while "Use Blockscout" is on.
|
||||
same line under it as on TxApproval, in the same case. As there,
|
||||
Blockscout's report of the user's balances gives a token's name and
|
||||
decimals only while the setting is on.
|
||||
- Raw data (`personal_sign` and `eth_sign`): the message's hex exactly as
|
||||
the site sent it. The bytes it encodes are what is signed, as an EIP-191
|
||||
personal message.
|
||||
@@ -2829,19 +2827,19 @@ AutistMask is not a fully self-contained offline tool. By default it sends the
|
||||
user's data only to the Ethereum RPC endpoint. It also asks the CoinDesk price
|
||||
API for prices, sending token symbols and nothing else.
|
||||
|
||||
Two more services are sent none of the user's data until the user turns on a
|
||||
setting for each:
|
||||
Two more services are sent none of the user's data until the user turns on their
|
||||
settings:
|
||||
|
||||
- Blockscout, with "Use Blockscout"
|
||||
- Etherscan, with "Check recipients on Etherscan"
|
||||
|
||||
Both settings are off in a new install. Welcome and Settings both offer them.
|
||||
Each setting applies to every network.
|
||||
Both settings are on the Welcome screen and in Settings. Both are off in a new
|
||||
install. Each setting applies to every network.
|
||||
|
||||
Before each request that sends the user's data to Blockscout or Etherscan, the
|
||||
wallet reads that service's setting from storage. The wallet reads the setting
|
||||
again when the answer lands. While the setting is off, no such request is made,
|
||||
and an answer that lands after the setting went off is dropped.
|
||||
wallet reads that service's setting from storage. It reads it again when the
|
||||
answer lands. While the setting is off, no such request is made, and an answer
|
||||
that lands after it went off is dropped.
|
||||
|
||||
Contacted by default:
|
||||
|
||||
@@ -2850,10 +2848,10 @@ Contacted by default:
|
||||
them the balance of every tracked token at every address (`balanceOf`),
|
||||
estimate gas (`eth_estimateGas`), fetch nonces (`eth_getTransactionCount`),
|
||||
broadcast transactions (`eth_sendRawTransaction`), and check transaction
|
||||
receipts. Every ENS lookup is made through the RPC endpoint alone. So a name
|
||||
does not resolve when its resolver says the name is resolved off-chain. The
|
||||
default endpoint is a public RPC (configurable by the user to any endpoint
|
||||
they prefer, including a local node). By default the extension talks to
|
||||
receipts. Every ENS lookup is made through it alone. So a name does not
|
||||
resolve when its resolver says the name is resolved off-chain. The default
|
||||
endpoint is a public RPC (configurable by the user to any endpoint they
|
||||
prefer, including a local node). By default the extension talks to
|
||||
`https://ethereum-rpc.publicnode.com`.
|
||||
- **Data sent**: Ethereum addresses, transaction data, contract call
|
||||
parameters. The RPC endpoint can see all on-chain queries and submitted
|
||||
@@ -2866,7 +2864,7 @@ Contacted by default:
|
||||
- **Data sent**: Token symbol strings only (e.g. "ETH", "USDC"). No
|
||||
addresses or user-specific data.
|
||||
|
||||
Sent the user's data only while its setting is on:
|
||||
Sent the user's data only while the user has turned the setting on:
|
||||
|
||||
- **Blockscout block-explorer API** ("Use Blockscout"): The default endpoint is
|
||||
`https://eth.blockscout.com/api/v2` (configurable by the user in Settings).
|
||||
@@ -2885,8 +2883,8 @@ Sent the user's data only while its setting is on:
|
||||
- when Home, AddressDetail or AddressToken loads its history
|
||||
- when TransactionDetail opens
|
||||
- **While the setting is off**: each of those screens shows a line saying
|
||||
what the screen leaves out and that "Use Blockscout" is off. Only tracked
|
||||
tokens are listed.
|
||||
what it leaves out and that "Use Blockscout" is off. Only tracked tokens
|
||||
are listed.
|
||||
- **Saving the URL**: pressing "Save" beside the URL in Settings asks that
|
||||
URL for `/stats`, whether or not the setting is on. This request carries
|
||||
no user data.
|
||||
|
||||
+15
-16
@@ -74,9 +74,9 @@ not have a backend server. Out of the box it sends your data only to the
|
||||
Ethereum RPC endpoint. It also asks the CoinDesk price API for prices, sending
|
||||
token symbols and nothing else.
|
||||
|
||||
Blockscout and Etherscan are sent none of your data until you turn on a setting
|
||||
for each. The settings are "Use Blockscout" and "Check recipients on Etherscan".
|
||||
Both are off in a new install. Welcome and Settings both offer them.
|
||||
Blockscout and Etherscan are sent none of your data until you turn them on.
|
||||
Their settings are "Use Blockscout" and "Check recipients on Etherscan". Both
|
||||
are on the Welcome screen and in Settings. Both are off in a new install.
|
||||
|
||||
### External Services
|
||||
|
||||
@@ -113,10 +113,10 @@ only while "Use Blockscout" is on. AutistMask then asks Blockscout for:
|
||||
for spam filtering
|
||||
- the block, fees and calldata of a transaction you open
|
||||
|
||||
You can change the endpoint in Settings to a self-hosted Blockscout instance.
|
||||
While the setting is off, each screen that would show Blockscout's data says
|
||||
instead that the setting is off. Only the tokens you track are listed. When you
|
||||
turn the setting off, every other token leaves the lists at once.
|
||||
You can change this in Settings to a self-hosted Blockscout instance. While the
|
||||
setting is off, each screen that would show Blockscout's data says so instead.
|
||||
Only the tokens you track are listed. When you turn the setting off, every other
|
||||
token leaves the lists at once.
|
||||
|
||||
When it is contacted, while "Use Blockscout" is on:
|
||||
|
||||
@@ -124,9 +124,9 @@ When it is contacted, while "Use Blockscout" is on:
|
||||
- whenever a screen showing transaction history is opened
|
||||
- when you open a transaction
|
||||
|
||||
Pressing "Save" beside the Blockscout URL in Settings checks the URL by asking
|
||||
it for `/stats`. That happens whether or not the setting is on. The request
|
||||
sends none of your data.
|
||||
Pressing "Save" beside the Blockscout URL in Settings asks that URL for `/stats`
|
||||
to check it, whether or not the setting is on. That request sends none of your
|
||||
data.
|
||||
|
||||
What gets sent: your Ethereum addresses (to look up balances and transactions)
|
||||
and the hash of each transaction you open.
|
||||
@@ -215,8 +215,8 @@ password.
|
||||
1. Click the AutistMask icon in your browser toolbar.
|
||||
2. Click "Add wallet" (on first use), or open Settings and click "+ Add wallet".
|
||||
On first use, the screen with "Add wallet" also offers "Use Blockscout" and
|
||||
"Check recipients on Etherscan", both off. External Services above says what
|
||||
each one does. You can change both later in Settings.
|
||||
"Check recipients on Etherscan", both off. Tick either if you want what it
|
||||
does (see External Services). You can change both later in Settings.
|
||||
3. On the "From Phrase" tab, click the die button to generate a random 12-word
|
||||
recovery phrase.
|
||||
4. **Write down the recovery phrase and store it safely.** Anyone with these
|
||||
@@ -252,8 +252,8 @@ always produce the same sequence of addresses.
|
||||
|
||||
### Adding ERC-20 Tokens
|
||||
|
||||
The wallet looks for tokens you hold only while "Use Blockscout" is on. Even
|
||||
then, a token shows up only if it is in the extension's bundled list of
|
||||
The wallet finds the tokens you hold by itself only while "Use Blockscout" is
|
||||
on. Even then, a token shows up only if it is in the extension's bundled list of
|
||||
well-known tokens or has at least 1,000 holders. Everything else is treated as
|
||||
spam and hidden.
|
||||
|
||||
@@ -276,8 +276,7 @@ screen. Tokens can also be added from Settings, under "Tracked Tokens".
|
||||
2. Select what to send (ETH, or any ERC-20 token with a balance on this address
|
||||
that survives the spam filters).
|
||||
3. Enter the recipient address or ENS name (e.g. `vitalik.eth`). AutistMask does
|
||||
not look up a name resolved off-chain. For such a name, enter the address
|
||||
instead.
|
||||
not look up a name resolved off-chain, so enter its address instead.
|
||||
4. Enter the amount, or click "Max" to fill it in: a token's balance, cut to 18
|
||||
decimal places, or your ETH balance minus the amount reserved for the network
|
||||
fee.
|
||||
|
||||
@@ -1391,9 +1391,9 @@ const RECENT_BALANCE_REFRESH_MS = Math.floor(BALANCE_REFRESH_PERIOD_MS / 2);
|
||||
// lastBalanceRefresh is left as the switch set it, so the next tick refreshes
|
||||
// the new network.
|
||||
//
|
||||
// Blockscout may have answered just before the user turned "Use Blockscout"
|
||||
// off. So the save reads the stored setting again, and drops every token the
|
||||
// user has not tracked if the setting is off.
|
||||
// Blockscout may have answered before the user turned "Use Blockscout" off. So
|
||||
// the save drops every token the user has not tracked if storage NOW holds "Use
|
||||
// Blockscout" off.
|
||||
async function backgroundRefresh() {
|
||||
const s = await getState();
|
||||
const now = Date.now();
|
||||
|
||||
+2
-2
@@ -72,8 +72,8 @@ let refreshInFlight = false;
|
||||
let refreshTimer = null;
|
||||
|
||||
// The refresh first takes the stored network, "Use Blockscout" and "Check
|
||||
// recipients on Etherscan" (followStoredSettings() below). So the screens it
|
||||
// draws reflect any change saved elsewhere.
|
||||
// recipients on Etherscan" (followStoredSettings() below). So it draws its
|
||||
// screens under any change saved elsewhere.
|
||||
//
|
||||
// The refresh writes into a copy of the wallets. Inside the save, under the
|
||||
// lock, its results are copied onto the address records in `state` only if the
|
||||
|
||||
@@ -335,7 +335,7 @@ function show(txInfo) {
|
||||
$("confirm-burn-warning").style.visibility = "hidden";
|
||||
$("confirm-etherscan-warning").style.visibility = "hidden";
|
||||
// While "Check recipients on Etherscan" is off, there is no Etherscan
|
||||
// warning to reserve space for. A line in its place says the check is off.
|
||||
// warning to reserve space for. A line in its place says so.
|
||||
const etherscanOn = !!state.checkRecipientsOnEtherscan;
|
||||
$("confirm-etherscan-warning").classList.toggle("hidden", !etherscanOn);
|
||||
$("confirm-etherscan-note").classList.toggle("hidden", etherscanOn);
|
||||
|
||||
@@ -310,8 +310,8 @@ function nativeCurrency() {
|
||||
// active network's, so another network gets the tokens tracked on it
|
||||
// (state.networkTrackedTokens, see applyChainSwitchFields()) and no balances.
|
||||
//
|
||||
// The wallets' balances hold what Blockscout reported for each token. So the
|
||||
// wallets are returned only while "Use Blockscout" is on.
|
||||
// The balances give what Blockscout reported for each token. So they are given
|
||||
// only while "Use Blockscout" is on.
|
||||
function tokenSourcesByChainId(chainId) {
|
||||
const net = chainId ? networkByChainId(chainId) : currentNetwork();
|
||||
if (net && net.id === state.networkId) {
|
||||
|
||||
+10
-11
@@ -293,12 +293,11 @@ function setUseBlockscout(on) {
|
||||
|
||||
// Draws the page again after a network switch, or after another page changed
|
||||
// "Use Blockscout" or "Check recipients on Etherscan". Every screen counts as
|
||||
// not yet rendered, so "Back" renders again any screen that a reopened popup
|
||||
// can render. Settings on top is brought up to date in place. Any other screen
|
||||
// is drawn again as a reopened popup draws it, which is Home for one that
|
||||
// cannot be rendered from saved state. Without a wallet any other screen is
|
||||
// Welcome or AddWallet. Back only unhides Welcome, so its two checkboxes are
|
||||
// set here.
|
||||
// not yet rendered, so "Back" renders again any screen a reopened popup can
|
||||
// render. Settings on top is brought up to date in place; any other screen is
|
||||
// drawn again as a reopened popup draws it, which is Home for one that cannot
|
||||
// be rendered from saved state. Without a wallet any other screen is Welcome or
|
||||
// AddWallet. Back only unhides Welcome, so its two checkboxes are set here.
|
||||
function showNewSettings() {
|
||||
resetRenderedViews();
|
||||
$("welcome-use-blockscout").checked = state.useBlockscout;
|
||||
@@ -394,14 +393,14 @@ function init(_ctx) {
|
||||
showFlash("Saved.");
|
||||
});
|
||||
|
||||
// Each change is made inside the save, holding the lock. So
|
||||
// followStoredSettings() in src/popup/index.js never mistakes this page's
|
||||
// unsaved change for one that another page saved.
|
||||
// Each change is made inside the save, holding the lock. Then
|
||||
// followStoredSettings() in src/popup/index.js never takes this page's
|
||||
// unsaved change for another page's.
|
||||
//
|
||||
// The screens under Settings were drawn under the old setting. So each
|
||||
// change makes every screen but Settings count as not yet drawn, as a
|
||||
// network switch does. Back then draws again any screen that a reopened
|
||||
// popup can draw. Back only unhides Welcome, so its boxes are set here too.
|
||||
// network switch does. Back then draws again any screen a reopened popup
|
||||
// can draw. Back only unhides Welcome, so its boxes are set here too.
|
||||
$("settings-use-blockscout").addEventListener("change", async () => {
|
||||
const on = $("settings-use-blockscout").checked;
|
||||
await saveState(() => setUseBlockscout(on));
|
||||
|
||||
@@ -192,8 +192,7 @@ function render() {
|
||||
if (el) el.classList.add("hidden");
|
||||
}
|
||||
|
||||
// The block, network details, decoded details and raw data come from
|
||||
// Blockscout. While the setting is off, this line says why none is shown.
|
||||
// Those details are Blockscout's; this line says why there are none.
|
||||
$("tx-detail-blockscout-note").classList.toggle(
|
||||
"hidden",
|
||||
!!state.useBlockscout,
|
||||
|
||||
@@ -46,8 +46,8 @@ const { storedSettingIsOn } = require("./storedSettings");
|
||||
// `disableCcipRead` keeps every ENS lookup on the RPC endpoint. A resolver can
|
||||
// say a name is resolved off-chain and give a web address for it. By default
|
||||
// ethers then fetches that address straight from the browser, sending the name
|
||||
// being looked up. For the reverse lookup of the user's addresses, the name sent
|
||||
// is the user's own (https://git.eeqj.de/sneak/AutistMask/issues/668). With the
|
||||
// being looked up. For the reverse lookup of the user's addresses, that is the
|
||||
// user's own name (https://git.eeqj.de/sneak/AutistMask/issues/668). With the
|
||||
// flag set, such a name does not resolve.
|
||||
function getProvider(rpcUrl, networkId) {
|
||||
const net = Network.from(requireNetworkId(networkId).id);
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
// profile.
|
||||
//
|
||||
// Before each request that sends the user's data to Blockscout or Etherscan, the
|
||||
// wallet reads that service's setting from storage. The wallet reads the setting
|
||||
// again when the answer lands. While the setting is off, no such request is
|
||||
// made, and an answer that lands after the setting went off is dropped. A page's
|
||||
// own copy of the setting is not used, because another page may have just
|
||||
// changed it.
|
||||
// wallet reads that service's setting from storage. It reads it again when the
|
||||
// answer lands. While the setting is off, no such request is made, and an
|
||||
// answer that lands after it went off is dropped. A page's own copy of the
|
||||
// setting is not used, because another page may have just changed it.
|
||||
|
||||
const { storageGet } = require("./browserApi");
|
||||
const { normalizePersisted } = require("./persistedState");
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// the tracked tokens alone (https://git.eeqj.de/sneak/AutistMask/issues/668).
|
||||
// A token missing from both gets a line under it. The line says Blockscout's
|
||||
// report of the user's balances is not used to name the token. While the
|
||||
// setting is on, Blockscout's report of the user's holding is a source too, as
|
||||
// before.
|
||||
// setting is on, the token's name and scale come from Blockscout's report of
|
||||
// the user's holding, as before.
|
||||
//
|
||||
// Booted through the real popup entry point, as the approval window or as a
|
||||
// popup reopened onto SuccessTx, WaitTx or ErrorTx. The vault is mocked so that
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
// Blockscout and Etherscan are sent none of the user's data until the user
|
||||
// turns on a setting for each
|
||||
// (https://git.eeqj.de/sneak/AutistMask/issues/668). A new profile has "Use
|
||||
// Blockscout" and "Check recipients on Etherscan" both off. While a setting is
|
||||
// off, no request sends its service the user's data.
|
||||
// turns them on (https://git.eeqj.de/sneak/AutistMask/issues/668). A new
|
||||
// profile has "Use Blockscout" and "Check recipients on Etherscan" both off.
|
||||
// While a setting is off, no request sends its service the user's data.
|
||||
//
|
||||
// One request still reaches Blockscout while "Use Blockscout" is off: the check
|
||||
// behind "Save" beside the Blockscout URL in Settings. That check asks the URL
|
||||
// only for `/stats` and sends none of the user's data.
|
||||
// Only one request is made with the setting off: the check behind "Save" beside
|
||||
// the Blockscout URL in Settings. That check asks the URL only for `/stats` and
|
||||
// sends none of the user's data.
|
||||
//
|
||||
// Before any other request to Blockscout or Etherscan, the wallet reads that
|
||||
// service's setting from storage, not the page's copy. The wallet reads the
|
||||
// setting again when the answer lands. So a change saved by another page
|
||||
// applies at once. An open page also takes such a change and draws its screens
|
||||
// again.
|
||||
// Before any other request to Blockscout or Etherscan, the wallet reads its
|
||||
// setting from storage, not the page's copy. The wallet reads the setting again
|
||||
// when the answer lands. So a change saved by another page applies at once. An
|
||||
// open page also takes such a change and draws its screens again.
|
||||
//
|
||||
// Only Blockscout reports the tokens the user has not tracked. While "Use
|
||||
// Blockscout" is off, no address keeps them and no screen lists them.
|
||||
@@ -546,8 +544,8 @@ describe("the popup", () => {
|
||||
});
|
||||
|
||||
// A token the user tracks, and an untracked one that Blockscout reported.
|
||||
// Both are written in lower case, because the balance rows' and the
|
||||
// dropdown's token ids are compared in lower case below.
|
||||
// Both are written in lower case, as the balance rows' and the dropdown's
|
||||
// token ids are compared below.
|
||||
const TRACKED = "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
|
||||
const UNTRACKED = TOKEN_ADDRESS.toLowerCase();
|
||||
const SECOND_ADDRESS = "0x3333333333333333333333333333333333333333";
|
||||
|
||||
@@ -247,8 +247,7 @@ async function openSend(token, tokenUnits = null) {
|
||||
state.selectedWallet = 0;
|
||||
state.selectedAddress = 0;
|
||||
// Blockscout is asked only while the stored "Use Blockscout" is on. The
|
||||
// screens save this page's copy of "Use Blockscout" over the stored one. So
|
||||
// the page's copy is turned on here too.
|
||||
// screens save this page's copy of the setting over the stored one.
|
||||
state.useBlockscout = true;
|
||||
await refreshBalances(
|
||||
state.wallets,
|
||||
|
||||
+6
-8
@@ -273,16 +273,14 @@ test("the exact confirmation phrase erases the record and reloads into Welcome (
|
||||
//
|
||||
// A fresh install sends Blockscout and Etherscan none of the user's data until
|
||||
// the user turns on "Use Blockscout" or "Check recipients on Etherscan". One
|
||||
// request still reaches Blockscout while "Use Blockscout" is off: pressing
|
||||
// "Save" beside the Blockscout URL asks that URL for `/stats`. That request
|
||||
// carries no user data.
|
||||
// request is made with the setting off: pressing "Save" beside the Blockscout
|
||||
// URL asks that URL for `/stats`. That request carries no user data.
|
||||
//
|
||||
// The route handler in tests/e2e/network.js records in env.routeOpts.requests
|
||||
// every request the extension makes, from its pages and its background worker.
|
||||
// Recording starts when launch() in tests/e2e/harness.js installs that handler,
|
||||
// before the first popup page opens. The background worker also makes requests
|
||||
// while it starts up. Those come before the handler is installed, so they are
|
||||
// not recorded.
|
||||
// while it starts up. Those come earlier, so they are not recorded.
|
||||
//
|
||||
// Before either setting is changed, these tests drive:
|
||||
//
|
||||
@@ -405,9 +403,9 @@ test("with neither setting changed, Home, AddressDetail, AddressToken and Confir
|
||||
|
||||
// The background refreshes balances on its alarm, once a minute. It skips a
|
||||
// refresh when the stored record says one ran in the last 30 seconds. The open
|
||||
// popup's own refresh runs every 10. So the popup is closed first. The test then
|
||||
// has the background worker set the stored time of the last refresh to 0, so
|
||||
// its next alarm runs a refresh.
|
||||
// popup's own refresh runs every 10. So the popup is closed first. The
|
||||
// background worker then writes that record back to say no refresh has run, as
|
||||
// another extension page saving it would.
|
||||
test("with neither setting changed, nothing has reached Blockscout or Etherscan, the background's refresh included (#668)", async (env) => {
|
||||
await waitForPersisted(
|
||||
env.page,
|
||||
|
||||
@@ -221,8 +221,7 @@ async function refreshWith(balanceWei, tokenItems = []) {
|
||||
state.selectedWallet = 0;
|
||||
state.selectedAddress = 0;
|
||||
// Blockscout is asked only while the stored "Use Blockscout" is on. The
|
||||
// screens save this page's copy of "Use Blockscout" over the stored one. So
|
||||
// the page's copy is turned on here too.
|
||||
// screens save this page's copy of the setting over the stored one.
|
||||
state.useBlockscout = true;
|
||||
await refreshBalances(
|
||||
state.wallets,
|
||||
|
||||
@@ -217,8 +217,7 @@ async function refreshWith(balanceWei, tokenItems = []) {
|
||||
state.selectedWallet = 0;
|
||||
state.selectedAddress = 0;
|
||||
// Blockscout is asked only while the stored "Use Blockscout" is on. The
|
||||
// screens save this page's copy of "Use Blockscout" over the stored one. So
|
||||
// the page's copy is turned on here too.
|
||||
// screens save this page's copy of the setting over the stored one.
|
||||
state.useBlockscout = true;
|
||||
await refreshBalances(
|
||||
state.wallets,
|
||||
|
||||
@@ -523,9 +523,8 @@ describe("a garbage value in a field the gate does not check", () => {
|
||||
});
|
||||
|
||||
test("a malformed tokenBalances entry is dropped, and the wallet and its address survive", async () => {
|
||||
// "Use Blockscout" is on. Otherwise the boot's balance refresh would
|
||||
// drop the well-formed entry too, since the user has not tracked its
|
||||
// token.
|
||||
// "Use Blockscout" is on, or the boot's balance refresh drops the
|
||||
// well-formed entry too: the user has not tracked its token.
|
||||
const profile = profileWithTokenBalances([
|
||||
null,
|
||||
42,
|
||||
|
||||
Reference in new issue
Block a user