sdk.rs 726 B

1234567891011121314151617181920212223242526272829
  1. use steel::*;
  2. use crate::prelude::*;
  3. pub fn initialize(signer: Pubkey) -> Instruction {
  4. Instruction {
  5. program_id: crate::ID,
  6. accounts: vec![
  7. AccountMeta::new(signer, true),
  8. AccountMeta::new(counter_pda().0, false),
  9. AccountMeta::new_readonly(system_program::ID, false),
  10. ],
  11. data: Initialize {}.to_bytes()
  12. }
  13. }
  14. pub fn add(signer: Pubkey, amount: u64) -> Instruction {
  15. Instruction {
  16. program_id: crate::ID,
  17. accounts: vec![
  18. AccountMeta::new(signer, true),
  19. AccountMeta::new(counter_pda().0, false),
  20. ],
  21. data: Add {
  22. amount: amount.to_le_bytes(),
  23. }
  24. .to_bytes(),
  25. }
  26. }