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..24903f08e 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) @@ -75,8 +76,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 ``` diff --git a/packages/extension/package.json b/packages/extension/package.json index 308e1493a..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 *;", @@ -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/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 c13e77e0d..8aa20b659 100644 --- a/packages/extension/src/providers/ethereum/networks/aa.ts +++ b/packages/extension/src/providers/ethereum/networks/aa.ts @@ -7,13 +7,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: "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 new file mode 100644 index 000000000..5ddff0941 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/aat.ts @@ -0,0 +1,23 @@ +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"; + +const artheraTestOptions: EvmNetworkOptions = { + name: NetworkNames.ArtheraTest, + name_long: "Arthera Test", + 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 a00ecd1cb..c07bb2a8b 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/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) => { diff --git a/packages/extension/src/ui/action/App.vue b/packages/extension/src/ui/action/App.vue index 8ff92c559..c2c2bd430 100644 --- a/packages/extension/src/ui/action/App.vue +++ b/packages/extension/src/ui/action/App.vue @@ -53,6 +53,7 @@ + @@ -94,6 +101,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 +132,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 +160,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 +222,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 +231,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/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) => { 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.

- +
{ 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; }); diff --git a/packages/extension/src/ui/action/views/send-transaction/index.vue b/packages/extension/src/ui/action/views/send-transaction/index.vue index 937c6ab06..4c9032abf 100644 --- a/packages/extension/src/ui/action/views/send-transaction/index.vue +++ b/packages/extension/src/ui/action/views/send-transaction/index.vue @@ -17,6 +17,7 @@ const sendLayouts: Record = { [ProviderName.bitcoin]: SendTransactionBTC, [ProviderName.enkrypt]: null, }; + const layout = shallowRef(); const route = useRoute(); const networkName: string = route.params.id as string; 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", } diff --git a/yarn.lock b/yarn.lock index 09590ef5a..86802de4a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2649,6 +2649,7 @@ __metadata: 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 switch-ts: ^1.1.1