Remove Instruction wrapper structs and name functions after enum fields

This commit is contained in:
Greg Fitzgerald
2019-04-03 09:45:57 -06:00
committed by Grimes
parent 867f6f107b
commit 35298e01a8
53 changed files with 835 additions and 922 deletions

View File

@@ -20,23 +20,16 @@ pub enum LoaderInstruction {
Finalize,
}
impl LoaderInstruction {
pub fn new_write(
account_id: &Pubkey,
program_id: &Pubkey,
offset: u32,
bytes: Vec<u8>,
) -> Instruction {
let account_metas = vec![AccountMeta::new(*account_id, true)];
Instruction::new(
*program_id,
&LoaderInstruction::Write { offset, bytes },
account_metas,
)
}
pub fn new_finalize(account_id: &Pubkey, program_id: &Pubkey) -> Instruction {
let account_metas = vec![AccountMeta::new(*account_id, true)];
Instruction::new(*program_id, &LoaderInstruction::Finalize, account_metas)
}
pub fn write(account_id: &Pubkey, program_id: &Pubkey, offset: u32, bytes: Vec<u8>) -> Instruction {
let account_metas = vec![AccountMeta::new(*account_id, true)];
Instruction::new(
*program_id,
&LoaderInstruction::Write { offset, bytes },
account_metas,
)
}
pub fn finalize(account_id: &Pubkey, program_id: &Pubkey) -> Instruction {
let account_metas = vec![AccountMeta::new(*account_id, true)];
Instruction::new(*program_id, &LoaderInstruction::Finalize, account_metas)
}