solana_json/processor/
mod.rs1use crate::instruction::OnchainMetadataInstructions;
2use borsh::BorshDeserialize;
3use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, msg, pubkey::Pubkey};
4
5mod add_authority;
6mod append_value;
7mod close;
8mod initialize;
9mod remove_authority;
10mod set_value;
11
12use add_authority::*;
13use append_value::*;
14use close::*;
15use initialize::*;
16use remove_authority::*;
17use set_value::*;
18
19pub struct Processor;
20impl Processor {
21 pub fn process_instruction(
22 _program_id: &Pubkey,
23 accounts: &[AccountInfo],
24 instruction_data: &[u8],
25 ) -> ProgramResult {
26 let instruction: OnchainMetadataInstructions =
27 OnchainMetadataInstructions::try_from_slice(instruction_data)?;
28 match instruction {
29 OnchainMetadataInstructions::Initialize => {
30 msg!("Instruction: Initialize");
31 process_initialize(accounts)
32 }
33 OnchainMetadataInstructions::Close => {
34 msg!("Instruction: Close");
35 process_close(accounts)
36 }
37 OnchainMetadataInstructions::SetValue(args) => {
38 msg!("Instruction: SetValue");
39 process_set_value(accounts, args)
40 }
41 OnchainMetadataInstructions::AppendValue(args) => {
42 msg!("Instruction: AppendValue");
43 process_append_value(accounts, args)
44 }
45 OnchainMetadataInstructions::AddAuthority(args) => {
46 msg!("Instruction: AddAuthority");
47 process_add_authority(accounts, args)
48 }
49 OnchainMetadataInstructions::RemoveAuthority(args) => {
50 msg!("Instruction: RemoveAuthority");
51 process_remove_authority(accounts, args)
52 }
53 }
54 }
55}