solana_loader_v2_interface/
lib.rs1#![cfg_attr(docsrs, feature(doc_auto_cfg))]
3
4#[cfg(feature = "bincode")]
5use {
6 solana_instruction::{AccountMeta, Instruction},
7 solana_pubkey::Pubkey,
8 solana_sdk_ids::sysvar::rent,
9};
10
11#[cfg_attr(
12 feature = "serde",
13 derive(serde_derive::Deserialize, serde_derive::Serialize)
14)]
15#[derive(Debug, PartialEq, Eq, Clone)]
16pub enum LoaderInstruction {
17 Write {
22 offset: u32,
24
25 #[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]
27 bytes: Vec<u8>,
28 },
29
30 Finalize,
39}
40
41#[deprecated(since = "2.2.0", note = "Use loader-v4 instead")]
42#[cfg(feature = "bincode")]
43pub fn write(
44 account_pubkey: &Pubkey,
45 program_id: &Pubkey,
46 offset: u32,
47 bytes: Vec<u8>,
48) -> Instruction {
49 let account_metas = vec![AccountMeta::new(*account_pubkey, true)];
50 Instruction::new_with_bincode(
51 *program_id,
52 &LoaderInstruction::Write { offset, bytes },
53 account_metas,
54 )
55}
56
57#[deprecated(since = "2.2.0", note = "Use loader-v4 instead")]
58#[cfg(feature = "bincode")]
59pub fn finalize(account_pubkey: &Pubkey, program_id: &Pubkey) -> Instruction {
60 let account_metas = vec![
61 AccountMeta::new(*account_pubkey, true),
62 AccountMeta::new_readonly(rent::id(), false),
63 ];
64 Instruction::new_with_bincode(*program_id, &LoaderInstruction::Finalize, account_metas)
65}