import { Address, TransactionMessage, Blockhash, EncodedAccount, ExcludeTransactionMessageLifetime, Lamports, MaybeEncodedAccount, Signature, Transaction, TransactionMessageWithBlockhashLifetime, TransactionMessageWithLifetime } from "@solana/kit"; import { Clock, ComputeBudget, EpochRewards, EpochSchedule, FailedTransactionMetadata, FeatureSet, Rent, SimulatedTransactionInfo as SimulatedTransactionInfoInner, SlotHash, SlotHistory, StakeHistory, TransactionMetadata } from "./internal"; export { Account, Clock, ComputeBudget, EpochRewards, EpochSchedule, FailedTransactionMetadata, FeatureSet, InnerInstruction, Rent, SlotHash, SlotHistory, SlotHistoryCheck, StakeHistory, StakeHistoryEntry, TransactionMetadata, TransactionReturnData, } from "./internal"; export declare class SimulatedTransactionInfo { constructor(inner: SimulatedTransactionInfoInner); private inner; meta(): TransactionMetadata; postAccounts(): EncodedAccount[]; } /** * The main class in the litesvm library. * * Use this to send transactions, query accounts and configure the runtime. */ export declare class LiteSVM { /** Create a new LiteSVM instance with standard functionality enabled */ constructor(); private inner; /** Create a new LiteSVM instance with minimal functionality enabled */ static default(): LiteSVM; /** * Set the compute budget * @param budget - The new compute budget * @returns The modified LiteSVM instance */ withComputeBudget(budget: ComputeBudget): LiteSVM; /** * Enable or disable sigverify * @param sigverify - if false, transaction signatures will not be checked. * @returns The modified LiteSVM instance */ withSigverify(sigverify: boolean): LiteSVM; /** * Enables or disables transaction blockhash checking. * @param check - If false, the blockhash check will be skipped * @returns The modified LiteSVM instance */ withBlockhashCheck(check: boolean): LiteSVM; /** * Sets up the standard sysvars. * @returns The modified LiteSVM instance */ withSysvars(): LiteSVM; /** * Set the FeatureSet used by the VM instance. * @param featureSet The FeatureSet to use. * @returns The modified LiteSVM instance */ withFeatureSet(featureSet: FeatureSet): LiteSVM; /** * Adds the standard builtin programs. Use `withFeatureSet` beforehand to change change what builtins are added. * @returns The modified LiteSVM instance */ withBuiltins(): LiteSVM; /** * Changes the initial lamports in LiteSVM's airdrop account. * @param lamports - The number of lamports to set in the airdrop account * @returns The modified LiteSVM instance */ withLamports(lamports: bigint): LiteSVM; /** * Adds the standard SPL programs. * @returns The modified LiteSVM instance */ withDefaultPrograms(): LiteSVM; /** * Adds the native mint accounts for SPL Token and Token-2022, if the programs are loaded. * @returns The modified LiteSVM instance */ withNativeMints(): LiteSVM; /** * Changes the capacity of the transaction history. * @param capacity - How many transactions to store in history. * Set this to 0 to disable transaction history and allow duplicate transactions. * @returns The modified LiteSVM instance */ withTransactionHistory(capacity: bigint): LiteSVM; /** * Set a limit for transaction logs, beyond which they will be truncated. * @param limit - The limit in bytes. If null, no limit is enforced. * @returns The modified LiteSVM instance */ withLogBytesLimit(limit?: bigint): LiteSVM; /** * Adds the standard precompiles. Use `withFeatureSet` beforehand to change change what builtins are added. * @returns The modified LiteSVM instance */ withPrecompiles(): LiteSVM; /** * Calculates the minimum balance required to make an account with specified data length rent exempt. * @param dataLen - The number of bytes in the account. * @returns The required balance in lamports */ minimumBalanceForRentExemption(dataLen: bigint): bigint; /** * Return the account at the given address. * If the account is not found, None is returned. * @param address - The account address to look up. * @returns The account object, if the account exists. */ getAccount(address: Address): MaybeEncodedAccount; /** * Create or overwrite an account, subverting normal runtime checks. * * This method exists to make it easier to set up artificial situations * that would be difficult to replicate by sending individual transactions. * Beware that it can be used to create states that would not be reachable * by sending transactions! * * @param address - The address to write to. * @param account - The account object to write. */ setAccount(account: EncodedAccount): void; /** * Gets the balance of the provided account address. * @param address - The account address. * @returns The account's balance in lamports. */ getBalance(address: Address): Lamports | null; /** * Gets the latest blockhash. * Since LiteSVM doesn't have blocks, this is an arbitrary value controlled by LiteSVM * @returns The designated latest blockhash. */ latestBlockhash(): Blockhash; /** * Sets the lifetime on a transaction message using * the latest blockhash from the LiteSVM instance. */ setTransactionMessageLifetimeUsingLatestBlockhash>(transactionMessage: TTransactionMessage): ExcludeTransactionMessageLifetime & TransactionMessageWithBlockhashLifetime; /** * Gets a transaction from the transaction history. * @param signature - The transaction signature bytes * @returns The transaction, if it is found in the history. */ getTransaction(signature: Signature): TransactionMetadata | FailedTransactionMetadata | null; /** * Airdrops the lamport amount specified to the given address. * @param address The airdrop recipient. * @param lamports - The amount to airdrop. * @returns The transaction result. */ airdrop(address: Address, lamports: Lamports): TransactionMetadata | FailedTransactionMetadata | null; /** * Adds an SBF program to the test environment from the file specified. * @param programId - The program ID. * @param path - The path to the .so file. */ addProgramFromFile(programId: Address, path: string): void; /** * Adds am SBF program to the test environment. * @param programId - The program ID. * @param programBytes - The raw bytes of the compiled program. */ addProgram(programId: Address, programBytes: Uint8Array): void; /** * Adds an SBF program with a specific loader. * @param programId - The program ID. * @param programBytes - The raw bytes of the compiled program. * @param loaderId - The loader program ID. */ addProgramWithLoader(programId: Address, programBytes: Uint8Array, loaderId: Address): void; /** * Processes a transaction and returns the result. * @param tx - The transaction to send. * @returns TransactionMetadata if the transaction succeeds, else FailedTransactionMetadata */ sendTransaction(tx: Transaction): TransactionMetadata | FailedTransactionMetadata; /** * Simulates a transaction * @param tx The transaction to simulate * @returns SimulatedTransactionInfo if simulation succeeds, else FailedTransactionMetadata */ simulateTransaction(tx: Transaction): FailedTransactionMetadata | SimulatedTransactionInfo; /** * Expires the current blockhash. * The return value of `latestBlockhash()` will be different after calling this. */ expireBlockhash(): void; /** * Warps the clock to the specified slot. This is a convenience wrapper * around `setClock()`. * @param slot - The new slot. */ warpToSlot(slot: bigint): void; /** * Get the cluster clock. * @returns the clock object. */ getClock(): Clock; /** * Overwrite the clock sysvar. * @param clock - The clock object. */ setClock(clock: Clock): void; /** * Get the EpochRewards sysvar. * @returns the EpochRewards object. */ getEpochRewards(): EpochRewards; /** * Overwrite the EpochRewards sysvar. * @param rewards - The EpochRewards object. */ setEpochRewards(rewards: EpochRewards): void; /** * Get the EpochSchedule sysvar. * @returns the EpochSchedule object. */ getEpochSchedule(): EpochSchedule; /** * Overwrite the EpochSchedule sysvar. * @param schedule - The EpochSchedule object. */ setEpochSchedule(schedule: EpochSchedule): void; /** * Get the last restart slot sysvar. * @returns the last restart slot. */ getLastRestartSlot(): bigint; /** * Overwrite the last restart slot sysvar. * @param slot - The last restart slot. */ setLastRestartSlot(slot: bigint): void; /** * Get the cluster rent. * @returns The rent object. */ getRent(): Rent; /** * Overwrite the rent sysvar. * @param rent - The new rent object. */ setRent(rent: Rent): void; /** * Get the SlotHashes sysvar. * @returns The SlotHash array. */ getSlotHashes(): SlotHash[]; /** * Overwrite the SlotHashes sysvar. * @param hashes - The SlotHash array. */ setSlotHashes(hashes: SlotHash[]): void; /** * Get the SlotHistory sysvar. * @returns The SlotHistory object. */ getSlotHistory(): SlotHistory; /** * Overwrite the SlotHistory sysvar. * @param history - The SlotHistory object */ setSlotHistory(history: SlotHistory): void; /** * Get the StakeHistory sysvar. * @returns The StakeHistory object. */ getStakeHistory(): StakeHistory; /** * Overwrite the StakeHistory sysvar. * @param history - The StakeHistory object */ setStakeHistory(history: StakeHistory): void; }