1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Program deployment utilities for Solana programs.
use crateSolanaKiteError;
use LiteSVM;
use Pubkey;
use fs;
/// Deploys a program to the LiteSVM test environment from a file path.
///
/// Reads a compiled program binary (.so file) from disk and deploys it.
/// For deploying from in-memory bytes (e.g. from `include_bytes!`), use
/// [`deploy_program_bytes`] instead.
///
/// # Arguments
///
/// * `litesvm` - Mutable reference to the LiteSVM instance
/// * `program_id` - The public key where the program should be deployed
/// * `program_path` - Path to the compiled program binary (.so file)
///
/// # Errors
///
/// Returns an error if the file cannot be read or the deployment fails.
///
/// # Example
///
/// ```rust,no_run
/// use solana_kite::deploy_program;
/// use litesvm::LiteSVM;
/// use solana_pubkey::Pubkey;
///
/// let mut litesvm = LiteSVM::new();
/// let program_id = Pubkey::new_unique();
/// deploy_program(&mut litesvm, &program_id, "./target/deploy/my_program.so").unwrap();
/// ```
/// Deploys a program to the LiteSVM test environment from raw bytes.
///
/// This is useful when you have the program binary embedded via `include_bytes!`
/// or loaded from a non-filesystem source.
///
/// # Arguments
///
/// * `litesvm` - Mutable reference to the LiteSVM instance
/// * `program_id` - The public key where the program should be deployed
/// * `program_bytes` - The compiled program binary as a byte slice
///
/// # Errors
///
/// Returns an error if the deployment fails.
///
/// # Example
///
/// ```rust,no_run
/// use solana_kite::deploy_program_bytes;
/// use litesvm::LiteSVM;
/// use solana_pubkey::Pubkey;
///
/// let mut litesvm = LiteSVM::new();
/// let program_id = Pubkey::new_unique();
/// # let program_bytes: &[u8] = &[];
/// deploy_program_bytes(&mut litesvm, &program_id, program_bytes).unwrap();
/// ```