diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 96970b650..a9dad7f90 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -6,7 +6,7 @@ jobs: buildAll: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: setup env id: node-version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41a729225..5c2cf8cc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: setup env id: node-version diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 6637eef3d..28ba5fef9 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -6,8 +6,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 with: node-version: "16" cache: "yarn" diff --git a/package.json b/package.json index 204851959..35314e423 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,14 @@ "version:apply": "yarn version apply --all" }, "devDependencies": { - "@commitlint/cli": "^17.7.1", - "@commitlint/config-conventional": "^17.7.0", - "@swc/core": "^1.3.84", - "concurrently": "^8.2.1", + "@commitlint/cli": "^17.8.1", + "@commitlint/config-conventional": "^17.8.1", + "@swc/core": "^1.3.100", + "concurrently": "^8.2.2", "devmoji": "^2.3.0", "husky": "^8.0.3", "node-notifier": "^10.0.1", - "nodemon": "^3.0.1", + "nodemon": "^3.0.2", "ultra-runner": "^3.10.5" }, "resolutions": { diff --git a/packages/extension-bridge/package.json b/packages/extension-bridge/package.json index ebc6c289a..a50ee3506 100644 --- a/packages/extension-bridge/package.json +++ b/packages/extension-bridge/package.json @@ -34,23 +34,23 @@ ], "dependencies": { "nanoevents": "^7.0.1", - "serialize-error": "11.0.2", + "serialize-error": "11.0.3", "tiny-uid": "^1.1.2", "webextension-polyfill": "^0.10.0" }, "devDependencies": { - "@types/chai": "^4.3.6", - "@types/mocha": "^10.0.1", - "@types/node": "^20.6.0", - "@types/webextension-polyfill": "^0.10.2", + "@types/chai": "^4.3.11", + "@types/mocha": "^10.0.6", + "@types/node": "^20.10.4", + "@types/webextension-polyfill": "^0.10.7", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", - "bumpp": "^8.2.1", - "eslint": "^8.49.0", + "bumpp": "^9.2.0", + "eslint": "^8.55.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.10.0", "eslint-import-resolver-alias": "^1.1.2", - "eslint-plugin-import": "^2.28.1", + "eslint-plugin-import": "^2.29.0", "eslint-plugin-module-resolver": "^1.5.0", "prettier": "^2.8.8", "ts-node": "^10.9.1", diff --git a/packages/extension/babel.config.js b/packages/extension/babel.config.js index 162a3ea97..2c39e935f 100644 --- a/packages/extension/babel.config.js +++ b/packages/extension/babel.config.js @@ -1,3 +1,4 @@ module.exports = { + plugins: ["@babel/plugin-transform-class-static-block"], presets: ["@vue/cli-plugin-babel/preset"], }; diff --git a/packages/extension/configs/browser-build.js b/packages/extension/configs/browser-build.js index fe8a19a3b..34ec1651f 100644 --- a/packages/extension/configs/browser-build.js +++ b/packages/extension/configs/browser-build.js @@ -61,6 +61,7 @@ const setConfig = (config) => { args[0]["process.env"] = { ..._base, PACKAGE_VERSION: JSON.stringify(package.version), + BUILD_TIME: new Date().toLocaleString().replace(/\D/g, ""), IS_DEV: process.env.NODE_ENV === "development", IS_FIREFOX: BROWSER === browserNames.firefox, PREFILL_PASSWORD: diff --git a/packages/extension/package.json b/packages/extension/package.json index e7e53e0f3..308e1493a 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "@enkryptcom/extension", - "version": "1.29.0", + "version": "1.30.0", "private": true, "scripts": { "zip": "cd dist; zip -r release.zip *;", @@ -18,7 +18,7 @@ "watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean" }, "dependencies": { - "@babel/runtime": "^7.22.15", + "@babel/runtime": "^7.23.5", "@enkryptcom/extension-bridge": "workspace:^", "@enkryptcom/hw-wallets": "workspace:^", "@enkryptcom/keyring": "workspace:^", @@ -29,23 +29,23 @@ "@enkryptcom/utils": "workspace:^", "@ethereumjs/common": "^3.2.0", "@ethereumjs/tx": "^4.2.0", - "@ledgerhq/hw-transport-webusb": "^6.27.19", - "@metamask/eth-sig-util": "^6.0.1", - "@rollup/plugin-replace": "^5.0.2", - "@types/chrome": "^0.0.245", - "@types/events": "^3.0.0", - "@types/less": "^3.0.4", - "@types/lodash": "^4.14.198", - "@types/utf-8-validate": "^5.0.0", + "@ledgerhq/hw-transport-webusb": "^6.28.0", + "@metamask/eth-sig-util": "^6.0.2", + "@rollup/plugin-replace": "^5.0.5", + "@types/chrome": "^0.0.250", + "@types/events": "^3.0.3", + "@types/less": "^3.0.6", + "@types/lodash": "^4.14.202", + "@types/utf-8-validate": "^5.0.2", "@vueuse/core": "^9.13.0", "add": "^2.0.6", "bignumber.js": "^9.1.2", "bip39": "^3.1.0", - "bitcoinjs-lib": "^6.1.3", + "bitcoinjs-lib": "^6.1.5", "bitcoinjs-message": "^2.2.0", - "chai": "^4.3.8", - "concurrently": "^8.2.1", - "core-js": "^3.32.2", + "chai": "^4.3.10", + "concurrently": "^8.2.2", + "core-js": "^3.34.0", "echarts": "^5.4.3", "ethereumjs-abi": "^0.6.8", "ethereumjs-util": "^7.1.5", @@ -55,41 +55,42 @@ "memoize-one": "^6.0.0", "moment": "^2.29.4", "nanoevents": "^7.0.1", - "pinia": "^2.1.6", + "pinia": "^2.1.7", "qrcode.vue": "^3.4.1", "switch-ts": "^1.1.1", "url-parse": "^1.5.10", - "uuid": "^9.0.0", - "vue": "^3.3.4", - "vue-echarts": "^6.6.1", - "vue-router": "4.2.4", + "uuid": "^9.0.1", + "vue": "^3.3.10", + "vue-echarts": "6.6.1", + "vue-router": "4.2.5", "vue3-lottie": "^2.7.4", "vuedraggable": "^4.1.0", - "web3-eth": "^1.10.2", - "web3-utils": "^1.10.2", - "yarn": "^1.22.19", + "web3-eth": "^1.10.3", + "web3-utils": "^1.10.3", + "yarn": "^1.22.21", "zxcvbn": "^4.4.2" }, "devDependencies": { - "@polkadot/api": "^10.9.1", - "@polkadot/extension-inject": "^0.46.5", - "@polkadot/keyring": "^12.4.2", - "@polkadot/rpc-provider": "^10.9.1", - "@polkadot/types": "^10.9.1", - "@polkadot/types-known": "^10.9.1", - "@polkadot/ui-shared": "^3.6.2", - "@polkadot/util": "^12.4.2", - "@polkadot/wasm-crypto": "^7.2.2", - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-inject": "^5.0.3", - "@rollup/plugin-node-resolve": "^15.2.1", - "@rollup/plugin-typescript": "^11.1.3", - "@types/ethereumjs-abi": "^0.6.3", - "@types/mocha": "^10.0.1", - "@types/url-parse": "^1.4.9", - "@types/uuid": "^9.0.3", - "@types/wif": "^2.0.2", - "@types/zxcvbn": "^4.4.2", + "@babel/plugin-transform-class-static-block": "^7.23.4", + "@polkadot/api": "^10.11.1", + "@polkadot/extension-inject": "^0.46.6", + "@polkadot/keyring": "^12.6.1", + "@polkadot/rpc-provider": "^10.11.1", + "@polkadot/types": "^10.11.1", + "@polkadot/types-known": "^10.11.1", + "@polkadot/ui-shared": "^3.6.4", + "@polkadot/util": "^12.6.1", + "@polkadot/wasm-crypto": "^7.3.2", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-inject": "^5.0.5", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-typescript": "^11.1.5", + "@types/ethereumjs-abi": "^0.6.5", + "@types/mocha": "^10.0.6", + "@types/url-parse": "^1.4.11", + "@types/uuid": "^9.0.7", + "@types/wif": "^2.0.5", + "@types/zxcvbn": "^4.4.4", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "@vue/cli-plugin-babel": "~5.0.8", @@ -100,7 +101,7 @@ "buffer": "^6.0.3", "cross-env": "^7.0.3", "crypto-browserify": "^3.12.0", - "eslint": "^8.49.0", + "eslint": "^8.55.0", "eslint-config-prettier": "^8.10.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-vue": "^8.7.1", @@ -110,16 +111,16 @@ "mocha": "^10.2.0", "path-browserify": "^1.0.1", "prettier": "^2.8.8", - "rimraf": "^5.0.1", - "rollup": "^3.29.1", + "rimraf": "^5.0.5", + "rollup": "^3.29.4", "rollup-plugin-uglify": "^6.0.4", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", - "systeminformation": "^5.21.4", + "systeminformation": "^5.21.20", "ts-mocha": "^10.0.0", "tsconfig-paths": "^4.2.0", "typescript": "^4.9.5", - "url": "^0.11.2", + "url": "^0.11.3", "webextension-polyfill": "^0.10.0" }, "installConfig": { diff --git a/packages/extension/src/libs/settings-state/index.ts b/packages/extension/src/libs/settings-state/index.ts index a91d96c85..e7e228fc2 100644 --- a/packages/extension/src/libs/settings-state/index.ts +++ b/packages/extension/src/libs/settings-state/index.ts @@ -30,7 +30,7 @@ class SettingsState { async getSubstrateSettings(): Promise { const state = await this.getStateByKey(StorageKeys.substrateState); const settings: SubstrateSettingsType = { - injectPolkadotjs: true, + injectPolkadotjs: false, }; return merge(settings, state); } diff --git a/packages/extension/src/providers/bitcoin/libs/api-ss.ts b/packages/extension/src/providers/bitcoin/libs/api-ss.ts index 42671d7c5..df9899e73 100644 --- a/packages/extension/src/providers/bitcoin/libs/api-ss.ts +++ b/packages/extension/src/providers/bitcoin/libs/api-ss.ts @@ -63,7 +63,8 @@ class API implements ProviderAPIInterface { return toBN(balance.balance) .add(toBN(balance.unconfirmedBalance)) .toString(); - }); + }) + .catch(() => "0"); } async broadcastTx(rawtx: string): Promise { return fetch(`${this.node}/api/v1/send`, { diff --git a/packages/extension/src/providers/bitcoin/libs/api.ts b/packages/extension/src/providers/bitcoin/libs/api.ts index 1ee289e6f..da9dc6bf0 100644 --- a/packages/extension/src/providers/bitcoin/libs/api.ts +++ b/packages/extension/src/providers/bitcoin/libs/api.ts @@ -56,7 +56,8 @@ class API implements ProviderAPIInterface { .then((balance: HaskoinBalanceType) => { if ((balance as any).error) return "0"; return toBN(balance.confirmed).addn(balance.unconfirmed).toString(); - }); + }) + .catch(() => "0"); } async broadcastTx(rawtx: string): Promise { return fetch(`${this.node}transactions`, { diff --git a/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts b/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts index 1cc641602..81151b173 100644 --- a/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts +++ b/packages/extension/src/providers/bitcoin/libs/ss-fee-handler.ts @@ -19,6 +19,8 @@ const SSFeeHandler = async ( .then((json: FeeType) => { if (json.fast.satsPerKiloByte < 0) json.fast.satsPerKiloByte = json.average.satsPerKiloByte; + if (json.average.satsPerKiloByte < 0) + json.average.satsPerKiloByte = json.slow.satsPerKiloByte; return { [GasPriceTypes.FASTEST]: Math.ceil(json.fast.satsPerKiloByte / 1024) + 5, diff --git a/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts b/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts index fe2c96906..fe9c716d2 100644 --- a/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts +++ b/packages/extension/src/providers/bitcoin/networks/bitcoin-testnet.ts @@ -46,6 +46,7 @@ const bitcoinOptions: BitcoinNetworkOptions = { wif: 0xef, dustThreshold: null, paymentType: PaymentType.P2WPKH, + maxFeeRate: 5000 * 2, }, }; diff --git a/packages/extension/src/providers/bitcoin/networks/bitcoin.ts b/packages/extension/src/providers/bitcoin/networks/bitcoin.ts index 8e17d7db0..20641fb26 100644 --- a/packages/extension/src/providers/bitcoin/networks/bitcoin.ts +++ b/packages/extension/src/providers/bitcoin/networks/bitcoin.ts @@ -39,6 +39,7 @@ const bitcoinOptions: BitcoinNetworkOptions = { wif: 0x80, dustThreshold: null, paymentType: PaymentType.P2WPKH, + maxFeeRate: 5000, }, }; diff --git a/packages/extension/src/providers/bitcoin/networks/dogecoin.ts b/packages/extension/src/providers/bitcoin/networks/dogecoin.ts index 63b06beea..589503314 100644 --- a/packages/extension/src/providers/bitcoin/networks/dogecoin.ts +++ b/packages/extension/src/providers/bitcoin/networks/dogecoin.ts @@ -41,6 +41,7 @@ const dogeOptions: BitcoinNetworkOptions = { wif: 0x9e, dustThreshold: null, paymentType: PaymentType.P2PKH, + maxFeeRate: 5000 * 4, }, }; diff --git a/packages/extension/src/providers/bitcoin/networks/litecoin.ts b/packages/extension/src/providers/bitcoin/networks/litecoin.ts index a565d52e9..050b569e7 100644 --- a/packages/extension/src/providers/bitcoin/networks/litecoin.ts +++ b/packages/extension/src/providers/bitcoin/networks/litecoin.ts @@ -41,6 +41,7 @@ const litecoinOptions: BitcoinNetworkOptions = { wif: 0xb0, dustThreshold: null, paymentType: PaymentType.P2WPKH, + maxFeeRate: 5000 * 2, }, }; diff --git a/packages/extension/src/providers/bitcoin/types/index.ts b/packages/extension/src/providers/bitcoin/types/index.ts index d5c965487..011822d6d 100644 --- a/packages/extension/src/providers/bitcoin/types/index.ts +++ b/packages/extension/src/providers/bitcoin/types/index.ts @@ -19,6 +19,7 @@ export interface BitcoinNetworkInfo { wif: number; dustThreshold: null; paymentType: PaymentType; + maxFeeRate: number; } export interface HaskoinBalanceType { diff --git a/packages/extension/src/providers/bitcoin/ui/libs/signer.ts b/packages/extension/src/providers/bitcoin/ui/libs/signer.ts index afe2e7098..dbafcb399 100644 --- a/packages/extension/src/providers/bitcoin/ui/libs/signer.ts +++ b/packages/extension/src/providers/bitcoin/ui/libs/signer.ts @@ -32,7 +32,10 @@ const TransactionSigner = ( }); }, }; - const tx = new Psbt({ network: network.networkInfo }); + const tx = new Psbt({ + network: network.networkInfo, + maximumFeeRate: network.networkInfo.maxFeeRate, + }); payload.inputs .map((u) => { const res: { diff --git a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue index b30e0dc2d..57c6aad1c 100644 --- a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue @@ -185,7 +185,10 @@ onMounted(async () => { }); const nativeBalanceAfterTransaction = computed(() => { - if (selectedAsset.value) { + if ( + selectedAsset.value && + isValidDecimals(sendAmount.value, selectedAsset.value.decimals!) + ) { return toBN(selectedAsset.value.balance ?? "0").sub( toBN(toBase(sendAmount.value ?? "0", selectedAsset.value.decimals!)).add( toBN( diff --git a/packages/extension/src/providers/ethereum/libs/transaction/index.ts b/packages/extension/src/providers/ethereum/libs/transaction/index.ts index c63ef57d5..e968dd69f 100644 --- a/packages/extension/src/providers/ethereum/libs/transaction/index.ts +++ b/packages/extension/src/providers/ethereum/libs/transaction/index.ts @@ -1,4 +1,4 @@ -import Web3Eth from "web3-eth"; +import Web3Eth, { FeeHistoryResult } from "web3-eth"; import { EthereumTransaction, FinalizedFeeMarketEthereumTransaction, @@ -69,26 +69,19 @@ class Transaction { gasLimit: string; formattedFeeHistory?: FormattedFeeHistory; }> { - const { isFeeMarketNetwork, baseFeePerGas } = await this.web3 - .getBlock("pending", false) - .then((block) => { - if (block) { - return { - isFeeMarketNetwork: !!block.baseFeePerGas, - baseFeePerGas: block.baseFeePerGas?.toString(), - }; - } - // some networks such as zksync era pending block is null - return this.web3.getBlock("latest", false).then((block) => { - return { - isFeeMarketNetwork: !!block.baseFeePerGas, - baseFeePerGas: block.baseFeePerGas?.toString(), - }; - }); - }); - const gasPrice = await this.web3.getGasPrice(); + const { isFeeMarketNetwork, feeHistory } = await this.web3 + .getFeeHistory(6, "latest", GAS_PERCENTILES) + .then((history) => ({ + isFeeMarketNetwork: true, + feeHistory: history, + })) + .catch(() => ({ + isFeeMarketNetwork: false, + feeHistory: {} as FeeHistoryResult, + })); const nonce = await this.web3.getTransactionCount(this.tx.from, "pending"); if (!isFeeMarketNetwork) { + const gasPrice = await this.web3.getGasPrice(); const gasLimit = this.tx.gasLimit || (numberToHex(await this.estimateGas()) as `0x${string}`); @@ -114,11 +107,8 @@ class Transaction { gasLimit: legacyTx.gasLimit, }; } else { - const feeHistory = await this.web3.getFeeHistory( - 6, - "latest", - GAS_PERCENTILES - ); + const baseFeePerGas = + feeHistory.baseFeePerGas[feeHistory.baseFeePerGas.length - 2]; // -2 since -1 is the pending block const formattedFeeHistory = formatFeeHistory(feeHistory); const feeMarket = this.getFeeMarketGasInfo( baseFeePerGas!, diff --git a/packages/extension/src/providers/ethereum/networks/aa.ts b/packages/extension/src/providers/ethereum/networks/aa.ts index 4f0dd16dd..c13e77e0d 100644 --- a/packages/extension/src/providers/ethereum/networks/aa.ts +++ b/packages/extension/src/providers/ethereum/networks/aa.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 artheraOptions: EvmNetworkOptions = { name: NetworkNames.Arthera, diff --git a/packages/extension/src/providers/ethereum/networks/glmr.ts b/packages/extension/src/providers/ethereum/networks/glmr.ts index bd749671f..348b135f5 100644 --- a/packages/extension/src/providers/ethereum/networks/glmr.ts +++ b/packages/extension/src/providers/ethereum/networks/glmr.ts @@ -2,7 +2,6 @@ import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; import { EtherscanActivity } from "../libs/activity-handlers"; import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; -import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; const moonbeamOptions: EvmNetworkOptions = { name: NetworkNames.Moonbeam, @@ -18,7 +17,6 @@ const moonbeamOptions: EvmNetworkOptions = { icon: require("./icons/moonbeam.svg"), coingeckoID: "moonbeam", coingeckoPlatform: CoingeckoPlatform.Moonbeam, - assetsInfoHandler, activityHandler: wrapActivityHandler(EtherscanActivity), }; diff --git a/packages/extension/src/providers/ethereum/networks/icons/tomo.png b/packages/extension/src/providers/ethereum/networks/icons/tomo.png deleted file mode 100644 index b6115a193..000000000 Binary files a/packages/extension/src/providers/ethereum/networks/icons/tomo.png and /dev/null differ diff --git a/packages/extension/src/providers/ethereum/networks/icons/viction.png b/packages/extension/src/providers/ethereum/networks/icons/viction.png new file mode 100644 index 000000000..6b78e8b26 Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/viction.png differ diff --git a/packages/extension/src/providers/ethereum/networks/index.ts b/packages/extension/src/providers/ethereum/networks/index.ts index 067492027..a00ecd1cb 100644 --- a/packages/extension/src/providers/ethereum/networks/index.ts +++ b/packages/extension/src/providers/ethereum/networks/index.ts @@ -15,7 +15,7 @@ import cantoNode from "./canto"; import rootstockNode from "./rsk"; import edgeEvmNode from "./edg"; import zkGoerliNode from "./zkgoerli"; -import tomoNode from "./tomo"; +import vicNode from "./vic"; import zkSyncNode from "./zksync"; import arbNode from "./arb"; import * as skale from "./skale"; @@ -51,7 +51,7 @@ export default { rootstock: rootstockNode, edgeEvm: edgeEvmNode, zkGoerli: zkGoerliNode, - tomo: tomoNode, + vic: vicNode, zkSync: zkSyncNode, skaleEuropa: skale.europaNode, skaleBlockBrawlers: skale.blockBrawlersNode, diff --git a/packages/extension/src/providers/ethereum/networks/movr.ts b/packages/extension/src/providers/ethereum/networks/movr.ts index 802edc8aa..58dd8bf06 100644 --- a/packages/extension/src/providers/ethereum/networks/movr.ts +++ b/packages/extension/src/providers/ethereum/networks/movr.ts @@ -2,7 +2,6 @@ import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; import { EtherscanActivity } from "../libs/activity-handlers"; import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; -import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; const moonriverOptions: EvmNetworkOptions = { name: NetworkNames.Moonriver, @@ -18,7 +17,6 @@ const moonriverOptions: EvmNetworkOptions = { icon: require("./icons/moonriver.svg"), coingeckoID: "moonriver", coingeckoPlatform: CoingeckoPlatform.Moonriver, - assetsInfoHandler, activityHandler: wrapActivityHandler(EtherscanActivity), }; diff --git a/packages/extension/src/providers/ethereum/networks/tomo.ts b/packages/extension/src/providers/ethereum/networks/vic.ts similarity index 83% rename from packages/extension/src/providers/ethereum/networks/tomo.ts rename to packages/extension/src/providers/ethereum/networks/vic.ts index 88970c263..418d2e659 100644 --- a/packages/extension/src/providers/ethereum/networks/tomo.ts +++ b/packages/extension/src/providers/ethereum/networks/vic.ts @@ -6,16 +6,16 @@ import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; const tomoOptions: EvmNetworkOptions = { name: NetworkNames.TomoChain, - name_long: "TomoChain", - homePage: "https://tomochain.com/", + name_long: "Viction", + homePage: "https://viction.xyz/", blockExplorerTX: "https://tomoscan.io/tx/[[txHash]]", blockExplorerAddr: "https://tomoscan.io/address/[[address]]", chainID: "0x58", isTestNetwork: false, - currencyName: "TOMO", - currencyNameLong: "TomoChain", + currencyName: "VIC", + currencyNameLong: "Viction", node: "wss://ws.tomochain.com", - icon: require("./icons/tomo.png"), + icon: require("./icons/viction.png"), coingeckoID: "tomochain", basePath: "m/44'/889'/0'/0", assetsInfoHandler, diff --git a/packages/extension/src/providers/ethereum/ui/eth-verify-transaction.vue b/packages/extension/src/providers/ethereum/ui/eth-verify-transaction.vue index a1d72124f..c1ffb9ddb 100644 --- a/packages/extension/src/providers/ethereum/ui/eth-verify-transaction.vue +++ b/packages/extension/src/providers/ethereum/ui/eth-verify-transaction.vue @@ -156,6 +156,7 @@ import { bigIntToBuffer, bigIntToHex, fromBase } from "@enkryptcom/utils"; import broadcastTx from "../libs/tx-broadcaster"; import TokenSigs from "../libs/transaction/lists/tokenSigs"; import AlertIcon from "@action/icons/send/alert-icon.vue"; +import { NetworkNames } from "@enkryptcom/types"; const isProcessing = ref(false); const isOpenSelectFee = ref(false); @@ -182,7 +183,7 @@ const Options = ref({ url: "", tabId: 0, }); -const selectedFee = ref(GasPriceTypes.REGULAR); +const selectedFee = ref(GasPriceTypes.ECONOMY); defineExpose({ providerVerifyTransactionScrollRef }); @@ -191,6 +192,10 @@ onBeforeMount(async () => { network.value = (await getNetworkByName( Request.value.params![2] )) as EvmNetwork; + selectedFee.value = + network.value.name === NetworkNames.Ethereum || NetworkNames.Binance + ? GasPriceTypes.REGULAR + : GasPriceTypes.ECONOMY; account.value = Request.value.params![1] as EnkryptAccount; identicon.value = network.value.identicon(account.value.address); Options.value = options; diff --git a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue index 731ce286f..185db0547 100644 --- a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue @@ -169,6 +169,7 @@ import Browser from "webextension-polyfill"; import { ProviderName } from "@/types/provider"; import PublicKeyRing from "@/libs/keyring/public-keyring"; import { GenericNameResolver, CoinType } from "@/libs/name-resolver"; +import { NetworkNames } from "@enkryptcom/types"; const props = defineProps({ network: { @@ -200,6 +201,7 @@ const selected: string = route.params.id as string; const accountAssets = ref([]); const selectedAsset = ref>(loadingAsset); const amount = ref(""); +const isEstimateValid = ref(true); const hasEnoughBalance = computed(() => { if (!isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)) { return false; @@ -214,7 +216,11 @@ const sendAmount = computed(() => { return "0"; }); const isMaxSelected = ref(false); -const selectedFee = ref(GasPriceTypes.REGULAR); +const selectedFee = ref( + props.network.name === NetworkNames.Ethereum || NetworkNames.Binance + ? GasPriceTypes.REGULAR + : GasPriceTypes.ECONOMY +); const gasCostValues = ref(defaultGasCostVals); const addressFrom = ref( props.accountInfo.selectedAccount?.address ?? "" @@ -287,7 +293,8 @@ const nativeBalanceAfterTransaction = computed(() => { nativeBalance.value && selectedAsset.value && selectedAsset.value.contract && - amount.value !== "" + amount.value !== "" && + isValidDecimals(sendAmount.value, selectedAsset.value.decimals!) ) { let endingAmount = toBN(nativeBalance.value); @@ -314,45 +321,51 @@ const nativeBalanceAfterTransaction = computed(() => { }); const setTransactionFees = (tx: Transaction) => { - return tx.getGasCosts().then(async (gasvals) => { - const getConvertedVal = (type: GasPriceTypes) => - fromBase(gasvals[type], props.network.decimals); - const nativeVal = accountAssets.value[0].price || "0"; - gasCostValues.value = { - [GasPriceTypes.ECONOMY]: { - nativeValue: getConvertedVal(GasPriceTypes.ECONOMY), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.ECONOMY)) - .times(nativeVal!) - .toString(), - nativeSymbol: props.network.currencyName, - fiatSymbol: "USD", - }, - [GasPriceTypes.REGULAR]: { - nativeValue: getConvertedVal(GasPriceTypes.REGULAR), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.REGULAR)) - .times(nativeVal!) - .toString(), - nativeSymbol: props.network.currencyName, - fiatSymbol: "USD", - }, - [GasPriceTypes.FAST]: { - nativeValue: getConvertedVal(GasPriceTypes.FAST), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FAST)) - .times(nativeVal!) - .toString(), - nativeSymbol: props.network.currencyName, - fiatSymbol: "USD", - }, - [GasPriceTypes.FASTEST]: { - nativeValue: getConvertedVal(GasPriceTypes.FASTEST), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FASTEST)) - .times(nativeVal!) - .toString(), - nativeSymbol: props.network.currencyName, - fiatSymbol: "USD", - }, - }; - }); + return tx + .getGasCosts() + .then(async (gasvals) => { + const getConvertedVal = (type: GasPriceTypes) => + fromBase(gasvals[type], props.network.decimals); + const nativeVal = accountAssets.value[0].price || "0"; + gasCostValues.value = { + [GasPriceTypes.ECONOMY]: { + nativeValue: getConvertedVal(GasPriceTypes.ECONOMY), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.ECONOMY)) + .times(nativeVal!) + .toString(), + nativeSymbol: props.network.currencyName, + fiatSymbol: "USD", + }, + [GasPriceTypes.REGULAR]: { + nativeValue: getConvertedVal(GasPriceTypes.REGULAR), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.REGULAR)) + .times(nativeVal!) + .toString(), + nativeSymbol: props.network.currencyName, + fiatSymbol: "USD", + }, + [GasPriceTypes.FAST]: { + nativeValue: getConvertedVal(GasPriceTypes.FAST), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FAST)) + .times(nativeVal!) + .toString(), + nativeSymbol: props.network.currencyName, + fiatSymbol: "USD", + }, + [GasPriceTypes.FASTEST]: { + nativeValue: getConvertedVal(GasPriceTypes.FASTEST), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FASTEST)) + .times(nativeVal!) + .toString(), + nativeSymbol: props.network.currencyName, + fiatSymbol: "USD", + }, + }; + isEstimateValid.value = true; + }) + .catch(() => { + isEstimateValid.value = false; + }); }; const setBaseCosts = () => { @@ -395,6 +408,7 @@ const sendButtonTitle = computed(() => { }); const isInputsValid = computed(() => { + if (!isEstimateValid.value) return false; if (!props.network.isAddress(addressTo.value)) return false; if (!isValidDecimals(sendAmount.value, selectedAsset.value.decimals!)) { return false; @@ -458,7 +472,9 @@ const assetMaxValue = computed(() => { }); const setMaxValue = () => { isMaxSelected.value = true; - updateTransactionFees(Tx.value); + if (isInputsValid.value) { + updateTransactionFees(Tx.value); + } }; const inputAddressFrom = (text: string) => { addressFrom.value = text; @@ -514,7 +530,9 @@ const inputAmount = (inputAmount: string) => { const inputAmountBn = new BigNumber(inputAmount); isMaxSelected.value = false; amount.value = inputAmountBn.lt(0) ? "0" : inputAmountBn.toFixed(); - updateTransactionFees(Tx.value); + if (isInputsValid.value) { + updateTransactionFees(Tx.value); + } }; const toggleSelectFee = () => { @@ -524,7 +542,8 @@ const toggleSelectFee = () => { const selectFee = (type: GasPriceTypes) => { selectedFee.value = type; isOpenSelectFee.value = false; - if (isMaxSelected.value) updateTransactionFees(Tx.value); + if (isMaxSelected.value && isInputsValid.value) + updateTransactionFees(Tx.value); }; const sendAction = async () => { @@ -575,6 +594,7 @@ const sendAction = async () => { height: 600, width: 460, }); + window.close(); } else { router.push(routedRoute); } diff --git a/packages/extension/src/providers/polkadot/inject.ts b/packages/extension/src/providers/polkadot/inject.ts index 6ef85511a..c5127ba03 100644 --- a/packages/extension/src/providers/polkadot/inject.ts +++ b/packages/extension/src/providers/polkadot/inject.ts @@ -97,7 +97,7 @@ const injectDocument = ( JSON.stringify({ method: InternalMethods.getSettings, params: [] }) ) .then((settings: SettingsType) => { - if (!settings.substrate.injectPolkadotjs) + if (settings.substrate.injectPolkadotjs) document.injectedWeb3["polkadot-js"] = new Proxy( provider, ProxyHandler diff --git a/packages/extension/src/providers/polkadot/networks/acala/libs/assetinfo-orml.ts b/packages/extension/src/providers/polkadot/networks/acala/libs/assetinfo-orml.ts index 43f5fa192..489a6ef69 100644 --- a/packages/extension/src/providers/polkadot/networks/acala/libs/assetinfo-orml.ts +++ b/packages/extension/src/providers/polkadot/networks/acala/libs/assetinfo-orml.ts @@ -10,6 +10,7 @@ import { import { toBN } from "web3-utils"; import { KnownTokenDisplay } from "@/providers/polkadot/types"; import { SubstrateNativeToken } from "@/providers/polkadot/types/substrate-native-token"; +import { BN } from "ethereumjs-util"; type AssetMetadata = { name: `0x${string}`; @@ -104,7 +105,7 @@ export default async ( const ormlOptions: AcalaOrmlAssetOptions = { name: hexToString(asset!.name), symbol: hexToString(asset!.symbol), - existentialDeposit: asset!.minimalBalance, + existentialDeposit: asset!.minimalBalance as BN, assetType: asset!.assetLookupId, lookupValue: asset!.assetLookupValue, icon: network.icon, diff --git a/packages/extension/src/providers/polkadot/networks/bifrost/libs/assetinfo-orml.ts b/packages/extension/src/providers/polkadot/networks/bifrost/libs/assetinfo-orml.ts index 34b55a35e..b157e875e 100644 --- a/packages/extension/src/providers/polkadot/networks/bifrost/libs/assetinfo-orml.ts +++ b/packages/extension/src/providers/polkadot/networks/bifrost/libs/assetinfo-orml.ts @@ -10,6 +10,7 @@ import { OrmlTokensAccountData } from "../../acala/types/acala-orml-asset"; import { toBN } from "web3-utils"; import { KnownTokenDisplay } from "@/providers/polkadot/types"; import { SubstrateNativeToken } from "@/providers/polkadot/types/substrate-native-token"; +import { BN } from "ethereumjs-util"; type AssetMetadata = { name: `0x${string}`; @@ -104,7 +105,7 @@ export default async ( const ormlOptions: BifrostOrmlAssetOptions = { name: hexToString(asset!.name), symbol: hexToString(asset!.symbol), - existentialDeposit: asset!.minimalBalance, + existentialDeposit: asset!.minimalBalance as BN, assetType: asset!.assetLookupId, lookupValue: asset!.assetLookupValue, icon: network.icon, diff --git a/packages/extension/src/providers/polkadot/ui/send-transaction/index.vue b/packages/extension/src/providers/polkadot/ui/send-transaction/index.vue index 1229ee9e7..5a99c4a98 100644 --- a/packages/extension/src/providers/polkadot/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/polkadot/ui/send-transaction/index.vue @@ -489,6 +489,7 @@ const sendAction = async () => { height: 600, width: 460, }); + window.close(); } else { router.push(routedRoute); } diff --git a/packages/extension/src/ui/action/App.vue b/packages/extension/src/ui/action/App.vue index f1996f7de..8ff92c559 100644 --- a/packages/extension/src/ui/action/App.vue +++ b/packages/extension/src/ui/action/App.vue @@ -183,7 +183,7 @@ const openBuyPage = () => { Browser.tabs.create({ url: `https://ccswap.myetherwallet.com/?to=${currentNetwork.value.displayAddress( accountHeaderData.value.selectedAccount!.address - )}`, + )}&platform=enkrypt`, }); }; const isKeyRingLocked = async (): Promise => { diff --git a/packages/extension/src/ui/action/views/network-activity/components/network-activity-action.vue b/packages/extension/src/ui/action/views/network-activity/components/network-activity-action.vue index 9b0ad1be9..3e785de34 100644 --- a/packages/extension/src/ui/action/views/network-activity/components/network-activity-action.vue +++ b/packages/extension/src/ui/action/views/network-activity/components/network-activity-action.vue @@ -6,7 +6,7 @@
- Buy + Buy/Sell
- -

{{ collection.name }}

- +

+ {{ + collection.name.length > 25 + ? $filters.replaceWithEllipsis(collection.name, 25, 4) + : collection.name + }} +

@@ -65,6 +65,7 @@ import ModalForgot from "@action/views/modal-forgot/index.vue"; const isOpenSign = ref(false); const isForgot = ref(false); const version = process.env.PACKAGE_VERSION; +const buildTime = process.env.BUILD_TIME; defineEmits<{ (e: "action:reset"): void; (e: "action:support"): void; diff --git a/packages/extension/src/ui/action/views/swap/components/swap-token-amount-input/components/swap-token-amount-input.vue b/packages/extension/src/ui/action/views/swap/components/swap-token-amount-input/components/swap-token-amount-input.vue index 11a74ad97..7b28fd736 100644 --- a/packages/extension/src/ui/action/views/swap/components/swap-token-amount-input/components/swap-token-amount-input.vue +++ b/packages/extension/src/ui/action/views/swap/components/swap-token-amount-input/components/swap-token-amount-input.vue @@ -14,6 +14,7 @@