deploy_program

Function deploy_program 

Source
pub fn deploy_program(
    litesvm: &mut LiteSVM,
    program_id: &Pubkey,
    program_path: &str,
) -> Result<(), SolanaKiteError>
Expand description

Deploys a program to the LiteSVM test environment.

This function reads a program binary from the filesystem and deploys it to the specified program ID in the LiteSVM instance. The program will be marked as executable and owned by the BPF loader.

§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)

§Returns

Returns Ok(()) on successful deployment, or a SolanaKiteError on failure.

§Errors

This function will return an error if:

  • The program binary file cannot be read
  • The program deployment to LiteSVM fails

§Example

use solana_kite::deploy_program;
use litesvm::LiteSVM;
use solana_pubkey::Pubkey;

let mut litesvm = LiteSVM::new();
let program_id = Pubkey::new_unique();
 
// Deploy a program (this would fail in tests without an actual .so file)
// deploy_program(&mut litesvm, &program_id, "./target/deploy/my_program.so")?;