From 423662d20d79f2322714695c89febc40cc4ddff5 Mon Sep 17 00:00:00 2001 From: Bertrand Juglas Date: Wed, 3 Jan 2024 19:09:27 +0100 Subject: [PATCH 1/8] Add Arthera Mainnet support --- .../providers/etherscan/configs.ts | 3 ++- .../src/providers/ethereum/networks/aa.ts | 10 ++++---- .../src/providers/ethereum/networks/aat.ts | 24 +++++++++++++++++++ .../src/providers/ethereum/networks/index.ts | 2 ++ packages/types/src/networks.ts | 1 + 5 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 packages/extension/src/providers/ethereum/networks/aat.ts 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 92fabf1c5..d40f81e79 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 @@ -46,7 +46,8 @@ const NetworkEndpoints: Record = { [NetworkNames.MaticZK]: "https://api-zkevm.polygonscan.com/", [NetworkNames.Base]: "https://api.basescan.org/", [NetworkNames.Celo]: "https://explorer.celo.org/mainnet/", - [NetworkNames.Arthera]: "https://explorer-test.arthera.net/", + [NetworkNames.ArtheraTest]: "https://explorer-test.arthera.net/", + [NetworkNames.Arthera]: "https://explorer.arthera.net/", }; export { NetworkEndpoints }; diff --git a/packages/extension/src/providers/ethereum/networks/aa.ts b/packages/extension/src/providers/ethereum/networks/aa.ts index 4f0dd16dd..8a6317a0d 100644 --- a/packages/extension/src/providers/ethereum/networks/aa.ts +++ b/packages/extension/src/providers/ethereum/networks/aa.ts @@ -8,13 +8,13 @@ const artheraOptions: EvmNetworkOptions = { name: NetworkNames.Arthera, name_long: "Arthera", homePage: "https://arthera.net/", - blockExplorerTX: "https://explorer-test.arthera.net/tx/[[txHash]]", - blockExplorerAddr: "https://explorer-test.arthera.net/address/[[address]]", - chainID: "0x2803", - isTestNetwork: true, + blockExplorerTX: "https://explorer.arthera.net/tx/[[txHash]]", + blockExplorerAddr: "https://explorer.arthera.net/address/[[address]]", + chainID: "0x2802", + isTestNetwork: false, currencyName: "AA", currencyNameLong: "Arthera", - node: "wss://ws-test.arthera.net", + node: "wss://ws.arthera.net", icon: require("./icons/aa.svg"), activityHandler: wrapActivityHandler(EtherscanActivity), }; diff --git a/packages/extension/src/providers/ethereum/networks/aat.ts b/packages/extension/src/providers/ethereum/networks/aat.ts new file mode 100644 index 000000000..753dde9a8 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/aat.ts @@ -0,0 +1,24 @@ +import { NetworkNames } from "@enkryptcom/types"; +import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; +import { EtherscanActivity } from "../libs/activity-handlers"; +import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; +import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; + +const artheraTestOptions: EvmNetworkOptions = { + name: NetworkNames.ArtheraTest, + name_long: "Arthera", + homePage: "https://arthera.net/", + blockExplorerTX: "https://explorer-test.arthera.net/tx/[[txHash]]", + blockExplorerAddr: "https://explorer-test.arthera.net/address/[[address]]", + chainID: "0x2803", + isTestNetwork: true, + currencyName: "AA", + currencyNameLong: "Arthera", + node: "wss://ws-test.arthera.net", + icon: require("./icons/aa.svg"), + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const artheraTest = new EvmNetwork(artheraTestOptions); + +export default artheraTest; diff --git a/packages/extension/src/providers/ethereum/networks/index.ts b/packages/extension/src/providers/ethereum/networks/index.ts index 067492027..9a55be808 100644 --- a/packages/extension/src/providers/ethereum/networks/index.ts +++ b/packages/extension/src/providers/ethereum/networks/index.ts @@ -31,6 +31,7 @@ import baseNode from "./base"; import celoNode from "./celo"; import shibNode from "./shib"; import artheraNode from "./aa"; +import artheraTestNode from "./aat"; export default { goerli: goerliNode, @@ -75,4 +76,5 @@ export default { celo: celoNode, shib: shibNode, arthera: artheraNode, + artheraTest: artheraTestNode, }; diff --git a/packages/types/src/networks.ts b/packages/types/src/networks.ts index 6a4ed8786..b46dccf54 100644 --- a/packages/types/src/networks.ts +++ b/packages/types/src/networks.ts @@ -60,6 +60,7 @@ export enum NetworkNames { Celo = "CELO", Litecoin = "LTC", Dogecoin = "DOGE", + ArtheraTest = "AATest", Arthera = "AA", } From a82ac0d778b0508904895188b47a372b420251e0 Mon Sep 17 00:00:00 2001 From: Bertrand Juglas Date: Wed, 3 Jan 2024 19:23:07 +0100 Subject: [PATCH 2/8] Listing Arthera in the README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cb9fe6742..9c611f3bc 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Enkrypt is a web3 wallet built from the ground up to support the multi-chain fut - Aurora - Ontology - Puppy Net +- Arthera - More coming soon! Looking to add your project? [Contact us!](https://mewwallet.typeform.com/enkrypt-inquiry?typeform-source=www.enkrypt.com) From 2534dfa08078de9019344b1315a6d09e189a3da1 Mon Sep 17 00:00:00 2001 From: kvhnuke <10602065+kvhnuke@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:29:46 -0800 Subject: [PATCH 3/8] devop: add update popup notification --- packages/extension/package.json | 1 + packages/extension/src/ui/action/App.vue | 33 +++- .../extension/src/ui/action/utils/browser.ts | 14 ++ .../action/views/modal-new-version/index.vue | 143 ++++++++++++++++++ .../src/ui/action/views/modal-rate/index.vue | 2 +- yarn.lock | 1 + 6 files changed, 190 insertions(+), 4 deletions(-) create mode 100644 packages/extension/src/ui/action/views/modal-new-version/index.vue diff --git a/packages/extension/package.json b/packages/extension/package.json index 308e1493a..ca80c10f8 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -114,6 +114,7 @@ "rimraf": "^5.0.5", "rollup": "^3.29.4", "rollup-plugin-uglify": "^6.0.4", + "semver": "^7.5.4", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "systeminformation": "^5.21.20", diff --git a/packages/extension/src/ui/action/App.vue b/packages/extension/src/ui/action/App.vue index 8ff92c559..47b555068 100644 --- a/packages/extension/src/ui/action/App.vue +++ b/packages/extension/src/ui/action/App.vue @@ -77,6 +77,12 @@ + @@ -94,6 +100,7 @@ import MoreIcon from "./icons/actions/more.vue"; import AddNetwork from "./views/add-network/index.vue"; import Settings from "./views/settings/index.vue"; import ModalRate from "./views/modal-rate/index.vue"; +import ModalNewVersion from "./views/modal-new-version/index.vue"; import { useRouter, useRoute } from "vue-router"; import { BaseNetwork } from "@/types/base-network"; import { @@ -124,6 +131,8 @@ import { onClickOutside } from "@vueuse/core"; import RateState from "@/libs/rate-state"; import SwapLookingAnimation from "@action/icons/swap/swap-looking-animation.vue"; import { addNetworkSelectMetrics } from "@/libs/metrics"; +import { getLatestEnkryptVersion } from "@action/utils/browser"; +import { gt as semverGT } from "semver"; const domainState = new DomainState(); const networksState = new NetworksState(); @@ -150,9 +159,12 @@ const kr = new PublicKeyRing(); const addNetworkShow = ref(false); const settingsShow = ref(false); const rateShow = ref(false); +const updateShow = ref(false); const dropdown = ref(null); const toggle = ref(null); const isLoading = ref(true); +const currentVersion = process.env.PACKAGE_VERSION as string; +const latestVersion = ref(""); const setActiveNetworks = async () => { const activeNetworkNames = await networksState.getActiveNetworkNames(); @@ -209,9 +221,6 @@ const init = async () => { isLoading.value = false; }; onMounted(async () => { - if (await rateState.showPopup()) { - rateShow.value = true; - } const isInitialized = await kr.isInitialized(); if (isInitialized) { const _isLocked = await isKeyRingLocked(); @@ -221,6 +230,24 @@ onMounted(async () => { .then(() => (isLoading.value = false)); } else { init(); + setTimeout(() => { + rateState.showPopup().then((show) => { + if (show) { + rateShow.value = true; + } else { + getLatestEnkryptVersion().then((version) => { + if ( + currentVersion && + version && + semverGT(version, currentVersion) + ) { + latestVersion.value = version; + updateShow.value = true; + } + }); + } + }); + }, 2000); } } else { openOnboard(); diff --git a/packages/extension/src/ui/action/utils/browser.ts b/packages/extension/src/ui/action/utils/browser.ts index 51cee93a6..cf3decec3 100644 --- a/packages/extension/src/ui/action/utils/browser.ts +++ b/packages/extension/src/ui/action/utils/browser.ts @@ -37,3 +37,17 @@ export const openLink = (url: string) => { window.open(url, "_blank", "noopener"); } }; + +export const getLatestEnkryptVersion = (): Promise => { + return fetch( + "https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/configs/versions.json" + ) + .then((res) => res.json()) + .then((versions) => { + const browser = detectBrowser(); + if (versions[browser] && browser === BROWSER_NAMES.safari) + return versions[browser]; + return null; + }) + .catch(() => null); +}; diff --git a/packages/extension/src/ui/action/views/modal-new-version/index.vue b/packages/extension/src/ui/action/views/modal-new-version/index.vue new file mode 100644 index 000000000..bfeb3ce56 --- /dev/null +++ b/packages/extension/src/ui/action/views/modal-new-version/index.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/packages/extension/src/ui/action/views/modal-rate/index.vue b/packages/extension/src/ui/action/views/modal-rate/index.vue index 206ab7d87..84ae4463f 100644 --- a/packages/extension/src/ui/action/views/modal-rate/index.vue +++ b/packages/extension/src/ui/action/views/modal-rate/index.vue @@ -9,7 +9,7 @@

Let us know how you feel, your feedback is important to us.

- +
Date: Mon, 8 Jan 2024 11:06:43 -0800 Subject: [PATCH 4/8] devop: node update to lts --- Dockerfile | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b22218257..94bfb4365 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-bullseye +FROM node:20-bullseye RUN apt update RUN apt install build-essential zip -y ENV HOME /home diff --git a/README.md b/README.md index cb9fe6742..cf48f56b1 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,8 @@ To get started make sure you have `nodejs` and `nvm` installed on your system - npm ```sh - nvm install 16 - nvm use 16 + nvm install 20 + nvm use 20 npm install yarn -g ``` From 3ced8a5bc833342f1825a8cf92bab195011112c2 Mon Sep 17 00:00:00 2001 From: kvhnuke <10602065+kvhnuke@users.noreply.github.com> Date: Tue, 9 Jan 2024 13:26:01 -0800 Subject: [PATCH 5/8] devop: prep release --- packages/extension/package.json | 2 +- packages/extension/src/providers/ethereum/networks/aat.ts | 1 - .../src/providers/polkadot/methods/dot_signer_signRaw.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/extension/package.json b/packages/extension/package.json index ca80c10f8..fefbf1342 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "@enkryptcom/extension", - "version": "1.30.0", + "version": "1.31.0", "private": true, "scripts": { "zip": "cd dist; zip -r release.zip *;", diff --git a/packages/extension/src/providers/ethereum/networks/aat.ts b/packages/extension/src/providers/ethereum/networks/aat.ts index 753dde9a8..954d6b479 100644 --- a/packages/extension/src/providers/ethereum/networks/aat.ts +++ b/packages/extension/src/providers/ethereum/networks/aat.ts @@ -2,7 +2,6 @@ import { NetworkNames } from "@enkryptcom/types"; import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; import { EtherscanActivity } from "../libs/activity-handlers"; import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; -import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; const artheraTestOptions: EvmNetworkOptions = { name: NetworkNames.ArtheraTest, diff --git a/packages/extension/src/providers/polkadot/methods/dot_signer_signRaw.ts b/packages/extension/src/providers/polkadot/methods/dot_signer_signRaw.ts index e21bfe41b..b06aea475 100644 --- a/packages/extension/src/providers/polkadot/methods/dot_signer_signRaw.ts +++ b/packages/extension/src/providers/polkadot/methods/dot_signer_signRaw.ts @@ -16,7 +16,7 @@ const method: MiddlewareFunction = function ( if (!payload.params?.length) return res(getCustomError("Missing Params: signer_signPayload")); const reqPayload = payload.params[0] as SignerPayloadRaw; - if (reqPayload.type !== "bytes") + if (reqPayload.type !== "bytes" && reqPayload.type !== "payload") return res(getCustomError("type is not bytes: signer_signRaw")); this.KeyRing.getAccount(polkadotEncodeAddress(reqPayload.address)).then( (account) => { From 9e655077ae8fbfb2371c278669b5ef9cf863a55a Mon Sep 17 00:00:00 2001 From: kvhnuke <10602065+kvhnuke@users.noreply.github.com> Date: Wed, 10 Jan 2024 11:21:38 -0800 Subject: [PATCH 6/8] fix: assets loading for wrong network --- packages/extension/src/providers/ethereum/networks/aa.ts | 2 +- packages/extension/src/providers/ethereum/networks/aat.ts | 2 +- packages/extension/src/ui/action/views/network-assets/index.vue | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/extension/src/providers/ethereum/networks/aa.ts b/packages/extension/src/providers/ethereum/networks/aa.ts index b40a38806..8aa20b659 100644 --- a/packages/extension/src/providers/ethereum/networks/aa.ts +++ b/packages/extension/src/providers/ethereum/networks/aa.ts @@ -13,7 +13,7 @@ const artheraOptions: EvmNetworkOptions = { isTestNetwork: false, currencyName: "AA", currencyNameLong: "Arthera", - node: "wss://ws.arthera.net", + node: "https://rpc.arthera.net", icon: require("./icons/aa.svg"), activityHandler: wrapActivityHandler(EtherscanActivity), }; diff --git a/packages/extension/src/providers/ethereum/networks/aat.ts b/packages/extension/src/providers/ethereum/networks/aat.ts index 954d6b479..5ddff0941 100644 --- a/packages/extension/src/providers/ethereum/networks/aat.ts +++ b/packages/extension/src/providers/ethereum/networks/aat.ts @@ -5,7 +5,7 @@ import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; const artheraTestOptions: EvmNetworkOptions = { name: NetworkNames.ArtheraTest, - name_long: "Arthera", + name_long: "Arthera Test", homePage: "https://arthera.net/", blockExplorerTX: "https://explorer-test.arthera.net/tx/[[txHash]]", blockExplorerAddr: "https://explorer-test.arthera.net/address/[[address]]", diff --git a/packages/extension/src/ui/action/views/network-assets/index.vue b/packages/extension/src/ui/action/views/network-assets/index.vue index 1fca880d5..26046ee70 100644 --- a/packages/extension/src/ui/action/views/network-assets/index.vue +++ b/packages/extension/src/ui/action/views/network-assets/index.vue @@ -97,9 +97,11 @@ const selected: string = route.params.id as string; const updateAssets = () => { isLoading.value = true; assets.value = []; + const currentNetwork = selectedNetworkName.value; props.network .getAllTokenInfo(props.accountInfo.selectedAccount?.address || "") .then((_assets) => { + if (selectedNetworkName.value !== currentNetwork) return; assets.value = _assets; isLoading.value = false; }); From 1ef2ab5f04235210da22545ea8e1dfb4bc802e55 Mon Sep 17 00:00:00 2001 From: kvhnuke <10602065+kvhnuke@users.noreply.github.com> Date: Wed, 10 Jan 2024 11:28:19 -0800 Subject: [PATCH 7/8] fix: network ordering when testnets active --- .../views/add-network/views/add-network-list.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/extension/src/ui/action/views/add-network/views/add-network-list.vue b/packages/extension/src/ui/action/views/add-network/views/add-network-list.vue index cc0032711..ca0897db4 100644 --- a/packages/extension/src/ui/action/views/add-network/views/add-network-list.vue +++ b/packages/extension/src/ui/action/views/add-network/views/add-network-list.vue @@ -108,9 +108,10 @@ const searchAllNetworks = computed(() => { a.name_long.toLowerCase().startsWith(searchInput.value.toLowerCase()) ); }); -onBeforeMount(async () => { + +const setNetworkLists = async (isTestActive: boolean) => { const allNetworksNotTestNets = (await getAllNetworksAndStatus()) - .filter(({ isTestNetwork }) => !isTestNetwork) + .filter(({ isTestNetwork }) => !isTestNetwork || isTestActive) .sort((a, b) => a.name_long.localeCompare(b.name_long)); const popularNetworks = allNetworksNotTestNets @@ -119,16 +120,15 @@ onBeforeMount(async () => { all.value = allNetworksNotTestNets; popular.value = popularNetworks; +}; + +onBeforeMount(async () => { + await setNetworkLists(showTestNets.value); }); const onTestNetCheck = async () => { showTestNets.value = !showTestNets.value; - - if (showTestNets.value) { - all.value = await getAllNetworksAndStatus(); - } else { - all.value = all.value.filter(({ isTestNetwork }) => !isTestNetwork); - } + await setNetworkLists(showTestNets.value); }; const onToggle = async (networkName: string, isActive: boolean) => { From dc9b9843c9335a531ed8e85ab581b7bdc94f0478 Mon Sep 17 00:00:00 2001 From: kvhnuke <10602065+kvhnuke@users.noreply.github.com> Date: Wed, 10 Jan 2024 15:16:38 -0800 Subject: [PATCH 8/8] fix: dynamic component rendering --- packages/extension/src/ui/action/App.vue | 1 + .../extension/src/ui/action/views/send-transaction/index.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/extension/src/ui/action/App.vue b/packages/extension/src/ui/action/App.vue index 47b555068..c2c2bd430 100644 --- a/packages/extension/src/ui/action/App.vue +++ b/packages/extension/src/ui/action/App.vue @@ -53,6 +53,7 @@ = { [ProviderName.bitcoin]: SendTransactionBTC, [ProviderName.enkrypt]: null, }; + const layout = shallowRef(); const route = useRoute(); const networkName: string = route.params.id as string;