fixed type check errors

This commit is contained in:
hueso
2025-03-04 18:46:10 -03:00
parent 54cff28ba0
commit 3227e3209c
6 changed files with 20 additions and 14 deletions

View File

@@ -87,12 +87,12 @@ describe("addresses.ts functions", () => {
it("isPossibleNetwork Returns", () => {
const etherStore = useEtherStore();
etherStore.setNetworkId(NetworkEnum.sepolia);
expect(isPossibleNetwork(0x5)).toBe(true);
expect(isPossibleNetwork(5)).toBe(true);
expect(isPossibleNetwork(0x13881)).toBe(true);
expect(isPossibleNetwork(80001)).toBe(true);
expect(isPossibleNetwork(0x5 as NetworkEnum)).toBe(true);
expect(isPossibleNetwork(5 as NetworkEnum)).toBe(true);
expect(isPossibleNetwork(0x13881 as NetworkEnum)).toBe(true);
expect(isPossibleNetwork(80001 as NetworkEnum)).toBe(true);
expect(isPossibleNetwork(NaN)).toBe(false);
expect(isPossibleNetwork(0x55)).toBe(false);
expect(isPossibleNetwork(NaN as NetworkEnum)).toBe(false);
expect(isPossibleNetwork(0x55 as NetworkEnum)).toBe(false);
});
});

View File

@@ -26,8 +26,8 @@ export const updateWalletStatus = async (): Promise<void> => {
const provider = await getProvider();
const signer = await provider?.getSigner();
const { chainId } = await provider?.getNetwork();
const network = await provider?.getNetwork();
const chainId = network?.chainId;
if (!isPossibleNetwork(Number(chainId))) {
window.alert("Invalid chain!:" + chainId);
return;