processor.rs 656 B

123456789101112131415161718192021222324252627
  1. use borsh::{ BorshDeserialize, BorshSerialize };
  2. use solana_program::{
  3. account_info::AccountInfo,
  4. entrypoint::ProgramResult,
  5. program_error::ProgramError,
  6. pubkey::Pubkey,
  7. };
  8. use crate::instructions;
  9. use crate::state::AddressInfo;
  10. pub fn process_instruction(
  11. program_id: &Pubkey,
  12. accounts: &[AccountInfo],
  13. instruction_data: &[u8],
  14. ) -> ProgramResult {
  15. match AddressInfo::try_from_slice(&instruction_data) {
  16. Ok(address_info) => return instructions::create::create_address_info(
  17. program_id, accounts, address_info
  18. ),
  19. Err(_) => {},
  20. };
  21. Err(ProgramError::InvalidInstructionData)
  22. }