Skip to main content

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:


_10
import * as fcl from '@onflow/fcl';
_10
_10
fcl.getNetworkParameters();

Or import directly the specific function:


_10
import { getNetworkParameters } from '@onflow/fcl';
_10
_10
getNetworkParameters();

Usage


_14
import * as fcl from '@onflow/fcl';
_14
_14
// Get network parameters to verify chain ID
_14
const params = await fcl.send([fcl.getNetworkParameters()]).then(fcl.decode);
_14
_14
console.log('Chain ID:', params.chainId);
_14
console.log('Network:', params.name);
_14
_14
// Use this to verify you're connected to the right network
_14
if (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


_10
export type InteractionBuilderFn = (
_10
ix: Interaction,
_10
) => Interaction | Promise<Interaction>;

A function that processes an interaction object


Rate this page