account.rs 716 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. use anchor_lang::prelude::*;
  2. pub const MAX_SIZE: usize = 10;
  3. #[account]
  4. pub struct Data {
  5. pub udata: u128,
  6. pub idata: i128,
  7. }
  8. #[account]
  9. #[derive(Default)]
  10. pub struct DataU16 {
  11. pub data: u16,
  12. }
  13. #[account]
  14. #[derive(Default)]
  15. pub struct DataI8 {
  16. pub data: i8,
  17. }
  18. #[account]
  19. pub struct DataI16 {
  20. pub data: i16,
  21. }
  22. #[account(zero_copy)]
  23. #[derive(Default)]
  24. pub struct DataZeroCopy {
  25. pub data: u16,
  26. pub bump: u8,
  27. }
  28. #[account]
  29. #[derive(Default)]
  30. pub struct DataWithFilter {
  31. pub authority: Pubkey,
  32. pub filterable: Pubkey,
  33. }
  34. #[account]
  35. pub struct DataMultidimensionalArray {
  36. pub data: [[u8; 10]; 10],
  37. }
  38. #[account]
  39. pub struct DataConstArraySize {
  40. pub data: [u8; MAX_SIZE],
  41. }