Skip to main content
See the Handling program instructions guide for usage examples and ABI generation. Returns a query-transformer combo that instructs the source to fetch and decode Solana program instructions.
Parameters:
  • range: Slot range { from: number | string | 'latest', to?: number } (required)
  • programId: Program address(es) string | string[] (required)
  • instructions: Map of instruction names to ABI instruction objects (required)
  • profiler: Profiler config shard that’ll be used for labeling the transformer in profiling data { name: string } (optional)
  • onError: Error handler (ctx: BatchCtx, error: any) => unknown | Promise<unknown> (optional)
Example:

Decoded instruction structure

Each entry in the output arrays is a DecodedInstruction object:

Instruction discriminators

Instructions are filtered by discriminators (prefix bytes of instruction data). The discriminator names indicate the number of hex characters returned: The decoder automatically extracts the appropriate discriminator from the ABI instruction definition.

Multiple programs

Decode instructions from multiple programs:

Error handling

Handle decoding errors: