MCPcopy Create free account
hub / github.com/nifty-oss/asset / process_instruction

Function process_instruction

programs/proxy/src/processor/mod.rs:18–60  ·  view source on GitHub ↗
(
    program_id: &Pubkey,
    accounts: &'a [AccountInfo<'a>],
    instruction_data: &[u8],
)

Source from the content-addressed store, hash-verified

16const CONTENT_TYPE: &str = "image/svg+xml";
17
18pub fn process_instruction<'a>(
19 program_id: &Pubkey,
20 accounts: &'a [AccountInfo<'a>],
21 instruction_data: &[u8],
22) -> ProgramResult {
23 // we first try to match the instruction on the `Proxy` program
24 // interface since they do not overlap
25
26 let instruction = Instruction::try_from_slice(instruction_data);
27
28 if let Ok(Instruction::Create(metadata)) = instruction {
29 msg!("Instruction: Create");
30 return create::process_create(program_id, CreateAccounts::context(accounts)?, metadata);
31 }
32
33 // if it is not an instruction from the `Proxy` program, we try to match it
34 // on the Nifty Asset interface
35
36 if let Ok(instruction) = Interface::try_from_slice(instruction_data) {
37 match instruction {
38 Interface::Transfer => {
39 msg!("Interface: Transfer");
40 return transfer::process_transfer(
41 program_id,
42 TransferAccounts::context(accounts)?,
43 );
44 }
45 Interface::Update(input) => {
46 msg!("Interface: Update");
47 return update::process_update(
48 program_id,
49 UpdateAccounts::context(accounts)?,
50 input,
51 );
52 }
53 // we can block instructions that are not supported by the proxy
54 // by returning an error here
55 _ => (),
56 }
57 }
58
59 Interface::process_instruction(&crate::ID, accounts, instruction_data)
60}
61
62#[macro_export]
63macro_rules! require {

Callers

nothing calls this directly

Calls 3

process_createFunction · 0.70
process_transferFunction · 0.70
process_updateFunction · 0.70

Tested by

no test coverage detected