From 62dd4349b2491bf78dff9b2733ccdf9462523ed4 Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Thu, 12 Jan 2023 18:06:44 -0300 Subject: [PATCH] Remove alchemy file and add localhost network to possible network to choose Co-authored-by: brunoedcf --- src/components/TopBar.vue | 19 ++++++++++++++++++- src/model/NetworkEnum.ts | 1 + src/utils/alchemy.ts | 32 -------------------------------- 3 files changed, 19 insertions(+), 33 deletions(-) delete mode 100644 src/utils/alchemy.ts diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue index 7979faf..b93ac71 100644 --- a/src/components/TopBar.vue +++ b/src/components/TopBar.vue @@ -52,6 +52,7 @@ const getNetworkImage = (networkName: NetworkEnum) => { let validImages = { Ethereum: ethereumImage, Polygon: polygonImage, + Localhost: ethereumImage }; return validImages[networkName]; @@ -159,7 +160,23 @@ const getNetworkImage = (networkName: NetworkEnum) => { Polygon -
+ +
+
+
+ diff --git a/src/model/NetworkEnum.ts b/src/model/NetworkEnum.ts index 47a1f2a..0304338 100644 --- a/src/model/NetworkEnum.ts +++ b/src/model/NetworkEnum.ts @@ -1,4 +1,5 @@ export enum NetworkEnum { ethereum = "Ethereum", polygon = "Polygon", + localhost = "Localhost", } diff --git a/src/utils/alchemy.ts b/src/utils/alchemy.ts deleted file mode 100644 index 14816ec..0000000 --- a/src/utils/alchemy.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Network, Alchemy } from "alchemy-sdk"; -import { useEtherStore } from "@/store/ether"; - -const getAlchemy = () => { - const possibleSettings = { - Ethereum: { - apiKey: import.meta.env.VITE_GOERLI_API_KEY, - network: Network.ETH_GOERLI, - }, - Polygon: { - apiKey: import.meta.env.VITE_MUMBAI_API_KEY, - network: Network.MATIC_MUMBAI, - }, - }; - const etherStore = useEtherStore(); - - const settings = possibleSettings[etherStore.networkName]; - const alchemy = new Alchemy(settings); - return alchemy; -}; - -const showLatestBlockNumber = async () => { - const alchemy = getAlchemy(); - - const latestBlock = await alchemy.core.getBlockNumber(); - if (latestBlock) console.log(latestBlock); -}; - -export default { - getAlchemy, - showLatestBlockNumber, -};