solana_kit_transaction_introspection 0.8.0 copy "solana_kit_transaction_introspection: ^0.8.0" to clipboard
solana_kit_transaction_introspection: ^0.8.0 copied to clipboard

Decode confirmed Solana transactions and walk their instructions for the auto-generated program clients.

solana_kit_transaction_introspection #

pub package CI coverage

Decode confirmed Solana transactions and walk their outer and inner instructions in a form that the auto-generated @solana-program/* clients can identify and parse directly.

This is the Dart port of @solana/transaction-introspection from the Solana TypeScript SDK.

Key APIs #

  • decodeTransactionFromRpcResponse(Map<String, Object?>?) — decodes a getTransaction response ('base64', 'base58', or 'json') into a DecodedRpcTransaction (compiled message + loaded ALT addresses + wire-format transaction for binary encodings).
  • walkInstructions({compiledMessage, meta, loadedAddresses}) — returns every instruction in display order as TracedInstructions (each outer instruction followed by its CPI inner instructions), with account indices resolved to AccountMetas.
  • getInstructionsFromCompiledTransactionMessage(compiledMessage, {loadedAddresses}) — returns the outer instructions as resolved Instructions.
  • getInnerInstructionsFromMeta(meta, accountMetas) — returns the inner instructions from a getTransaction meta as TracedInstructions.

Usage #

import 'package:solana_kit_transaction_introspection/solana_kit_transaction_introspection.dart';

void main() {
  // `rpcTx` is a `getTransaction` response map.
  final decoded = decodeTransactionFromRpcResponse(rpcTx);
  for (final ix in walkInstructions(
    compiledMessage: decoded.compiledMessage,
    loadedAddresses: decoded.loadedAddresses,
  )) {
    print(ix.trace);
    print(ix.programAddress);
  }
}

'jsonParsed' responses are not supported: their instructions arrive pre-parsed by the server and lack raw bytes, so they cannot be round-tripped through the auto-generated parseXInstruction clients. Prefer 'base64' when bandwidth allows — it is the most compact and the returned transaction is re-encodable.

RPC input is validated fail-closed. Mixed-type account/index arrays, unsupported transaction versions, incomplete compiled instructions, invalid header counts, malformed loaded addresses, and inner-instruction groups that do not match an outer instruction throw a SolanaError instead of being silently dropped or misattributed.

0
likes
150
points
315
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Decode confirmed Solana transactions and walk their instructions for the auto-generated program clients.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

meta, solana_kit_addresses, solana_kit_codecs_strings, solana_kit_errors, solana_kit_instructions, solana_kit_transaction_messages, solana_kit_transactions

More

Packages that depend on solana_kit_transaction_introspection