// Reads "Use Blockscout" or "Check recipients on Etherscan" from the stored // 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. const { storageGet } = require("./browserApi"); const { normalizePersisted } = require("./persistedState"); // Whether the setting `name` is on in the stored profile. `name` is // "useBlockscout" or "checkRecipientsOnEtherscan". The profile is read through // normalizePersisted(), as a load reads it, so only a stored true is on. A // failed read counts as off. async function storedSettingIsOn(name) { try { const { autistmask } = await storageGet("autistmask"); return normalizePersisted(autistmask)[name]; } catch { return false; } } module.exports = { storedSettingIsOn };