diff --git a/package.json b/package.json index 93c3c2887..1dfed6c47 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "ultra-runner": "^3.10.5" }, "resolutions": { - "@ledgerhq/compressjs": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.2.1.tgz" + "@ledgerhq/compressjs": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.2.1.tgz", + "@noble/hashes": "^1.4.0" } } diff --git a/packages/extension-bridge/src/utils.ts b/packages/extension-bridge/src/utils.ts index d98a024ab..fc6e87f64 100644 --- a/packages/extension-bridge/src/utils.ts +++ b/packages/extension-bridge/src/utils.ts @@ -36,7 +36,10 @@ export const getBackgroundPageType = (): RuntimeContext => { const url = new URL(browser.runtime.getURL(manifest.options_ui.page)); if (url.pathname === window.location.pathname) return "options"; } - if (window?.location?.pathname === "/index.html") { + if ( + window?.location?.pathname === "/index.html" || + window?.location?.pathname === "/onboard.html" + ) { return "new-window"; } return "background"; diff --git a/packages/extension/package.json b/packages/extension/package.json index b1b6ae323..ef6d8fd59 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "@enkryptcom/extension", - "version": "1.41.0", + "version": "1.42.0", "private": true, "scripts": { "zip": "cd dist; zip -r release.zip *;", diff --git a/packages/extension/src/providers/common/libs/new-features.ts b/packages/extension/src/providers/common/libs/new-features.ts index 44dc5c56a..1c8820a04 100644 --- a/packages/extension/src/providers/common/libs/new-features.ts +++ b/packages/extension/src/providers/common/libs/new-features.ts @@ -1,10 +1,12 @@ import { NetworkNames } from "@enkryptcom/types"; const newNetworks = [ - NetworkNames.Kadena, - NetworkNames.Rollux, - NetworkNames.Syscoin, + NetworkNames.Telos, + NetworkNames.Blast, + NetworkNames.Sanko, + NetworkNames.Degen, + NetworkNames.Ham, ]; -const newSwaps = [NetworkNames.MaticZK, NetworkNames.Base]; +const newSwaps: NetworkNames[] = []; export { newNetworks, newSwaps }; diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/index.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/index.ts index 2f0c8e4d6..300826277 100644 --- a/packages/extension/src/providers/ethereum/libs/activity-handlers/index.ts +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/index.ts @@ -3,10 +3,12 @@ import EtherscanActivity from "./providers/etherscan"; import OkcActivity from "./providers/okc"; import TomoScan from "./providers/tomoscan"; import OntEVMActivity from "./providers/ont-evm"; +import TelosActivity from "./providers/telos"; export { RivetActivity, EtherscanActivity, OkcActivity, OntEVMActivity, TomoScan, + TelosActivity, }; 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 30181213d..5ef2d8828 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 @@ -1,9 +1,9 @@ import { NetworkNames } from "@enkryptcom/types"; const NetworkEndpoints: Record = { - [NetworkNames.Ethereum]: "https://api.etherscan.io/", + [NetworkNames.Ethereum]: "https://eth.blockscout.com/", [NetworkNames.Binance]: "https://api.bscscan.com/", - [NetworkNames.Matic]: "https://api.polygonscan.com/", + [NetworkNames.Matic]: "https://polygon.blockscout.com/", [NetworkNames.Moonbeam]: "https://api-moonbeam.moonscan.io/", [NetworkNames.Moonriver]: "https://api-moonriver.moonscan.io/", [NetworkNames.KaruraEVM]: "https://blockscout.karura.network/", @@ -13,6 +13,7 @@ const NetworkEndpoints: Record = { [NetworkNames.Canto]: "https://evm.explorer.canto.io/", [NetworkNames.EdgeEVM]: "https://edgscan.live/", [NetworkNames.Rootstock]: "https://blockscout.com/rsk/mainnet/", + [NetworkNames.RootstockTestnet]: "https://rootstock-testnet.blockscout.com/", [NetworkNames.SkaleBlockBrawlers]: "https://frayed-decent-antares.explorer.mainnet.skalenodes.com/", [NetworkNames.SkaleCalypso]: @@ -53,6 +54,10 @@ const NetworkEndpoints: Record = { [NetworkNames.Syscoin]: "https://explorer.syscoin.org/", [NetworkNames.RolluxTest]: "https://rollux.tanenbaum.io/", [NetworkNames.Rollux]: "https://explorer.rollux.com/", + [NetworkNames.Blast]: "https://blastscan.io/", + [NetworkNames.Sanko]: "https://explorer.sanko.xyz/", + [NetworkNames.Degen]: "https://explorer.degen.tips/", + [NetworkNames.Ham]: "https://explorer.ham.fun/", }; export { NetworkEndpoints }; diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/index.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/index.ts index d5ec170c9..b0023ccdf 100644 --- a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/index.ts +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/index.ts @@ -24,7 +24,7 @@ const getAddressActivity = async ( ).then((res) => { if (res.status === "0") return []; const results = res.result as EtherscanTxType[]; - const newResults = results.reverse().map((tx) => { + const newResults = results.map((tx) => { const rawTx: EthereumRawInfo = { blockHash: tx.blockHash, blockNumber: numberToHex(tx.blockNumber), diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/configs.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/configs.ts new file mode 100644 index 000000000..5ddc8a61e --- /dev/null +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/configs.ts @@ -0,0 +1,7 @@ +import { NetworkNames } from "@enkryptcom/types"; + +const NetworkEndpoints: Record = { + [NetworkNames.Telos]: "https://api.teloscan.io/", +}; + +export { NetworkEndpoints }; diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/index.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/index.ts new file mode 100644 index 000000000..9fec60183 --- /dev/null +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/index.ts @@ -0,0 +1,88 @@ +import cacheFetch from "@/libs/cache-fetch"; +import { EvmNetwork } from "@/providers/ethereum/types/evm-network"; +import { + Activity, + ActivityStatus, + ActivityType, + EthereumRawInfo, +} from "@/types/activity"; +import { BaseNetwork } from "@/types/base-network"; +import { numberToHex } from "web3-utils"; +import { decodeTx } from "../../../transaction/decoder"; +import { NetworkEndpoints } from "./configs"; +import { TelosTXType } from "./types"; +const TTL = 30000; +const getAddressActivity = async ( + address: string, + endpoint: string +): Promise => { + return cacheFetch( + { + url: `${endpoint}v1/address/${address}/transactions`, + }, + TTL + ).then((res) => { + if (!res.success) return []; + const results = res.results as TelosTXType[]; + const newResults = results.map((tx) => { + const rawTx: EthereumRawInfo = { + blockHash: "0x", + blockNumber: numberToHex(tx.blockNumber), + contractAddress: tx.contractAddress + ? tx.contractAddress.toLowerCase() + : null, + data: tx.input, + effectiveGasPrice: tx.gasPrice, + from: tx.from.toLowerCase(), + to: tx.to === "" ? null : tx.to.toLowerCase(), + gas: tx.gasLimit, + gasUsed: tx.gasused, + nonce: numberToHex(tx.nonce), + status: tx.status === "0x1" ? true : false, + transactionHash: tx.hash, + value: tx.value, + timestamp: tx.timestamp, + }; + return rawTx; + }); + return newResults.slice(0, 50) as EthereumRawInfo[]; + }); +}; +export default async ( + network: BaseNetwork, + address: string +): Promise => { + address = address.toLowerCase(); + const enpoint = + NetworkEndpoints[network.name as keyof typeof NetworkEndpoints]; + const activities = await getAddressActivity(address, enpoint); + const Promises = activities.map((activity) => { + return decodeTx(activity, network as EvmNetwork).then((txData) => { + return { + from: activity.from, + to: activity.contractAddress + ? activity.contractAddress + : txData.tokenTo!, + isIncoming: activity.from !== address, + network: network.name, + rawInfo: activity, + status: activity.status + ? ActivityStatus.success + : ActivityStatus.failed, + timestamp: activity.timestamp ? activity.timestamp : 0, + value: txData.tokenValue, + transactionHash: activity.transactionHash, + type: ActivityType.transaction, + nonce: activity.nonce, + token: { + decimals: txData.tokenDecimals, + icon: txData.tokenImage, + name: txData.tokenName, + symbol: txData.tokenSymbol, + price: txData.currentPriceUSD.toString(), + }, + }; + }); + }); + return Promise.all(Promises); +}; diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/types.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/types.ts new file mode 100644 index 000000000..6ad5341d2 --- /dev/null +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/telos/types.ts @@ -0,0 +1,16 @@ +export interface TelosTXType { + gasused: string; + contractAddress: string; + index: number; + nonce: number; + input: string; + gasLimit: string; + blockNumber: number; + from: string; + to: string; + value: string; + hash: string; + timestamp: number; + gasPrice: string; + status: "0x1" | "0x0"; +} 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 007239be4..f84545f31 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 @@ -119,6 +119,22 @@ const supportedNetworks: Record = { tbName: "rollux", cgPlatform: CoingeckoPlatform.Rollux, }, + [NetworkNames.Telos]: { + tbName: "tlos", + cgPlatform: CoingeckoPlatform.Telos, + }, + [NetworkNames.Blast]: { + tbName: "blast", + cgPlatform: CoingeckoPlatform.Blast, + }, + [NetworkNames.Sanko]: { + tbName: "sanko", + cgPlatform: CoingeckoPlatform.Sanko, + }, + [NetworkNames.Degen]: { + tbName: "degen", + cgPlatform: CoingeckoPlatform.Degen, + }, }; 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 aa1c9a0fc..48243f0e3 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 @@ -26,6 +26,10 @@ const TokenList: Record = { [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`, + [NetworkNames.Telos]: `https://tokens.coingecko.com/${CoingeckoPlatform.Telos}/all.json`, + [NetworkNames.Blast]: `https://tokens.coingecko.com/${CoingeckoPlatform.Blast}/all.json`, + [NetworkNames.Sanko]: `https://tokens.coingecko.com/${CoingeckoPlatform.Sanko}/all.json`, + [NetworkNames.Degen]: `https://tokens.coingecko.com/${CoingeckoPlatform.Degen}/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 b5de45cc7..89093b4b4 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 @@ -48,4 +48,8 @@ export type SupportedNetworkNames = | NetworkNames.MaticZK | NetworkNames.Celo | NetworkNames.ZkSync - | NetworkNames.Rollux; + | NetworkNames.Telos + | NetworkNames.Rollux + | NetworkNames.Sanko + | NetworkNames.Degen + | NetworkNames.Blast; diff --git a/packages/extension/src/providers/ethereum/networks/blast.ts b/packages/extension/src/providers/ethereum/networks/blast.ts new file mode 100644 index 000000000..387ab9dc9 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/blast.ts @@ -0,0 +1,27 @@ +import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; +import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; +import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; +import { EtherscanActivity } from "../libs/activity-handlers"; +import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; + +const ethOptions: EvmNetworkOptions = { + name: NetworkNames.Blast, + name_long: "Blast", + homePage: "https://blast.io/en", + blockExplorerTX: "https://blastscan.io/tx/[[txHash]]", + blockExplorerAddr: "https://blastscan.io/address/[[address]]", + chainID: "0x13e31", + isTestNetwork: false, + currencyName: "ETH", + currencyNameLong: "Ethereum", + node: "wss://blast-rpc.publicnode.com", + icon: require("./icons/blast.webp"), + coingeckoID: "ethereum", + coingeckoPlatform: CoingeckoPlatform.Blast, + assetsInfoHandler, + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const eth = new EvmNetwork(ethOptions); + +export default eth; diff --git a/packages/extension/src/providers/ethereum/networks/degen.ts b/packages/extension/src/providers/ethereum/networks/degen.ts new file mode 100644 index 000000000..ed7dfded7 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/degen.ts @@ -0,0 +1,27 @@ +import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; +import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; +import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; +import { EtherscanActivity } from "../libs/activity-handlers"; +import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; + +const ethOptions: EvmNetworkOptions = { + name: NetworkNames.Degen, + name_long: "Degen", + homePage: "https://www.degen.tips/", + blockExplorerTX: "https://explorer.degen.tips/tx/[[txHash]]", + blockExplorerAddr: "https://explorer.degen.tips/address/[[address]]", + chainID: "0x27bc86aa", + isTestNetwork: false, + currencyName: "DEGEN", + currencyNameLong: "DEGEN", + node: "https://rpc.degen.tips", + icon: require("./icons/degen.png"), + coingeckoID: "degen-base", + coingeckoPlatform: CoingeckoPlatform.Degen, + assetsInfoHandler, + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const eth = new EvmNetwork(ethOptions); + +export default eth; diff --git a/packages/extension/src/providers/ethereum/networks/dmt.ts b/packages/extension/src/providers/ethereum/networks/dmt.ts new file mode 100644 index 000000000..dd8b78f0b --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/dmt.ts @@ -0,0 +1,27 @@ +import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; +import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; +import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; +import { EtherscanActivity } from "../libs/activity-handlers"; +import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; + +const ethOptions: EvmNetworkOptions = { + name: NetworkNames.Sanko, + name_long: "Sanko", + homePage: "https://sanko.xyz", + blockExplorerTX: "https://explorer.sanko.xyz/tx/[[txHash]]", + blockExplorerAddr: "https://explorer.sanko.xyz/address/[[address]]", + chainID: "0x7cc", + isTestNetwork: false, + currencyName: "DMT", + currencyNameLong: "DMT", + node: "https://mainnet.sanko.xyz", + icon: require("./icons/sanko.png"), + coingeckoID: "dream-machine-token", + coingeckoPlatform: CoingeckoPlatform.Sanko, + assetsInfoHandler, + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const eth = new EvmNetwork(ethOptions); + +export default eth; diff --git a/packages/extension/src/providers/ethereum/networks/ham.ts b/packages/extension/src/providers/ethereum/networks/ham.ts new file mode 100644 index 000000000..846e29335 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/ham.ts @@ -0,0 +1,24 @@ +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 ethOptions: EvmNetworkOptions = { + name: NetworkNames.Ham, + name_long: "Ham Chain", + homePage: "https://ham.fun/", + blockExplorerTX: "https://explorer.ham.fun/tx/[[txHash]]", + blockExplorerAddr: "https://explorer.ham.fun/address/[[address]]", + chainID: "0x13f8", + isTestNetwork: false, + currencyName: "ETH", + currencyNameLong: "Ethereum", + node: "https://rpc.ham.fun", + icon: require("./icons/ham.png"), + coingeckoID: "ethereum", + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const eth = new EvmNetwork(ethOptions); + +export default eth; diff --git a/packages/extension/src/providers/ethereum/networks/icons/blast.webp b/packages/extension/src/providers/ethereum/networks/icons/blast.webp new file mode 100644 index 000000000..8fdf07632 Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/blast.webp differ diff --git a/packages/extension/src/providers/ethereum/networks/icons/degen.png b/packages/extension/src/providers/ethereum/networks/icons/degen.png new file mode 100644 index 000000000..5c4863f66 Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/degen.png differ diff --git a/packages/extension/src/providers/ethereum/networks/icons/ham.png b/packages/extension/src/providers/ethereum/networks/icons/ham.png new file mode 100644 index 000000000..b3669038c Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/ham.png differ diff --git a/packages/extension/src/providers/ethereum/networks/icons/sanko.png b/packages/extension/src/providers/ethereum/networks/icons/sanko.png new file mode 100644 index 000000000..bf697fc32 Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/sanko.png differ diff --git a/packages/extension/src/providers/ethereum/networks/icons/telos.svg b/packages/extension/src/providers/ethereum/networks/icons/telos.svg new file mode 100644 index 000000000..49cc05f82 Binary files /dev/null and b/packages/extension/src/providers/ethereum/networks/icons/telos.svg differ diff --git a/packages/extension/src/providers/ethereum/networks/index.ts b/packages/extension/src/providers/ethereum/networks/index.ts index 9a17874f5..daf736213 100644 --- a/packages/extension/src/providers/ethereum/networks/index.ts +++ b/packages/extension/src/providers/ethereum/networks/index.ts @@ -12,6 +12,7 @@ import astarEvmNode from "./astr"; import optimismNode from "./op"; import cantoNode from "./canto"; import rootstockNode from "./rsk"; +import rootstockTestnetNode from "./rsk-testnet"; import edgeEvmNode from "./edg"; import zkGoerliNode from "./zkgoerli"; import vicNode from "./vic"; @@ -37,6 +38,11 @@ import syscoinNode from "./sys"; import rolluxTestNode from "./trlx"; import rolluxNode from "./rlx"; import cagaAnkara from "./cagaAnkara"; +import telosNode from "./tlos"; +import blastNode from "./blast"; +import sankoNode from "./dmt"; +import degenNode from "./degen"; +import hamNode from "./ham"; export default { sepolia: sepoliaNode, @@ -54,6 +60,7 @@ export default { op: optimismNode, canto: cantoNode, rootstock: rootstockNode, + rootstockTestnet: rootstockTestnetNode, edgeEvm: edgeEvmNode, zkGoerli: zkGoerliNode, vic: vicNode, @@ -87,4 +94,9 @@ export default { rolluxTest: rolluxTestNode, rollux: rolluxNode, cagaAnkara: cagaAnkara, + telos: telosNode, + blast: blastNode, + sanko: sankoNode, + degen: degenNode, + ham: hamNode, }; diff --git a/packages/extension/src/providers/ethereum/networks/rsk-testnet.ts b/packages/extension/src/providers/ethereum/networks/rsk-testnet.ts new file mode 100644 index 000000000..8542dcd14 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/rsk-testnet.ts @@ -0,0 +1,40 @@ +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 { + toChecksumAddress, + isValidChecksumAddress, + isValidAddress, +} from "@ethereumjs/util"; + +const rootstockTestnetOptions: EvmNetworkOptions = { + name: NetworkNames.RootstockTestnet, + name_long: "Rootstock Testnet", + homePage: "https://rootstock.io/", + blockExplorerTX: "https://explorer.testnet.rootstock.io/tx/[[txHash]]", + blockExplorerAddr: + "https://explorer.testnet.rootstock.io/address/[[address]]", + chainID: "0x1f", + isTestNetwork: true, + currencyName: "tRBTC", + currencyNameLong: "Rootstock Testnet", + node: "wss://public-node.testnet.rsk.co/websocket", + icon: require("./icons/rootstock.svg"), + basePath: "m/44'/37310'/0'/0", + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +rootstockTestnetOptions.displayAddress = (address: string) => { + return toChecksumAddress(address, rootstockTestnetOptions.chainID); +}; +rootstockTestnetOptions.isAddress = (address: string) => { + return ( + isValidAddress(address) || + isValidChecksumAddress(address, rootstockTestnetOptions.chainID) + ); +}; + +const rootstockTestnet = new EvmNetwork(rootstockTestnetOptions); + +export default rootstockTestnet; diff --git a/packages/extension/src/providers/ethereum/networks/tlos.ts b/packages/extension/src/providers/ethereum/networks/tlos.ts new file mode 100644 index 000000000..65e1b1ab0 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/tlos.ts @@ -0,0 +1,27 @@ +import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; +import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; +import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; +import { TelosActivity } from "../libs/activity-handlers"; +import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; + +const ethOptions: EvmNetworkOptions = { + name: NetworkNames.Telos, + name_long: "Telos EVM", + homePage: "https://www.telos.net", + blockExplorerTX: "https://www.teloscan.io/tx/[[txHash]]", + blockExplorerAddr: "https://www.teloscan.io/address/[[address]]", + chainID: "0x28", + isTestNetwork: false, + currencyName: "TLOS", + currencyNameLong: "Telos", + node: "https://mainnet-eu.telos.net/evm", + icon: require("./icons/telos.svg"), + coingeckoID: "telos", + coingeckoPlatform: CoingeckoPlatform.Telos, + assetsInfoHandler, + activityHandler: wrapActivityHandler(TelosActivity), +}; + +const eth = new EvmNetwork(ethOptions); + +export default eth; 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 7dc0321d8..c3067bdf5 100644 --- a/packages/extension/src/providers/ethereum/ui/eth-verify-transaction.vue +++ b/packages/extension/src/providers/ethereum/ui/eth-verify-transaction.vue @@ -97,7 +97,9 @@

Data Hex: {{ decodedTx?.dataHex || "0x" }}

- +

+ {{ errorMsg }} +

@@ -172,6 +178,7 @@ const approvalAmount = ref(""); const network = ref(DEFAULT_EVM_NETWORK); const marketdata = new MarketData(); const gasCostValues = ref(defaultGasCostVals); +const errorMsg = ref(""); const account = ref({ name: "", address: "", @@ -236,52 +243,57 @@ onBeforeMount(async () => { Request.value.params![0] as EthereumTransaction, web3 ); - await tx.getGasCosts().then(async (gasvals) => { - let nativeVal = "0"; - if (network.value.coingeckoID) { - await marketdata - .getTokenValue("1", network.value.coingeckoID, "USD") - .then((val) => (nativeVal = val)); - } - const getConvertedVal = (type: GasPriceTypes) => - fromBase(gasvals[type], network.value.decimals); + await tx + .getGasCosts() + .then(async (gasvals) => { + let nativeVal = "0"; + if (network.value.coingeckoID) { + await marketdata + .getTokenValue("1", network.value.coingeckoID, "USD") + .then((val) => (nativeVal = val)); + } + const getConvertedVal = (type: GasPriceTypes) => + fromBase(gasvals[type], network.value.decimals); - gasCostValues.value = { - [GasPriceTypes.ECONOMY]: { - nativeValue: getConvertedVal(GasPriceTypes.ECONOMY), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.ECONOMY)) - .times(nativeVal) - .toString(), - nativeSymbol: network.value.currencyName, - fiatSymbol: "USD", - }, - [GasPriceTypes.REGULAR]: { - nativeValue: getConvertedVal(GasPriceTypes.REGULAR), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.REGULAR)) - .times(nativeVal) - .toString(), - nativeSymbol: network.value.currencyName, - fiatSymbol: "USD", - }, - [GasPriceTypes.FAST]: { - nativeValue: getConvertedVal(GasPriceTypes.FAST), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FAST)) - .times(nativeVal) - .toString(), - nativeSymbol: network.value.currencyName, - fiatSymbol: "USD", - }, - [GasPriceTypes.FASTEST]: { - nativeValue: getConvertedVal(GasPriceTypes.FASTEST), - fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FASTEST)) - .times(nativeVal) - .toString(), - nativeSymbol: network.value.currencyName, - fiatSymbol: "USD", - }, - }; - selectedFee.value = GasPriceTypes.REGULAR; - }); + gasCostValues.value = { + [GasPriceTypes.ECONOMY]: { + nativeValue: getConvertedVal(GasPriceTypes.ECONOMY), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.ECONOMY)) + .times(nativeVal) + .toString(), + nativeSymbol: network.value.currencyName, + fiatSymbol: "USD", + }, + [GasPriceTypes.REGULAR]: { + nativeValue: getConvertedVal(GasPriceTypes.REGULAR), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.REGULAR)) + .times(nativeVal) + .toString(), + nativeSymbol: network.value.currencyName, + fiatSymbol: "USD", + }, + [GasPriceTypes.FAST]: { + nativeValue: getConvertedVal(GasPriceTypes.FAST), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FAST)) + .times(nativeVal) + .toString(), + nativeSymbol: network.value.currencyName, + fiatSymbol: "USD", + }, + [GasPriceTypes.FASTEST]: { + nativeValue: getConvertedVal(GasPriceTypes.FASTEST), + fiatValue: new BigNumber(getConvertedVal(GasPriceTypes.FASTEST)) + .times(nativeVal) + .toString(), + nativeSymbol: network.value.currencyName, + fiatSymbol: "USD", + }, + }; + selectedFee.value = GasPriceTypes.REGULAR; + }) + .catch((e) => { + errorMsg.value = e.message; + }); }); const approve = async () => { diff --git a/packages/extension/src/scripts/chrome/hot-reload.ts b/packages/extension/src/scripts/chrome/hot-reload.ts index 43fd1febe..fb027a665 100644 --- a/packages/extension/src/scripts/chrome/hot-reload.ts +++ b/packages/extension/src/scripts/chrome/hot-reload.ts @@ -1,30 +1,28 @@ import browser from "webextension-polyfill"; -import { keccak256 } from "ethereum-cryptography/keccak"; -import { bufferToHex } from "@enkryptcom/utils"; const filesToMonitor = { content: { path: "scripts/contentscript.js", - hash: "", + length: 0, }, inject: { path: "scripts/inject.js", - hash: "", + length: 0, }, background: { path: "scripts/background.js", - hash: "", + length: 0, }, action: { path: "action.html", - hash: "", + length: 0, }, index: { path: "index.html", - hash: "", + length: 0, }, manifest: { path: "manifest.json", - hash: "", + length: 0, }, }; const checkFilesChanged = async () => { @@ -34,10 +32,10 @@ const checkFilesChanged = async () => { await fetch(exturl) .then((res) => res.text()) .then((content) => { - const hash = bufferToHex(keccak256(Buffer.from(content))); - if (value.hash !== hash) { + const length = content.length; + if (value.length !== length) { filesChanged = true; - value.hash = hash; + value.length = length; } }); } diff --git a/packages/types/src/networks.ts b/packages/types/src/networks.ts index fcfccfbb3..48bd18ea7 100644 --- a/packages/types/src/networks.ts +++ b/packages/types/src/networks.ts @@ -9,6 +9,7 @@ export enum NetworkNames { Moonbeam = "GLMR", Moonriver = "MOVR", Rootstock = "Rootstock", + RootstockTestnet = "RootstockTestnet", Acala = "ACA", Karura = "KAR", KaruraEVM = "evmKAR", @@ -71,6 +72,11 @@ export enum NetworkNames { RolluxTest = "TRLX", Rollux = "RLX", CagaAnkara = "CagaAnkara", + Telos = "TLOS", + Blast = "blast", + Sanko = "sanko", + Degen = "degen", + Ham = "ham", } export enum CoingeckoPlatform { @@ -113,4 +119,8 @@ export enum CoingeckoPlatform { Kadena = "kadena", Syscoin = "syscoin", Rollux = "rollux", + Telos = "telos", + Blast = "blast", + Sanko = "sanko", + Degen = "degen", } diff --git a/yarn.lock b/yarn.lock index 2574f2fba..ff2ba5c0d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6095,7 +6095,7 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.3.0, @noble/curves@npm:^1.0.0, @noble/curves@npm:^1.1.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:^1.3.0, @noble/curves@npm:~1.3.0": +"@noble/curves@npm:1.3.0, @noble/curves@npm:~1.3.0": version: 1.3.0 resolution: "@noble/curves@npm:1.3.0" dependencies: @@ -6104,7 +6104,7 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.4.0, @noble/curves@npm:^1.4.0, @noble/curves@npm:~1.4.0": +"@noble/curves@npm:1.4.0, @noble/curves@npm:^1.0.0, @noble/curves@npm:^1.1.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:^1.3.0, @noble/curves@npm:^1.4.0, @noble/curves@npm:~1.4.0": version: 1.4.0 resolution: "@noble/curves@npm:1.4.0" dependencies: @@ -6129,42 +6129,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.1.2": - version: 1.1.2 - resolution: "@noble/hashes@npm:1.1.2" - checksum: 3c2a8cb7c2e053811032f242155d870c5eb98844d924d69702244d48804cb03b42d4a666c49c2b71164420d8229cb9a6f242b972d50d5bb2f1d673b98b041de2 - languageName: node - linkType: hard - -"@noble/hashes@npm:1.1.5": - version: 1.1.5 - resolution: "@noble/hashes@npm:1.1.5" - checksum: de3f095a7ac1cbf5b4b3d09f193288d4f2eec35fbadf2ed9fd7e47d8a3042fef410052ba62dc0296a185f994c11192f5357fdb1bd9178c905efd82e946c53b00 - languageName: node - linkType: hard - -"@noble/hashes@npm:1.3.1": - version: 1.3.1 - resolution: "@noble/hashes@npm:1.3.1" - checksum: 7fdefc0f7a0c1ec27acc6ff88841793e3f93ec4ce6b8a6a12bfc0dd70ae6b7c4c82fe305fdfeda1735d5ad4a9eebe761e6693b3d355689c559e91242f4bc95b1 - languageName: node - linkType: hard - -"@noble/hashes@npm:1.3.2, @noble/hashes@npm:^1.3.2": - version: 1.3.2 - resolution: "@noble/hashes@npm:1.3.2" - checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474 - languageName: node - linkType: hard - -"@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1, @noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.1.2, @noble/hashes@npm:^1.2.0, @noble/hashes@npm:^1.3.0, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.3, @noble/hashes@npm:~1.3.1, @noble/hashes@npm:~1.3.2": - version: 1.3.3 - resolution: "@noble/hashes@npm:1.3.3" - checksum: 8a6496d1c0c64797339bc694ad06cdfaa0f9e56cd0c3f68ae3666cfb153a791a55deb0af9c653c7ed2db64d537aa3e3054629740d2f2338bb1dcb7ab60cd205b - languageName: node - linkType: hard - -"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.4.0, @noble/hashes@npm:~1.4.0": +"@noble/hashes@npm:^1.4.0": version: 1.4.0 resolution: "@noble/hashes@npm:1.4.0" checksum: 8ba816ae26c90764b8c42493eea383716396096c5f7ba6bea559993194f49d80a73c081f315f4c367e51bd2d5891700bcdfa816b421d24ab45b41cb03e4f3342