Skip to content

Commit

Permalink
Merge branch 'main' into feat/safari-support
Browse files Browse the repository at this point in the history
  • Loading branch information
kvhnuke committed Jun 25, 2024
2 parents bc874a6 + e569724 commit bf54bdd
Show file tree
Hide file tree
Showing 33 changed files with 1,685 additions and 1,648 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@swc/core": "^1.5.3",
"@swc/core": "^1.6.3",
"concurrently": "^8.2.2",
"husky": "^9.0.11",
"node-notifier": "^10.0.1",
"nodemon": "^3.1.0",
"nodemon": "^3.1.3",
"ultra-runner": "^3.10.5"
},
"resolutions": {
Expand Down
8 changes: 4 additions & 4 deletions packages/extension-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"nanoevents": "^9.0.0",
"serialize-error": "11.0.3",
"tiny-uid": "^1.1.2",
"webextension-polyfill": "^0.10.0"
"webextension-polyfill": "^0.12.0"
},
"devDependencies": {
"@types/chai": "^4.3.16",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.10",
"@types/node": "^20.14.6",
"@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": "^8.0.2",
"type-fest": "^4.18.2",
"tsup": "^8.1.0",
"type-fest": "^4.20.1",
"typescript": "^4.9.5",
"typescript-eslint": "0.0.1-alpha.0"
}
Expand Down
58 changes: 29 additions & 29 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.40.0",
"version": "1.41.0",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand All @@ -22,8 +22,8 @@
"watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean"
},
"dependencies": {
"@amplitude/analytics-browser": "2.5.3",
"@babel/runtime": "^7.24.5",
"@amplitude/analytics-browser": "^2.9.0",
"@babel/runtime": "^7.24.7",
"@enkryptcom/extension-bridge": "workspace:^",
"@enkryptcom/hw-wallets": "workspace:^",
"@enkryptcom/keyring": "workspace:^",
Expand All @@ -35,25 +35,25 @@
"@ethereumjs/common": "^4.3.0",
"@ethereumjs/tx": "^5.3.0",
"@ethereumjs/util": "^9.0.3",
"@kadena/client": "^1.11.0",
"@ledgerhq/hw-transport-webusb": "^6.28.6",
"@kadena/client": "^1.12.0",
"@ledgerhq/hw-transport-webusb": "^6.29.0",
"@metamask/eth-sig-util": "^7.0.2",
"@rollup/plugin-replace": "^5.0.5",
"@types/chrome": "^0.0.267",
"@rollup/plugin-replace": "^5.0.7",
"@types/chrome": "^0.0.268",
"@types/events": "^3.0.3",
"@types/less": "^3.0.6",
"@types/lodash": "^4.17.1",
"@types/lodash": "^4.17.5",
"@types/utf-8-validate": "^5.0.2",
"@vueuse/core": "^10.9.0",
"@vueuse/core": "^10.11.0",
"add": "^2.0.6",
"bignumber.js": "^9.1.2",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.5",
"bitcoinjs-lib": "^6.1.6",
"chai": "^4.4.1",
"concurrently": "^8.2.2",
"core-js": "^3.37.0",
"core-js": "^3.37.1",
"echarts": "^5.5.0",
"ethereum-cryptography": "^2.1.3",
"ethereum-cryptography": "^2.2.0",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-wallet": "^1.0.2",
"eventemitter3": "^5.0.1",
Expand All @@ -66,10 +66,10 @@
"qrcode.vue": "^3.4.1",
"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^9.0.1",
"vue": "^3.4.27",
"vue-echarts": "6.7.2",
"vue-router": "4.3.2",
"uuid": "^10.0.0",
"vue": "^3.4.29",
"vue-echarts": "6.7.3",
"vue-router": "4.3.3",
"vue3-lottie": "^3.3.0",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.10.4",
Expand All @@ -78,18 +78,18 @@
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@babel/plugin-transform-class-static-block": "^7.24.4",
"@kadena/pactjs-cli": "^1.11.0",
"@polkadot/api": "^11.0.2",
"@polkadot/extension-inject": "^0.47.3",
"@babel/plugin-transform-class-static-block": "^7.24.7",
"@kadena/pactjs-cli": "^1.12.0",
"@polkadot/api": "^11.3.1",
"@polkadot/extension-inject": "^0.47.6",
"@polkadot/keyring": "^12.6.2",
"@polkadot/rpc-provider": "^11.0.2",
"@polkadot/types": "^11.0.2",
"@polkadot/types-known": "^11.0.2",
"@polkadot/rpc-provider": "^11.3.1",
"@polkadot/types": "^11.3.1",
"@polkadot/types-known": "^11.3.1",
"@polkadot/ui-shared": "^3.6.6",
"@polkadot/util": "^12.6.2",
"@polkadot/wasm-crypto": "^7.3.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-inject": "^5.0.5",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
Expand Down Expand Up @@ -119,18 +119,18 @@
"mocha": "^10.4.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^4.17.2",
"rimraf": "^5.0.7",
"rollup": "^4.18.0",
"rollup-plugin-uglify": "^6.0.4",
"semver": "^7.6.1",
"semver": "^7.6.2",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.22.8",
"systeminformation": "^5.22.11",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5",
"url": "^0.11.3",
"webextension-polyfill": "^0.10.0"
"webextension-polyfill": "^0.12.0"
},
"installConfig": {
"hoistingLimits": "none"
Expand Down
5 changes: 5 additions & 0 deletions packages/extension/src/libs/background/internal/unlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getCustomError } from "@/libs/error";
import KeyRingBase from "@/libs/keyring/keyring";
import { InternalOnMessageResponse } from "@/types/messenger";
import { RPCRequestType } from "@enkryptcom/types";
import { initAccounts } from "@/libs/utils/initialize-wallet";

