Skip to main content

createFlowClient

Creates a Flow client instance with authentication, transaction, and query capabilities.

Import

You can import the entire package and access the function:


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

Or import directly the specific function:


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

Parameters

params

  • Type:

_21
export interface FlowClientConfig {
_21
accessNodeUrl: string
_21
flowNetwork?: string
_21
flowJson?: any
_21
discoveryWallet?: string
_21
discoveryWalletMethod?: string
_21
discoveryAuthnEndpoint?: string
_21
discoveryAuthnInclude?: string[]
_21
walletconnectProjectId?: string
_21
walletconnectDisableNotifications?: boolean
_21
storage?: StorageProvider
_21
appDetailTitle?: string
_21
appDetailIcon?: string
_21
appDetailDescription?: string
_21
appDetailUrl?: string
_21
serviceOpenIdScopes?: string[]
_21
transport?: SdkTransport
_21
computeLimit?: number
_21
customResolver?: any
_21
customDecoders?: any
_21
}

  • Description: Configuration object for the Flow client

Returns


_56
{
_56
send: (args?: false | InteractionBuilderFn | (false | InteractionBuilderFn)[], opts?: any) => Promise<any>;
_56
subscribe: <T extends SubscriptionTopic>({
_56
topic, args, onData, onError
_56
}: SubscribeParams<T>, opts?: {
_56
node?: string;
_56
transport?: SdkTransport;
_56
}) => Subscription;
_56
subscribeRaw: <T extends SubscriptionTopic>({
_56
topic, args, onData, onError
_56
}: SubscribeRawParams<T>, opts?: {
_56
node?: string;
_56
transport?: SdkTransport;
_56
}) => {
_56
unsubscribe: () => void;
_56
};
_56
account: (address: string, {
_56
height, id, isSealed
_56
}?: AccountQueryOptions, opts?: object) => Promise<Account>;
_56
block: ({
_56
sealed, id, height
_56
}?: BlockQueryOptions, opts?: object) => Promise<Block>;
_56
resolve: (ix: Interaction) => Promise<Interaction>;
_56
decode: (response: any) => Promise<any>;
_56
currentUser: CurrentUserServiceApi;
_56
mutate: (opts?: MutateOptions) => Promise<string>;
_56
query: (opts?: QueryOptions) => Promise<any>;
_56
queryRaw: (opts?: QueryOptions) => Promise<any>;
_56
verifyUserSignatures: (message: string, compSigs: CompositeSignature[], opts?: VerifySignaturesScriptOptions) => Promise<boolean>;
_56
getChainId: (opts?: GetChainIdOptions) => Promise<string>;
_56
tx: {
_56
(transactionId: string, opts?: {
_56
pollRate?: number;
_56
txNotFoundTimeout?: number;
_56
}): {
_56
snapshot: () => Promise<TransactionStatus>;
_56
subscribe: (onData: (txStatus: TransactionStatus) => void, onError?: (err: Error) => void) => () => void;
_56
onceFinalized: () => Promise<TransactionStatus>;
_56
onceExecuted: () => Promise<TransactionStatus>;
_56
onceSealed: () => Promise<TransactionStatus>;
_56
};
_56
isUnknown: (ix: Interaction) => boolean;
_56
isPending: (tx: TransactionStatus) => boolean;
_56
isFinalized: (tx: TransactionStatus) => boolean;
_56
isExecuted: (tx: TransactionStatus) => boolean;
_56
isSealed: (tx: TransactionStatus) => boolean;
_56
isExpired: (tx: TransactionStatus) => boolean;
_56
};
_56
events: (filterOrType?: string | EventFilter) => {
_56
subscribe: (onData: (event: Event) => void, onError?: (error: Error) => void) => () => void;
_56
};
_56
authenticate: (opts?: AuthenticationOptions) => Promise<CurrentUser>;
_56
unauthenticate: () => void;
_56
signUserMessage: (msg: string) => Promise<CompositeSignature[]>;
_56
serialize: (args: (false | InteractionBuilderFn)[] | Interaction, opts?: SerializeOptions) => Promise<string>;
_56
}

A Flow client object with many methods for interacting with the Flow blockchain


Rate this page