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
//! Transaction utilities for sending Solana transactions.
use crateSolanaKiteError;
use LiteSVM;
use Instruction;
use Keypair;
use Message;
use Pubkey;
use Transaction;
/// Sends a transaction built from a vector of instructions.
///
/// This function creates a transaction from the provided instructions, signs it with
/// the given signers, and sends it through the LiteSVM instance.
///
/// # Arguments
///
/// * `litesvm` - Mutable reference to the LiteSVM instance
/// * `instructions` - Vector of instructions to include in the transaction
/// * `signers` - Array of keypairs that will sign the transaction
/// * `fee_payer` - Public key of the account that will pay transaction fees
///
/// # Returns
///
/// Returns `Ok(())` on successful transaction, or a [`SolanaKiteError`] on failure.
///
/// # Errors
///
/// This function will return an error if the transaction fails to send or execute.
///
/// # Example
///
/// ```rust
/// use solana_kite::{send_transaction_from_instructions, create_wallet};
/// use litesvm::LiteSVM;
/// use solana_signer::Signer;
///
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let mut litesvm = LiteSVM::new();
/// let payer = create_wallet(&mut litesvm, 1_000_000_000)?;
/// let instructions = vec![]; // Your instructions here
///
/// send_transaction_from_instructions(
/// &mut litesvm,
/// instructions,
/// &[&payer],
/// &payer.pubkey(),
/// )?;
/// # Ok(())
/// # }
/// ```