diff --git a/packages/extension/configs/rollup.config.base.mjs b/packages/extension/configs/rollup.config.base.mjs index abbe66bc1..6f83f2904 100644 --- a/packages/extension/configs/rollup.config.base.mjs +++ b/packages/extension/configs/rollup.config.base.mjs @@ -18,6 +18,7 @@ const base = { replace({ preventAssignment: true, __VERSION__: JSON.stringify(packageJson.version), + __IS_OPERA__: process.env.BROWSER === "opera-edge", }), typescript(), commonjs(), diff --git a/packages/extension/configs/testNullCompiler.js b/packages/extension/configs/testNullCompiler.js index 061b8ebc9..152247070 100644 --- a/packages/extension/configs/testNullCompiler.js +++ b/packages/extension/configs/testNullCompiler.js @@ -1,5 +1,6 @@ const noop = () => 1; global.__VERSION__ = "test"; +global.__IS_OPERA__ = false; require.extensions[".css"] = noop; require.extensions[".scss"] = noop; require.extensions[".png"] = noop; diff --git a/packages/extension/package.json b/packages/extension/package.json index d4e115584..38857ca7e 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,11 +1,11 @@ { "name": "@enkryptcom/extension", - "version": "1.36.0", + "version": "1.37.1", "private": true, "scripts": { "zip": "cd dist; zip -r release.zip *;", "build:chrome": "cross-env BROWSER='chrome' vue-cli-service build && yarn build:rollup", - "build:operaedge": "cross-env BROWSER='opera-edge' vue-cli-service build && yarn build:rollup", + "build:operaedge": "cross-env BROWSER='opera-edge' vue-cli-service build && cross-env BROWSER='opera-edge' yarn build:rollup", "build:firefox": "cross-env BROWSER='firefox' vue-cli-service build && yarn build:rollup && node configs/get-system-info.js", "lint": "vue-cli-service lint --fix", "build:rollup": "cross-env minify=on rollup --config configs/rollup.config.contentscript.mjs && cross-env minify=on rollup --config configs/rollup.config.inject.mjs", diff --git a/packages/extension/src/libs/metrics/amplitude.ts b/packages/extension/src/libs/metrics/amplitude.ts index 54798ca68..2ca127398 100644 --- a/packages/extension/src/libs/metrics/amplitude.ts +++ b/packages/extension/src/libs/metrics/amplitude.ts @@ -1,4 +1,4 @@ -import { init, track, Types } from "@amplitude/analytics-browser"; +import { init, track, Types, setOptOut } from "@amplitude/analytics-browser"; import { detectBrowser, detectOS } from "@action/utils/browser"; import SettingsState from "../settings-state"; @@ -32,7 +32,7 @@ class Metrics { instanceName: process.env.IS_DEV ? "enkrypt-extension-dev" : "enkrypt-extension", - optOut: false, + optOut: !set.isMetricsEnabled, serverUrl: process.env.IS_DEV ? "https://analytics-enkrypt-dev.mewwallet.dev/record" : "https://analytics-enkrypt.mewwallet.dev/record", @@ -63,6 +63,9 @@ class Metrics { } ); } + setOptOut(val: boolean) { + setOptOut(val); + } } export default Metrics; diff --git a/packages/extension/src/libs/metrics/index.ts b/packages/extension/src/libs/metrics/index.ts index eb507d69a..a83aaa617 100644 --- a/packages/extension/src/libs/metrics/index.ts +++ b/packages/extension/src/libs/metrics/index.ts @@ -7,6 +7,7 @@ import { NFTEventType, NetworkChangeEvents, SendEventType, + SettingEventType, SwapEventType, } from "./types"; @@ -68,6 +69,16 @@ const trackDAppsEvents = ( ) => { metrics.track("dapps", { event, ...options }); }; + +const optOutofMetrics = (optOut: boolean) => { + metrics.setOptOut(false); + metrics.track("settings", { + event: SettingEventType.OptOut, + value: optOut ? 1 : 0, + }); + metrics.setOptOut(optOut); +}; + export { trackNetworkSelected, trackSwapEvents, @@ -75,4 +86,5 @@ export { trackSendEvents, trackNFTEvents, trackDAppsEvents, + optOutofMetrics, }; diff --git a/packages/extension/src/libs/metrics/types.ts b/packages/extension/src/libs/metrics/types.ts index 16ba765b8..b35f023a1 100644 --- a/packages/extension/src/libs/metrics/types.ts +++ b/packages/extension/src/libs/metrics/types.ts @@ -38,3 +38,7 @@ export enum NFTEventType { export enum DAppsEventType { DAppsOpen = "dapps_open", } + +export enum SettingEventType { + OptOut = "opt_out", +} diff --git a/packages/extension/src/libs/nft-handlers/simplehash.ts b/packages/extension/src/libs/nft-handlers/simplehash.ts index 88361664c..b644ee64d 100644 --- a/packages/extension/src/libs/nft-handlers/simplehash.ts +++ b/packages/extension/src/libs/nft-handlers/simplehash.ts @@ -24,7 +24,6 @@ export default async ( [NetworkNames.MaticZK]: "polygon-zkevm", [NetworkNames.ZkSync]: "zksync-era", [NetworkNames.ZkSyncGoerli]: "zksync-era-testnet", - [NetworkNames.Goerli]: "ethereum-goerli", [NetworkNames.Base]: "base", }; if (!Object.keys(supportedNetworks).includes(network.name)) diff --git a/packages/extension/src/libs/settings-state/index.ts b/packages/extension/src/libs/settings-state/index.ts index 025b13f81..2987d650d 100644 --- a/packages/extension/src/libs/settings-state/index.ts +++ b/packages/extension/src/libs/settings-state/index.ts @@ -49,6 +49,7 @@ class SettingsState { const settings: EnkryptSettingsType = { installedTimestamp: 0, randomUserID: "", + isMetricsEnabled: true, }; return merge(settings, state); } diff --git a/packages/extension/src/libs/settings-state/types.ts b/packages/extension/src/libs/settings-state/types.ts index 79f2bb3f8..a7d375b64 100644 --- a/packages/extension/src/libs/settings-state/types.ts +++ b/packages/extension/src/libs/settings-state/types.ts @@ -20,6 +20,7 @@ export interface BtcSettingsType { export interface EnkryptSettingsType { installedTimestamp: number; randomUserID: string; + isMetricsEnabled: boolean; } export interface SettingsType { evm: EVMSettingsType; diff --git a/packages/extension/src/providers/ethereum/inject.ts b/packages/extension/src/providers/ethereum/inject.ts index 24a7d59ee..89807fc1e 100644 --- a/packages/extension/src/providers/ethereum/inject.ts +++ b/packages/extension/src/providers/ethereum/inject.ts @@ -146,6 +146,9 @@ const injectDocument = ( const provider = new Provider(options); const proxiedProvider = new Proxy(provider, ProxyHandler); document["enkrypt"]["providers"][options.name] = provider; + if (__IS_OPERA__) { + document[options.name] = proxiedProvider; // Opera expects you to inject immediatly and their wallet switcher will handle conflicts + } options .sendMessageHandler( ProviderName.enkrypt, diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts index ef4490c5b..54b8bcf51 100644 --- a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts @@ -2,7 +2,6 @@ import { NetworkNames } from "@enkryptcom/types"; const NetworkEndpoints: Record = { [NetworkNames.Ethereum]: "https://api.etherscan.io/", - [NetworkNames.Goerli]: "https://api-goerli.etherscan.io/", [NetworkNames.Binance]: "https://api.bscscan.com/", [NetworkNames.Matic]: "https://api.polygonscan.com/", [NetworkNames.Moonbeam]: "https://api-moonbeam.moonscan.io/", diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/rivet/configs.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/rivet/configs.ts index 24f3c97ee..daec718ea 100644 --- a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/rivet/configs.ts +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/rivet/configs.ts @@ -3,7 +3,6 @@ import { NetworkNames } from "@enkryptcom/types"; const NetworkEndpoints = { [NetworkNames.Ethereum]: "https://nodes.mewapi.io/rpc/eth", [NetworkNames.Sepolia]: "https://nodes.mewapi.io/rpc/sepolia", - [NetworkNames.Goerli]: "https://nodes.mewapi.io/rpc/goerli", [NetworkNames.EthereumClassic]: "https://nodes.mewapi.io/rpc/etc", }; diff --git a/packages/extension/src/providers/ethereum/networks/form-testnet.ts b/packages/extension/src/providers/ethereum/networks/form-testnet.ts index ee6e82f0b..aba41e7dc 100644 --- a/packages/extension/src/providers/ethereum/networks/form-testnet.ts +++ b/packages/extension/src/providers/ethereum/networks/form-testnet.ts @@ -15,7 +15,7 @@ const formTestnetOptions: EvmNetworkOptions = { currencyName: "ETH", currencyNameLong: "Ethereum", node: "wss://testnet-rpc.form.network/ws", - icon: require("./icons/eth.svg"), + icon: require("./icons/form.png"), activityHandler: wrapActivityHandler(EtherscanActivity), }; diff --git a/packages/extension/src/providers/ethereum/networks/goerli.ts b/packages/extension/src/providers/ethereum/networks/goerli.ts deleted file mode 100644 index 13fadb1e2..000000000 --- a/packages/extension/src/providers/ethereum/networks/goerli.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NetworkNames } from "@enkryptcom/types"; -import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; -import { RivetActivity } from "../libs/activity-handlers"; -import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; -import shNFTHandler from "@/libs/nft-handlers/simplehash"; - -const goerliOptions: EvmNetworkOptions = { - name: NetworkNames.Goerli, - name_long: "Goerli", - homePage: "https://github.com/goerli/testnet", - blockExplorerTX: "https://goerli.etherscan.io/tx/[[txHash]]", - blockExplorerAddr: "https://goerli.etherscan.io/address/[[address]]", - chainID: "0x5", - isTestNetwork: true, - currencyName: "GöETH", - currencyNameLong: "Goerli", - node: "wss://nodes.mewapi.io/ws/goerli", - icon: require("./icons/eth.svg"), - NFTHandler: shNFTHandler, - activityHandler: wrapActivityHandler(RivetActivity), -}; - -const goerli = new EvmNetwork(goerliOptions); - -export default goerli; diff --git a/packages/extension/src/providers/ethereum/networks/icons/form.png b/packages/extension/src/providers/ethereum/networks/icons/form.png new file mode 100644 index 000000000..4156b8201 Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/form.png differ diff --git a/packages/extension/src/providers/ethereum/networks/index.ts b/packages/extension/src/providers/ethereum/networks/index.ts index b52ab6e70..e45505591 100644 --- a/packages/extension/src/providers/ethereum/networks/index.ts +++ b/packages/extension/src/providers/ethereum/networks/index.ts @@ -1,5 +1,4 @@ import ethNode from "./eth"; -import goerliNode from "./goerli"; import etcNode from "./etc"; import maticNode from "./matic"; import maticZkNode from "./maticzk"; @@ -35,7 +34,6 @@ import formTestnet from "./form-testnet"; import artheraTestNode from "./aat"; export default { - goerli: goerliNode, sepolia: sepoliaNode, ethereum: ethNode, etc: etcNode, diff --git a/packages/extension/src/providers/ethereum/tests/ethereum.events.mocha.ts b/packages/extension/src/providers/ethereum/tests/ethereum.events.mocha.ts index 4925883ad..df2d976d1 100644 --- a/packages/extension/src/providers/ethereum/tests/ethereum.events.mocha.ts +++ b/packages/extension/src/providers/ethereum/tests/ethereum.events.mocha.ts @@ -22,6 +22,7 @@ const defaultSettings = { enkrypt: { installedTimestamp: 0, randomUserID: "", + isMetricsEnabled: true, }, manifestVersion: 3, }; diff --git a/packages/extension/src/providers/ethereum/tests/ethereum.requests.mocha.ts b/packages/extension/src/providers/ethereum/tests/ethereum.requests.mocha.ts index f0cc48a69..15d9a6a5f 100644 --- a/packages/extension/src/providers/ethereum/tests/ethereum.requests.mocha.ts +++ b/packages/extension/src/providers/ethereum/tests/ethereum.requests.mocha.ts @@ -23,6 +23,7 @@ const defaultSettings = { enkrypt: { installedTimestamp: 0, randomUserID: "", + isMetricsEnabled: true, }, manifestVersion: 3, }; diff --git a/packages/extension/src/providers/polkadot/tests/polkadot.requests.mocha.ts b/packages/extension/src/providers/polkadot/tests/polkadot.requests.mocha.ts index 27b3d9357..ab7693779 100644 --- a/packages/extension/src/providers/polkadot/tests/polkadot.requests.mocha.ts +++ b/packages/extension/src/providers/polkadot/tests/polkadot.requests.mocha.ts @@ -64,6 +64,7 @@ const tempWindow: EnkryptWindow = { enkrypt: { installedTimestamp: 0, randomUserID: "", + isMetricsEnabled: true, }, manifestVersion: 3, }, diff --git a/packages/extension/src/types/shims-vue.d.ts b/packages/extension/src/types/shims-vue.d.ts index 9bf592026..08730cdd9 100644 --- a/packages/extension/src/types/shims-vue.d.ts +++ b/packages/extension/src/types/shims-vue.d.ts @@ -1,3 +1,4 @@ declare module "*.vue"; declare module "vue3-lottie"; declare const __VERSION__: string; +declare const __IS_OPERA__: boolean; diff --git a/packages/extension/src/ui/action/views/settings/views/settings-general/index.vue b/packages/extension/src/ui/action/views/settings/views/settings-general/index.vue index 7beec7ed8..d05bedb77 100644 --- a/packages/extension/src/ui/action/views/settings/views/settings-general/index.vue +++ b/packages/extension/src/ui/action/views/settings/views/settings-general/index.vue @@ -38,6 +38,18 @@

Enable Enkrypt act like Unisat wallet for dapps

+ +
+

+ MEW uses Amplitude events to improve Enkrypt. No identifiable + information is collected. +

+
+