22
33use {
44 crate :: id,
5+ codama:: { codama, CodamaInstructions } ,
56 solana_instruction:: { AccountMeta , Instruction } ,
67 solana_program_error:: ProgramError ,
78 solana_pubkey:: Pubkey ,
89 std:: mem:: size_of,
910} ;
1011
1112/// Instructions supported by the program
12- #[ derive( Clone , Debug , PartialEq ) ]
13+ #[ derive( Clone , Debug , PartialEq , CodamaInstructions ) ]
1314pub enum RecordInstruction < ' a > {
1415 /// Create a new record
1516 ///
1617 /// Accounts expected by this instruction:
1718 ///
1819 /// 0. `[writable]` Record account, must be uninitialized
1920 /// 1. `[]` Record authority
21+ #[ codama( account( name = "record_account" , writable) ) ]
22+ #[ codama( account( name = "authority" ) ) ]
2023 Initialize ,
2124
2225 /// Write to the provided record account
@@ -25,10 +28,14 @@ pub enum RecordInstruction<'a> {
2528 ///
2629 /// 0. `[writable]` Record account, must be previously initialized
2730 /// 1. `[signer]` Current record authority
31+ #[ codama( account( name = "record_account" , writable) ) ]
32+ #[ codama( account( name = "authority" , signer) ) ]
2833 Write {
2934 /// Offset to start writing record, expressed as `u64`.
3035 offset : u64 ,
3136 /// Data to replace the existing record data
37+ #[ codama( type = bytes) ]
38+ #[ codama( size_prefix = number( u32 ) ) ]
3239 data : & ' a [ u8 ] ,
3340 } ,
3441
@@ -39,6 +46,9 @@ pub enum RecordInstruction<'a> {
3946 /// 0. `[writable]` Record account, must be previously initialized
4047 /// 1. `[signer]` Current record authority
4148 /// 2. `[]` New record authority
49+ #[ codama( account( name = "record_account" , writable) ) ]
50+ #[ codama( account( name = "authority" , signer) ) ]
51+ #[ codama( account( name = "new_authority" ) ) ]
4252 SetAuthority ,
4353
4454 /// Close the provided record account, draining lamports to recipient
@@ -49,6 +59,9 @@ pub enum RecordInstruction<'a> {
4959 /// 0. `[writable]` Record account, must be previously initialized
5060 /// 1. `[signer]` Record authority
5161 /// 2. `[]` Receiver of account lamports
62+ #[ codama( account( name = "record_account" , writable) ) ]
63+ #[ codama( account( name = "authority" , signer) ) ]
64+ #[ codama( account( name = "receiver" , writable) ) ]
5265 CloseAccount ,
5366
5467 /// Reallocate additional space in a record account
@@ -60,6 +73,8 @@ pub enum RecordInstruction<'a> {
6073 ///
6174 /// 0. `[writable]` The record account to reallocate
6275 /// 1. `[signer]` The account's owner
76+ #[ codama( account( name = "record_account" , writable) ) ]
77+ #[ codama( account( name = "authority" , signer) ) ]
6378 Reallocate {
6479 /// The length of the data to hold in the record account excluding meta
6580 /// data
0 commit comments