@exodus/solana-web3.js
Version:
Solana Javascript API
68 lines (67 loc) • 2.54 kB
TypeScript
/// <reference types="node" />
import { Buffer } from 'buffer';
import { PublicKey } from '../publickey.js';
import type { Blockhash } from '../blockhash.js';
import { MessageHeader, MessageAddressTableLookup, MessageCompiledInstruction } from './index.js';
import { TransactionInstruction } from '../transaction/index.js';
import { MessageAccountKeys } from './account-keys.js';
/**
* An instruction to execute by a program
*
* @property {number} programIdIndex
* @property {number[]} accounts
* @property {string} data
*/
export declare type CompiledInstruction = {
/** Index into the transaction keys array indicating the program account that executes this instruction */
programIdIndex: number;
/** Ordered indices into the transaction keys array indicating which accounts to pass to the program */
accounts: number[];
/** The program input data encoded as base 58 */
data: string;
};
/**
* Message constructor arguments
*/
export declare type MessageArgs = {
/** The message header, identifying signed and read-only `accountKeys` */
header: MessageHeader;
/** All the account keys used by this transaction */
accountKeys: string[] | PublicKey[];
/** The hash of a recent ledger block */
recentBlockhash: Blockhash;
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
instructions: CompiledInstruction[];
};
export declare type CompileLegacyArgs = {
payerKey: PublicKey;
instructions: Array<TransactionInstruction>;
recentBlockhash: Blockhash;
};
/**
* List of instructions to be processed atomically
*/
export declare class Message {
header: MessageHeader;
accountKeys: PublicKey[];
recentBlockhash: Blockhash;
instructions: CompiledInstruction[];
private indexToProgramIds;
constructor(args: MessageArgs);
get version(): 'legacy';
get staticAccountKeys(): Array<PublicKey>;
get compiledInstructions(): Array<MessageCompiledInstruction>;
get addressTableLookups(): Array<MessageAddressTableLookup>;
getAccountKeys(): MessageAccountKeys;
static compile(args: CompileLegacyArgs): Message;
isAccountSigner(index: number): boolean;
isAccountWritable(index: number): boolean;
isProgramId(index: number): boolean;
programIds(): PublicKey[];
nonProgramIds(): PublicKey[];
serialize(): Buffer;
/**
* Decode a compiled message into a Message object.
*/
static from(buffer: Buffer | Uint8Array | Array<number>): Message;
}