Remove alchemy file and add localhost network to possible network to choose

Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
RcleydsonR
2023-01-12 18:06:44 -03:00
parent aedd4bc532
commit 62dd4349b2
3 changed files with 19 additions and 33 deletions

View File

@@ -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,
};