fix: Blockscout and Etherscan lookups are off until the user turns them on (closes #668)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

Out of the box the wallet sent the user's addresses to Blockscout for history
and token lookups, and each recipient to Etherscan for its label. Two settings,
"Use Blockscout" and "Check recipients on Etherscan", now gate those requests
where they are made. Both are off in a new profile and offered unticked on
Welcome and in Settings. While one is off, the screens that relied on it say so
in a plain line naming the setting; after either changes in Settings, Back
draws the screen it lands on again. ENS lookups ask only the RPC endpoint, so a
name resolved off-chain does not resolve. README and the user guide say what is
contacted by default and what each setting adds.

Model: opus-5-5
This commit is contained in:
2026-10-21 16:11:02 +00:00
parent c316d9ee78
commit d7f0e241ff
50 changed files with 1476 additions and 143 deletions
+23 -2
View File
@@ -653,6 +653,12 @@ function traceEnabled(raw) {
* confirmed receipt instead of null, so a wait screen resolves.
* @param {boolean} [opts.failReceiptLookup] answer eth_getTransactionReceipt
* with an error, so every receipt lookup fails; read at request time.
* @param {string} [opts.etherscanLabel] the label Etherscan's page gives the
* address asked about, such as "Fake_Phishing1"; none when unset. Read at
* request time.
* @param {object[]} [opts.requests] every request this handler sees, from the
* popup's pages and the background worker alike, appended in order as
* { method, url, fromWorker }.
* @returns {Promise<{waitForServiceWorkerTraffic: (ms: number) =>
* Promise<string|null>}>}
*/
@@ -691,6 +697,13 @@ async function installNetworkStubs(ctx, opts) {
const origin = fromWorker ? "[sw] " : "[page] ";
console.log("# routed " + origin + req.method() + " " + req.url());
}
if (Array.isArray(opts.requests)) {
opts.requests.push({
method: req.method(),
url: req.url(),
fromWorker,
});
}
// JSON-RPC endpoint (any host): a POST with a JSON-RPC body.
if (req.method() === "POST") {
@@ -762,12 +775,20 @@ async function installNetworkStubs(ctx, opts) {
return route.fulfill({ status: 204, body: "" });
}
// Best-effort Etherscan address labels: served as an empty page.
// Best-effort Etherscan address labels: served as an empty page, or
// as a page labelling the address with opts.etherscanLabel.
if (url.hostname.endsWith("etherscan.io")) {
const title = opts.etherscanLabel
? "<title>" +
opts.etherscanLabel +
" | Address: " +
p.split("/").pop() +
" | Etherscan</title>"
: "";
return route.fulfill({
status: 200,
contentType: "text/html",
body: "<html><body></body></html>",
body: "<html><head>" + title + "</head><body></body></html>",
});
}