* Add all new chains * Import from SDK * Add RPC urls * Fix type error * Fix currency map * Fix build * Fix imports * Add faucets, fix stuff * Rename * Add Optimism/Arbitrum icons * Disable arbitrum/optimism * Fix build * Fix build again * Update SDK * Update TypeScript SDK * Add registry * Fix faucets * Update embeds * slight changes * Update embeds * Filter gnosis, update optimism kovan alchemy url * Simplify transfer modal * Remove console.logs * Fix embeds Co-authored-by: Jonas Daniels <[email protected]>
18 lines
591 B
TypeScript
18 lines
591 B
TypeScript
import { SUPPORTED_CHAIN_ID } from "@thirdweb-dev/sdk";
|
|
import { useSingleQueryParam } from "hooks/useQueryParam";
|
|
import {
|
|
SupportedNetwork,
|
|
getChainIdFromNetwork,
|
|
getNetworkFromChainId,
|
|
} from "utils/network";
|
|
|
|
export function useActiveChainId(): SUPPORTED_CHAIN_ID | undefined {
|
|
const networkFromUrl = useSingleQueryParam<SupportedNetwork>("network");
|
|
return getChainIdFromNetwork(networkFromUrl);
|
|
}
|
|
|
|
export function useActiveNetwork(): SupportedNetwork | undefined {
|
|
const activeChainId = useActiveChainId();
|
|
return activeChainId && getNetworkFromChainId(activeChainId);
|
|
}
|