Skip to main content

createFcl

Creates a configured FCL (Flow Client Library) instance for web applications. This function initializes FCL with web-specific defaults and discovery configuration, providing a complete interface for interacting with the Flow blockchain.

The created FCL instance includes all core functionality for:

  • User authentication and wallet connections
  • Transaction submission and monitoring
  • Blockchain queries and event subscriptions
  • Configuration management
  • Discovery service integration

This function automatically configures the platform as "web" and uses localStorage for session persistence by default, while allowing customization of other parameters.

Import

You can import the entire package and access the function:


_10
import * as fcl from "@onflow/fcl"
_10
_10
fcl.createFcl(params)

Or import directly the specific function:


_10
import { createFcl } from "@onflow/fcl"
_10
_10
createFcl(params)

Usage


_12
// Basic FCL instance creation
_12
import { createFcl } from "@onflow/fcl"
_12
_12
const fcl = createFcl({
_12
accessNodeUrl: "https://rest-testnet.onflow.org",
_12
computeLimit: 1000,
_12
flowNetwork: "testnet"
_12
})
_12
_12
// Use the instance for authentication
_12
const user = await fcl.currentUser.authenticate()
_12
console.log("Authenticated user:", user.addr)

Parameters

params

  • Type:

_10
WithOptionalProperties<any, "platform" | "storage">

  • Description: Configuration parameters for the FCL instance

Properties:

  • accessNodeUrl - URL of the Flow access node (e.g., "https://rest-testnet.onflow.org")
  • computeLimit - Default compute limit for transactions and queries
  • customResolver - Optional custom resolver for address replacement
  • customDecoders - Optional custom decoders for response parsing
  • contracts - Optional contract address mappings
  • discoveryWallet - Optional discovery wallet endpoint
  • discoveryWalletMethod - Optional discovery wallet method
  • defaultComputeLimit - Optional default compute limit override
  • flowNetwork - Optional Flow network identifier
  • serviceOpenIdScopes - Optional OpenID scopes for services
  • walletconnectProjectId - Optional WalletConnect project ID
  • walletconnectDisableNotifications - Optional flag to disable WalletConnect notifications
  • storage - Optional custom storage provider (defaults to localStorage)
  • discovery - Optional discovery configuration

Returns

any

A fully configured FCL instance with all core methods and services


Rate this page