refactored network and token selection

This commit is contained in:
hueso
2024-10-09 21:52:59 -03:00
parent 1f003f19bc
commit e483fd537c
8 changed files with 103 additions and 102 deletions

View File

@@ -1,7 +1,7 @@
import { useEtherStore } from "@/store/ether";
import { getContract, getProvider } from "./provider";
import { getTokenAddress, possibleChains, isPossibleNetwork } from "./addresses";
import { getTokenAddress, isPossibleNetwork } from "./addresses";
import mockToken from "@/utils/smart_contract_files/MockToken.json";
@@ -21,11 +21,11 @@ const updateWalletStatus = async (): Promise<void> => {
const signer = provider.getSigner();
const { chainId } = await provider.getNetwork();
if (!isPossibleNetwork(chainId.toString())) {
if (!isPossibleNetwork(chainId)) {
window.alert("Invalid chain!:" + chainId);
return;
}
etherStore.setNetworkName(possibleChains[chainId]);
etherStore.setNetworkName(chainId);
const mockTokenContract = new ethers.Contract(
getTokenAddress(etherStore.selectedToken),