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

Release: v1.40.0 #448

Merged
merged 21 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,24 @@ To get started make sure you have `nodejs` and `nvm` installed on your system
yarn watch-extension # chromium based browsers
yarn watch:firefox # firefox
```
4. Build the project for release
4. Build the project for release (if you are Firefox team dont follow this)
```sh
yarn build:all
yarn build:chrome # chromium based browsers
yarn build:firefox # firefox
```
5. Add to your browser
5. Build the project for release (For Firefox team)

Since Firefox verification team looking for identical builds, you have to build it using docker

```sh
docker build -t enkrypt-build-container .
docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" enkrypt-build-container /bin/bash -c "yarn install --silent"
docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && 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:firefox && yarn zip"
```

6. Add to your browser
- [Chrome/Brave/Opera](https://developer.chrome.com/docs/extensions/mv2/getstarted/#manifest)
- [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing)

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"prepare": "husky"
},
"devDependencies": {
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@swc/core": "^1.4.8",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@swc/core": "^1.5.3",
"concurrently": "^8.2.2",
"husky": "^9.0.11",
"node-notifier": "^10.0.1",
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 @@ -39,13 +39,13 @@
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@types/chai": "^4.3.14",
"@types/chai": "^4.3.16",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.30",
"@types/node": "^20.12.10",
"@types/webextension-polyfill": "^0.10.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"bumpp": "^9.4.0",
"bumpp": "^9.4.1",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.10.0",
Expand All @@ -56,7 +56,7 @@
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsup": "^8.0.2",
"type-fest": "^4.13.1",
"type-fest": "^4.18.2",
"typescript": "^4.9.5",
"typescript-eslint": "0.0.1-alpha.0"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/extension/configs/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ const setConfig = (config) => {
args[0]["process.env"] = {
..._base,
PACKAGE_VERSION: JSON.stringify(package.version),
BUILD_TIME: new Date().toLocaleString().replace(/\D/g, ""),
BUILD_TIME:
BROWSER === browserNames.firefox
? JSON.stringify("FF-build")
: new Date().toLocaleString().replace(/\D/g, ""),
IS_DEV: process.env.NODE_ENV === "development",
IS_FIREFOX: BROWSER === browserNames.firefox,
IS_OPERA_EDGE: BROWSER === browserNames.operaedge,
Expand Down
48 changes: 24 additions & 24 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.39.0",
"version": "1.40.0",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand All @@ -21,8 +21,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.1",
"@amplitude/analytics-browser": "2.5.3",
"@babel/runtime": "^7.24.5",
"@enkryptcom/extension-bridge": "workspace:^",
"@enkryptcom/hw-wallets": "workspace:^",
"@enkryptcom/keyring": "workspace:^",
Expand All @@ -34,14 +34,14 @@
"@ethereumjs/common": "^4.3.0",
"@ethereumjs/tx": "^5.3.0",
"@ethereumjs/util": "^9.0.3",
"@kadena/client": "^1.2.0",
"@ledgerhq/hw-transport-webusb": "^6.28.5",
"@metamask/eth-sig-util": "^7.0.1",
"@kadena/client": "^1.11.0",
"@ledgerhq/hw-transport-webusb": "^6.28.6",
"@metamask/eth-sig-util": "^7.0.2",
"@rollup/plugin-replace": "^5.0.5",
"@types/chrome": "^0.0.263",
"@types/chrome": "^0.0.267",
"@types/events": "^3.0.3",
"@types/less": "^3.0.6",
"@types/lodash": "^4.17.0",
"@types/lodash": "^4.17.1",
"@types/utf-8-validate": "^5.0.2",
"@vueuse/core": "^10.9.0",
"add": "^2.0.6",
Expand All @@ -50,7 +50,7 @@
"bitcoinjs-lib": "^6.1.5",
"chai": "^4.4.1",
"concurrently": "^8.2.2",
"core-js": "^3.36.1",
"core-js": "^3.37.0",
"echarts": "^5.5.0",
"ethereum-cryptography": "^2.1.3",
"ethereumjs-abi": "^0.6.8",
Expand All @@ -66,9 +66,9 @@
"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^9.0.1",
"vue": "^3.4.21",
"vue-echarts": "6.6.9",
"vue-router": "4.3.0",
"vue": "^3.4.27",
"vue-echarts": "6.7.2",
"vue-router": "4.3.2",
"vue3-lottie": "^3.3.0",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.10.4",
Expand All @@ -77,15 +77,15 @@
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@babel/plugin-transform-class-static-block": "^7.24.1",
"@kadena/pactjs-cli": "^1.7.0",
"@polkadot/api": "^10.12.4",
"@polkadot/extension-inject": "^0.46.9",
"@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",
"@polkadot/keyring": "^12.6.2",
"@polkadot/rpc-provider": "^10.12.4",
"@polkadot/types": "^10.12.4",
"@polkadot/types-known": "^10.12.4",
"@polkadot/ui-shared": "^3.6.5",
"@polkadot/rpc-provider": "^11.0.2",
"@polkadot/types": "^11.0.2",
"@polkadot/types-known": "^11.0.2",
"@polkadot/ui-shared": "^3.6.6",
"@polkadot/util": "^12.6.2",
"@polkadot/wasm-crypto": "^7.3.2",
"@rollup/plugin-commonjs": "^25.0.7",
Expand Down Expand Up @@ -115,16 +115,16 @@
"https-browserify": "^1.0.0",
"less": "^4.2.0",
"less-loader": "^12.2.0",
"mocha": "^10.3.0",
"mocha": "^10.4.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^4.13.0",
"rollup": "^4.17.2",
"rollup-plugin-uglify": "^6.0.4",
"semver": "^7.6.0",
"semver": "^7.6.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.22.6",
"systeminformation": "^5.22.8",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5",
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 @@ -67,6 +67,8 @@ const lists: Partial<Record<NetworkNames, string>> = {
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/matic-zkevm.json",
[NetworkNames.Bitcoin]:
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/btc.json",
[NetworkNames.Arthera]:
"https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/arthera.json",
};

export default lists;
50 changes: 40 additions & 10 deletions packages/extension/src/libs/networks-state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BrowserStorage from "../common/browser-storage";
import { POPULAR_NAMES } from "../utils/networks";
import { InternalStorageNamespace } from "@/types/provider";
import { IState, StorageKeys, NetworkStorageElement } from "./types";
import { newNetworks, newSwaps } from "@/providers/common/libs/new-features";

class NetworksState {
private storage: BrowserStorage;
Expand All @@ -14,7 +15,7 @@ class NetworksState {
const networks: NetworkStorageElement[] = POPULAR_NAMES.map((name) => ({
name,
}));
await this.setState({ networks });
await this.setState({ networks, newNetworksVersion: "" });
}

async setNetworkStatus(
Expand All @@ -33,7 +34,7 @@ class NetworksState {
} else if (!isActive) {
const idxArr = state.networks.map((_, i) => i);
const filteredIdx = idxArr
.filter((i) => state.networks[i].name !== targetNetwork!.name)
.filter((i) => state.networks[i].name !== targetNetwork.name)
.sort((a, b) => a - b);
const activeNetworks: NetworkStorageElement[] = [];
filteredIdx.forEach((i) => activeNetworks.push(state.networks[i]));
Expand All @@ -42,16 +43,41 @@ class NetworksState {
await this.setState(state);
}

async getActiveNetworkNames(): Promise<string[]> {
async insertNetworksWithNewFeatures(): Promise<void> {
const state: IState | undefined = await this.getState();
if (state && state.networks) {
const validNetworks = state.networks.filter((net) => {
if ((net as any).isActive === undefined || (net as any).isActive) {
return true;
}
if (
state &&
state.networks &&
state.newNetworksVersion !== process.env.PACKAGE_VERSION
) {
let validNetworks = state.networks;
const netsWithFeatures = [
...new Set([...newNetworks, ...newSwaps]),
].sort();
const filteredNets = netsWithFeatures.filter((n) => {
for (const vn of validNetworks) if (vn.name === n) return false;
return true;
});
const fnetworkItem = filteredNets.map((name) => {
return {
name,
};
});
const insertIdx = validNetworks.length > 5 ? 5 : validNetworks.length;
validNetworks = validNetworks
.slice(0, insertIdx)
.concat(fnetworkItem, validNetworks.slice(insertIdx));
state.networks = validNetworks;
state.newNetworksVersion = process.env.PACKAGE_VERSION as string;
await this.setState(state);
}
}

async getActiveNetworkNames(): Promise<string[]> {
await this.insertNetworksWithNewFeatures();
const state: IState | undefined = await this.getState();
if (state && state.networks) {
const validNetworks = state.networks;
return validNetworks.map(({ name }) => name);
} else {
await this.setInitialActiveNetworks();
Expand All @@ -60,10 +86,14 @@ class NetworksState {
}

async reorderNetwork(networkNames: string[]): Promise<void> {
const state: IState | undefined = await this.getState();
const activeNetworks: NetworkStorageElement[] = networkNames.map(
(name) => ({ name })
(name) => ({ name, isActive: true })
);
await this.setState({ networks: activeNetworks });
await this.setState({
networks: activeNetworks,
newNetworksVersion: state.newNetworksVersion,
});
}

async setState(state: IState): Promise<void> {
Expand Down
1 change: 1 addition & 0 deletions packages/extension/src/libs/networks-state/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface NetworkStorageElement {

export interface IState {
networks: NetworkStorageElement[];
newNetworksVersion: string;
}
2 changes: 1 addition & 1 deletion packages/extension/src/manifest/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "https://www.enkrypt.com",
"homepage_url": "https://www.enkrypt.com",
"version": "",
"name": "Enkrypt: Multichain Crypto Wallet",
"name": "Enkrypt Crypto Wallet: ETH, BTC, KDA & more!",
"short_name": "Enkrypt",
"permissions": [
"storage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ const inputAmount = (inputAmount: string) => {
}
const inputAmountBn = new BigNumber(inputAmount);
isMaxSelected.value = false;
amount.value = inputAmountBn.lt(0) ? "0" : inputAmountBn.toFixed();
amount.value = inputAmountBn.lt(0) ? "0" : inputAmount;
};

const toggleSelectFee = () => {
Expand Down
10 changes: 10 additions & 0 deletions packages/extension/src/providers/common/libs/new-features.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NetworkNames } from "@enkryptcom/types";

const newNetworks = [
NetworkNames.Kadena,
NetworkNames.Rollux,
NetworkNames.Syscoin,
];
const newSwaps = [NetworkNames.MaticZK, NetworkNames.Base];

export { newNetworks, newSwaps };
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<input
ref="inputRef"
v-model="amount"
type="number"
type="text"
placeholder="0"
:style="{ color: !hasEnoughBalance ? 'red' : 'black' }"
@keypress="onlyNumber"
@focus="changeFocus"
@blur="changeFocus"
/>
Expand All @@ -31,7 +32,7 @@ import SwitchArrowIcon from "@action/icons/send/switch-arrow-icon.vue";
import BigNumber from "bignumber.js";

const emit = defineEmits<{
(e: "update:inputAmount", address: string): void;
(e: "update:inputAmount", value: string): void;
(e: "update:inputSetMax"): void;
}>();

Expand Down Expand Up @@ -64,10 +65,18 @@ const fiatEquivalent = computed(() => {
const amount = computed({
get: () => props.amount,
set: (value) => {
emit("update:inputAmount", value.toString());
let fValue = value.toString();
if (fValue === ".") fValue = "0.";
emit("update:inputAmount", fValue);
},
});

const onlyNumber = ($event: KeyboardEvent) => {
const keyCode = $event.keyCode ? $event.keyCode : $event.which;
if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) {
$event.preventDefault();
}
};
const changeFocus = () => {
isFocus.value = !isFocus.value;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const NetworkEndpoints: Record<string, string> = {
[NetworkNames.FormTestnet]: "https://testnet-explorer.form.network/",
[NetworkNames.ArtheraTest]: "https://explorer-test.arthera.net/",
[NetworkNames.Arthera]: "https://explorer.arthera.net/",
[NetworkNames.SyscoinTest]: "https://tanenbaum.io/",
[NetworkNames.Syscoin]: "https://explorer.syscoin.org/",
[NetworkNames.RolluxTest]: "https://rollux.tanenbaum.io/",
[NetworkNames.Rollux]: "https://explorer.rollux.com/",
};

export { NetworkEndpoints };
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ const supportedNetworks: Record<SupportedNetworkNames, SupportedNetwork> = {
tbName: "shib",
cgPlatform: CoingeckoPlatform.Shibarium,
},
[NetworkNames.Rollux]: {
tbName: "rollux",
cgPlatform: CoingeckoPlatform.Rollux,
},
};

const getTokens = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const TokenList: Record<SupportedNetworkNames, string> = {
[NetworkNames.Celo]: `https://tokens.coingecko.com/${CoingeckoPlatform.Celo}/all.json`,
[NetworkNames.TomoChain]: `https://tokens.coingecko.com/${CoingeckoPlatform.TomoChain}/all.json`,
[NetworkNames.Shibarium]: `https://tokens.coingecko.com/${CoingeckoPlatform.Shibarium}/all.json`,
[NetworkNames.Rollux]: `https://tokens.coingecko.com/${CoingeckoPlatform.Rollux}/all.json`,
};

const getKnownNetworkTokens = async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ export type SupportedNetworkNames =
| NetworkNames.Shibarium
| NetworkNames.MaticZK
| NetworkNames.Celo
| NetworkNames.ZkSync;
| NetworkNames.ZkSync
| NetworkNames.Rollux;
Loading
Loading