Skip to main content

useChainId

Callable

  • useChainId<TAllowList, TDenylist>(options?: { allowlist?: TAllowList; denylist?: TDenylist }): Exclude<Extract<ChainId, TAllowList[number]>, TDenylist[number]>

  • Hook for getting the current chain ID.


    Type parameters

    • TAllowList: ChainId[]
    • TDenylist: ChainId[] = []

    Parameters

    • optionaloptions: { allowlist?: TAllowList; denylist?: TDenylist }

      Additional options

      • optionalallowlist: TAllowList
      • optionaldenylist: TDenylist

    Returns Exclude<Extract<ChainId, TAllowList[number]>, TDenylist[number]>

    The current chain ID