Skip to content

Commit

Permalink
Merge pull request #379 from enkryptcom/develop
Browse files Browse the repository at this point in the history
Release: v1.31.0
  • Loading branch information
kvhnuke authored Jan 11, 2024
2 parents 88b0a97 + c2ca03c commit 500fd27
Show file tree
Hide file tree
Showing 17 changed files with 241 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
```

Expand Down
3 changes: 2 additions & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -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 *;",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const NetworkEndpoints: Record<string, string> = {
[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 };
10 changes: 5 additions & 5 deletions packages/extension/src/providers/ethereum/networks/aa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
Expand Down
23 changes: 23 additions & 0 deletions packages/extension/src/providers/ethereum/networks/aat.ts
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 2 additions & 0 deletions packages/extension/src/providers/ethereum/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -75,4 +76,5 @@ export default {
celo: celoNode,
shib: shibNode,
arthera: artheraNode,
artheraTest: artheraTestNode,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
34 changes: 31 additions & 3 deletions packages/extension/src/ui/action/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<transition :name="transitionName" mode="out-in">
<component
:is="Component"
:key="$route.fullPath"
:network="currentNetwork"
:account-info="accountHeaderData"
@update:init="init"
Expand All @@ -77,6 +78,12 @@

<settings v-if="settingsShow" @close:popup="settingsShow = !settingsShow" />
<modal-rate v-if="rateShow" @close:popup="rateShow = !rateShow" />
<modal-new-version
v-if="updateShow"
:current-version="currentVersion"
:latest-version="latestVersion"
@close:popup="updateShow = !updateShow"
/>
</div>
</template>

Expand All @@ -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 {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions packages/extension/src/ui/action/utils/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ export const openLink = (url: string) => {
window.open(url, "_blank", "noopener");
}
};

export const getLatestEnkryptVersion = (): Promise<string> => {
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);
};
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) => {
Expand Down
143 changes: 143 additions & 0 deletions packages/extension/src/ui/action/views/modal-new-version/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<template>
<div class="rate__container">
<div class="rate__overlay" @click="close" />
<div class="rate__wrap">
<div class="rate__header">
<h2>New Enkrypt version available</h2>
<a class="rate__close" @click="close">
<close-icon />
</a>
</div>
<p>For latest and greatest features please update!</p>
<p>
You current version: {{ currentVersion }} latest version:
{{ latestVersion }}
</p>
<base-button title="Update" :click="update" />
<div class="rate__button-indent"></div>
<base-button title="Cancel" :no-background="true" :click="close" />
</div>
</div>
</template>

<script setup lang="ts">
import CloseIcon from "@action/icons/common/close-icon.vue";
import BaseButton from "@action/components/base-button/index.vue";
import { openLink } from "@action/utils/browser";
const emit = defineEmits<{
(e: "close:popup"): void;
}>();
const close = async () => {
emit("close:popup");
};
interface IProps {
currentVersion: string;
latestVersion: string;
}
defineProps<IProps>();
const update = async () => {
openLink("https://www.enkrypt.com");
};
</script>

<style lang="less">
@import "~@action/styles/theme.less";
.rate {
width: 100%;
height: auto;
box-sizing: border-box;
&__wrap {
background: @white;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.039),
0px 7px 24px rgba(0, 0, 0, 0.19);
border-radius: 12px;
box-sizing: border-box;
width: 450px;
height: auto;
z-index: 107;
position: relative;
overflow-x: hidden;
padding: 24px 16px;
p {
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 24px;
color: @secondaryLabel;
margin: 0 0 12px 0;
}
}
&__header {
width: 100%;
background: @white;
box-sizing: border-box;
padding: 0 40px 12px 0;
h2 {
font-style: normal;
font-weight: bold;
font-size: 24px;
line-height: 32px;
margin: 0;
color: @primaryLabel;
}
}
&__close {
position: absolute;
top: 8px;
right: 8px;
border-radius: 8px;
cursor: pointer;
transition: background 300ms ease-in-out;
font-size: 0;
&:hover {
background: @black007;
}
}
&__container {
width: 800px;
height: 100%;
left: 0px;
top: 0px;
position: fixed;
z-index: 105;
display: flex;
box-sizing: border-box;
justify-content: center;
align-items: center;
flex-direction: row;
}
&__overlay {
background: rgba(0, 0, 0, 0.32);
width: 100%;
height: 100%;
left: 0px;
top: 0px;
position: absolute;
z-index: 106;
}
&__block {
padding: 12px 0;
&:nth-child(2) {
padding-top: 0;
}
}
&__button-indent {
margin-bottom: 8px;
}
}
</style>
Loading

2 comments on commit 500fd27

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