createSdkClient
Creates an SDK client with the provided options.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.createSdkClient(options)
Or import directly the specific function:
_10import { createSdkClient } from "@onflow/sdk"_10_10createSdkClient(options)
Usage
_10const client = createSdkClient({_10 accessNodeUrl: "https://rest-mainnet.onflow.org",_10 transport: myTransport,_10 computeLimit: 1000,_10})_10client.send([myScript, myTransaction])_10 .then(client.decode)_10 .catch(error => console.error("Error sending request:", error))
Parameters
options
- Type:
_10export interface SdkClientOptions {_10 accessNodeUrl: string_10 transport: SdkTransport_10 computeLimit: number_10 contracts?: {_10 [contractName: string]: string_10 }_10 customResolver?: (args: any) => Promise<any>_10 customDecoders?: {[key: string]: (data: any) => any}_10}
- Description: - Configuration options for the SDK client.
Returns
_25{_25 send: (args?: false | InteractionBuilderFn | (false | InteractionBuilderFn)[], opts?: any) => Promise<any>;_25 subscribe: <T extends SubscriptionTopic>({_25 topic, args, onData, onError_25}: SubscribeParams<T>, opts?: {_25 node?: string;_25 transport?: SdkTransport;_25}) => Subscription;_25 subscribeRaw: <T extends SubscriptionTopic>({_25 topic, args, onData, onError_25}: SubscribeRawParams<T>, opts?: {_25 node?: string;_25 transport?: SdkTransport;_25}) => {_25 unsubscribe: () => void;_25};_25 account: (address: string, {_25 height, id, isSealed_25}?: AccountQueryOptions, opts?: object) => Promise<Account>;_25 block: ({_25 sealed, id, height_25}?: BlockQueryOptions, opts?: object) => Promise<Block>;_25 resolve: (ix: Interaction) => Promise<Interaction>;_25 decode: (response: any) => Promise<any>;_25}
A client object with methods to interact with the Flow blockchain.