Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devop: 🔧 add swap analytics #414

Merged
merged 46 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
baad05f
devop: temp setup for opera and edge
kvhnuke Aug 15, 2023
c84e5e7
Merge branch 'main' into fix/opera-edge-store
kvhnuke Sep 5, 2023
6561610
Merge branch 'main' into fix/opera-edge-store
kvhnuke Sep 15, 2023
b92182f
Merge branch 'main' into fix/opera-edge-store
kvhnuke Oct 2, 2023
2695450
Merge branch 'main' into fix/opera-edge-store
kvhnuke Oct 24, 2023
4662693
Merge branch 'main' into fix/opera-edge-store
kvhnuke Jan 3, 2024
53c9691
Merge branch 'main' into fix/opera-edge-store
kvhnuke Jan 11, 2024
e41dfcb
Merge branch 'main' into fix/opera-edge-store
kvhnuke Jan 23, 2024
ba254ad
Merge pull request #400 from enkryptcom/develop
kvhnuke Feb 22, 2024
6819f60
Merge branch 'main' into fix/opera-edge-store
kvhnuke Feb 22, 2024
75347fd
Merge pull request #403 from enkryptcom/develop
kvhnuke Feb 28, 2024
a70100f
Merge branch 'main' into fix/opera-edge-store
kvhnuke Feb 28, 2024
9a98ce7
devop: minor package updates
kvhnuke Feb 28, 2024
f087b0e
devop: remove commitlint
kvhnuke Feb 28, 2024
e7548cf
devop: switch to commitlint
kvhnuke Feb 28, 2024
9232c0d
devop: commitlint
kvhnuke Feb 28, 2024
6434f3f
devop: commitlint
kvhnuke Feb 28, 2024
c39281f
devop: update @ensdomains/address-encoder
kvhnuke Feb 28, 2024
b82bdf6
devop: update @ethereumjs/common/tx
kvhnuke Feb 28, 2024
355c8d9
devop: update @ledger/common
kvhnuke Feb 28, 2024
5a0766c
devop: update js-ethereum-cryptography
kvhnuke Feb 28, 2024
3f58113
devop: update utils
kvhnuke Feb 28, 2024
ee92473
devop: husky
kvhnuke Feb 28, 2024
6773bcd
devop: prep husky
kvhnuke Feb 28, 2024
95bee65
devop: update vuedraggable and lottie
kvhnuke Feb 28, 2024
35b649b
devop: switch to @ethereumjs/utils
kvhnuke Feb 29, 2024
69c71b2
devop: update yarnlock
kvhnuke Mar 4, 2024
3cd09d4
Merge pull request #408 from enkryptcom/develop
kvhnuke Mar 6, 2024
4258591
devop: 🔧 add swap analytics
kvhnuke Mar 20, 2024
8aa162d
Merge pull request #415 from enkryptcom/develop
kvhnuke Mar 20, 2024
4625097
devop: merge and update
kvhnuke Mar 20, 2024
6bbdb38
devop: more updates
kvhnuke Mar 20, 2024
acab47e
Merge branch 'main' into devop/update-packages
kvhnuke Mar 20, 2024
e0b5e01
devop: merge
kvhnuke Mar 20, 2024
e67c53a
devop: amplitude events
kvhnuke Mar 21, 2024
db30857
devop: set prod amplitude links
kvhnuke Mar 21, 2024
8902c1d
devop: update browserlist
kvhnuke Mar 21, 2024
775b887
devop: upgrade rollup
kvhnuke Mar 21, 2024
3756cda
devop: add more analytics
kvhnuke Mar 25, 2024
244aef9
fix: tests
kvhnuke Mar 25, 2024
87e8284
Merge pull request #404 from enkryptcom/devop/update-packages
kvhnuke Mar 25, 2024
a7f56fc
devop: add swap close and swap back metrics
kvhnuke Mar 26, 2024
ee76431
fix: subscan activity
kvhnuke Mar 27, 2024
65eebce
devop: add setting to disable metrics
kvhnuke Mar 29, 2024
25df0f2
fix: toggle
kvhnuke Mar 29, 2024
0dfbc4a
devop: prep for release
kvhnuke Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn commitlint --edit $1
4 changes: 0 additions & 4 deletions .husky/prepare-commit-msg

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.3.cjs

This file was deleted.

875 changes: 875 additions & 0 deletions .yarn/releases/yarn-3.8.1.cjs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
checksumBehavior: update

nodeLinker: node-modules

