solana_kit_system 0.4.1 copy "solana_kit_system: ^0.4.1" to clipboard
solana_kit_system: ^0.4.1 copied to clipboard

System Program instruction builders for the Solana Kit Dart SDK.

solana_kit_system #

pub package CI Coverage

Generated Dart client for the Solana System Program, part of the Solana Kit Dart SDK.

Provides typed instruction builders, account decoders, error definitions, PDA helpers, and program address constants for all 13 System Program instructions. Generated from the upstream Codama IDL at solana-program/system (js@v0.12.0).

Installation #

dependencies:
  solana_kit_system: ^0.3.2

Usage #

import 'package:solana_kit_system/solana_kit_system.dart';

// Create a new account
final ix = getCreateAccountInstruction(
  programAddress: systemProgramAddress,
  fromPubkey: payer,
  newAccountPubkey: newAccount,
  lamports: BigInt.from(10000000),
  space: BigInt.from(165),
  owner: tokenProgramAddress,
);

// Transfer SOL
final transferIx = getTransferSolInstruction(
  programAddress: systemProgramAddress,
  source: payer,
  destination: recipient,
  amount: BigInt.from(1000000),
);

// Derive a system account PDA
final pda = findCreateAccountWithSeedPda(
  base: baseAddress,
  seed: 'my-seed',
  owner: systemProgramAddress,
);

Instructions #

Instruction Discriminator Description
CreateAccount 0 Create a new account with the given space and owner.
Assign 1 Assign an account to a program.
TransferSol 2 Transfer lamports between accounts.
CreateAccountWithSeed 3 Create an account derived from a base address and seed.
AdvanceNonceAccount 4 Advance the nonce value in a nonce account.
WithdrawNonceAccount 5 Withdraw lamports from a nonce account.
InitializeNonceAccount 6 Initialize a nonce account with an authority.
AuthorizeNonceAccount 7 Change the authority of a nonce account.
Allocate 8 Allocate space for an account.
AllocateWithSeed 9 Allocate space using a derived seed.
AssignWithSeed 10 Assign an account to a program using a derived seed.
TransferSolWithSeed 11 Transfer lamports using a derived source address.
UpgradeNonceAccount 12 Upgrade a nonce account to a versioned format.

Accounts #

  • Nonce — Nonce account data including authority, nonce value, and fee calculator.

Types #

  • NonceState — Enum for nonce account state (uninitialized, initialized, ready).
  • NonceVersion — Enum for nonce account version (legacy, current).

Errors #

Nine typed error codes covering invalid nonce state, missing accounts, insufficient funds, and other System Program failure modes.

Upstream reference #

Generated layer mirrors solana-program/system at js@v0.12.0 (commit 95897f3).