solana_loader_v2_interface/
lib.rs#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[cfg(feature = "bincode")]
use {
solana_instruction::{AccountMeta, Instruction},
solana_pubkey::Pubkey,
solana_sdk_ids::sysvar::rent,
};
#[cfg_attr(
feature = "serde",
derive(serde_derive::Deserialize, serde_derive::Serialize)
)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum LoaderInstruction {
Write {
offset: u32,
#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]
bytes: Vec<u8>,
},
Finalize,
}
#[deprecated(since = "2.2.0", note = "Use loader-v4 instead")]
#[cfg(feature = "bincode")]
pub fn write(
account_pubkey: &Pubkey,
program_id: &Pubkey,
offset: u32,
bytes: Vec<u8>,
) -> Instruction {
let account_metas = vec![AccountMeta::new(*account_pubkey, true)];
Instruction::new_with_bincode(
*program_id,
&LoaderInstruction::Write { offset, bytes },
account_metas,
)
}
#[deprecated(since = "2.2.0", note = "Use loader-v4 instead")]
#[cfg(feature = "bincode")]
pub fn finalize(account_pubkey: &Pubkey, program_id: &Pubkey) -> Instruction {
let account_metas = vec![
AccountMeta::new(*account_pubkey, true),
AccountMeta::new_readonly(rent::id(), false),
];
Instruction::new_with_bincode(*program_id, &LoaderInstruction::Finalize, account_metas)
}