import { BanksClient as BanksClientInner, EpochSchedule, FeeRateGovernor, GenesisConfig as GenesisConfigInner, PohConfig, ProgramTestContext as ProgramTestContextInner, TransactionReturnData as TransactionReturnDataInner, BanksTransactionMeta as BanksTransactionMetaInner, BanksTransactionResultWithMeta as BanksTransactionResultWithMetaInner, TransactionStatus, Rent, Clock } from "./internal"; export { EpochSchedule, TransactionStatus, Rent, Clock, PohConfig, FeeRateGovernor, } from "./internal"; import { AccountInfo, Keypair, PublicKey, Transaction, Blockhash, TransactionSignature, Message, Commitment, VersionedTransaction, InflationGovernor, Cluster } from "@solana/web3.js"; export type AccountInfoBytes = AccountInfo; export declare class TransactionReturnData { constructor(inner: TransactionReturnDataInner); private inner; get programId(): PublicKey; get data(): Uint8Array; } /** * Transaction metadata. */ export declare class BanksTransactionMeta { constructor(inner: BanksTransactionMetaInner); private inner; /** The log messages written during transaction execution. */ get logMessages(): Array; /** The transaction return data, if present. */ get returnData(): TransactionReturnData | null; /** The number of compute units consumed by the transaction. */ get computeUnitsConsumed(): bigint; } /** * A transaction result. Contains transaction metadata, and the transaction error, if there is one. */ export declare class BanksTransactionResultWithMeta { constructor(inner: BanksTransactionResultWithMetaInner); private inner; /** The transaction error info, if the transaction failed. */ get result(): string | null; /** The transaction metadata. */ get meta(): BanksTransactionMeta | null; } export type ClusterType = Cluster | "development"; export declare class GenesisConfig { constructor(inner: GenesisConfigInner); private inner; get creationTime(): number; get accounts(): Map; get nativeInstructionProcessors(): Array<[String, PublicKey]>; get rewardsPools(): Map; get ticksPerSlot(): bigint; get pohConfig(): PohConfig; get feeRateGovernor(): FeeRateGovernor; get rent(): Rent; get inflation(): InflationGovernor; get epochSchedule(): EpochSchedule; get clusterType(): ClusterType; } /** * A client for the ledger state, from the perspective of an arbitrary validator. * * The client is used to send transactions and query account data, among other things. * Use `start()` to initialize a BanksClient. */ export declare class BanksClient { constructor(inner: BanksClientInner); private inner; /** * Return the account at the given address at the slot corresponding to the given * commitment level. If the account is not found, None is returned. * @param address - The account address to look up. * @param commitment - The commitment to use. * @returns The account object, if the account exists. */ getAccount(address: PublicKey, commitment?: Commitment): Promise; /** * Send a transaction and return immediately. * @param tx - The transaction to send. */ sendTransaction(tx: Transaction | VersionedTransaction): Promise; /** * Process a transaction and return the result with metadata. * @param tx - The transaction to send. * @returns The transaction result and metadata. */ processTransaction(tx: Transaction | VersionedTransaction): Promise; /** * Try to process a transaction and return the result with metadata. * * If the transaction errors, a JS error is not raised. * Instead the returned object's `result` field will contain an error message. * * This makes it easier to process transactions that you expect to fail * and make assertions about things like log messages. * * @param tx - The transaction to send. * @returns The transaction result and metadata. */ tryProcessTransaction(tx: Transaction | VersionedTransaction): Promise; /** * Simulate a transaction at the given commitment level. * @param tx - The transaction to simulate. * @param commitment - The commitment to use. * @returns The transaction simulation result. */ simulateTransaction(tx: Transaction | VersionedTransaction, commitment?: Commitment): Promise; /** * Return the status of a transaction with a signature matching the transaction's first signature. * * Return None if the transaction is not found, which may be because the * blockhash was expired or the fee-paying account had insufficient funds to pay the * transaction fee. Note that servers rarely store the full transaction history. This * method may return None if the transaction status has been discarded. * * @param signature - The transaction signature (the first signature of the transaction). * @returns The transaction status, if found. */ getTransactionStatus(signature: TransactionSignature): Promise; /** * Same as `getTransactionStatus`, but for multiple transactions. * @param signatures - The transaction signatures. * @returns The transaction statuses, if found. */ getTransactionStatuses(signatures: TransactionSignature[]): Promise<(TransactionStatus | undefined | null)[]>; /** * Get the slot that has reached the given commitment level (or the default commitment). * @param commitment - The commitment to use. * @returns The current slot. */ getSlot(commitment?: Commitment): Promise; /** * Get the current block height. * @param commitment - The commitment to use. * @returns The current block height. */ getBlockHeight(commitment?: Commitment): Promise; /** * Get the cluster rent. * @returns The rent object. */ getRent(): Promise; /** * Get the cluster clock. * @returns the clock object. */ getClock(): Promise; /** * Return the balance in lamports of an account at the given address at the slot. * @param address - The account to look up. * @param commitment - The commitment to use. * @returns The account balance in lamports. */ getBalance(address: PublicKey, commitment?: Commitment): Promise; /** * Returns latest blockhash and last valid block height for given commitment level. * @param commitment - The commitment to use. * @returns The blockhash and last valid block height. */ getLatestBlockhash(commitment?: Commitment): Promise<[Blockhash, bigint] | null>; /** * Get the fee in lamports for a given message. * @param msg - The message to check. * @param commitment - The commitment to use. * @returns The fee for the given message. */ getFeeForMessage(msg: Message, commitment?: Commitment): Promise; } /** * The result of calling `start()`. * * Contains a BanksClient, a recent blockhash and a funded payer keypair. */ export declare class ProgramTestContext { constructor(inner: ProgramTestContextInner); private inner; /** The client for this test. */ get banksClient(): BanksClient; /** A funded keypair for sending transactions. */ get payer(): Keypair; /** The last blockhash registered when the client was initialized. */ get lastBlockhash(): string; /** The chain's genesis config. */ get genesisConfig(): GenesisConfig; /** * 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(address: PublicKey, account: AccountInfoBytes): void; /** * Overwrite the clock sysvar. * @param clock - The new clock object. */ setClock(clock: Clock): void; /** * Overwrite the rent sysvar. * @param rent - The new rent object. */ setRent(rent: Rent): void; /** * Force the working bank ahead to a new slot. * @param slot - The slot to warp to. */ warpToSlot(slot: bigint): void; /** * Force the working bank ahead to a new epoch. * @param epoch - The epoch to warp to. */ warpToEpoch(epoch: bigint): void; } export interface AddedProgram { name: string; programId: PublicKey; } export interface AddedAccount { address: PublicKey; info: AccountInfoBytes; } /** * Start a bankrun! * * This will spin up a BanksServer and a BanksClient, * deploy programs and add accounts as instructed. * * @param programs - An array of objects indicating which programs to deploy to the test environment. See the main bankrun docs for more explanation on how to add programs. * @param accounts - An array of objects indicating what data to write to the given addresses. * @param computeMaxUnits - Override the default compute unit limit for a transaction. * @param transactionAccountLockLimit - Override the default transaction account lock limit. * @param deactivateFeatures - A list of feature IDs (pubkeys) to deactivate. * @returns A container for stuff you'll need to send transactions and interact with the test environment. */ export declare function start(programs: AddedProgram[], accounts: AddedAccount[], computeMaxUnits?: bigint, transactionAccountLockLimit?: bigint, deactivateFeatures?: PublicKey[]): Promise; /** * Start a bankrun in an Anchor workspace, with all the workspace programs deployed. * * This will spin up a BanksServer and a BanksClient, * deploy programs and add accounts as instructed. * * @param path - Path to root of the Anchor project. * @param programs - An array of objects indicating extra programs to deploy to the test environment. See the main bankrun docs for more explanation on how to add programs. * @param accounts - An array of objects indicating what data to write to the given addresses. * @param computeMaxUnits - Override the default compute unit limit for a transaction. * @param transactionAccountLockLimit - Override the default transaction account lock limit. * @param deactivateFeatures - A list of feature IDs (pubkeys) to deactivate. * @returns A container for stuff you'll need to send transactions and interact with the test environment. */ export declare function startAnchor(path: string, extraPrograms: AddedProgram[], accounts: AddedAccount[], computeMaxUnits?: bigint, transactionAccountLockLimit?: bigint, deactivateFeatures?: PublicKey[]): Promise;