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 fcl from '@onflow/fcl';_10_10fcl.getNetworkParameters();
Or import directly the specific function:
_10import { getNetworkParameters } from '@onflow/fcl';_10_10getNetworkParameters();
Usage
_14import * as fcl from '@onflow/fcl';_14_14// Get network parameters to verify chain ID_14const params = await fcl.send([fcl.getNetworkParameters()]).then(fcl.decode);_14_14console.log('Chain ID:', params.chainId);_14console.log('Network:', params.name);_14_14// Use this to verify you're connected to the right network_14if (params.chainId === 'flow-mainnet') {_14 console.log('Connected to Flow Mainnet');_14} else if (params.chainId === 'flow-testnet') {_14 console.log('Connected to Flow Testnet');_14}
Returns
_10export type InteractionBuilderFn = (_10 ix: Interaction,_10) => Interaction | Promise<Interaction>;
A function that processes an interaction object