import { type Address, type Instruction } from '@solana/kit'; /** * Maximum size, in bytes, of a serialized Solana transaction (the packet MTU limit). * @group @nosana/kit */ export declare const TRANSACTION_SIZE_LIMIT = 1232; /** * Maximum compute units a single Solana transaction may consume. * @group @nosana/kit */ export declare const MAX_COMPUTE_UNITS = 1400000; /** * Options for {@link packInstructions}. * @group @nosana/kit */ export interface PackInstructionsOptions { /** * The fee payer address for the resulting transactions. Provided so that size * measurement accounts for account deduplication accurately (the fee payer is * shared across every instruction). Defaults to a placeholder address, which is * slightly conservative. */ feePayer?: Address; /** * Instructions that will be prepended to every transaction at send time (for * example compute-budget or priority-fee instructions). They are charged against * the size budget of each bucket but are NOT included in the returned buckets — * the transaction builder adds the real ones when sending. */ reservedInstructions?: Instruction[]; /** * Maximum serialized transaction size in bytes. Defaults to * {@link TRANSACTION_SIZE_LIMIT} (1232). */ maxTransactionSize?: number; /** * Optional per-instruction compute-unit estimator. When provided, a bucket is * also split whenever its cumulative estimated compute units would exceed * {@link PackInstructionsOptions.maxComputeUnits}. When omitted, compute units * are not considered and only transaction size bounds the packing. */ computeUnits?: (instruction: Instruction) => number; /** * Maximum compute units per transaction. Only enforced when * {@link PackInstructionsOptions.computeUnits} is provided. Defaults to * {@link MAX_COMPUTE_UNITS} (1,400,000). */ maxComputeUnits?: number; } /** * Greedily pack instruction groups into the fewest transactions that each stay * within Solana's transaction size limit. * * Each entry of `groups` is an *atomic group*: a single instruction, or an array * of instructions that must land together in the same transaction (e.g. a * create-account + initialize pair). A group is never split across transactions; * groups are filled into a bucket in order until the next group would overflow the * size limit, at which point a new bucket is started. * * A bucket is bounded by two constraints, and is split whenever the next group * would exceed either one: * - Transaction size: determined by compiling each candidate transaction * in-memory and measuring its serialized length, so shared accounts (program * ids, fee payer, sysvars) are correctly deduplicated — no static estimate and * no RPC call. * - Compute units (optional): when a `computeUnits` estimator is provided, the * cumulative estimated compute units of a bucket may not exceed * `maxComputeUnits`. * * @param groups Atomic instruction groups to pack, in order. * @param options Packing options (fee payer, reserved instructions, limits). * @returns An array of buckets; each bucket is a flat array of instructions for * one transaction. * @throws {NosanaError} If a single group cannot fit in one transaction (by size * or compute units), since it cannot be split. * @group @nosana/kit */ export declare function packInstructions(groups: Array, options?: PackInstructionsOptions): Instruction[][]; //# sourceMappingURL=packInstructions.d.ts.map