InstructionDecoder

Trait InstructionDecoder 

Source
pub trait InstructionDecoder: Send + Sync {
    // Required methods
    fn program_id(&self) -> Pubkey;
    fn program_name(&self) -> &'static str;
    fn decode(
        &self,
        data: &[u8],
        accounts: &[AccountMeta],
    ) -> Option<DecodedInstruction>;
}
Expand description

Trait for instruction decoders - each program implements this.

Required Methods§

Source

fn program_id(&self) -> Pubkey

Program ID this decoder handles.

Source

fn program_name(&self) -> &'static str

Human-readable program name (e.g., “Compressed Token Program”).

Source

fn decode( &self, data: &[u8], accounts: &[AccountMeta], ) -> Option<DecodedInstruction>

Decode instruction data into a structured representation. Returns None if decoding fails or instruction is unknown.

Implementors§