createClientWithGetMinimumBalanceFromRpc

function createClientWithGetMinimumBalanceFromRpc(
    rpc,
): ClientWithGetMinimumBalance;

Creates a ClientWithGetMinimumBalance from a raw Rpc object.

The returned client computes the minimum balance for rent exemption using the getMinimumBalanceForRentExemption RPC method. By default, the 128-byte account header is included on top of the provided space; pass { withoutHeader: true } to compute the minimum balance for the data portion only.

This is a convenience helper for consumers that only have a raw Rpc object rather than a Kit client. If you are building a full client, prefer composing it with a plugin such as solanaRpc (i.e. createClient().use(solanaRpc(...))), which provides getMinimumBalance amongst other capabilities.

Parameters

ParameterTypeDescription
rpcRpc<GetMinimumBalanceForRentExemptionApi>An object that supports the GetMinimumBalanceForRentExemptionApi of the Solana RPC API.

Returns

ClientWithGetMinimumBalance

Example

const client = createClientWithGetMinimumBalanceFromRpc(rpc);
const rentExemptBalance = await client.getMinimumBalance(100);

On this page