import { type AccountMeta, type Instruction } from '@solana/instructions'; import type { CompiledTransactionMessage } from '@solana/transaction-messages'; import type { LoadedAddresses } from './loaded-addresses'; /** * An outer transaction instruction with its account indices resolved to * full {@link AccountMeta}s and its data exposed as a `ReadonlyUint8Array`. * * Following the kit `Instruction` conventions, `accounts` and `data` are * present only when non-empty, so `isInstructionWithAccounts` and * `isInstructionWithData` from `@solana/instructions` behave as expected * and can be used to narrow before passing the instruction to the * auto-generated `parseXInstruction` helpers. * * @example * ```ts * for (const ix of getInstructionsFromCompiledTransactionMessage(compiled)) { * // `ix` is a `ResolvedInstruction` — usable with `isInstructionForProgram` * // directly, and with the auto-generated `identifyXInstruction` helpers * // after narrowing `data`. * if (isInstructionWithData(ix)) { * identifyTokenInstruction(ix); * } * } * ``` */ export type ResolvedInstruction = Instruction; /** * Builds the full ordered list of {@link AccountMeta}s for a compiled * transaction message. * * The order matches the runtime's resolution order: * * 1. Static accounts, with role bits derived from the message header * (writable signers, readonly signers, writable non-signers, readonly * non-signers). * 2. ALT-loaded writable accounts (always non-signer, writable). * 3. ALT-loaded readonly accounts (always non-signer, readonly). * * Inner-instruction account indices reference the same flat list, so this * helper is also useful for resolving inner instructions. */ export declare function getAccountMetasFromCompiledTransactionMessage(compiledMessage: CompiledTransactionMessage, loadedAddresses?: LoadedAddresses | null): AccountMeta[]; /** * Returns the outer instructions of a compiled transaction message as kit * {@link Instruction} objects. * * Each returned instruction has its account indices resolved to * {@link AccountMeta}s (with the proper signer/writable bits) and its data * exposed as a `ReadonlyUint8Array` — the form the auto-generated * `@solana-program/*` `parseXInstruction` functions expect. `accounts` and * `data` are omitted when empty. * * Supports `legacy`, `v0`, and `v1` compiled messages. Throws * {@link SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED} for any * other version, * {@link SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND} * if a `programAddressIndex` falls outside the resolved account list, and * {@link SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_ACCOUNT_INDEX_OUT_OF_RANGE} * if an account index does. * * @example * ```ts * const instructions = getInstructionsFromCompiledTransactionMessage( * compiled, * rpcResponse.meta?.loadedAddresses, * ); * for (const ix of instructions) { * if (ix.programAddress === TOKEN_PROGRAM_ADDRESS && isInstructionWithData(ix)) { * const kind = identifyTokenInstruction(ix); * // ... * } * } * ``` */ export declare function getInstructionsFromCompiledTransactionMessage(compiledMessage: CompiledTransactionMessage, loadedAddresses?: LoadedAddresses | null): ResolvedInstruction[]; /** * Internal variant of {@link getInstructionsFromCompiledTransactionMessage} * that takes pre-built {@link AccountMeta}s. Used by {@link walkInstructions} * to avoid rebuilding the meta list when it is already needed for resolving * inner instructions. * * @internal */ export declare function getInstructionsFromCompiledTransactionMessageWithMetas(compiledMessage: CompiledTransactionMessage, accountMetas: readonly AccountMeta[]): ResolvedInstruction[]; //# sourceMappingURL=get-instructions.d.ts.map