Skip to main content

getChainId

Gets the chain ID if its set, otherwise gets the chain ID from the access node

Import

You can import the entire package and access the function:


_10
import * as fcl from "@onflow/fcl"
_10
_10
fcl.getChainId(opts)

Or import directly the specific function:


_10
import { getChainId } from "@onflow/fcl"
_10
_10
getChainId(opts)

Usage


_10
// returns "testnet"
_10
getChainId()

Parameters

opts (optional)

  • Type:

_10
export interface GetChainIdOptions {
_10
node?: unknown
_10
enableRequestLogging?: boolean
_10
[key: string]: any
_10
}

  • Description: Optional parameters

Returns

Promise<string>

The chain ID of the access node


Rate this page