ClientWithGetMinimumBalance

type ClientWithGetMinimumBalance = object;

Represents a client that can compute the minimum balance required for an account to be exempt from deletion.

Different implementations may compute this value differently — for example, by calling the getMinimumBalanceForRentExemption RPC method, or by using a locally cached value.

Example

async function logAccountCost(client: ClientWithGetMinimumBalance, dataSize: number) {
    const minimumBalance = await client.getMinimumBalance(dataSize);
    console.log(`Minimum balance for ${dataSize} bytes: ${minimumBalance} lamports`);
}

Properties

getMinimumBalance()

getMinimumBalance: (space, config?) => Promise<Lamports>;

Computes the minimum lamports required for an account with the given data size.

By default, the 128-byte account header is added on top of the provided space. Pass { withoutHeader: true } to skip adding the header bytes.

Parameters

ParameterTypeDescription
spacenumberThe number of bytes of account data.
config?GetMinimumBalanceConfigOptional configuration for the computation.

Returns

Promise<Lamports>

A promise resolving to the minimum Lamports required.

See

@solana/accounts#BASE_ACCOUNT_SIZE | BASE_ACCOUNT_SIZE for the account header size constant.

On this page