carbon_memo_program_decoder/instructions/
mod.rs1use crate::MemoProgramDecoder;
2use carbon_core::instruction::DecodedInstruction;
3
4#[derive(
5 carbon_core::InstructionType,
6 serde::Serialize,
7 serde::Deserialize,
8 PartialEq,
9 Eq,
10 Debug,
11 Clone,
12 Hash,
13)]
14pub enum MemoProgramInstruction {
15 Memo(Vec<u8>),
16}
17
18impl<'a> carbon_core::instruction::InstructionDecoder<'a> for MemoProgramDecoder {
19 type InstructionType = MemoProgramInstruction;
20
21 fn decode_instruction(
22 &self,
23 instruction: &solana_sdk::instruction::Instruction,
24 ) -> Option<DecodedInstruction<Self::InstructionType>> {
25 if instruction.program_id != spl_memo::ID {
26 return None;
27 }
28
29 Some(DecodedInstruction {
30 data: MemoProgramInstruction::Memo(instruction.data.clone()),
31 program_id: instruction.program_id,
32 accounts: instruction.accounts.clone(),
33 })
34 }
35}