Skip to content

Commit

Permalink
feat: revert network changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simodrws committed Jun 27, 2023
1 parent ca3697d commit 60e6ffe
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/refactor/wallet-client/network/use-network.ts
Expand Up @@ -60,15 +60,19 @@ export const useNetwork = () => {
const activeChainId = useMemo(() => activeChain?.id, [activeChain]);
const activeNetwork = useMemo(() => activeChain?.network, [activeChain]);
const currentNetwork = useMemo(() => {
const networkId = activeChain?.id;
const newNetworkName = getNetworkNameByChainId(
networkId as number
) as string;
let nw = activeChain?.network;
// * NOTE: name mismatch from masa & wagmi
if (nw === 'celo-alfajores') {
nw = 'alfajores';
}

return SupportedNetworks[newNetworkName as NetworkName];
return SupportedNetworks[nw as NetworkName];
}, [activeChain]);

// console.log({ currentNetwork });
const currentNetworkByChainId = useMemo(() => {
if (!activeChainId) return 0;
return getNetworkNameByChainId(activeChainId);
}, [activeChainId]);

const stopSwitching = useCallback(() => {
setSwitchingToChain(null);
Expand Down Expand Up @@ -124,6 +128,7 @@ export const useNetwork = () => {

// * old
currentNetwork,
currentNetworkByChainId,
currentNetworkNew: network,
};
};

0 comments on commit 60e6ffe

Please sign in to comment.