solana_kit_spl_account_compression 0.4.3 copy "solana_kit_spl_account_compression: ^0.4.3" to clipboard
solana_kit_spl_account_compression: ^0.4.3 copied to clipboard

SPL Account Compression Program instruction builders and helpers for the Solana Kit Dart SDK.

solana_kit_spl_account_compression #

pub package docs website CI Coverage

Concurrent Merkle tree account sizing, valid depth/buffer lookups, program addresses, and generated instruction builders for the SPL Account Compression program.

Installation #

Install the package directly:

dependencies:
  "solana_kit_spl_account_compression": ^0.4.3

If your app uses several Solana Kit packages together, you can also depend on the umbrella package instead:

dart pub add solana_kit

Inside this monorepo, Dart workspace resolution uses the local package automatically.

Usage #

Calculate the on-chain account size for a tree with a given depth and buffer size:

import 'package:solana_kit_spl_account_compression/solana_kit_spl_account_compression.dart';

void main() {
  final size = getConcurrentMerkleTreeAccountSize(
    maxDepth: 14,
    maxBufferSize: 64,
  );
  print(size); // 31800 (no canopy by default)

  final sizeWithCanopy = getConcurrentMerkleTreeAccountSize(
    maxDepth: 14,
    maxBufferSize: 64,
    canopyDepth: 10,
  );
  print(sizeWithCanopy);
}

Check whether a depth/buffer pair is valid and list all valid pairs:

import 'package:solana_kit_spl_account_compression/solana_kit_spl_account_compression.dart';

void main() {
  final isValid = isValidDepthSizePair(maxDepth: 14, maxBufferSize: 64);
  print(isValid); // true

  print(validDepthSizePairs);
}

Reference the program and noop addresses:

import 'package:solana_kit_spl_account_compression/solana_kit_spl_account_compression.dart';

void main() {
  print(splAccountCompressionProgramAddress);
  // cmtDvXzGgh4bcrDY2gZqFaGQqat4RNQPhKJ4jAc7uLi

  print(noopProgramAddress);
  // noopb9bkMVz3tFhZ5L7bJGby9DreGG5J2P4V4Wxe8tK
}

Relationship with solana_kit_mpl_bubblegum #

This package is a low-level dependency of solana_kit_mpl_bubblegum, which provides higher-level CNFT helpers (createTree, mintV1, etc.). Use this package directly for tree sizing and instruction building, or use solana_kit_mpl_bubblegum for the full compressed NFT workflow.

License #

MIT