getNetworkParameters
A builder function that returns the interaction to get network parameters.
Network parameters contain important configuration information about the Flow network, including the chain ID, which is essential for signing transactions correctly. This information is crucial for ensuring transactions are submitted to the correct network.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.getNetworkParameters()
Or import directly the specific function:
_10import { getNetworkParameters } from "@onflow/sdk"_10_10getNetworkParameters()
Usage
_16import * as fcl from "@onflow/fcl";_16_16// Get network parameters to verify chain ID_16const params = await fcl.send([_16 fcl.getNetworkParameters()_16]).then(fcl.decode);_16_16console.log("Chain ID:", params.chainId);_16console.log("Network:", params.name);_16_16// Use this to verify you're connected to the right network_16if (params.chainId === "flow-mainnet") {_16 console.log("Connected to Flow Mainnet");_16} else if (params.chainId === "flow-testnet") {_16 console.log("Connected to Flow Testnet");_16}
Returns
InteractionBuilderFn
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>