@starknet-react/core
Version:
Starknet React is a collection of React hooks for Starknet.
26 lines (22 loc) • 549 B
text/typescript
import type { Chain } from "@starknet-react/chains";
import { useStarknet } from "../context/starknet";
/** Value returned from `useNetwork`. */
export type UseNetworkResult = {
/** The current chain. */
chain: Chain;
/** List of supported chains. */
chains: Chain[];
};
/**
* Hook for accessing the current connected chain.
*
* @remarks
*
* The network object contains information about the
* network.
*
*/
export function useNetwork(): UseNetworkResult {
const { chain, chains } = useStarknet();
return { chain, chains };
}