Skip to main content

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

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();