createClient

function createClient<TSelf>(value?): Client<TSelf>;

Creates a new empty client that can be extended with plugins.

This serves as an entry point for building Solana clients. Start with an empty client and chain the .use() method to apply plugins that add various functionalities such as RPC connectivity, wallet integration, transaction building, and more.

See ClientPlugin for detailed examples on creating and using plugins.

Type Parameters

Type ParameterDefault type
TSelf extends objectobject

Parameters

ParameterType
value?TSelf

Returns

Client<TSelf>

An empty client object with only the use method available.

Example

import { createClient } from '@solana/client';
import { generatedPayer } from '@solana/kit-plugin-payer';
import { rpc } from '@solana/kit-plugin-rpc';
 
const client = await createClient()
    .use(generatedPayer())
    .use(rpc('https://api.mainnet-beta.solana.com'));

On this page