solana_kit_codecs 0.9.1 copy "solana_kit_codecs: ^0.9.1" to clipboard
solana_kit_codecs: ^0.9.1 copied to clipboard

Umbrella package re-exporting all codec sub-packages for the Solana Kit Dart SDK.

solana_kit_codecs #

pub package docs website CI coverage

The codec umbrella for the Solana Kit SDK. One import gives you the core codec interfaces plus the number, string, data-structure, fixed-point, and option codecs used to serialize Solana on-chain data.

Import this package when you need to encode or decode binary data and do not want to track which codec sub-package each function lives in.

Installation #

Install the package directly:

dependencies:
  "solana_kit_codecs": ^0.9.1

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.

Documentation #

For architecture notes, getting-started guides, and cross-package examples, start with the workspace docs site and then drill down into the package README and API reference.

Usage #

import 'package:solana_kit_codecs/solana_kit_codecs.dart';

void main() {
  // Encode a u64 as 8 little-endian bytes.
  final u64Codec = getU64Codec();
  final bytes = u64Codec.encode(BigInt.from(1000000));
  print('Encoded: ${bytes.length} bytes'); // 8

  // Decode it back.
  final value = u64Codec.decode(bytes);
  print('Decoded: $value'); // 1000000

  // Encode a UTF-8 string with a u16 length prefix.
  final stringCodec = getUtf8Codec();
  final text = stringCodec.encode('Hello, Solana!');
  print('String bytes: ${text.length}');
}

Re-exported packages #

Package Contents
solana_kit_codecs_core Encoder, Decoder, Codec interfaces and composition helpers
solana_kit_codecs_numbers Integer and float codecs (u8-u128, i8-i128, f32, f64)
solana_kit_codecs_strings String codecs (utf8, base58, base64, base16)
solana_kit_codecs_data_structures Struct, array, tuple, map, set, enum, boolean, and nullable codecs
solana_kit_fixed_points Fixed-point arithmetic and codecs
solana_kit_options Rust-like Option<T> type and codec

Example #

Use example/main.dart as a runnable starting point for solana_kit_codecs.

  • Import path: package:solana_kit_codecs/solana_kit_codecs.dart
  • This section is centrally maintained with mdt to keep package guidance aligned.
  • After updating shared docs templates, run docs:update from the repo root.

Maintenance #

  • Validate docs in CI and locally with docs:check.
  • Keep examples focused on one workflow and reference package README sections for deeper API details.