Fixed some reactivity for network selected.

This commit is contained in:
Filipe Soccol
2025-04-15 17:56:32 -03:00
parent 0186afe971
commit 1ec4780e14
5 changed files with 52 additions and 45 deletions

View File

@@ -1,5 +1,20 @@
import { NetworkEnum } from "@/model/NetworkEnum";
export const NetworkById = (
chainId: string | number
): NetworkEnum | undefined => {
const normalizedChainId =
typeof chainId === "number" ? chainId : Number(chainId);
for (const [network, details] of Object.entries(Networks)) {
if (Number(details.chainId) === normalizedChainId) {
return network as unknown as NetworkEnum;
}
}
return undefined;
};
export const Networks = {
[NetworkEnum.sepolia]: {
chainId: "0xAA36A7",