diff --git a/README.md b/README.md index 479e219c7..c5896b7b4 100644 --- a/README.md +++ b/README.md @@ -97,13 +97,24 @@ To get started make sure you have `nodejs` and `nvm` installed on your system yarn watch-extension # chromium based browsers yarn watch:firefox # firefox ``` -4. Build the project for release +4. Build the project for release (if you are Firefox team dont follow this) ```sh yarn build:all yarn build:chrome # chromium based browsers yarn build:firefox # firefox ``` -5. Add to your browser +5. Build the project for release (For Firefox team) + + Since Firefox verification team looking for identical builds, you have to build it using docker + + ```sh + docker build -t enkrypt-build-container . + docker run --rm -v `pwd`:/home:rw --user "$(id -u):$(id -g)" enkrypt-build-container /bin/bash -c "yarn install --silent" + docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:all" + docker run --rm --user "$(id -u):$(id -g)" -v `pwd`:/home:rw enkrypt-build-container /bin/bash -c "cd packages/extension && yarn build:firefox && yarn zip" + ``` + +6. Add to your browser - [Chrome/Brave/Opera](https://developer.chrome.com/docs/extensions/mv2/getstarted/#manifest) - [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing) diff --git a/package.json b/package.json index cf8331cf5..e72796c3d 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,9 @@ "prepare": "husky" }, "devDependencies": { - "@commitlint/cli": "^19.2.1", - "@commitlint/config-conventional": "^19.1.0", - "@swc/core": "^1.4.8", + "@commitlint/cli": "^19.3.0", + "@commitlint/config-conventional": "^19.2.2", + "@swc/core": "^1.5.3", "concurrently": "^8.2.2", "husky": "^9.0.11", "node-notifier": "^10.0.1", diff --git a/packages/extension-bridge/package.json b/packages/extension-bridge/package.json index 742e6bc47..946f8ff14 100644 --- a/packages/extension-bridge/package.json +++ b/packages/extension-bridge/package.json @@ -39,13 +39,13 @@ "webextension-polyfill": "^0.10.0" }, "devDependencies": { - "@types/chai": "^4.3.14", + "@types/chai": "^4.3.16", "@types/mocha": "^10.0.6", - "@types/node": "^20.11.30", + "@types/node": "^20.12.10", "@types/webextension-polyfill": "^0.10.7", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", - "bumpp": "^9.4.0", + "bumpp": "^9.4.1", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.10.0", @@ -56,7 +56,7 @@ "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "tsup": "^8.0.2", - "type-fest": "^4.13.1", + "type-fest": "^4.18.2", "typescript": "^4.9.5", "typescript-eslint": "0.0.1-alpha.0" } diff --git a/packages/extension/configs/browser-build.js b/packages/extension/configs/browser-build.js index 2180cdeb3..a46e9b71e 100644 --- a/packages/extension/configs/browser-build.js +++ b/packages/extension/configs/browser-build.js @@ -69,7 +69,10 @@ const setConfig = (config) => { args[0]["process.env"] = { ..._base, PACKAGE_VERSION: JSON.stringify(package.version), - BUILD_TIME: new Date().toLocaleString().replace(/\D/g, ""), + BUILD_TIME: + BROWSER === browserNames.firefox + ? JSON.stringify("FF-build") + : new Date().toLocaleString().replace(/\D/g, ""), IS_DEV: process.env.NODE_ENV === "development", IS_FIREFOX: BROWSER === browserNames.firefox, IS_OPERA_EDGE: BROWSER === browserNames.operaedge, diff --git a/packages/extension/package.json b/packages/extension/package.json index 7eaa66dcd..b5f4127ce 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "@enkryptcom/extension", - "version": "1.39.0", + "version": "1.40.0", "private": true, "scripts": { "zip": "cd dist; zip -r release.zip *;", @@ -21,8 +21,8 @@ "watch-vue-firefox": "cross-env BROWSER='firefox' vue-cli-service build --watch --no-clean" }, "dependencies": { - "@amplitude/analytics-browser": "^2.5.3", - "@babel/runtime": "^7.24.1", + "@amplitude/analytics-browser": "2.5.3", + "@babel/runtime": "^7.24.5", "@enkryptcom/extension-bridge": "workspace:^", "@enkryptcom/hw-wallets": "workspace:^", "@enkryptcom/keyring": "workspace:^", @@ -34,14 +34,14 @@ "@ethereumjs/common": "^4.3.0", "@ethereumjs/tx": "^5.3.0", "@ethereumjs/util": "^9.0.3", - "@kadena/client": "^1.2.0", - "@ledgerhq/hw-transport-webusb": "^6.28.5", - "@metamask/eth-sig-util": "^7.0.1", + "@kadena/client": "^1.11.0", + "@ledgerhq/hw-transport-webusb": "^6.28.6", + "@metamask/eth-sig-util": "^7.0.2", "@rollup/plugin-replace": "^5.0.5", - "@types/chrome": "^0.0.263", + "@types/chrome": "^0.0.267", "@types/events": "^3.0.3", "@types/less": "^3.0.6", - "@types/lodash": "^4.17.0", + "@types/lodash": "^4.17.1", "@types/utf-8-validate": "^5.0.2", "@vueuse/core": "^10.9.0", "add": "^2.0.6", @@ -50,7 +50,7 @@ "bitcoinjs-lib": "^6.1.5", "chai": "^4.4.1", "concurrently": "^8.2.2", - "core-js": "^3.36.1", + "core-js": "^3.37.0", "echarts": "^5.5.0", "ethereum-cryptography": "^2.1.3", "ethereumjs-abi": "^0.6.8", @@ -66,9 +66,9 @@ "switch-ts": "^1.1.1", "url-parse": "^1.5.10", "uuid": "^9.0.1", - "vue": "^3.4.21", - "vue-echarts": "6.6.9", - "vue-router": "4.3.0", + "vue": "^3.4.27", + "vue-echarts": "6.7.2", + "vue-router": "4.3.2", "vue3-lottie": "^3.3.0", "vuedraggable": "^4.1.0", "web3-eth": "^1.10.4", @@ -77,15 +77,15 @@ "zxcvbn": "^4.4.2" }, "devDependencies": { - "@babel/plugin-transform-class-static-block": "^7.24.1", - "@kadena/pactjs-cli": "^1.7.0", - "@polkadot/api": "^10.12.4", - "@polkadot/extension-inject": "^0.46.9", + "@babel/plugin-transform-class-static-block": "^7.24.4", + "@kadena/pactjs-cli": "^1.11.0", + "@polkadot/api": "^11.0.2", + "@polkadot/extension-inject": "^0.47.3", "@polkadot/keyring": "^12.6.2", - "@polkadot/rpc-provider": "^10.12.4", - "@polkadot/types": "^10.12.4", - "@polkadot/types-known": "^10.12.4", - "@polkadot/ui-shared": "^3.6.5", + "@polkadot/rpc-provider": "^11.0.2", + "@polkadot/types": "^11.0.2", + "@polkadot/types-known": "^11.0.2", + "@polkadot/ui-shared": "^3.6.6", "@polkadot/util": "^12.6.2", "@polkadot/wasm-crypto": "^7.3.2", "@rollup/plugin-commonjs": "^25.0.7", @@ -115,16 +115,16 @@ "https-browserify": "^1.0.0", "less": "^4.2.0", "less-loader": "^12.2.0", - "mocha": "^10.3.0", + "mocha": "^10.4.0", "path-browserify": "^1.0.1", "prettier": "^2.8.8", "rimraf": "^5.0.5", - "rollup": "^4.13.0", + "rollup": "^4.17.2", "rollup-plugin-uglify": "^6.0.4", - "semver": "^7.6.0", + "semver": "^7.6.1", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", - "systeminformation": "^5.22.6", + "systeminformation": "^5.22.8", "ts-mocha": "^10.0.0", "tsconfig-paths": "^4.2.0", "typescript": "^4.9.5", diff --git a/packages/extension/src/libs/dapp-list/index.ts b/packages/extension/src/libs/dapp-list/index.ts index 050838e4f..d214ce39e 100644 --- a/packages/extension/src/libs/dapp-list/index.ts +++ b/packages/extension/src/libs/dapp-list/index.ts @@ -67,6 +67,8 @@ const lists: Partial> = { "https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/matic-zkevm.json", [NetworkNames.Bitcoin]: "https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/btc.json", + [NetworkNames.Arthera]: + "https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/dapps/arthera.json", }; export default lists; diff --git a/packages/extension/src/libs/networks-state/index.ts b/packages/extension/src/libs/networks-state/index.ts index 059540b01..37efd50f6 100644 --- a/packages/extension/src/libs/networks-state/index.ts +++ b/packages/extension/src/libs/networks-state/index.ts @@ -2,6 +2,7 @@ import BrowserStorage from "../common/browser-storage"; import { POPULAR_NAMES } from "../utils/networks"; import { InternalStorageNamespace } from "@/types/provider"; import { IState, StorageKeys, NetworkStorageElement } from "./types"; +import { newNetworks, newSwaps } from "@/providers/common/libs/new-features"; class NetworksState { private storage: BrowserStorage; @@ -14,7 +15,7 @@ class NetworksState { const networks: NetworkStorageElement[] = POPULAR_NAMES.map((name) => ({ name, })); - await this.setState({ networks }); + await this.setState({ networks, newNetworksVersion: "" }); } async setNetworkStatus( @@ -33,7 +34,7 @@ class NetworksState { } else if (!isActive) { const idxArr = state.networks.map((_, i) => i); const filteredIdx = idxArr - .filter((i) => state.networks[i].name !== targetNetwork!.name) + .filter((i) => state.networks[i].name !== targetNetwork.name) .sort((a, b) => a - b); const activeNetworks: NetworkStorageElement[] = []; filteredIdx.forEach((i) => activeNetworks.push(state.networks[i])); @@ -42,16 +43,41 @@ class NetworksState { await this.setState(state); } - async getActiveNetworkNames(): Promise { + async insertNetworksWithNewFeatures(): Promise { const state: IState | undefined = await this.getState(); - if (state && state.networks) { - const validNetworks = state.networks.filter((net) => { - if ((net as any).isActive === undefined || (net as any).isActive) { - return true; - } + if ( + state && + state.networks && + state.newNetworksVersion !== process.env.PACKAGE_VERSION + ) { + let validNetworks = state.networks; + const netsWithFeatures = [ + ...new Set([...newNetworks, ...newSwaps]), + ].sort(); + const filteredNets = netsWithFeatures.filter((n) => { + for (const vn of validNetworks) if (vn.name === n) return false; + return true; + }); + const fnetworkItem = filteredNets.map((name) => { + return { + name, + }; }); + const insertIdx = validNetworks.length > 5 ? 5 : validNetworks.length; + validNetworks = validNetworks + .slice(0, insertIdx) + .concat(fnetworkItem, validNetworks.slice(insertIdx)); state.networks = validNetworks; + state.newNetworksVersion = process.env.PACKAGE_VERSION as string; await this.setState(state); + } + } + + async getActiveNetworkNames(): Promise { + await this.insertNetworksWithNewFeatures(); + const state: IState | undefined = await this.getState(); + if (state && state.networks) { + const validNetworks = state.networks; return validNetworks.map(({ name }) => name); } else { await this.setInitialActiveNetworks(); @@ -60,10 +86,14 @@ class NetworksState { } async reorderNetwork(networkNames: string[]): Promise { + const state: IState | undefined = await this.getState(); const activeNetworks: NetworkStorageElement[] = networkNames.map( - (name) => ({ name }) + (name) => ({ name, isActive: true }) ); - await this.setState({ networks: activeNetworks }); + await this.setState({ + networks: activeNetworks, + newNetworksVersion: state.newNetworksVersion, + }); } async setState(state: IState): Promise { diff --git a/packages/extension/src/libs/networks-state/types.ts b/packages/extension/src/libs/networks-state/types.ts index db546f5b2..bd560a1f2 100644 --- a/packages/extension/src/libs/networks-state/types.ts +++ b/packages/extension/src/libs/networks-state/types.ts @@ -8,4 +8,5 @@ export interface NetworkStorageElement { export interface IState { networks: NetworkStorageElement[]; + newNetworksVersion: string; } diff --git a/packages/extension/src/manifest/base.json b/packages/extension/src/manifest/base.json index 615cb92aa..78b5e608a 100644 --- a/packages/extension/src/manifest/base.json +++ b/packages/extension/src/manifest/base.json @@ -2,7 +2,7 @@ "author": "https://www.enkrypt.com", "homepage_url": "https://www.enkrypt.com", "version": "", - "name": "Enkrypt: Multichain Crypto Wallet", + "name": "Enkrypt Crypto Wallet: ETH, BTC, KDA & more!", "short_name": "Enkrypt", "permissions": [ "storage", 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 e52a41789..8d309b56d 100644 --- a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue @@ -389,7 +389,7 @@ const inputAmount = (inputAmount: string) => { } const inputAmountBn = new BigNumber(inputAmount); isMaxSelected.value = false; - amount.value = inputAmountBn.lt(0) ? "0" : inputAmountBn.toFixed(); + amount.value = inputAmountBn.lt(0) ? "0" : inputAmount; }; const toggleSelectFee = () => { diff --git a/packages/extension/src/providers/common/libs/new-features.ts b/packages/extension/src/providers/common/libs/new-features.ts new file mode 100644 index 000000000..44dc5c56a --- /dev/null +++ b/packages/extension/src/providers/common/libs/new-features.ts @@ -0,0 +1,10 @@ +import { NetworkNames } from "@enkryptcom/types"; + +const newNetworks = [ + NetworkNames.Kadena, + NetworkNames.Rollux, + NetworkNames.Syscoin, +]; +const newSwaps = [NetworkNames.MaticZK, NetworkNames.Base]; + +export { newNetworks, newSwaps }; diff --git a/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue b/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue index a0df84c6b..66adba85f 100644 --- a/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue +++ b/packages/extension/src/providers/common/ui/send-transaction/send-input-amount.vue @@ -3,9 +3,10 @@ @@ -31,7 +32,7 @@ import SwitchArrowIcon from "@action/icons/send/switch-arrow-icon.vue"; import BigNumber from "bignumber.js"; const emit = defineEmits<{ - (e: "update:inputAmount", address: string): void; + (e: "update:inputAmount", value: string): void; (e: "update:inputSetMax"): void; }>(); @@ -64,10 +65,18 @@ const fiatEquivalent = computed(() => { const amount = computed({ get: () => props.amount, set: (value) => { - emit("update:inputAmount", value.toString()); + let fValue = value.toString(); + if (fValue === ".") fValue = "0."; + emit("update:inputAmount", fValue); }, }); +const onlyNumber = ($event: KeyboardEvent) => { + const keyCode = $event.keyCode ? $event.keyCode : $event.which; + if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { + $event.preventDefault(); + } +}; const changeFocus = () => { isFocus.value = !isFocus.value; }; 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 54b8bcf51..30181213d 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 @@ -49,6 +49,10 @@ const NetworkEndpoints: Record = { [NetworkNames.FormTestnet]: "https://testnet-explorer.form.network/", [NetworkNames.ArtheraTest]: "https://explorer-test.arthera.net/", [NetworkNames.Arthera]: "https://explorer.arthera.net/", + [NetworkNames.SyscoinTest]: "https://tanenbaum.io/", + [NetworkNames.Syscoin]: "https://explorer.syscoin.org/", + [NetworkNames.RolluxTest]: "https://rollux.tanenbaum.io/", + [NetworkNames.Rollux]: "https://explorer.rollux.com/", }; export { NetworkEndpoints }; diff --git a/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts b/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts index 5eb13ce91..007239be4 100644 --- a/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts +++ b/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts @@ -115,6 +115,10 @@ const supportedNetworks: Record = { tbName: "shib", cgPlatform: CoingeckoPlatform.Shibarium, }, + [NetworkNames.Rollux]: { + tbName: "rollux", + cgPlatform: CoingeckoPlatform.Rollux, + }, }; const getTokens = ( diff --git a/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts b/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts index b3dd20211..aa1c9a0fc 100644 --- a/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts +++ b/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts @@ -25,6 +25,7 @@ const TokenList: Record = { [NetworkNames.Celo]: `https://tokens.coingecko.com/${CoingeckoPlatform.Celo}/all.json`, [NetworkNames.TomoChain]: `https://tokens.coingecko.com/${CoingeckoPlatform.TomoChain}/all.json`, [NetworkNames.Shibarium]: `https://tokens.coingecko.com/${CoingeckoPlatform.Shibarium}/all.json`, + [NetworkNames.Rollux]: `https://tokens.coingecko.com/${CoingeckoPlatform.Rollux}/all.json`, }; const getKnownNetworkTokens = async ( diff --git a/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts b/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts index 5271ae82c..b5de45cc7 100644 --- a/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts +++ b/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts @@ -47,4 +47,5 @@ export type SupportedNetworkNames = | NetworkNames.Shibarium | NetworkNames.MaticZK | NetworkNames.Celo - | NetworkNames.ZkSync; + | NetworkNames.ZkSync + | NetworkNames.Rollux; diff --git a/packages/extension/src/providers/ethereum/networks/icons/sys_nevm.svg b/packages/extension/src/providers/ethereum/networks/icons/sys_nevm.svg new file mode 100644 index 000000000..235f7571d --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/icons/sys_nevm.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/extension/src/providers/ethereum/networks/icons/sys_rollux.svg b/packages/extension/src/providers/ethereum/networks/icons/sys_rollux.svg new file mode 100644 index 000000000..40f6876f6 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/icons/sys_rollux.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/packages/extension/src/providers/ethereum/networks/icons/tsys_nevm.svg b/packages/extension/src/providers/ethereum/networks/icons/tsys_nevm.svg new file mode 100644 index 000000000..82f6622ff --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/icons/tsys_nevm.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + diff --git a/packages/extension/src/providers/ethereum/networks/icons/tsys_rollux.svg b/packages/extension/src/providers/ethereum/networks/icons/tsys_rollux.svg new file mode 100644 index 000000000..5650aa0a4 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/icons/tsys_rollux.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/packages/extension/src/providers/ethereum/networks/index.ts b/packages/extension/src/providers/ethereum/networks/index.ts index 40fc52d31..9a17874f5 100644 --- a/packages/extension/src/providers/ethereum/networks/index.ts +++ b/packages/extension/src/providers/ethereum/networks/index.ts @@ -32,6 +32,10 @@ import shibNode from "./shib"; import artheraNode from "./aa"; import formTestnet from "./form-testnet"; import artheraTestNode from "./aat"; +import syscoinTestNode from "./tsys"; +import syscoinNode from "./sys"; +import rolluxTestNode from "./trlx"; +import rolluxNode from "./rlx"; import cagaAnkara from "./cagaAnkara"; export default { @@ -78,5 +82,9 @@ export default { arthera: artheraNode, formTestnet: formTestnet, artheraTest: artheraTestNode, + syscoinTest: syscoinTestNode, + syscoin: syscoinNode, + rolluxTest: rolluxTestNode, + rollux: rolluxNode, cagaAnkara: cagaAnkara, }; diff --git a/packages/extension/src/providers/ethereum/networks/okc.ts b/packages/extension/src/providers/ethereum/networks/okc.ts index bdc1ce782..2f87d7087 100644 --- a/packages/extension/src/providers/ethereum/networks/okc.ts +++ b/packages/extension/src/providers/ethereum/networks/okc.ts @@ -6,14 +6,14 @@ import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetin const okcOptions: EvmNetworkOptions = { name: NetworkNames.Okc, - name_long: "OKX Chain", - homePage: "https://www.oklink.com/en/okc", - blockExplorerTX: "https://www.oklink.com/en/okc/tx/[[txHash]]", - blockExplorerAddr: "https://www.oklink.com/en/okc/address/[[address]]", + name_long: "OKT Chain", + homePage: "https://www.okx.com/oktc", + blockExplorerTX: "https://www.oklink.com/oktc/tx/[[txHash]]", + blockExplorerAddr: "https://www.oklink.com/oktc/address/[[address]]", chainID: "0x42", isTestNetwork: false, currencyName: "OKT", - currencyNameLong: "OKX Chain", + currencyNameLong: "OKT Chain", node: "https://exchainrpc.okex.org", icon: require("./icons/okc.svg"), coingeckoID: "oec-token", diff --git a/packages/extension/src/providers/ethereum/networks/rlx.ts b/packages/extension/src/providers/ethereum/networks/rlx.ts new file mode 100644 index 000000000..24dd7971f --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/rlx.ts @@ -0,0 +1,27 @@ +import { NetworkNames, CoingeckoPlatform } 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 rolluxOptions: EvmNetworkOptions = { + name: NetworkNames.Rollux, + name_long: "Syscoin ROLLUX", + homePage: "https://www.rollux.com/", + blockExplorerTX: "https://explorer.rollux.com/tx/[[txHash]]", + blockExplorerAddr: "https://explorer.rollux.com/address/[[address]]", + chainID: "0x23a", + isTestNetwork: false, + currencyName: "SYS", + currencyNameLong: "Syscoin", + node: "wss://rpc.rollux.com/wss", + coingeckoID: "syscoin", + coingeckoPlatform: CoingeckoPlatform.Rollux, + icon: require("./icons/sys_rollux.svg"), + assetsInfoHandler, + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const rollux = new EvmNetwork(rolluxOptions); + +export default rollux; diff --git a/packages/extension/src/providers/ethereum/networks/sys.ts b/packages/extension/src/providers/ethereum/networks/sys.ts new file mode 100644 index 000000000..77c9f8886 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/sys.ts @@ -0,0 +1,25 @@ +import { NetworkNames, CoingeckoPlatform } 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 syscoinOptions: EvmNetworkOptions = { + name: NetworkNames.Syscoin, + name_long: "Syscoin NEVM", + homePage: "https://www.syscoin.org/", + blockExplorerTX: "https://explorer.syscoin.org/tx/[[txHash]]", + blockExplorerAddr: "https://explorer.syscoin.org/address/[[address]]", + chainID: "0x39", + isTestNetwork: false, + currencyName: "SYS", + currencyNameLong: "Syscoin", + node: "wss://rpc.syscoin.org/wss", + icon: require("./icons/sys_nevm.svg"), + coingeckoID: "syscoin", + coingeckoPlatform: CoingeckoPlatform.Syscoin, + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const syscoin = new EvmNetwork(syscoinOptions); + +export default syscoin; diff --git a/packages/extension/src/providers/ethereum/networks/trlx.ts b/packages/extension/src/providers/ethereum/networks/trlx.ts new file mode 100644 index 000000000..53c5d862b --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/trlx.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 rolluxTestOptions: EvmNetworkOptions = { + name: NetworkNames.RolluxTest, + name_long: "Syscoin ROLLUX Testnet", + homePage: "https://www.rollux.com/", + blockExplorerTX: "https://rollux.tanenbaum.io/tx/[[txHash]]", + blockExplorerAddr: "https://rollux.tanenbaum.io/address/[[address]]", + chainID: "0xdea8", + isTestNetwork: true, + currencyName: "TSYS", + currencyNameLong: "Test Syscoin", + node: "wss://rpc-tanenbaum.rollux.com/wss", + icon: require("./icons/tsys_rollux.svg"), + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const rolluxTest = new EvmNetwork(rolluxTestOptions); + +export default rolluxTest; diff --git a/packages/extension/src/providers/ethereum/networks/tsys.ts b/packages/extension/src/providers/ethereum/networks/tsys.ts new file mode 100644 index 000000000..3dbafe5e8 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/tsys.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 syscoinTestOptions: EvmNetworkOptions = { + name: NetworkNames.SyscoinTest, + name_long: "Syscoin NEVM Testnet", + homePage: "https://www.syscoin.org/", + blockExplorerTX: "https://tanenbaum.io/tx/[[txHash]]", + blockExplorerAddr: "https://tanenbaum.io/address/[[address]]", + chainID: "0x1644", + isTestNetwork: true, + currencyName: "TSYS", + currencyNameLong: "Test Syscoin", + node: "wss://rpc.tanenbaum.io/wss", + icon: require("./icons/tsys_nevm.svg"), + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const syscoinTest = new EvmNetwork(syscoinTestOptions); + +export default syscoinTest; 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 45b551633..e87798c72 100644 --- a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue @@ -614,7 +614,7 @@ const inputAmount = (inputAmount: string) => { } const inputAmountBn = new BigNumber(inputAmount); isMaxSelected.value = false; - amount.value = inputAmountBn.lt(0) ? "0" : inputAmountBn.toFixed(); + amount.value = inputAmountBn.lt(0) ? "0" : inputAmount; if (isInputsValid.value) { updateTransactionFees(Tx.value); } diff --git a/packages/extension/src/providers/kadena/ui/send-transaction/components/send-input-amount.vue b/packages/extension/src/providers/kadena/ui/send-transaction/components/send-input-amount.vue deleted file mode 100644 index 8124653ea..000000000 --- a/packages/extension/src/providers/kadena/ui/send-transaction/components/send-input-amount.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - - - diff --git a/packages/extension/src/providers/kadena/ui/send-transaction/index.vue b/packages/extension/src/providers/kadena/ui/send-transaction/index.vue index 50d5507f8..f671df28d 100644 --- a/packages/extension/src/providers/kadena/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/kadena/ui/send-transaction/index.vue @@ -65,8 +65,9 @@ @@ -103,7 +104,7 @@ import SendContactsList from "./components/send-contacts-list.vue"; import SendFromContactsList from "./components/send-from-contacts-list.vue"; import SendTokenSelect from "./components/send-token-select.vue"; import AssetsSelectList from "@action/views/assets-select-list/index.vue"; -import SendInputAmount from "./components/send-input-amount.vue"; +import SendInputAmount from "@/providers/common/ui/send-transaction/send-input-amount.vue"; import SendFeeSelect from "./components/send-fee-select.vue"; import SendAlert from "./components/send-alert.vue"; import BaseButton from "@action/components/base-button/index.vue"; @@ -123,6 +124,7 @@ import KadenaAPI from "@/providers/kadena/libs/api"; import getUiPath from "@/libs/utils/get-ui-path"; import { ProviderName } from "@/types/provider"; import Browser from "webextension-polyfill"; +import { ICommandResult } from "@kadena/client"; const props = defineProps({ network: { @@ -255,21 +257,41 @@ const validateFields = async () => { ); const networkApi = (await props.network.api()) as KadenaAPI; - const transactionResult = await networkApi.sendLocalTransaction( - localTransaction - ); + const transactionResult = await networkApi + .sendLocalTransaction(localTransaction) + .catch((e) => { + if ((e.message as string).includes("Insufficient funds")) { + return { + result: { + status: "error", + error: { + message: "Insufficient funds", + }, + }, + }; + } + return { + result: { + status: "error", + error: { + message: "An error occurred", + }, + }, + }; + }); if (transactionResult.result.status !== "success") { fieldsValidation.value.amount = false; - console.log(transactionResult.result.error); errorMsg.value = - (transactionResult.result.error as any).message || + (transactionResult.result as any).error.message || "An error occurred"; return; } - const gasLimit = transactionResult.metaData?.publicMeta?.gasLimit; - const gasPrice = transactionResult.metaData?.publicMeta?.gasPrice; + const gasLimit = (transactionResult as ICommandResult).metaData + ?.publicMeta?.gasLimit; + const gasPrice = (transactionResult as ICommandResult).metaData + ?.publicMeta?.gasPrice; const gasFee = gasLimit && gasPrice ? gasLimit * gasPrice : 0; const rawFee = toBN( @@ -399,9 +421,13 @@ const selectToken = (token: KDAToken | Partial) => { isOpenSelectToken.value = false; }; -const inputAmount = (number: string | undefined) => { +const inputAmount = (inputAmount: string) => { + if (inputAmount === "") { + inputAmount = "0"; + } + const inputAmountBn = new BigNumber(inputAmount); sendMax.value = false; - amount.value = number ? (parseFloat(number) < 0 ? "" : number) : number; + amount.value = inputAmountBn.lt(0) ? "0" : inputAmount; }; const sendButtonTitle = computed(() => { diff --git a/packages/extension/src/providers/polkadot/ui/send-transaction/components/send-input-amount.vue b/packages/extension/src/providers/polkadot/ui/send-transaction/components/send-input-amount.vue deleted file mode 100644 index 535dcd24e..000000000 --- a/packages/extension/src/providers/polkadot/ui/send-transaction/components/send-input-amount.vue +++ /dev/null @@ -1,169 +0,0 @@ - - - - - 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 927f75aa4..36e767183 100644 --- a/packages/extension/src/providers/polkadot/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/polkadot/ui/send-transaction/index.vue @@ -63,6 +63,7 @@ ) => { isOpenSelectToken.value = false; }; -const inputAmount = (number: string | undefined) => { +const inputAmount = (inputAmount: string) => { + if (inputAmount === "") { + inputAmount = "0"; + } + const inputAmountBn = new BigNumber(inputAmount); sendMax.value = false; - amount.value = number ? (parseFloat(number) < 0 ? "0" : number) : number; + amount.value = inputAmountBn.lt(0) ? "0" : inputAmount; validateFields(); }; @@ -423,12 +428,7 @@ const sendButtonTitle = computed(() => { return title; }); -const setSendMax = (max: boolean) => { - if (!max) { - sendMax.value = false; - return; - } - +const setSendMax = () => { if (selectedAsset.value) { const humanBalance = fromBase( selectedAsset.value.balance!, diff --git a/packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue b/packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue index 3115eed30..8d5090b87 100644 --- a/packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue +++ b/packages/extension/src/ui/action/components/app-menu/components/app-menu-item.vue @@ -3,7 +3,16 @@ {{ network.name_long }} - + New + Swap @@ -15,6 +24,7 @@ import { NodeType } from "@/types/provider"; import { PropType, ref, watch } from "vue"; import DragIcon from "@action/icons/common/drag-icon.vue"; import TestNetworkIcon from "@action/icons/common/test-network-icon.vue"; +import { newNetworks, newSwaps } from "@/providers/common/libs/new-features"; const props = defineProps({ network: { @@ -87,7 +97,42 @@ watch(