Skip to content

Commit

Permalink
Merge pull request #251 from enkryptcom/develop
Browse files Browse the repository at this point in the history
Release: v1.14.0
  • Loading branch information
kvhnuke authored Mar 21, 2023
2 parents 3819c9c + 63e4d1e commit b86505c
Show file tree
Hide file tree
Showing 59 changed files with 2,312 additions and 1,416 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ jobs:
mkdir release
docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "yarn build:all"
docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:chrome && yarn zip"
mv packages/extension/dist/release.zip release/enkrypt-chrome-edge-${{ steps.get_release_tag.outputs.VERSION }}.zip
mv packages/extension/dist/release.zip release/enkrypt-chrome-edge-opera-${{ steps.get_release_tag.outputs.VERSION }}.zip
docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:firefox && yarn zip"
mv packages/extension/dist/release.zip release/enkrypt-firefox-${{ steps.get_release_tag.outputs.VERSION }}.xpi
docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:opera && yarn zip"
mv packages/extension/dist/release.zip release/enkrypt-opera-${{ steps.get_release_tag.outputs.VERSION }}.zip
- uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
550 changes: 550 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions .yarn/versions/8cbbf8cb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
undecided:
- enkrypt
- "@enkryptcom/extension"
- "@enkryptcom/extension-bridge"
- "@enkryptcom/hw-wallets"
- "@enkryptcom/keyring"
- "@enkryptcom/name-resolution"
- "@enkryptcom/request"
- "@enkryptcom/signer-bitcoin"
- "@enkryptcom/signer-ethereum"
- "@enkryptcom/signer-polkadot"
- "@enkryptcom/storage"
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ plugins:
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.2.2.cjs
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "enkrypt",
"packageManager": "[email protected]",
"version": "0.0.1",
"private": true,
"workspaces": [
"packages/signers/*",
Expand All @@ -15,22 +16,26 @@
"packages/name-resolution"
],
"scripts": {
"test": "yarn workspaces foreach -pv run test",
"test": "yarn workspaces foreach -v run test",
"lint": "yarn workspaces foreach run lint",
"build:all": "ultra -r build",
"watch": "concurrently 'npm:watch-*'",
"watch-extension": "cd packages/extension && npm run watch",
"watch-ts": "nodemon --exec 'yarn run build:all && node scripts/compile-done.js'"
"watch-ts": "nodemon --exec 'yarn run build:all && node scripts/compile-done.js'",
"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'",
"version:apply": "yarn version apply --all"
},
"devDependencies": {
"@commitlint/cli": "^17.4.2",
"@commitlint/config-conventional": "^17.4.2",
"@swc/core": "^1.3.32",
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@swc/core": "^1.3.41",
"concurrently": "^7.6.0",
"devmoji": "^2.3.0",
"husky": "^8.0.3",
"node-notifier": "^10.0.1",
"nodemon": "^2.0.20",
"nodemon": "^2.0.21",
"ultra-runner": "^3.10.5"
}
}
16 changes: 8 additions & 8 deletions packages/extension-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension-bridge",
"version": "0.0.1",
"version": "0.0.2",
"description": "Messaging in Web Extensions made easy. Out of the box.",
"keywords": [
"chrome",
Expand Down Expand Up @@ -42,21 +42,21 @@
"@antfu/eslint-config": "^0.27.0",
"@types/chai": "^4.3.4",
"@types/mocha": "^9.1.1",
"@types/node": "^18.13.0",
"@types/node": "^18.15.3",
"@types/webextension-polyfill": "^0.10.0",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"bumpp": "^8.2.1",
"eslint": "^8.33.0",
"eslint": "^8.36.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^8.7.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-module-resolver": "^1.5.0",
"prettier": "^2.8.3",
"prettier": "^2.8.4",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.2",
"tsup": "^6.6.0",
"tsup": "^6.6.3",
"type-fest": "^2.19.0",
"typescript": "^4.9.5",
"typescript-eslint": "0.0.1-alpha.0"
Expand Down
6 changes: 0 additions & 6 deletions packages/extension/configs/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const BROWSER = process.env.BROWSER;
const browserNames = {
chrome: "chrome",
firefox: "firefox",
opera: "opera",
};

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

function modifyManifest(buffer) {
Expand Down Expand Up @@ -65,7 +60,6 @@ const setConfig = (config) => {
const _base = args[0]["process.env"];
args[0]["process.env"] = {
..._base,
IS_MANIFEST_V3: BROWSER === browserNames.chrome,
PACKAGE_VERSION: JSON.stringify(package.version),
IS_DEV: process.env.NODE_ENV === "development",
IS_FIREFOX: BROWSER === browserNames.firefox,
Expand Down
67 changes: 34 additions & 33 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "@enkryptcom/extension",
"version": "1.13.0",
"version": "1.14.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:firefox": "cross-env BROWSER='firefox' vue-cli-service build && yarn build:rollup && node configs/get-system-info.js",
"build:opera": "cross-env BROWSER='opera' vue-cli-service build && yarn build:rollup",
"lint": "vue-cli-service lint --fix",
"build:rollup": "cross-env minify=on rollup --config configs/rollup.config.contentscript.js && cross-env minify=on rollup --config configs/rollup.config.inject.js",
"inspectWebpack": "vue-cli-service inspect > webpack.log",
Expand All @@ -20,31 +19,32 @@
},
"dependencies": {
"@acala-network/api": "^4.1.8-2.3",
"@enkryptcom/extension-bridge": "^0.0.1",
"@enkryptcom/hw-wallets": "^0.0.1",
"@enkryptcom/keyring": "^0.0.1",
"@enkryptcom/extension-bridge": "^0.0.2",
"@enkryptcom/hw-wallets": "^0.0.2",
"@enkryptcom/keyring": "^0.0.2",
"@enkryptcom/request": "^0.0.1",
"@enkryptcom/storage": "^0.0.1",
"@enkryptcom/storage": "^0.0.2",
"@enkryptcom/types": "^0.0.1",
"@enkryptcom/utils": "^0.0.1",
"@ethereumjs/common": "^3.0.2",
"@ethereumjs/tx": "^4.0.2",
"@ledgerhq/hw-transport-webusb": "^6.27.11",
"@enkryptcom/utils": "^0.0.3",
"@ethereumjs/common": "^3.1.1",
"@ethereumjs/tx": "^4.1.1",
"@ledgerhq/hw-transport-webusb": "^6.27.12",
"@metamask/eth-sig-util": "^5.0.2",
"@types/chrome": "^0.0.212",
"@types/chrome": "^0.0.224",
"@types/events": "^3.0.0",
"@types/less": "^3.0.3",
"@types/lodash": "^4.14.191",
"@types/utf-8-validate": "^5.0.0",
"@vueuse/core": "^9.12.0",
"@vueuse/core": "^9.13.0",
"add": "^2.0.6",
"bignumber.js": "^9.1.1",
"bip39": "^3.0.4",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.0",
"bitcoinjs-message": "^2.2.0",
"chai": "^4.3.7",
"concurrently": "^7.6.0",
"core-js": "^3.27.2",
"core-js": "^3.29.1",
"echarts": "^5.4.1",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-util": "^7.1.5",
"ethereumjs-wallet": "^1.0.2",
Expand All @@ -53,28 +53,29 @@
"memoize-one": "^6.0.0",
"moment": "^2.29.4",
"nanoevents": "^7.0.1",
"pinia": "^2.0.30",
"qrcode.vue": "^3.3.3",
"pinia": "^2.0.33",
"qrcode.vue": "^3.3.4",
"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^9.0.0",
"vue": "^3.2.47",
"vue-echarts": "^6.5.4",
"vue-router": "4.1.6",
"vue3-lottie": "^2.4.0",
"vue3-lottie": "^2.5.0",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.8.2",
"web3-utils": "^1.8.2",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@polkadot/api": "^9.13.6",
"@polkadot/extension-inject": "^0.44.8",
"@polkadot/keyring": "^10.3.1",
"@polkadot/rpc-provider": "^9.13.6",
"@polkadot/types": "^9.13.6",
"@polkadot/types-known": "^9.13.6",
"@polkadot/ui-shared": "^2.11.1",
"@polkadot/util": "^10.3.1",
"@polkadot/api": "^9.14.2",
"@polkadot/extension-inject": "^0.44.9",
"@polkadot/keyring": "^10.4.2",
"@polkadot/rpc-provider": "^9.14.2",
"@polkadot/types": "^9.14.2",
"@polkadot/types-known": "^9.14.2",
"@polkadot/ui-shared": "^2.12.1",
"@polkadot/util": "^10.4.2",
"@polkadot/wasm-crypto": "^6.4.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-inject": "^4.0.4",
Expand All @@ -84,11 +85,11 @@
"@types/ethereumjs-abi": "^0.6.3",
"@types/mocha": "^9.1.1",
"@types/url-parse": "^1.4.8",
"@types/uuid": "^9.0.0",
"@types/uuid": "^9.0.1",
"@types/wif": "^2.0.2",
"@types/zxcvbn": "^4.4.1",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
Expand All @@ -97,22 +98,22 @@
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^8.7.1",
"https-browserify": "^1.0.0",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"mocha": "^10.2.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.3",
"rimraf": "^4.1.2",
"prettier": "^2.8.4",
"rimraf": "^4.4.0",
"rollup": "^2.79.1",
"rollup-plugin-uglify": "^6.0.4",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.17.8",
"systeminformation": "^5.17.12",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.1.2",
"typescript": "^4.9.5",
Expand Down
29 changes: 27 additions & 2 deletions packages/extension/src/libs/activity-state/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { InternalStorageNamespace } from "@/types/provider";
import BrowserStorage from "@/libs/common/browser-storage";
import { ActivityOptions } from "./types";
import { Activity } from "@/types/activity";
import { Activity, ActivityStatus } from "@/types/activity";
const STORAGE_KEY = "activity";
const MAX_PENDING_TIME = 12 * 60 * 60 * 1000; // 12 hours
class ActivityState {
#storage: BrowserStorage;
constructor() {
Expand All @@ -21,8 +22,32 @@ class ActivityState {
const activities = await this.getActivitiesById(
this.getActivityId(options)
);
const combined = activity.concat(activities);
combined.sort((a, b) => {
return b.timestamp - a.timestamp;
});
const existingHashes: string[] = [];
const cleanArr: Activity[] = [];
const currentTime = new Date().getTime();
const minedNonces = cleanArr
.filter((item) => item.status === ActivityStatus.success && item.nonce)
.map((item) => item.nonce);
for (let i = 0; i < combined.length; i++) {
if (
!existingHashes.includes(combined[i].transactionHash) &&
combined[i].timestamp > currentTime - MAX_PENDING_TIME
) {
if (
combined[i].status !== ActivityStatus.pending ||
!combined[i].nonce ||
!minedNonces.includes(combined[i].nonce)
)
cleanArr.push(combined[i]);
}
existingHashes.push(combined[i].transactionHash);
}
await this.setActivitiesById(
activity.concat(activities),
cleanArr.slice(0, 50),
this.getActivityId(options)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default (activityHandler: ActivityHandlerType): ActivityHandlerType => {
const newSet = stillPendingActivities.concat(liveActivities);
await activityState.addActivities(newSet, options);
await activityState.setCacheTime(options);
return newSet;
return activityState.getAllActivities(options);
}
} else {
return activities;
Expand Down
14 changes: 9 additions & 5 deletions packages/extension/src/libs/cache-fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ const cacheFetch = async (
return fetch(options.url)
.then((res) => res.json())
.then((json) => {
const store: StoredData = {
timestamp: new Date().getTime(),
data: JSON.stringify(json),
};
return storage.set(hash, store).then(() => json);
const jsonstring = JSON.stringify(json);
if (!jsonstring.includes("error")) {
const store: StoredData = {
timestamp: new Date().getTime(),
data: jsonstring,
};
return storage.set(hash, store).then(() => json);
}
return json;
});
}
};
Expand Down
2 changes: 2 additions & 0 deletions packages/extension/src/libs/dapp-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const lists: Partial<Record<NetworkNames, string>> = {
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/zksyncgoerli.json",
[NetworkNames.ZkSync]:
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/zksync.json",
[NetworkNames.Rootstock]:
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/rootstock.json",
};

export default lists;
Loading

2 comments on commit b86505c

@github-actions
Copy link

Choose a reason for hiding this comment

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

@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.