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

devop: minor updates #407

Merged
merged 5 commits into from
Mar 6, 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-bullseye
FROM node:20-bookworm
RUN apt update
RUN apt install build-essential zip -y
ENV HOME /home
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@swc/core": "^1.3.104",
"@swc/core": "^1.4.4",
"concurrently": "^8.2.2",
"devmoji": "^2.3.0",
"husky": "^8.0.3",
"node-notifier": "^10.0.1",
"nodemon": "^3.0.3",
"nodemon": "^3.1.0",
"ultra-runner": "^3.10.5"
},
"resolutions": {
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,14 +39,14 @@
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/chai": "^4.3.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.5",
"@types/node": "^20.11.24",
"@types/webextension-polyfill": "^0.10.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"bumpp": "^9.3.0",
"eslint": "^8.56.0",
"bumpp": "^9.4.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.10.0",
"eslint-import-resolver-alias": "^1.1.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/configs/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const setConfig = (config) => {
});
config.plugin("copy-manifest").use(copyManifest);
config.plugin("define").tap((args) => {
Object.assign(args[0], {
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false",
});
const _base = args[0]["process.env"];
args[0]["process.env"] = {
..._base,
Expand Down
42 changes: 21 additions & 21 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.34.0",
"version": "1.35.0",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand Down Expand Up @@ -29,10 +29,10 @@
"@enkryptcom/utils": "workspace:^",
"@ethereumjs/common": "^3.2.0",
"@ethereumjs/tx": "^4.2.0",
"@ledgerhq/hw-transport-webusb": "^6.28.1",
"@ledgerhq/hw-transport-webusb": "^6.28.4",
"@metamask/eth-sig-util": "^7.0.1",
"@rollup/plugin-replace": "^5.0.5",
"@types/chrome": "^0.0.258",
"@types/chrome": "^0.0.262",
"@types/events": "^3.0.3",
"@types/less": "^3.0.6",
"@types/lodash": "^4.14.202",
Expand All @@ -44,8 +44,8 @@
"bitcoinjs-lib": "^6.1.5",
"chai": "^4.4.1",
"concurrently": "^8.2.2",
"core-js": "^3.35.0",
"echarts": "^5.4.3",
"core-js": "^3.36.0",
"echarts": "^5.5.0",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-util": "^7.1.5",
"ethereumjs-wallet": "^1.0.2",
Expand All @@ -59,25 +59,25 @@
"switch-ts": "^1.1.1",
"url-parse": "^1.5.10",
"uuid": "^9.0.1",
"vue": "^3.4.15",
"vue-echarts": "6.6.8",
"vue-router": "4.2.5",
"vue": "^3.4.21",
"vue-echarts": "6.6.9",
"vue-router": "4.3.0",
"vue3-lottie": "^2.7.4",
"vuedraggable": "^4.1.0",
"web3-eth": "^1.10.3",
"web3-utils": "^1.10.3",
"web3-eth": "^1.10.4",
"web3-utils": "^1.10.4",
"yarn": "^1.22.21",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@babel/plugin-transform-class-static-block": "^7.23.4",
"@polkadot/api": "^10.11.2",
"@polkadot/extension-inject": "^0.46.6",
"@polkadot/api": "^10.12.1",
"@polkadot/extension-inject": "^0.46.7",
"@polkadot/keyring": "^12.6.2",
"@polkadot/rpc-provider": "^10.11.2",
"@polkadot/types": "^10.11.2",
"@polkadot/types-known": "^10.11.2",
"@polkadot/ui-shared": "^3.6.4",
"@polkadot/rpc-provider": "^10.12.1",
"@polkadot/types": "^10.12.1",
"@polkadot/types-known": "^10.12.1",
"@polkadot/ui-shared": "^3.6.5",
"@polkadot/util": "^12.6.2",
"@polkadot/wasm-crypto": "^7.3.2",
"@rollup/plugin-commonjs": "^25.0.7",
Expand All @@ -87,7 +87,7 @@
"@types/ethereumjs-abi": "^0.6.5",
"@types/mocha": "^10.0.6",
"@types/url-parse": "^1.4.11",
"@types/uuid": "^9.0.7",
"@types/uuid": "^9.0.8",
"@types/wif": "^2.0.5",
"@types/zxcvbn": "^4.4.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand All @@ -100,23 +100,23 @@
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^8.7.1",
"https-browserify": "^1.0.0",
"less": "^4.2.0",
"less-loader": "^11.1.4",
"mocha": "^10.2.0",
"mocha": "^10.3.0",
"path-browserify": "^1.0.1",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"rollup": "^3.29.4",
"rollup-plugin-uglify": "^6.0.4",
"semver": "^7.5.4",
"semver": "^7.6.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"systeminformation": "^5.21.22",
"systeminformation": "^5.22.0",
"ts-mocha": "^10.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,13 @@ const isInputsValid = computed<boolean>(() => {
!isAddress(addressTo.value, (props.network as BitcoinNetwork).networkInfo)
)
return false;
if (!isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)) {
if (
isSendToken.value &&
!isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)
) {
return false;
}
if (!isSendToken.value && !selectedNft.value.id) {
return false;
}
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ const NetworkEndpoints: Record<string, string> = {
"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com/",
[NetworkNames.SkaleChaos]:
"https://staging-fast-active-bellatrix.explorer.staging-v3.skalenodes.com/",
[NetworkNames.ZkSyncGoerli]: "https://zksync2-testnet.zkscan.io/",
[NetworkNames.ZkSync]: "https://zksync2-mainnet.zkscan.io/",
[NetworkNames.ZkSyncGoerli]:
"https://block-explorer-api.testnets.zksync.dev/",
[NetworkNames.ZkSync]: "https://block-explorer-api.mainnet.zksync.io/",
[NetworkNames.Arbitrum]: "https://api.arbiscan.io/",
[NetworkNames.Gnosis]: "https://api.gnosisscan.io/",
[NetworkNames.Avalanche]: "https://api.snowtrace.io/",
Expand All @@ -46,7 +47,6 @@ 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.FormTestnet]: "https://testnet-explorer.form.network/",
[NetworkNames.ArtheraTest]: "https://explorer-test.arthera.net/",
[NetworkNames.Arthera]: "https://explorer.arthera.net/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const method: MiddlewareFunction = async function (
): Promise<void> {
if (payload.method !== "enkrypt_getPublicKey") return next();
else {
const whitelistDomains = ["localhost", "raffle.enkrypt.com"];
const whitelistDomains = ["localhost", "giveaway.enkrypt.com"];
if (!whitelistDomains.includes(payload.options?.domain || "".toLowerCase()))
return res(getCustomError("Cannot call this method from this domain"));
const isInitialized = await this.KeyRing.isInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const zkSyncOptions: EvmNetworkOptions = {
coingeckoPlatform: CoingeckoPlatform.Zksync,
NFTHandler: shNFTHandler,
assetsInfoHandler,

activityHandler: wrapActivityHandler(EtherscanActivity),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,13 @@ const isValidSend = computed<boolean>(() => {

const isInputsValid = computed<boolean>(() => {
if (!props.network.isAddress(addressTo.value)) return false;
if (!isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)) {
if (
isSendToken.value &&
!isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)
) {
return false;
}
if (!isSendToken.value && !selectedNft.value.id) {
return false;
}
if (new BigNumber(sendAmount.value).gt(assetMaxValue.value)) return false;
Expand Down
24 changes: 22 additions & 2 deletions packages/extension/src/ui/action/views/send-transaction/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<component v-bind="$props" :is="layout" />
<component
:is="layout"
:account-info="localAccounts"
:network="localNetwork"
/>
</template>

<script setup lang="ts">
Expand All @@ -9,7 +13,9 @@ import SendTransactionBTC from "@/providers/bitcoin/ui/send-transaction/index.vu
import { useRoute } from "vue-router";
import { ProviderName } from "@/types/provider";
import { getNetworkByName } from "@/libs/utils/networks";
import { shallowRef } from "vue";
import { shallowRef, ref, PropType } from "vue";
import { BaseNetwork } from "@/types/base-network";
import { AccountsHeaderData } from "../../types/account";

const sendLayouts: Record<ProviderName, any> = {
[ProviderName.ethereum]: SendTransactionEVM,
Expand All @@ -20,9 +26,23 @@ const sendLayouts: Record<ProviderName, any> = {

const layout = shallowRef();
const route = useRoute();
const localNetwork = ref<BaseNetwork>();
const localAccounts = ref<AccountsHeaderData>();
const props = defineProps({
network: {
type: Object as PropType<BaseNetwork>,
default: () => ({}),
},
accountInfo: {
type: Object as PropType<AccountsHeaderData>,
default: () => ({}),
},
});
const networkName: string = route.params.id as string;
getNetworkByName(networkName).then((network) => {
if (network) {
localNetwork.value = props.network;
localAccounts.value = props.accountInfo;
layout.value = sendLayouts[network.provider];
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,44 @@
class="swap-looking__animation"
/>
<Vue3Lottie
v-else-if="error === SwapError.NETWORK_NOT_SUPPORTED"
v-else-if="
error === SwapError.NETWORK_NOT_SUPPORTED ||
error === SwapError.TEMP_NOT_SUPPORTED
"
:loop="true"
:animation-data="LottieWarning"
class="swap-looking__animation"
/>

<h3 v-if="error !== SwapError.NETWORK_NOT_SUPPORTED">
<h3
v-if="
error !== SwapError.NETWORK_NOT_SUPPORTED &&
error !== SwapError.TEMP_NOT_SUPPORTED
"
>
{{ Errors[error!].title }}
</h3>
<p v-if="error !== SwapError.NETWORK_NOT_SUPPORTED">
<p
v-if="
error !== SwapError.NETWORK_NOT_SUPPORTED &&
error !== SwapError.TEMP_NOT_SUPPORTED
"
>
{{ Errors[error!].description }}
</p>

<h3 v-if="error === SwapError.NETWORK_NOT_SUPPORTED">
Coming soon to<br />{{ networkName }}
</h3>
<p v-if="error === SwapError.NETWORK_NOT_SUPPORTED">
<h3 v-if="error === SwapError.TEMP_NOT_SUPPORTED">
{{ networkName }}<br />is temporarily not supported
</h3>
<p
v-if="
error === SwapError.NETWORK_NOT_SUPPORTED ||
error === SwapError.TEMP_NOT_SUPPORTED
"
>
Can't wait to swap? Try swapping on {{ supportedNets }}.
</p>
</div>
Expand All @@ -57,10 +78,11 @@ interface IProps {
networkName: string;
close: () => void;
}
const prop = defineProps<IProps>();
const supportedNets = getSupportedNetworks()
.map((net) => net.name)
.filter((name) => name !== prop.networkName)
.join(", ");
defineProps<IProps>();
</script>

<style lang="less" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum SwapError {
SOME_TOKENS,
NO_TRADES,
NETWORK_NOT_SUPPORTED,
TEMP_NOT_SUPPORTED,
}

export const Errors: Record<number, ErrorInfo> = {
Expand Down
8 changes: 7 additions & 1 deletion packages/extension/src/ui/action/views/swap/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ onMounted(async () => {
toNetworks.value.push(netInfo);
});
toNetworks.value.sort(sortByRank);
if (!thisNetwork!) {
swapError.value = SwapError.TEMP_NOT_SUPPORTED;
toggleSwapError();
return;
}
await initToNetworkInfo(thisNetwork!);
setToTokens();
isLooking.value = false;
Expand Down Expand Up @@ -597,7 +602,8 @@ const toggleLooking = () => {
const toggleSwapError = () => {
showSwapError.value = !showSwapError.value;
if (
swapError.value === SwapError.NETWORK_NOT_SUPPORTED &&
(swapError.value === SwapError.NETWORK_NOT_SUPPORTED ||
swapError.value === SwapError.TEMP_NOT_SUPPORTED) &&
!showSwapError.value
) {
router.go(-1);
Expand Down
Loading
Loading