const unlock = (
keyring: KeyRingBase,
Expand All @@ -12,9 +13,13 @@ const unlock = (
error: getCustomError("background: invalid params for unlocking"),
});
const password = message.params[0] as string;
const initNewAccounts = (message.params[1] as boolean) ?? false;
return keyring
.unlock(password)
.then(() => {
if (initNewAccounts) {
initAccounts(keyring);
}
return {
result: JSON.stringify(true),
};
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/src/libs/market-data/ethvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface getCoinGeckoTokenInfoAllType {
}[];
};
}
const ETHVM_BASE = `https://api-v2.ethvm.dev/`;
const ETHVM_BASE = `https://api-v3.ethvm.dev`;

const ethvmPost = (requestData: string): Promise<any> => {
return cacheFetch(
Expand Down
46 changes: 24 additions & 22 deletions packages/extension/src/libs/metrics/amplitude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,30 @@ class Metrics {
const settingsState = new SettingsState();
settingsState.getEnkryptSettings().then((set) => {
this.installedTime = set.installedTimestamp;
init("apikey", {
instanceName: process.env.IS_DEV
? "enkrypt-extension-dev"
: "enkrypt-extension",
optOut: !set.isMetricsEnabled,
serverUrl: process.env.IS_DEV
? "https://analytics-enkrypt-dev.mewwallet.dev/record"
: "https://analytics-enkrypt.mewwallet.dev/record",
appVersion: process.env.PACKAGE_VERSION as string,
trackingOptions: {
ipAddress: false,
},
userId: set.randomUserID,
useBatch: true,
identityStorage: "none",
logLevel: Types.LogLevel.None,
defaultTracking: {
formInteractions: false,
pageViews: false,
sessions: false,
},
});
if (typeof window !== "undefined") {
init("apikey", {
instanceName: process.env.IS_DEV
? "enkrypt-extension-dev"
: "enkrypt-extension",
optOut: !set.isMetricsEnabled,
serverUrl: process.env.IS_DEV
? "https://analytics-enkrypt-dev.mewwallet.dev/record"
: "https://analytics-enkrypt.mewwallet.dev/record",
appVersion: process.env.PACKAGE_VERSION as string,
trackingOptions: {
ipAddress: false,
},
userId: set.randomUserID,
useBatch: true,
identityStorage: "none",
sessionTimeout: 15 * 60 * 1000, // 15 mins
logLevel: Types.LogLevel.None,
defaultTracking: {
formInteractions: false,
pageViews: false,
},
});
}
});
}
track(event: string, options: Record<string, unknown>) {
Expand Down
12 changes: 7 additions & 5 deletions packages/extension/src/libs/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ const trackDAppsEvents = (
};

const optOutofMetrics = (optOut: boolean) => {
metrics.setOptOut(false);
metrics.track("settings", {
event: SettingEventType.OptOut,
value: optOut ? 1 : 0,
});
if (!process.env.IS_FIREFOX) {
metrics.setOptOut(false);
metrics.track("settings", {
event: SettingEventType.OptOut,
value: optOut ? 1 : 0,
});
}
metrics.setOptOut(optOut);
};

Expand Down
2 changes: 0 additions & 2 deletions packages/extension/src/libs/utils/initialize-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ export const onboardInitializeWallets = async (
): Promise<void> => {
const kr = new KeyRing();
await kr.init(mnemonic, password);
await kr.unlock(password);
await initAccounts(kr);
};
6 changes: 6 additions & 0 deletions packages/extension/src/libs/utils/open-onboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import Browser from "webextension-polyfill";

export const openPrivacy = () => {
const onboardURL = Browser.runtime.getURL("onboard.html#/user-privacy");
Browser.tabs.create({
url: onboardURL,
});
};
export default () => {
const onboardURL = Browser.runtime.getURL("onboard.html");
Browser.tabs.create({
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/manifest/manifest-firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"gecko": {
"strict_min_version": "100.0"
}
}
},
"content_security_policy": "script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'"
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const importAction = async () => {
sendToBackgroundFromAction({
message: JSON.stringify({
method: InternalMethods.unlock,
params: [keyringPassword.value],
params: [keyringPassword.value, false],
}),
}); // needed to reinitialize background keyring with new vals
isDone.value = true;
Expand Down
7 changes: 1 addition & 6 deletions packages/extension/src/ui/action/views/lock-screen/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ import { sendToBackgroundFromAction } from "@/libs/messenger/extension";
import { InternalMethods } from "@/types/messenger";
import { computed } from "@vue/reactivity";
import SwapLookingAnimation from "@action/icons/swap/swap-looking-animation.vue";
import KeyRing from "@/libs/keyring/keyring";
import { initAccounts } from "@/libs/utils/initialize-wallet";
import { trackGenericEvents } from "@/libs/metrics";
import { GenericEvents } from "@/libs/metrics/types";
Expand All @@ -75,7 +73,7 @@ const unlockAction = async () => {
const unlockStatus = await sendToBackgroundFromAction({
message: JSON.stringify({
method: InternalMethods.unlock,
params: [password.value.trim()],
params: [password.value.trim(), true],
}),
});
if (unlockStatus.error) {
Expand All @@ -84,9 +82,6 @@ const unlockAction = async () => {
trackGenericEvents(GenericEvents.login_error);
} else {
isError.value = false;
const privateKeyring = new KeyRing();
await privateKeyring.unlock(password.value.trim());
await initAccounts(privateKeyring);
password.value = "";
emit("update:init");
setTimeout(() => (isUnlocking.value = false), 750);
Expand Down
1 change: 1 addition & 0 deletions packages/extension/src/ui/onboard/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const isShowBackButton = () => {
return (
route.name &&
route.name != "new-wallet" &&
route.name != "user-analytics" &&
route.name != "create-wallet-wallet-ready" &&
route.name != "restore-wallet-wallet-ready" &&
!(route.name as string).includes("hardware-wallet")
Expand Down
6 changes: 6 additions & 0 deletions packages/extension/src/ui/onboard/create-wallet/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TypePassword from "./type-password.vue";
import RecoveryPhrase from "./recovery-phrase.vue";
import CheckPhrase from "./double-check-phrase.vue";
import WalletReady from "./wallet-ready.vue";
import UserAnalytics from "../user-analytics.vue";
import { RouteRecordRaw } from "vue-router";
export const routes = {
pickPassword: {
Expand All @@ -25,6 +26,11 @@ export const routes = {
name: "check-phrase",
component: CheckPhrase,
},
userAnalytics: {
path: "user-analytics",
name: "user-analytics",
component: UserAnalytics,
},
walletReady: {
path: "wallet-ready",
name: "wallet-ready",
Expand Down
6 changes: 6 additions & 0 deletions packages/extension/src/ui/onboard/restore-wallet/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import EnterRecoveryPhrase from "./enter-recovery-phrase.vue";
import PickPassword from "./pick-password.vue";
import TypePassword from "./type-password.vue";
import WalletReady from "../create-wallet/wallet-ready.vue";
import UserAnalytics from "../user-analytics.vue";
import { RouteRecordRaw } from "vue-router";
export const routes = {
start: {
Expand Down Expand Up @@ -31,6 +32,11 @@ export const routes = {
name: "type-password",
component: TypePassword,
},
userAnalytics: {
path: "user-analytics",
name: "user-analytics",
component: UserAnalytics,
},
walletReady: {
path: "wallet-ready",
name: "wallet-ready",
Expand Down
Loading

1 comment on commit bf54bdd

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.