fix: Blockscout and Etherscan lookups are off until the user turns them on (closes #668)
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. 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:
+23
-2
@@ -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>",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user