plugins:
Expand All @@ -8,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.6.3.cjs
yarnPath: .yarn/releases/yarn-3.8.1.cjs
24 changes: 24 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
[
"devop",
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
"button",
],
],
},
};
40 changes: 0 additions & 40 deletions devmoji.config.js

This file was deleted.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enkrypt",
"packageManager": "yarn@3.6.3",
"packageManager": "yarn@3.8.1",
"version": "0.0.2",
"private": true,
"workspaces": [
Expand All @@ -26,15 +26,15 @@
"upgrade": "yarn upgrade-interactive",
"version:bump:patch": "yarn workspaces foreach -pv --exclude @enkryptcom/extension exec 'yarn version --immediate patch'",
"publish": "yarn workspaces foreach -pv --exclude @enkryptcom/extension exec 'yarn npm publish --access public --otp 474911'",
"version:apply": "yarn version apply --all"
"version:apply": "yarn version apply --all",
"prepare": "husky"
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@swc/core": "^1.4.4",
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@swc/core": "^1.4.8",
"concurrently": "^8.2.2",
"devmoji": "^2.3.0",
"husky": "^8.0.3",
"husky": "^9.0.11",
"node-notifier": "^10.0.1",
"nodemon": "^3.1.0",
"ultra-runner": "^3.10.5"
Expand Down
10 changes: 5 additions & 5 deletions packages/extension-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"dist"
],
"dependencies": {
"nanoevents": "^7.0.1",
"nanoevents": "^9.0.0",
"serialize-error": "11.0.3",
"tiny-uid": "^1.1.2",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@types/chai": "^4.3.12",
"@types/chai": "^4.3.14",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.24",
"@types/node": "^20.11.30",
"@types/webextension-polyfill": "^0.10.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
Expand All @@ -55,8 +55,8 @@
"prettier": "^2.8.8",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsup": "^6.7.0",
"type-fest": "^2.19.0",
"tsup": "^8.0.2",
"type-fest": "^4.13.1",
"typescript": "^4.9.5",
"typescript-eslint": "0.0.1-alpha.0"
}
Expand Down
6 changes: 6 additions & 0 deletions packages/extension/configs/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const BROWSER = process.env.BROWSER;
const browserNames = {
chrome: "chrome",
firefox: "firefox",
operaedge: "opera-edge",
};

const browserConfigs = {
Expand All @@ -18,6 +19,10 @@ const browserConfigs = {
manifest: "./src/manifest/manifest-firefox.json",
background: "./src/scripts/firefox/background.ts",
},
[browserNames.operaedge]: {
manifest: "./src/manifest/manifest-edge-opera.json",
background: "./src/scripts/chrome/background.ts",
},
};

