sdk.rs 723 B

12345678910111213141516171819202122232425
  1. use steel::*;
  2. use crate::prelude::*;
  3. pub fn create(signer: Pubkey, user: Pubkey, page_visits: PageVisits) -> Instruction {
  4. let pda = page_visits_pda(&user);
  5. Instruction {
  6. program_id: crate::ID,
  7. accounts: vec![
  8. AccountMeta::new(signer, true),
  9. AccountMeta::new(user, false),
  10. AccountMeta::new(pda.0, false),
  11. AccountMeta::new_readonly(system_program::ID, false),
  12. ],
  13. data: Create { page_visits }.to_bytes(),
  14. }
  15. }
  16. pub fn increment(page_visits_pda: Pubkey) -> Instruction {
  17. Instruction {
  18. program_id: crate::ID,
  19. accounts: vec![AccountMeta::new(page_visits_pda, false)],
  20. data: Increment {}.to_bytes(),
  21. }
  22. }