function modifyManifest(buffer) {
Expand Down Expand Up @@ -67,6 +72,7 @@ const setConfig = (config) => {
BUILD_TIME: new Date().toLocaleString().replace(/\D/g, ""),
IS_DEV: process.env.NODE_ENV === "development",
IS_FIREFOX: BROWSER === browserNames.firefox,
IS_OPERA_EDGE: BROWSER === browserNames.operaedge,
PREFILL_PASSWORD:
process.env.NODE_ENV === "development"
? JSON.stringify("test pass")
Expand Down
47 changes: 25 additions & 22 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "@enkryptcom/extension",
"version": "1.36.0",
"version": "1.37.0",
"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: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",
Expand All @@ -18,7 +19,8 @@
"watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean"
},
"dependencies": {
"@babel/runtime": "^7.23.8",
"@amplitude/analytics-browser": "^2.5.3",
"@babel/runtime": "^7.24.1",
"@enkryptcom/extension-bridge": "workspace:^",
"@enkryptcom/hw-wallets": "workspace:^",
"@enkryptcom/keyring": "workspace:^",
Expand All @@ -27,33 +29,34 @@
"@enkryptcom/swap": "workspace:^",
"@enkryptcom/types": "workspace:^",
"@enkryptcom/utils": "workspace:^",
"@ethereumjs/common": "^3.2.0",
"@ethereumjs/tx": "^4.2.0",
"@ledgerhq/hw-transport-webusb": "^6.28.4",
"@ethereumjs/common": "^4.3.0",
"@ethereumjs/tx": "^5.3.0",
"@ethereumjs/util": "^9.0.3",
"@ledgerhq/hw-transport-webusb": "^6.28.5",
"@metamask/eth-sig-util": "^7.0.1",
"@rollup/plugin-replace": "^5.0.5",
"@types/chrome": "^0.0.262",
"@types/chrome": "^0.0.263",
"@types/events": "^3.0.3",
"@types/less": "^3.0.6",
"@types/lodash": "^4.14.202",
"@types/lodash": "^4.17.0",
"@types/utf-8-validate": "^5.0.2",
"@vueuse/core": "^9.13.0",
"@vueuse/core": "^10.9.0",
"add": "^2.0.6",
"bignumber.js": "^9.1.2",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.5",
"chai": "^4.4.1",
"concurrently": "^8.2.2",
"core-js": "^3.36.0",
"core-js": "^3.36.1",
"echarts": "^5.5.0",
"ethereum-cryptography": "^2.1.3",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-util": "^7.1.5",
"ethereumjs-wallet": "^1.0.2",
"eventemitter3": "^5.0.1",
"lodash": "^4.17.21",
"memoize-one": "^6.0.0",
"moment": "^2.30.1",
"nanoevents": "^7.0.1",
"nanoevents": "^9.0.0",
"pinia": "^2.1.7",
"qrcode.vue": "^3.4.1",
"switch-ts": "^1.1.1",
Expand All @@ -62,21 +65,21 @@
"vue": "^3.4.21",
"vue-echarts": "6.6.9",
"vue-router": "4.3.0",
"vue3-lottie": "^2.7.4",
"vue3-lottie": "^3.3.0",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.10.4",
"web3-utils": "^1.10.4",
"yarn": "^1.22.21",
"yarn": "^1.22.22",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@babel/plugin-transform-class-static-block": "^7.23.4",
"@polkadot/api": "^10.12.1",
"@polkadot/extension-inject": "^0.46.7",
"@babel/plugin-transform-class-static-block": "^7.24.1",
"@polkadot/api": "^10.12.4",
"@polkadot/extension-inject": "^0.46.9",
"@polkadot/keyring": "^12.6.2",
"@polkadot/rpc-provider": "^10.12.1",
"@polkadot/types": "^10.12.1",
"@polkadot/types-known": "^10.12.1",
"@polkadot/rpc-provider": "^10.12.4",
"@polkadot/types": "^10.12.4",
"@polkadot/types-known": "^10.12.4",
"@polkadot/ui-shared": "^3.6.5",
"@polkadot/util": "^12.6.2",
"@polkadot/wasm-crypto": "^7.3.2",
Expand Down Expand Up @@ -106,17 +109,17 @@
"eslint-plugin-vue": "^8.7.1",
"https-browserify": "^1.0.0",
"less": "^4.2.0",
"less-loader": "^11.1.4",
"less-loader": "^12.2.0",
"mocha": "^10.3.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^3.29.4",
"rollup": "^4.13.0",
"rollup-plugin-uglify": "^6.0.4",
"semver": "^7.6.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.22.0",
"systeminformation": "^5.22.6",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5",
Expand Down
21 changes: 19 additions & 2 deletions packages/extension/src/libs/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Message,
} from "@/types/messenger";
import { RPCRequestType } from "@enkryptcom/types";
import { v4 as randomUUID } from "uuid";
import { getCustomError } from "../error";
import KeyRingBase from "../keyring/keyring";
import { sendToWindow } from "@/libs/messenger/extension";
Expand Down Expand Up @@ -35,11 +36,13 @@ class BackgroundHandler {
#providers: ProviderType;
#persistentEvents: PersistentEvents;
#domainState: DomainState;
#settingsState: SettingsState;

constructor() {
this.#keyring = new KeyRingBase();
this.#persistentEvents = new PersistentEvents();
this.#domainState = new DomainState();
this.#settingsState = new SettingsState();
this.#tabProviders = {
[ProviderName.ethereum]: {},
[ProviderName.polkadot]: {},
Expand All @@ -49,6 +52,21 @@ class BackgroundHandler {
}
async init(): Promise<void> {
await handlePersistentEvents.bind(this)();
const enkryptSettings = await this.#settingsState.getEnkryptSettings();
if (!enkryptSettings.installedTimestamp) {
await this.#settingsState.setEnkryptSettings({
...enkryptSettings,
...{
installedTimestamp: new Date().getTime(),
randomUserID: randomUUID(),
},
});
} else {
await this.#settingsState.setEnkryptSettings({
...enkryptSettings,
randomUserID: randomUUID(),
});
}
}
async externalHandler(
msg: Message,
Expand All @@ -67,8 +85,7 @@ class BackgroundHandler {
result: JSON.stringify(true),
};
} else if (method === InternalMethods.getSettings) {
const settingsState = new SettingsState();
return settingsState.getAllSettings().then((settings) => {
return this.#settingsState.getAllSettings().then((settings) => {
return {
result: JSON.stringify(settings),
};
Expand Down
Loading
Loading