@solana/web3.js
Version:
Solana Javascript API
5,075 lines • 197 kB
TypeScript
import { Address, Base64EncodedZStdCompressedDataResponse, Blockhash, Blockhash as Blockhash$1, ClientWithGetMinimumBalance, ClientWithRpc, ClientWithRpcSubscriptions, Commitment, Commitment as Commitment$1, GetAgGenesisCertApi, GetBalanceApi, GetBlockCommitmentApi, GetBlockProductionApi, GetBlockTimeApi, GetBlocksApi, GetBlocksWithLimitApi, GetClusterNodesApi, GetEpochInfoApi, GetFeeForMessageApi, GetFirstAvailableBlockApi, GetGenesisHashApi, GetHealthApi, GetHighestSnapshotSlotApi, GetInflationRateApi, GetInflationRewardApi, GetLargestAccountsApi, GetMaxRetransmitSlotApi, GetMaxShredInsertSlotApi, GetMinimumBalanceConfig, GetMinimumBalanceForRentExemptionApi, GetRecentPerformanceSamplesApi, GetRecentPrioritizationFeesApi, GetSignaturesForAddressApi, GetSlotApi, GetStakeMinimumDelegationApi, GetSupplyApi, GetTokenAccountBalanceApi, GetTokenLargestAccountsApi, GetTokenSupplyApi, GetTransactionsForAddressApi, GetVersionApi, GetVoteAccountsApi, HasAddress, Instruction, InstructionPlan, IsBlockhashValidApi, KeyPairSigner, Lamports, MessagePartialSigner, MinimumLedgerSlotApi, ReadonlyUint8Array, Reward, Rpc, RpcSubscriptions, SendTransactionApi, SolanaRpcApi, SolanaRpcSubscriptionsApi, TransactionError as TransactionError$1, TransactionForAccounts, TransactionForFullBase58, TransactionForFullBase64, TransactionForFullJson, TransactionForFullJsonParsed, TransactionPartialSigner, TransactionVersion, V1TransactionConfig } from "@solana/kit";
/**
* Maximum length of derived pubkey seed
*/
export declare const MAX_SEED_LENGTH = 32;
/**
* Size of public key in bytes
*/
export declare const PUBLIC_KEY_LENGTH = 32;
/**
* Value to be converted into public key
*/
export type PublicKeyInitData = number | bigint | string | Uint8Array | ReadonlyUint8Array | Array<number> | PublicKey | Address;
/**
* A Solana address
*/
export declare class PublicKey implements HasAddress {
private readonly _publicKeyBytes;
/**
* Create a new PublicKey object
* @param value ed25519 public key as bytes or base-58 encoded string
*/
constructor(value: PublicKeyInitData);
/**
* Default public key value. The base58-encoded string representation is all ones (as seen below)
* The underlying number is 32 bytes that are all zeros
*/
static default: PublicKey;
/**
* Checks if two publicKeys are equal
*/
equals(address: PublicKey): boolean;
/**
* The base-58 representation of the public key as a Kit `Address` branded
* string. Satisfies Kit's
* [`HasAddress`](https://www.solanakit.com/api/type-aliases/HasAddress)
* interface so a `PublicKey` can be passed anywhere Kit accepts an
* address-bearing object.
*/
get address(): Address;
/**
* Return the base-58 representation of the public key as a Kit `Address`
* branded string, suitable for passing to `@solana/kit` APIs or generated
* program clients that expect an `Address`.
*/
toBase58(): Address;
toJSON(): string;
/**
* Return the byte array representation of the public key in big endian
*/
toBytes(): Uint8Array;
/**
* Verify a signature for the provided message with this public key.
* @since 2.0.0
*/
verifySignature(signature: ReadonlyUint8Array, message: ReadonlyUint8Array): Promise<boolean>;
/**
* Borsh-compatible encoding (little-endian)
*/
encode(): Uint8Array;
/**
* Borsh-compatible decoding (little-endian)
*/
static decode(data: Uint8Array | Array<number>): PublicKey;
/**
* Borsh-compatible unchecked decoding (little-endian)
*/
static decodeUnchecked(data: Uint8Array | Array<number>): PublicKey;
get [Symbol.toStringTag](): string;
/**
* Return the base-58 representation of the public key
*/
toString(): string;
/**
* Derive a public key from another key, a seed, and a program ID.
* The program ID will also serve as the owner of the public key, giving
* it permission to write data to the account.
*
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED` from
* `@solana/errors` if the seed exceeds 32 bytes.
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER` from
* `@solana/errors` if the program address ends with the PDA marker bytes.
*/
static createWithSeed(fromPublicKey: PublicKey, seed: string, programId: PublicKey): Promise<PublicKey>;
/**
* Derive a program address from seeds and a program ID.
*
* @throws `SolanaError` with
* `SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED` from
* `@solana/errors` if `crypto.subtle.digest()` is unavailable.
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED` from
* `@solana/errors` if the supplied seeds exceed the PDA count limit.
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED` from
* `@solana/errors` if any supplied seed exceeds the PDA seed-length limit.
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE` from
* `@solana/errors` if the derived address falls on the Ed25519 curve.
*/
static createProgramAddress(seeds: Array<Uint8Array | ReadonlyUint8Array>, programId: PublicKey): Promise<PublicKey>;
/**
* Find a valid program address
*
* Valid program addresses must fall off the ed25519 curve. This function
* iterates a nonce until it finds one that when combined with the seeds
* results in a valid program address.
*
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED` from
* `@solana/errors` if the supplied seeds exceed the PDA count limit.
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED` from
* `@solana/errors` if any supplied seed exceeds the PDA seed-length limit.
* @throws `SolanaError` with
* `SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED` from
* `@solana/errors` if no viable bump seed exists.
*/
static findProgramAddress(seeds: Array<Uint8Array | ReadonlyUint8Array>, programId: PublicKey): Promise<[PublicKey, number]>;
/**
* Check that a pubkey is on the ed25519 curve.
*/
static isOnCurve(addressData: PublicKeyInitData): boolean;
}
export declare const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
/**
* Epoch schedule
* (see https://docs.solana.com/terminology#epoch)
* Can be retrieved with the {@link Connection.getEpochSchedule} method
*/
export declare class EpochSchedule {
/** The maximum number of slots in each epoch */
slotsPerEpoch: bigint;
/** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */
leaderScheduleSlotOffset: bigint;
/** Indicates whether epochs start short and grow */
warmup: boolean;
/** The first epoch with `slotsPerEpoch` slots */
firstNormalEpoch: bigint;
/** The first slot of `firstNormalEpoch` */
firstNormalSlot: bigint;
constructor(slotsPerEpoch: bigint, leaderScheduleSlotOffset: bigint, warmup: boolean, firstNormalEpoch: bigint, firstNormalSlot: bigint);
getEpoch(slot: bigint): bigint;
getEpochAndSlotIndex(slot: bigint): [bigint, bigint];
getFirstSlotInEpoch(epoch: bigint): bigint;
getLastSlotInEpoch(epoch: bigint): bigint;
getSlotsInEpoch(epoch: bigint): bigint;
}
type AccountSubscriptionConfig = Readonly<{
commitment?: Commitment$1;
encoding?: 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
}>;
type AccountSubscriptionBinaryConfig = Readonly<{
commitment?: Commitment$1;
encoding?: 'base58' | 'base64';
}>;
type AccountSubscriptionBase64ZstdConfig = Readonly<{
commitment?: Commitment$1;
encoding: 'base64+zstd';
}>;
type AccountSubscriptionParsedConfig = Readonly<{
commitment?: Commitment$1;
encoding: 'jsonParsed';
}>;
type ProgramAccountSubscriptionConfig = Readonly<{
commitment?: Commitment$1;
encoding?: 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
filters?: ReadonlyArray<GetProgramAccountsFilter>;
}>;
type ProgramAccountSubscriptionBinaryConfig = Readonly<{
commitment?: Commitment$1;
encoding?: 'base58' | 'base64';
filters?: ProgramAccountSubscriptionConfig['filters'];
}>;
type ProgramAccountSubscriptionBase64ZstdConfig = Readonly<{
commitment?: Commitment$1;
encoding: 'base64+zstd';
filters?: ProgramAccountSubscriptionConfig['filters'];
}>;
type ProgramAccountSubscriptionParsedConfig = Readonly<{
commitment?: Commitment$1;
encoding: 'jsonParsed';
filters?: ProgramAccountSubscriptionConfig['filters'];
}>;
type AccountChangeCallback = (accountInfo: AccountInfoWithSpace<Uint8Array>, context: Context) => void;
type ParsedAccountChangeCallback = (accountInfo: AccountInfoWithSpace<Uint8Array | ParsedAccountData>, context: Context) => void;
type Base64ZstdAccountChangeCallback = (accountInfo: AccountInfoWithSpace<Base64EncodedZStdCompressedDataResponse>, context: Context) => void;
type ProgramAccountChangeCallback = (keyedAccountInfo: KeyedAccountInfo, context: Context) => void;
type ParsedProgramAccountChangeCallback = (keyedAccountInfo: KeyedAccountInfo<Uint8Array | ParsedAccountData>, context: Context) => void;
type Base64ZstdProgramAccountChangeCallback = (keyedAccountInfo: KeyedAccountInfo<Base64EncodedZStdCompressedDataResponse>, context: Context) => void;
type SlotChangeCallback = (slotInfo: SlotInfo) => void;
type SlotUpdateCallback = (slotUpdate: SlotUpdate) => void;
type SignatureResultCallback = (signatureResult: SignatureResult, context: Context) => void;
type SignatureSubscriptionCallback = (notification: SignatureStatusNotification | SignatureReceivedNotification, context: Context) => void;
type SignatureSubscriptionStatusOptions = {
commitment?: Commitment$1;
enableReceivedNotification?: false;
};
type SignatureSubscriptionReceivedOptions = {
commitment?: Commitment$1;
enableReceivedNotification: true;
};
type SignatureSubscriptionOptions = SignatureSubscriptionStatusOptions | SignatureSubscriptionReceivedOptions;
type RootChangeCallback = (root: bigint) => void;
type VoteCallback = (vote: Vote) => void;
type LogsFilter = PublicKey | 'all' | 'allWithVotes';
type LogsCallback = (logs: Logs, ctx: Context) => void;
type BlockSubscriptionFilter = PublicKey | 'all';
type BlockSubscriptionEncoding = 'base58' | 'base64' | 'json' | 'jsonParsed';
type BlockSubscriptionTransactionDetails = NonNullable<GetVersionedBlockConfig['transactionDetails']>;
type BlockSubscriptionConfig = Readonly<{
commitment?: Finality;
encoding?: BlockSubscriptionEncoding;
maxSupportedTransactionVersion?: GetVersionedBlockConfig['maxSupportedTransactionVersion'];
rewards?: boolean;
transactionDetails?: BlockSubscriptionTransactionDetails;
}>;
type BlockSubscriptionAccountsConfig = BlockSubscriptionConfig & Readonly<{
transactionDetails: 'accounts';
}>;
type BlockSubscriptionNoneConfig = BlockSubscriptionConfig & Readonly<{
transactionDetails: 'none';
}>;
type BlockSubscriptionSignaturesConfig = BlockSubscriptionConfig & Readonly<{
transactionDetails: 'signatures';
}>;
type BlockSubscriptionBase58Config = BlockSubscriptionConfig & Readonly<{
encoding: 'base58';
transactionDetails?: 'full';
}>;
type BlockSubscriptionBase64Config = BlockSubscriptionConfig & Readonly<{
encoding: 'base64';
transactionDetails?: 'full';
}>;
type BlockSubscriptionJsonParsedConfig = BlockSubscriptionConfig & Readonly<{
encoding: 'jsonParsed';
transactionDetails?: 'full';
}>;
type BlockSubscriptionJsonConfig = BlockSubscriptionConfig & Readonly<{
encoding?: 'json';
transactionDetails?: 'full';
}>;
type BlockNotificationBlock = BlockSubscriptionAccountsModeBlockResponse | BlockSubscriptionBase58BlockResponse | BlockSubscriptionBase64BlockResponse | BlockSubscriptionJsonBlockResponse | BlockSubscriptionJsonParsedBlockResponse | VersionedNoneModeBlockResponse | VersionedSignaturesModeBlockResponse;
type BlockNotificationResult = {
block: BlockNotificationBlock | null;
err: string | null;
slot: bigint;
};
type BlockSubscriptionAccountsResult = BlockNotificationResult & {
block: BlockSubscriptionAccountsModeBlockResponse | null;
};
type BlockSubscriptionNoneResult = BlockNotificationResult & {
block: VersionedNoneModeBlockResponse | null;
};
type BlockSubscriptionSignaturesResult = BlockNotificationResult & {
block: VersionedSignaturesModeBlockResponse | null;
};
type BlockSubscriptionBase58Result = BlockNotificationResult & {
block: BlockSubscriptionBase58BlockResponse | null;
};
type BlockSubscriptionBase64Result = BlockNotificationResult & {
block: BlockSubscriptionBase64BlockResponse | null;
};
type BlockSubscriptionJsonParsedResult = BlockNotificationResult & {
block: BlockSubscriptionJsonParsedBlockResponse | null;
};
type BlockSubscriptionJsonResult = BlockNotificationResult & {
block: BlockSubscriptionJsonBlockResponse | null;
};
type BlockSubscriptionAccountsCallback = (block: BlockSubscriptionAccountsResult, context: Context) => void;
type BlockSubscriptionNoneCallback = (block: BlockSubscriptionNoneResult, context: Context) => void;
type BlockSubscriptionSignaturesCallback = (block: BlockSubscriptionSignaturesResult, context: Context) => void;
type BlockSubscriptionBase58Callback = (block: BlockSubscriptionBase58Result, context: Context) => void;
type BlockSubscriptionBase64Callback = (block: BlockSubscriptionBase64Result, context: Context) => void;
type BlockSubscriptionJsonParsedCallback = (block: BlockSubscriptionJsonParsedResult, context: Context) => void;
type BlockSubscriptionJsonCallback = (block: BlockSubscriptionJsonResult, context: Context) => void;
type BlockSubscriptionCallback = (block: BlockNotificationResult, context: Context) => void;
/**
* The canonical input shape accepted by message- and transaction-message-level
* compilers.
*/
type InstructionInput = TransactionInstruction | Instruction | InstructionPlan;
/**
* Transaction signature as base-58 encoded string
*/
export type TransactionSignature = string;
export declare const enum TransactionStatus {
BLOCKHEIGHT_EXCEEDED = 0,
PROCESSED = 1,
TIMED_OUT = 2,
NONCE_INVALID = 3
}
/**
* Account metadata used to define instructions
*/
export type AccountMeta = {
/** An account's public key */
pubkey: PublicKey;
/** True if an instruction requires a transaction signature matching `pubkey` */
isSigner: boolean;
/** True if the `pubkey` can be loaded as a read-write account. */
isWritable: boolean;
};
/**
* List of TransactionInstruction object fields that may be initialized at construction
*/
export type TransactionInstructionCtorFields = {
keys: Array<AccountMeta>;
programId: PublicKey;
data?: Uint8Array;
};
/**
* Configuration object for Transaction.serialize()
*/
export type SerializeConfig = {
/** Require all transaction signatures be present (default: true) */
requireAllSignatures?: boolean;
/** Verify provided signatures (default: true) */
verifySignatures?: boolean;
};
/**
* Transaction Instruction class
*/
export declare class TransactionInstruction {
/**
* Public keys to include in this transaction
* Boolean represents whether this pubkey needs to sign the transaction
*/
keys: Array<AccountMeta>;
/**
* Program Id to execute
*/
programId: PublicKey;
/**
* Program input
*/
private _data;
get data(): Uint8Array;
set data(data: Uint8Array);
constructor(opts: TransactionInstructionCtorFields);
}
/**
* Pair of signature and corresponding public key
*/
export type SignaturePubkeyPair = {
signature: Uint8Array | null;
publicKey: PublicKey;
};
/**
* List of Transaction object fields that may be initialized at construction
*/
export type TransactionCtorFields_DEPRECATED = {
/** Optional nonce information used for offline nonce'd transactions */
nonceInfo?: NonceInformation | null;
/** The transaction fee payer */
feePayer?: PublicKey | null;
/** One or more signatures */
signatures?: Array<{
signature: Uint8Array | null;
publicKey: PublicKey;
}>;
/** A recent blockhash */
recentBlockhash?: Blockhash$1;
};
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
/**
* Blockhash-based transactions have a lifetime that are defined by
* the blockhash they include. Any transaction whose blockhash is
* too old will be rejected.
*/
export type TransactionBlockhashCtor = {
/** The transaction fee payer */
feePayer?: PublicKey | null;
/** One or more signatures */
signatures?: Array<SignaturePubkeyPair>;
/** A recent blockhash */
blockhash: Blockhash$1;
/** the last block chain can advance to before tx is declared expired */
lastValidBlockHeight: number | bigint;
};
/**
* Use these options to construct a durable nonce transaction.
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
export type TransactionNonceCtor = {
/** The transaction fee payer */
feePayer?: PublicKey | null;
minContextSlot: number | bigint;
nonceInfo: NonceInformation;
/** One or more signatures */
signatures?: Array<SignaturePubkeyPair>;
};
/**
* Nonce information to be used to build an offline Transaction.
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
export type NonceInformation = {
/** The current blockhash stored in the nonce */
nonce: Blockhash$1;
/** AdvanceNonceAccount Instruction */
nonceInstruction: TransactionInstruction;
};
/**
* Transaction class
*/
export declare class Transaction {
/**
* Signatures for the transaction. Typically created by invoking the
* `sign()` method
*/
signatures: Array<SignaturePubkeyPair>;
/**
* The first (payer) Transaction signature
*
* @returns {Uint8Array | null} The payer's signature bytes
*/
get signature(): Uint8Array | null;
/**
* The transaction fee payer
*/
feePayer?: PublicKey;
/**
* The instructions to atomically execute
*/
instructions: Array<TransactionInstruction>;
/**
* A recent transaction id. Must be populated by the caller
*/
recentBlockhash?: Blockhash$1;
/**
* the last block chain can advance to before tx is declared expired
* */
lastValidBlockHeight?: number | bigint;
/**
* Optional Nonce information. If populated, transaction will use a durable
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
*/
nonceInfo?: NonceInformation;
/**
* If this is a nonce transaction this represents the minimum slot from which
* to evaluate if the nonce has advanced when attempting to confirm the
* transaction. This protects against a case where the transaction confirmation
* logic loads the nonce account from an old slot and assumes the mismatch in
* nonce value implies that the nonce has been advanced.
*/
minNonceContextSlot?: number | bigint;
constructor(opts?: TransactionBlockhashCtor);
constructor(opts?: TransactionNonceCtor);
/**
* @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
* Please supply a `TransactionBlockhashCtor` instead.
*/
constructor(opts?: TransactionCtorFields_DEPRECATED);
/**
* Add one or more instructions to this Transaction.
*
* `InstructionPlan` inputs are flattened in order and each leaf instruction
* is appended. Parallel sub-trees collapse to sequential order in the
* single-transaction context. `MessagePackerInstructionPlan` leaves are
* rejected at runtime — they are designed to span multiple transactions and
* cannot be honored inside a single legacy `Transaction`.
*
* @param {Array< Transaction | TransactionInstructionCtorFields | InstructionInput >} items - Instructions or plans to add to the Transaction
*/
add(...items: Array<Transaction | TransactionInstructionCtorFields | InstructionInput>): Transaction;
/**
* Compile transaction data
*/
compileMessage(): Message;
/**
* Get the Transaction data that need to be covered by signatures
*/
serializeMessage(): Uint8Array;
/**
* Get the estimated fee associated with a transaction
*
* @param {Connection} connection Connection to RPC Endpoint.
*
* @returns {Promise<bigint | null>} The estimated fee for the transaction
*/
getEstimatedFee(connection: Connection): Promise<Awaited<ReturnType<Connection['getFeeForMessage']>>['value']>;
/**
* Specify the public keys which will be used to sign the Transaction.
* The first signer will be used as the transaction fee payer account.
*
* Signatures can be added with either `partialSign` or `addSignature`
*
* @deprecated Deprecated since v0.84.0. Only the fee payer needs to be
* specified and it can be set in the Transaction constructor or with the
* `feePayer` property.
*/
setSigners(...signers: Array<PublicKey>): void;
/**
* Sign the Transaction with the specified signers. Multiple signatures may
* be applied to a Transaction. The first signature is considered "primary"
* and is used identify and confirm transactions.
*
* If the Transaction `feePayer` is not set, the first signer will be used
* as the transaction fee payer account.
*
* Transaction fields should not be modified after the first call to `sign`,
* as doing so may invalidate the signature and cause the Transaction to be
* rejected.
*
* The Transaction must be assigned a valid `recentBlockhash` before invoking this method
*/
sign(...signers: Array<TransactionPartialSigner>): Promise<void>;
/**
* Partially sign a transaction with the specified accounts. All accounts must
* correspond to either the fee payer or a signer account in the transaction
* instructions.
*
* All the caveats from the `sign` method apply to `partialSign`
*/
partialSign(...signers: Array<TransactionPartialSigner>): Promise<void>;
private _resolveSigners;
/**
* Add an externally created signature to a transaction. The public key
* must correspond to either the fee payer or a signer account in the transaction
* instructions.
*
* @param {PublicKey} pubkey Public key that will be added to the transaction.
* @param {Uint8Array} signature An externally created signature to add to the transaction.
*/
addSignature(pubkey: PublicKey, signature: Uint8Array): void;
/**
* Verify signatures of a Transaction
* Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.
* If no boolean is provided, we expect a fully signed Transaction by default.
*
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
*/
verifySignatures(requireAllSignatures?: boolean): Promise<boolean>;
/**
* Serialize the Transaction in the wire format.
*
* @param {SerializeConfig} [config] Config of transaction.
*
* @returns {Uint8Array} Signature of transaction in wire format.
*/
serialize(config?: SerializeConfig): Promise<Uint8Array>;
/**
* Parse a wire transaction into a Transaction object.
*
* @param {Uint8Array | Array<number>} buffer Signature of wire Transaction
*
* @returns {Transaction} Transaction associated with the signature
*/
static from(buffer: Uint8Array | Array<number>): Transaction;
/**
* Populate Transaction object from message and signatures
*
* @param {Message} message Message of transaction
* @param {Array<string>} signatures List of signatures to assign to the transaction
*
* @returns {Transaction} The populated Transaction
*/
static populate(message: Message, signatures?: Array<string>): Transaction;
}
export type AccountKeysFromLookups = LoadedAddresses;
export declare class MessageAccountKeys {
staticAccountKeys: Array<PublicKey>;
accountKeysFromLookups?: AccountKeysFromLookups;
constructor(staticAccountKeys: Array<PublicKey>, accountKeysFromLookups?: AccountKeysFromLookups);
keySegments(): Array<Array<PublicKey>>;
get(index: number): PublicKey | undefined;
get length(): number;
compileInstructions(instructions: Array<Required<TransactionInstructionCtorFields>>): Array<MessageCompiledInstruction>;
}
/**
* An instruction to execute by a program
*
* @property {number} programIdIndex
* @property {number[]} accounts
* @property {string} data
*/
export 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 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$1;
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
instructions: CompiledInstruction[];
};
export type CompileLegacyArgs = {
payerKey: PublicKey;
instructions: Array<InstructionInput>;
recentBlockhash: Blockhash$1;
};
/**
* List of instructions to be processed atomically
*/
export declare class Message {
readonly header: Readonly<MessageHeader>;
accountKeys: PublicKey[];
recentBlockhash: Blockhash$1;
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(): Uint8Array;
/**
* Decode a compiled message into a Message object.
*/
static from(buffer: Uint8Array | Array<number>): Message;
}
/**
* Maximum over-the-wire size of a Transaction
*
* 1280 is IPv6 minimum MTU
* 40 bytes is the size of the IPv6 header
* 8 bytes is the size of the fragment header
*/
export declare const PACKET_DATA_SIZE: number;
export declare const VERSION_PREFIX_MASK = 127;
/** Version byte that opens the serialization of a v1 message (SIMD-0385). */
export declare const V1_MESSAGE_PREFIX = 129;
/** Maximum number of top-level instructions a v1 message can carry (SIMD-0385). */
export declare const V1_MAX_INSTRUCTIONS = 64;
export declare const SIGNATURE_LENGTH_IN_BYTES = 64;
export declare class TransactionExpiredBlockheightExceededError extends Error {
signature: string;
constructor(signature: string);
}
export declare class TransactionExpiredTimeoutError extends Error {
signature: string;
constructor(signature: string, timeoutSeconds: number);
}
export declare class TransactionExpiredNonceInvalidError extends Error {
signature: string;
constructor(signature: string);
}
export type TransactionMessageArgs = {
payerKey: PublicKey;
instructions: Array<InstructionInput>;
recentBlockhash: Blockhash$1;
/**
* Message-level resource limits and prioritization, used when compiling to
* a v1 message. Ignored by legacy and v0 compilation.
*/
transactionConfig?: V1TransactionConfig;
};
export type DecompileArgs = {
accountKeysFromLookups: AccountKeysFromLookups;
} | {
addressLookupTableAccounts: AddressLookupTableAccount[];
};
export declare class TransactionMessage {
payerKey: PublicKey;
instructions: Array<TransactionInstruction>;
recentBlockhash: Blockhash$1;
transactionConfig?: V1TransactionConfig;
constructor(args: TransactionMessageArgs);
static decompile(message: VersionedMessage, args?: DecompileArgs): TransactionMessage;
compileToLegacyMessage(): Message;
compileToV0Message(addressLookupTableAccounts?: AddressLookupTableAccount[]): MessageV0;
/**
* Compile to a v1 message (SIMD-0385).
*
* v1 messages do not support address lookup tables. Resource limits and
* prioritization are set through `transactionConfig` rather than Compute
* Budget program instructions, which are no-ops in v1 transactions.
*
* @param transactionConfig When provided, takes precedence over the
* `transactionConfig` set on this `TransactionMessage`.
*/
compileToV1Message(transactionConfig?: V1TransactionConfig): MessageV1;
}
/**
* Transaction lifetime information for {@link VersionedTransaction.sign}:
* the `lastValidBlockHeight` of the message's blockhash. Durable nonce
* lifetimes are detected from the message itself and need no configuration.
*/
export type VersionedTransactionSignConfig = {
lastValidBlockHeight: bigint;
};
/**
* Versioned transaction class
*/
export declare class VersionedTransaction {
signatures: Array<Uint8Array>;
message: VersionedMessage;
get version(): TransactionVersion;
constructor(message: VersionedMessage, signatures?: Array<Uint8Array>);
serialize(): Uint8Array;
static deserialize(serializedTransaction: Uint8Array): VersionedTransaction;
sign(signers: Array<TransactionPartialSigner>, config?: VersionedTransactionSignConfig): Promise<void>;
addSignature(publicKey: PublicKey, signature: Uint8Array): void;
}
export type AddressLookupTableState = {
deactivationSlot: bigint;
lastExtendedSlot: bigint;
lastExtendedSlotStartIndex: number;
authority?: PublicKey;
addresses: Array<PublicKey>;
};
export type AddressLookupTableAccountArgs = {
key: PublicKey;
state: AddressLookupTableState;
};
export declare class AddressLookupTableAccount {
key: PublicKey;
state: AddressLookupTableState;
constructor(args: AddressLookupTableAccountArgs);
isActive(): boolean;
static deserialize(accountData: Uint8Array): AddressLookupTableState;
}
export type CreateLookupTableParams = {
/** Account used to derive and control the new address lookup table. */
authority: PublicKey;
/** Account that will fund the new address lookup table. */
payer: PublicKey;
/** A recent slot must be used in the derivation path for each initialized table. */
recentSlot: bigint | number;
};
export type FreezeLookupTableParams = {
/** Address lookup table account to freeze. */
lookupTable: PublicKey;
/** Account which is the current authority. */
authority: PublicKey;
};
export type ExtendLookupTableParams = {
/** Address lookup table account to extend. */
lookupTable: PublicKey;
/** Account which is the current authority. */
authority: PublicKey;
/** Account that will fund the table reallocation.
* Not required if the reallocation has already been funded. */
payer?: PublicKey;
/** List of Public Keys to be added to the lookup table. */
addresses: Array<PublicKey>;
};
export type DeactivateLookupTableParams = {
/** Address lookup table account to deactivate. */
lookupTable: PublicKey;
/** Account which is the current authority. */
authority: PublicKey;
};
export type CloseLookupTableParams = {
/** Address lookup table account to close. */
lookupTable: PublicKey;
/** Account which is the current authority. */
authority: PublicKey;
/** Recipient of closed account lamports. */
recipient: PublicKey;
};
/**
* An enumeration of valid LookupTableInstructionType's
*/
export type LookupTableInstructionType = 'CreateLookupTable' | 'ExtendLookupTable' | 'CloseLookupTable' | 'FreezeLookupTable' | 'DeactivateLookupTable';
export declare class AddressLookupTableInstruction {
static decodeInstructionType(instruction: TransactionInstruction): LookupTableInstructionType;
static decodeCreateLookupTable(instruction: TransactionInstruction): CreateLookupTableParams;
static decodeExtendLookupTable(instruction: TransactionInstruction): ExtendLookupTableParams;
static decodeCloseLookupTable(instruction: TransactionInstruction): CloseLookupTableParams;
static decodeFreezeLookupTable(instruction: TransactionInstruction): FreezeLookupTableParams;
static decodeDeactivateLookupTable(instruction: TransactionInstruction): DeactivateLookupTableParams;
}
export declare class AddressLookupTableProgram {
static programId: PublicKey;
static createLookupTable(params: CreateLookupTableParams): Promise<[TransactionInstruction, PublicKey]>;
static freezeLookupTable(params: FreezeLookupTableParams): TransactionInstruction;
static extendLookupTable(params: ExtendLookupTableParams): TransactionInstruction;
static deactivateLookupTable(params: DeactivateLookupTableParams): TransactionInstruction;
static closeLookupTable(params: CloseLookupTableParams): TransactionInstruction;
}
/**
* An enumeration of valid ComputeBudgetInstructionType's
*/
export type ComputeBudgetInstructionType = 'RequestUnits' | 'RequestHeapFrame' | 'SetComputeUnitLimit' | 'SetComputeUnitPrice' | 'SetLoadedAccountsDataSizeLimit';
/**
* Request units instruction params
*/
export interface RequestUnitsParams {
/** Units to request for transaction-wide compute */
units: number;
/** Prioritization fee lamports */
additionalFee: number;
}
/**
* Request heap frame instruction params
*/
export type RequestHeapFrameParams = {
/** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
bytes: number;
};
/**
* Set compute unit limit instruction params
*/
export interface SetComputeUnitLimitParams {
/** Transaction-wide compute unit limit */
units: number;
}
/**
* Set compute unit price instruction params
*/
export interface SetComputeUnitPriceParams {
/** Transaction compute unit price used for prioritization fees */
microLamports: number | bigint;
}
/**
* Set loaded accounts data size limit instruction params
*/
export interface SetLoadedAccountsDataSizeLimitParams {
/** Maximum loaded accounts data size, in bytes */
accountDataSizeLimit: number;
}
/**
* Compute Budget Instruction class
*/
export declare class ComputeBudgetInstruction {
/**
* Decode a compute budget instruction and retrieve the instruction type.
*/
static decodeInstructionType(instruction: TransactionInstruction): ComputeBudgetInstructionType;
/**
* Decode request units compute budget instruction and retrieve the instruction params.
*/
static decodeRequestUnits(instruction: TransactionInstruction): RequestUnitsParams;
/**
* Decode request heap frame compute budget instruction and retrieve the instruction params.
*/
static decodeRequestHeapFrame(instruction: TransactionInstruction): RequestHeapFrameParams;
/**
* Decode set compute unit limit compute budget instruction and retrieve the instruction params.
*/
static decodeSetComputeUnitLimit(instruction: TransactionInstruction): SetComputeUnitLimitParams;
/**
* Decode set compute unit price compute budget instruction and retrieve the instruction params.
*/
static decodeSetComputeUnitPrice(instruction: TransactionInstruction): SetComputeUnitPriceParams;
/**
* Decode set loaded accounts data size limit compute budget instruction and retrieve the instruction params.
*/
static decodeSetLoadedAccountsDataSizeLimit(instruction: TransactionInstruction): SetLoadedAccountsDataSizeLimitParams;
}
/**
* Factory class for transaction instructions to interact with the Compute Budget program
*/
export declare class ComputeBudgetProgram {
/**
* Public key that identifies the Compute Budget program
*/
static programId: PublicKey;
/**
* @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
*/
static requestUnits(params: RequestUnitsParams): TransactionInstruction;
static requestHeapFrame(params: RequestHeapFrameParams): TransactionInstruction;
static setComputeUnitLimit(params: SetComputeUnitLimitParams): TransactionInstruction;
static setComputeUnitPrice(params: SetComputeUnitPriceParams): TransactionInstruction;
static setLoadedAccountsDataSizeLimit(params: SetLoadedAccountsDataSizeLimitParams): TransactionInstruction;
}
/**
* An enumeration of valid LoaderV3InstructionType's
*/
export type LoaderV3InstructionType = 'InitializeBuffer' | 'Write' | 'DeployWithMaxDataLen' | 'Upgrade' | 'SetAuthority' | 'Close' | 'ExtendProgram' | 'SetAuthorityChecked';
export type InitializeBufferParams = {
/** Source account to initialize. */
sourceAccount: PublicKey;
/** Buffer authority. */
bufferAuthority: PublicKey;
};
export type WriteParams = {
/** Buffer account. */
bufferAccount: PublicKey;
/** Buffer authority. */
bufferAuthority: PublicKey;
/** Offset into the buffer to write. */
offset: number;
/** Bytes to write. */
bytes: ReadonlyUint8Array | Uint8Array;
};
export type DeployWithMaxDataLenParams = {
/** Payer account that will pay to create the ProgramData account. */
payerAccount: PublicKey;
/** ProgramData account (uninitialized). */
programDataAccount: PublicKey;
/** Program account (uninitialized). */
programAccount: PublicKey;
/** Buffer account where the program data has been written. */
bufferAccount: PublicKey;
/** Authority. */
authority: PublicKey;
/** Maximum program data length. */
maxDataLen: bigint;
/** Rent sysvar. */
rentSysvar?: PublicKey;
/** Clock sysvar. */
clockSysvar?: PublicKey;
/** System program. */
systemProgram?: PublicKey;
};
export type UpgradeParams = {
/** ProgramData account. */
programDataAccount: PublicKey;
/** Program account. */
programAccount: PublicKey;
/** Buffer account where the new program data has been written. */
bufferAccount: PublicKey;
/** Spill account. */
spillAccount: PublicKey;
/** Authority. */
authority: PublicKey;
/** Rent sysvar. */
rentSysvar?: PublicKey;
/** Clock sysvar. */
clockSysvar?: PublicKey;
};
export type SetAuthorityParams = {
/** Buffer or ProgramData account. */
bufferOrProgramDataAccount: PublicKey;
/** Current authority. */
currentAuthority: PublicKey;
/** New authority. */
newAuthority?: PublicKey;
};
export type SetAuthorityCheckedParams = {
/** Buffer or ProgramData account to change the authority of. */
bufferOrProgramDataAccount: PublicKey;
/** Current authority. */
currentAuthority: PublicKey;
/** New authority. */
newAuthority: PublicKey;
};
export type CloseParams = {
/** Buffer or ProgramData account to close. */
bufferOrProgramDataAccount: PublicKey;
/** Destination account for reclaimed lamports. */
destinationAccount: PublicKey;
/** Authority. */
authority?: PublicKey;
/** Program account. */
programAccount?: PublicKey;
};
export type ExtendProgramParams = {
/** ProgramData account. */
programDataAccount: PublicKey;
/** Program account. */
programAccount: PublicKey;
/** Additional bytes to allocate. */
additionalBytes: number;
/** System program. */
systemProgram?: PublicKey;
/** Payer. */
payer?: PublicKey;
};
/**
* Loader V3 Instruction class
*/
export declare class LoaderV3Instruction {
/**
* Decode a loader v3 instruction and retrieve the instruction type.
*/
static decodeInstructionType(instruction: TransactionInstruction): LoaderV3InstructionType;
/**
* Decode an initialize buffer instruction and retrieve the instruction params.
*/
static decodeInitializeBuffer(instruction: TransactionInstruction): InitializeBufferParams;
/**
* Decode a write instruction and retrieve the instruction params.
*/
static decodeWrite(instruction: TransactionInstruction): WriteParams;
/**
* Decode a deploy with max data len instruction and retrieve the instruction params.
*/
static decodeDeployWithMaxDataLen(instruction: TransactionInstruction): DeployWithMaxDataLenParams;
/**
* Decode an upgrade instruction and retrieve the instruction params.
*/
static decodeUpgrade(instruction: TransactionInstruction): UpgradeParams;
/**
* Decode a set authority instruction and retrieve the instruction params.
*/
static decodeSetAuthority(instruction: TransactionInstruction): SetAuthorityParams;
/**
* Decode a set authority checked instruction and retrieve the instruction params.
*/
static decodeSetAuthorityChecked(instruction: TransactionInstruction): SetAuthorityCheckedParams;
/**
* Decode a close instruction and retrieve the instruction params.
*/
static decodeClose(instruction: TransactionInstruction): CloseParams;
/**
* Decode an extend program instruction and retrieve the instruction params.
*/
static decodeExtendProgram(instruction: TransactionInstruction): ExtendProgramParams;
}
/**
* Factory class for transaction instructions to interact with the Loader V3 program
*/
export declare class LoaderV3Program {
/**
* Public key that identifies the Loader V3 program
*/
static programId: PublicKey;
static initializeBuffer(params: InitializeBufferParams): TransactionInstruction;
static write(params: WriteParams): TransactionInstruction;
static deployWithMaxDataLen(params: DeployWithMaxDataLenParams): TransactionInstruction;
static upgrade(params: UpgradeParams): TransactionInstruction;
static setAuthority(params: SetAuthorityParams): TransactionInstruction;
static setAuthorityChecked(params: SetAuthorityCheckedParams): TransactionInstruction;
static close(params: CloseParams): TransactionInstruction;
static extendProgram(params: ExtendProgramParams): TransactionInstruction;
}
/**
* Params for creating an ed25519 instruction using a public key
*/
export type CreateEd25519InstructionWithPublicKeyParams = {
publicKey: Uint8Array;
message: Uint8Array;
signature: Uint8Array;
instructionIndex?: number;
};
/**
* Params for creating an ed25519 instruction using a private key
*/
export type CreateEd25519InstructionWithPrivateKeyParams = {
privateKey: Uint8Array;
message: Uint8Array;
instructionIndex?: number;
};
export declare class Ed25519Program {
/**
* Public key that identifies the ed25519 program
*/
static programId: PublicKey;
/**
* Create an ed25519 instruction with a public key and signature. The
* public key must be 32 bytes long, and the signature must be 64 bytes
* long.
*/
static createInstructionWithPublicKey(params: CreateEd25519InstructionWithPublicKeyParams): TransactionInstruction;
/**
* Create an ed25519 instruction with a private key. The private key
* must be 64 bytes long.
*/
static createInstructionWithPrivateKey(params: CreateEd25519InstructionWithPrivateKeyParams): Promise<TransactionInstruction>;
}
/**
* Params for creating an secp256k1 instruction using a public key
*/
export type CreateSecp256k1InstructionWithPublicKeyParams = {
publicKey: Uint8Array | Array<number>;
message: Uint8Array | Array<number>;
signature: Uint8Array | Array<number>;
recoveryId: number;
instructionIndex?: number;
};
/**
* Params for creating an secp256k1 instruction using an Ethereum address
*/
export type CreateSecp256k1InstructionWithEthAddressParams = {
ethAddress: Uint8Array | Array<number> | string;
message: Uint8Array | Array<number>;
signature: Uint8Array | Array<number>;
recoveryId: number;
instructionIndex?: number;
};
/**
* Params for creating an secp256k1 instruction using a private key
*/
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
privateKey: Uint8Array | Array<number>;
message: Uint8Array | Array<number>;
instructionIndex?: number;
};
export declare class Secp256k1Program {
/**
* Public key that identifies the secp256k1 program
*/
static programId: PublicKey;
/**
* Construct an Ethereum address from a secp256k1 public key.
* @param {Uint8Array | Array<number>} publicKey a 64 byte
* secp256k1 public key
*/
static publicKeyToEthAddress(publicKey: Uint8Array | Array<number>): Uint8Array;
/**
* Create an secp256k1 instruction with a public key. The public key
* must be 64 bytes long.
*/
static createInstructionWithPublicKey(params: CreateSecp256k1InstructionWithPublicKeyParams): TransactionInstruction;
/**
* Create an secp256k1 instruction with an Ethereum address. The address
* must be a hex string or 20 raw bytes.
*/
static createInstructionWithEthAddress(params: CreateSecp256k1InstructionWithEthAddressParams): TransactionInstruction;
/**
* Create an secp256k1 instruction with a private key. The private key
* must be 32 bytes long.
*/
static createInstructionWithPrivateKey(params: CreateSecp256k1InstructionWithPrivateKeyParams): TransactionInstruction;
}
/**
* PublicKey of the stake config account which configures the rate
* of stake warmup and cooldown as well as the slashing penalty.
*/
export declare const STAKE_CONFIG_ID: PublicKey;
/**
* Stake account authority info
*/
export declare class Authorized {
/** stake authority */
staker: PublicKey;
/** withdraw authority */
withdrawer: PublicKey;
/**
* Create a new Authorized object
* @param staker the stake authority
* @param withdrawer the withdraw authority
*/
constructor(staker: PublicKey, withdrawer: PublicKey);
}
/**
* Stake account lockup info
*/
export declare class Lockup {
/** Unix timestamp of lockup expiration */
unixTimestamp: number;
/** Epoch of lockup expiration */
epoch: number;
/** Lockup custodian authority */
custodian: PublicKey;
/**
* Create a new Lockup object
*/
constructor(unixTimestamp: number, epoch: number, custodian: PublicKey);
/**
* Default, inactive Lockup value
*/
static default: Lockup;
}
export type StakeAccountAuthorized = Readonly<{
staker: PublicKey;
withdrawer: PublicKey;
}>;
export type StakeAccountLockup = Readonly<{
unixTimestamp: bigint;
epoch: bigint;
custodian: PublicKey;
}>;
export type StakeAccountDelegation = Readonly<{
voterPubkey: PublicKey;
stake: bigint;
activationEpoch: bigint;
deactivationEpoch: bigint;
reserved: number[];
}>;
export type StakeAccountMeta = Readonly<{
rentExemptReserve: bigint;
authorized: StakeAccountAuthorized;
lockup: StakeAccountLockup;
}>;
export type StakeAccountStake = Readonly<{
delegation: StakeAccountDelegation;
creditsObserved: bigint;
}>;
export type StakeAccountFlags = Readonly<{
bits: number;
}>;
export type StakeAccountState = Readonly<{
__kind: 'Uninitialized';
}> | Readonly<{
__kind: 'Initialized';
meta: StakeAccountMeta;
}> | Readonly<{
__kind: 'Stake';
meta: StakeAccountMeta;
stake: StakeAccountStake;
stakeFlags: StakeAccountFlags;
}> | Readonly<{
__kind: 'RewardsPool';
}>;
/**
* StakeAccount class
*/
export declare class StakeAccount {
state: StakeAccountState;
/**
* Deserialize StakeAccount from the account data.
*
* @param bufferLike account data
* @return StakeAccount
*/
static fromAccountData(bufferLike: Uint8Array | Array<number>): StakeAccount;
}
/**
* Create stake account transaction params
*/
export type CreateStakeAccountParams = {
/** PublicKey of the account which will fund creation */
fromPubkey: PublicKey;
/** PublicKey of the new stake account */
stakePubkey: PublicKey;
/** Authorities of the new stake account */
authorized: Authorized;
/** Lockup of the new stake account */
lockup?: Lockup;
/** Funding amount */
lamports: number | bigint;
};
/**
* Create stake account with seed transaction params
*/
export type CreateStakeAccountWithSeedParams = {
fromPubkey: PublicKey;
stakePubkey: PublicKey;
basePubkey: PublicKey;
seed: string;
authorized: Authorized;
lockup?: Lockup;
lamports: number | bigint;
};
/**
* Initialize stake instruction params
*/
export type InitializeStakeParams = {
stakePubkey: PublicKey;
authorized: Authorized;
lockup?: Lockup;
};
/**
* Delegate stake instruction params
*/
export type DelegateStakeParams = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
votePubkey: PublicKey;
};
/**
* Authorize stake instruction params
*/
export type AuthorizeStakeParams = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
newAuthorizedPubkey: PublicKey;
stakeAuthorizationType: StakeAuthorizationType;
custodianPubkey?: PublicKey;
};
/**
* Authorize stake instruction params using a derived key
*/
export type AuthorizeWithSeedStakeParams = {
stakePubkey: PublicKey;
authorityBase: PublicKey;
authoritySeed: string;
authorityOwner: PublicKey;
newAuthorizedPubkey: PublicKey;
stakeAuthorizationType: StakeAuthorizationType;
custodianPubkey?: PublicKey;
};
/**
* Split stake instruction params
*/
type SplitStakeFields = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
splitStakePubkey: PublicKey;
lamports: bigint;
};
export type SplitStakeParams = Omit<SplitStakeFields, 'lamports'> & {
lamports: number | bigint;
};
export type DecodedSplitStakeInstruction = SplitStakeFields;
/**
* Split with seed transaction params
*/
export type SplitStakeWithSeedParams = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
splitStakePubkey: PublicKey;
basePubkey: PublicKey;
seed: string;
lamports: number | bigint;
};
/**
* Withdraw stake instruction params
*/
type WithdrawStakeFields = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
toPubkey: PublicKey;
lamports: bigint;
custodianPubkey?: PublicKey;
};
export type WithdrawStakeParams = Omit<WithdrawStakeFields, 'lamports'> & {
lamports: number | bigint;
};
export type DecodedWithdrawStakeInstruction = WithdrawStakeFields;
/**
* Deactivate stake instruction params
*/
export type DeactivateStakeParams = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
};
/**
* Merge stake instruction params
*/
export type MergeStakeParams = {
stakePubkey: PublicKey;
sourceStakePubKey: PublicKey;
authorizedPubkey: PublicKey;
};
/**
* Initialize checked stake instruction params
*/
export type InitializeCheckedStakeParams = {
stakePubkey: PublicKey;
authorized: Authorized;
};
/**
* Authorize checked stake instruction params
*/
export type AuthorizeCheckedStakeParams = AuthorizeStakeParams;
/**
* Authorize checked stake instruction params using a derived key
*/
export type AuthorizeCheckedWithSeedStakeParams = AuthorizeWithSeedStakeParams;
/**
* Set lockup stake instruction params
*/
export type SetLockupStakeParams = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
unixTimestamp?: number | bigint | null;
epoch?: number | bigint | null;
custodian?: PublicKey | null;
};
/**
* Set lockup checked stake instruction params
*/
export type SetLockupCheckedStakeParams = {
stakePubkey: PublicKey;
authorizedPubkey: PublicKey;
newAuthorizedPubkey?: PublicKey;
unixTimestamp?: number | bigint | null;
epoch?: number | bigint | null;
};
/**
* Get minimum delegation instruction params
*/
export type GetMinimumDelegationStakeParams = Record<string, never>;
/**
* Deactivate delinquent stake instruction params
*/
export type DeactivateDelinquentStakeParams = {
stakePubkey: PublicKey;
delinquentVotePubkey: PublicKey;
referenceVotePubkey: PublicKey;
};
/**
* Move stake instruction params
*/
export type MoveStakeParams = {
sourceStakePubkey: PublicKey;
destinationStakePubkey: PublicKey;
authorizedPubkey: PublicKey;
lamports: number | bigint;
};
/**
* Move lamports instruction params
*/
export type MoveLamportsParams = {
sourceStakePubkey: PublicKey;
destinationStakePubkey: PublicKey;
authorizedPubkey: PublicKey;
lamports: number | bigint;
};
type ValueOf$1<TRecord> = TRecord extends Record<PropertyKey, infer TValue> ? TValue : never;
declare const GENERATED_TO_LEGACY_INSTRUCTION_TYPE$1: {
readonly 1: "Authorize";
readonly 10: "AuthorizeChecked";
readonly 11: "AuthorizeCheckedWithSeed";
readonly 8: "AuthorizeWithSeed";
readonly 14: "DeactivateDelinquent";
readonly 5: "Deactivate";
readonly 2: "Delegate";
readonly 13: "GetMinimumDelegation";
readonly 9: "InitializeChecked";
readonly 0: "Initialize";
readonly 7: "Merge";
readonly 16: "MoveLamports";
readonly 15: "MoveStake";
readonly 6: "SetLockup";
readonly 12: "SetLockupChecked";
readonly 3: "Split";
readonly 4: "Withdraw";
};
/**
* Stake Instruction class
*/
export declare class StakeInstruction {
/**
* Decode a stake instruction and retrieve the instruction type.
*/
static decodeInstructionType(instruction: TransactionInstruction): StakeInstructionType;
/**
* Decode a initialize stake instruction and retrieve the instruction params.
*/
static decodeInitialize(instruction: TransactionInstruction): InitializeStakeParams;
/**
* Decode an initialize-checked stake instruction and retrieve the instruction params.
*/
static decodeInitializeChecked(instruction: TransactionInstruction): InitializeCheckedStakeParams;
/**
* Decode a delegate stake instruction and retrieve the instruction params.
*/
static decodeDelegate(instruction: TransactionInstruction): DelegateStakeParams;
/**
* Decode an authorize stake instruction and retrieve the instruction params.
*/
static decodeAuthorize(instruction: TransactionInstruction): AuthorizeStakeParams;
/**
* Decode an authorize-checked stake instruction and retrieve the instruction params.
*/
static decodeAuthorizeChecked(instruction: TransactionInstruction): AuthorizeCheckedStakeParams;
/**
* Decode an authorize-with-seed stake instruction and retrieve the instruction params.
*/
static decodeAuthorizeWithSeed(instruction: TransactionInstruction): AuthorizeWithSeedStakeParams;
/**
* Decode an authorize-checked-with-seed stake instruction and retrieve the instruction params.
*/
static decodeAuthorizeCheckedWithSeed(instruction: TransactionInstruction): AuthorizeCheckedWithSeedStakeParams;
/**
* Decode a set-lockup stake instruction and retrieve the instruction params.
*/
static decodeSetLockup(instruction: TransactionInstruction): SetLockupStakeParams;
/**
* Decode a set-lockup-checked stake instruction and retrieve the instruction params.
*/
static decodeSetLockupChecked(instruction: TransactionInstruction): SetLockupCheckedStakeParams;
/**
* Decode a split stake instruction and retrieve the instruction params.
*/
static decodeSplit(instruction: TransactionInstruction): DecodedSplitStakeInstruction;
/**
* Decode a get-minimum-delegation stake instruction and retrieve the instruction params.
*/
static decodeGetMinimumDelegation(instruction: TransactionInstruction): GetMinimumDelegationStakeParams;
/**
* Decode a merge stake instruction and retrieve the instruction params.
*/
static decodeMerge(instruction: TransactionInstruction): MergeStakeParams;
/**
* Decode a withdraw stake instruction and retrieve the instruction params.
*/
static decodeWithdraw(instruction: TransactionInstruction): DecodedWithdrawStakeInstruction;
/**
* Decode a deactivate stake instruction and retrieve the instruction params.
*/
static decodeDeactivate(instruction: TransactionInstruction): DeactivateStakeParams;
/**
* Decode a deactivate-delinquent stake instruction and retrieve the instruction params.
*/
static decodeDeactivateDelinquent(instruction: TransactionInstruction): DeactivateDelinquentStakeParams;
/**
* Decode a move-stake instruction and retrieve the instruction params.
*/
static decodeMoveStake(instruction: TransactionInstruction): MoveStakeParams;
/**
* Decode a move-lamports instruction and retrieve the instruction params.
*/
static decodeMoveLamports(instruction: TransactionInstruction): MoveLamportsParams;
}
/**
* An enumeration of valid StakeInstructionType's
*/
export type StakeInstructionType = ValueOf$1<typeof GENERATED_TO_LEGACY_INSTRUCTION_TYPE$1>;
/**
* Stake authorization type
*/
export type StakeAuthorizationType = {
/** The Stake Authorization index (from solana-stake-program) */
index: number;
};
/**
* An enumeration of valid StakeAuthorizationLayout's
*/
export declare const StakeAuthorizationLayout: Readonly<{
Staker: {
index: number;
};
Withdrawer: {
index: number;
};
}>;
/**
* Factory class for transactions to interact with the Stake program
*/
export declare class StakeProgram {
/**
* Public key that identifies the Stake program
*/
static programId: PublicKey;
/**
* Max space of a Stake account
*
* This is generated from the solana-stake-program StakeState struct as
* `StakeStateV2::size_of()`:
* https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html
*/
static space: number;
/**
* Generate an Initialize instruction to add to a Stake Create transaction
*/
static initialize(params: InitializeStakeParams): TransactionInstruction;
/**
* Generate an InitializeChecked instruction.
*/
static initializeChecked(params: InitializeCheckedStakeParams): TransactionInstruction;
/**
* Generate a Transaction that creates a new Stake account at
* an address generated with `from`, a seed, and the Stake programId
*/
static createAccountWithSeed(params: CreateStakeAccountWithSeedParams): Transaction;
/**
* Generate a Transaction that creates a new Stake account
*/
static createAccount(params: CreateStakeAccountParams): Transaction;
/**
* Generate a Transaction that delegates Stake tokens to a validator
* Vote PublicKey. This transaction can also be used to redelegate Stake
* to a new validator Vote PublicKey.
*/
static delegate(params: DelegateStakeParams): Transaction;
/**
* Generate a Transaction that authorizes a new PublicKey as Staker
* or Withdrawer on the Stake account.
*/
static authorize(params: AuthorizeStakeParams): Transaction;
/**
* Generate a Transaction that authorizes a new signer as Staker or Withdrawer on the Stake account.
*/
static authorizeChecked(params: AuthorizeCheckedStakeParams): Transaction;
/**
* Generate a Transaction that authorizes a new PublicKey as Staker
* or Withdrawer on the Stake account.
*/
static authorizeWithSeed(params: AuthorizeWithSeedStakeParams): Transaction;
/**
* Generate a Transaction that authorizes a new signer as Staker or Withdrawer on the Stake account using a derived key.
*/
static authorizeCheckedWithSeed(params: AuthorizeCheckedWithSeedStakeParams): Transaction;
/**
* Generate a Transaction that updates a stake account lockup.
*/
static setLockup(params: SetLockupStakeParams): Transaction;
/**
* Generate a Transaction that updates a stake account lockup using checked authorities.
*/
static setLockupChecked(params: SetLockupCheckedStakeParams): Transaction;
/**
* Generate a Transaction that splits Stake tokens into another stake account
*/
static split(params: SplitStakeParams, rentExemptReserve: number): Transaction;
/**
* Generate a Transaction that splits Stake tokens into another account
* derived from a base public key and seed
*/
static splitWithSeed(params: SplitStakeWithSeedParams, rentExemptReserve?: number): Transaction;
/**
* Generate a Transaction that merges Stake accounts.
*/
static merge(params: MergeStakeParams): Transaction;
/**
* Generate a get-minimum-delegation instruction.
*/
static getMinimumDelegation(): TransactionInstruction;
/**
* Generate a Transaction that withdraws deactivated Stake tokens.
*/
static withdraw(params: WithdrawStakeParams): Transaction;
/**
* Generate a Transaction that deactivates Stake tokens.
*/
static deactivate(params: DeactivateStakeParams): Transaction;
/**
* Generate a Transaction that deactivates stake delegated to a delinquent vote account.
*/
static deactivateDelinquent(params: DeactivateDelinquentStakeParams): Transaction;
/**
* Generate a Transaction that moves active stake between stake accounts.
*/
static moveStake(params: MoveStakeParams): Transaction;
/**
* Generate a Transaction that moves lamports between compatible stake accounts.
*/
static moveLamports(params: MoveLamportsParams): Transaction;
}
/**
* Create account system transaction params
*/
type CreateAccountFields = {
/** The account that will transfer lamports to the created account */
fromPubkey: PublicKey;
/** Public key of the created account */
newAccountPubkey: PublicKey;
/** Amount of lamports to transfer to the created account */
lamports: bigint;
/** Amount of space in bytes to allocate to the created account */
space: bigint;
/** Public key of the program to assign as the owner of the created account */
programId: PublicKey;
};
export type CreateAccountParams = Omit<CreateAccountFields, 'lamports' | 'space'> & {
lamports: number | bigint;
space: number | bigint;
};
/**
* Transfer system transaction params
*/
type TransferFields = {
/** Account that will transfer lamports */
fromPubkey: PublicKey;
/** Account that will receive transferred lamports */
toPubkey: PublicKey;
/** Amount of lamports to transfer */
lamports: bigint;
};
export type TransferParams = Omit<TransferFields, 'lamports'> & {
lamports: number | bigint;
};
/**
* Assign system transaction params
*/
export type AssignParams = {
/** Public key of the account which will be assigned a new owner */
accountPubkey: PublicKey;
/** Public key of the program to assign as the owner */
programId: PublicKey;
};
/**
* Create account with seed system transaction params
*/
type CreateAccountWithSeedFields = {
/** The account that will transfer lamports to the created account */
fromPubkey: PublicKey;
/** Public key of the created account. Must be pre-calculated with PublicKey.createWithSeed() */
newAccountPubkey: PublicKey;
/** Base public key to use to derive the address of the created account. Must be the same as the base key used to create `newAccountPubkey` */
basePubkey: PublicKey;
/** Seed to use to derive the address of the created account. Must be the same as the seed used to create `newAccountPubkey` */
seed: string;
/** Amount of lamports to transfer to the created account */
lamports: bigint;
/** Amount of space in bytes to allocate to the created account */
space: bigint;
/** Public key of the program to assign as the owner of the created account */
programId: PublicKey;
};
export type CreateAccountWithSeedParams = Omit<CreateAccountWithSeedFields, 'lamports' | 'space'> & {
lamports: number | bigint;
space: number | bigint;
};
/**
* Create nonce account system transaction params
*/
type CreateNonceAccountFields = {
/** The account that will transfer lamports to the created nonce account */
fromPubkey: PublicKey;
/** Public key of the created nonce account */
noncePubkey: PublicKey;
/** Public key to set as authority of the created nonce account */
authorizedPubkey: PublicKey;
/** Amount of lamports to transfer to the created nonce account */
lamports: bigint;
};
export type CreateNonceAccountParams = Omit<CreateNonceAccountFields, 'lamports'> & {
lamports: number | bigint;
};
/**
* Create nonce account with seed system transaction params
*/
type CreateNonceAccountWithSeedFields = {
/** The account that will transfer lamports to the created nonce account */
fromPubkey: PublicKey;
/** Public key of the created nonce account */
noncePubkey: PublicKey;
/** Public key to set as authority of the created nonce account */
authorizedPubkey: PublicKey;
/** Amount of lamports to transfer to the created nonce account */
lamports: bigint;
/** Base public key to use to derive the address of the nonce account */
basePubkey: PublicKey;
/** Seed to use to derive the address of the nonce account */
seed: string;
};
export type CreateNonceAccountWithSeedParams = Omit<CreateNonceAccountWithSeedFields, 'lamports'> & {
lamports: number | bigint;
};
/**
* Initialize nonce account system instruction params
*/
export type InitializeNonceParams = {
/** Nonce account which will be initialized */
noncePubkey: PublicKey;
/** Public key to set as authority of the initialized nonce account */
authorizedPubkey: PublicKey;
};
/**
* Advance nonce account system instruction params
*/
export type AdvanceNonceParams = {
/** Nonce account */
noncePubkey: PublicKey;
/** Public key of the nonce authority */
authorizedPubkey: PublicKey;
};
/**
* Withdraw nonce account system transaction params
*/
type WithdrawNonceFields = {
/** Nonce account */
noncePubkey: PublicKey;
/** Public key of the nonce authority */
authorizedPubkey: PublicKey;
/** Public key of the account which will receive the withdrawn nonce account balance */
toPubkey: PublicKey;
/** Amount of lamports to withdraw from the nonce account */
lamports: bigint;
};
export type WithdrawNonceParams = Omit<WithdrawNonceFields, 'lamports'> & {
lamports: number | bigint;
};
/**
* Authorize nonce account system transaction params
*/
export type AuthorizeNonceParams = {
/** Nonce account */
noncePubkey: PublicKey;
/** Public key of the current nonce authority */
authorizedPubkey: PublicKey;
/** Public key to set as the new nonce authority */
newAuthorizedPubkey: PublicKey;
};
/**
* Allocate account system transaction params
*/
type AllocateFields = {
/** Account to allocate */
accountPubkey: PublicKey;
/** Amount of space in bytes to allocate */
space: bigint;
};
export type AllocateParams = Omit<AllocateFields, 'space'> & {
space: number | bigint;
};
/**
* Allocate account with seed system transaction params
*/
type AllocateWithSeedFields = {
/** Account to allocate */
accountPubkey: PublicKey;
/** Base public key to use to derive the address of the allocated account */
basePubkey: PublicKey;
/** Seed to use to derive the address of the allocated account */
seed: string;
/** Amount of space in bytes to allocate */
space: bigint;
/** Public key of the program to assign as the owner of the allocated account */
programId: PublicKey;
};
export type AllocateWithSeedParams = Omit<AllocateWithSeedFields, 'space'> & {
space: number | bigint;
};
/**
* Assign account with seed system transaction params
*/
export type AssignWithSeedParams = {
/** Public key of the account which will be assigned a new owner */
accountPubkey: PublicKey;
/** Base public key to use to derive the address of the assigned account */
basePubkey: PublicKey;
/** Seed to use to derive the address of the assigned account */
seed: string;
/** Public key of the program to assign as the owner */
programId: PublicKey;
};
/**
* Transfer with seed system transaction params
*/
type TransferWithSeedFields = {
/** Account that will transfer lamports */
fromPubkey: PublicKey;
/** Base public key to use to derive the funding account address */
basePubkey: PublicKey;
/** Account that will receive transferred lamports */
toPubkey: PublicKey;
/** Amount of lamports to transfer */
lamports: bigint;
/** Seed to use to derive the funding account address */
seed: string;
/** Program id to use to derive the funding account address */
programId: PublicKey;
};
export type TransferWithSeedParams = Omit<TransferWithSeedFields, 'lamports'> & {
lamports: number | bigint;
};
/** Decoded create account system instruction */
export type DecodedCreateAccountInstruction = CreateAccountFields;
/** Decoded allocate system instruction */
export type DecodedAllocateInstruction = AllocateFields;
/** Decoded allocate with seed system instruction */
export type DecodedAllocateWithSeedInstruction = AllocateWithSeedFields;
/** Decoded create account with seed system instruction */
export type DecodedCreateAccountWithSeedInstruction = CreateAccountWithSeedFields;
/** Decoded transfer system transaction instruction */
export type DecodedTransferInstruction = TransferFields;
/** Decoded transferWithSeed system transaction instruction */
export type DecodedTransferWithSeedInstruction = TransferWithSeedFields;
/** Decoded withdraw nonce system transaction instruction */
export type DecodedWithdrawNonceInstruction = WithdrawNonceFields;
/**
* System Instruction class
*/
export declare class SystemInstruction {
/**
* Decode a system instruction and retrieve the instruction type.
*/
static decodeInstructionType(instruction: TransactionInstruction): SystemInstructionType;
/**
* Decode a create account system instruction and retrieve the instruction params.
*/
static decodeCreateAccount(instruction: TransactionInstruction): DecodedCreateAccountInstruction;
/**
* Decode a transfer system instruction and retrieve the instruction params.
*/
static decodeTransfer(instruction: TransactionInstruction): DecodedTransferInstruction;
/**
* Decode a transfer with seed system instruction and retrieve the instruction params.
*/
static decodeTransferWithSeed(instruction: TransactionInstruction): DecodedTransferWithSeedInstruction;
/**
* Decode an allocate system instruction and retrieve the instruction params.
*/
static decodeAllocate(instruction: TransactionInstruction): DecodedAllocateInstruction;
/**
* Decode an allocate with seed system instruction and retrieve the instruction params.
*/
static decodeAllocateWithSeed(instruction: TransactionInstruction): DecodedAllocateWithSeedInstruction;
/**
* Decode an assign system instruction and retrieve the instruction params.
*/
static decodeAssign(instruction: TransactionInstruction): AssignParams;
/**
* Decode an assign with seed system instruction and retrieve the instruction params.
*/
static decodeAssignWithSeed(instruction: TransactionInstruction): AssignWithSeedParams;
/**
* Decode a create account with seed system instruction and retrieve the instruction params.
*/
static decodeCreateWithSeed(instruction: TransactionInstruction): DecodedCreateAccountWithSeedInstruction;
/**
* Decode a nonce initialize system instruction and retrieve the instruction params.
*/
static decodeNonceInitialize(instruction: TransactionInstruction): InitializeNonceParams;
/**
* Decode a nonce advance system instruction and retrieve the instruction params.
*/
static decodeNonceAdvance(instruction: TransactionInstruction): AdvanceNonceParams;
/**
* Decode a nonce withdraw system instruction and retrieve the instruction params.
*/
static decodeNonceWithdraw(instruction: TransactionInstruction): DecodedWithdrawNonceInstruction;
/**
* Decode a nonce authorize system instruction and retrieve the instruction params.
*/
static decodeNonceAuthorize(instruction: TransactionInstruction): AuthorizeNonceParams;
}
type ValueOf<TRecord> = TRecord extends Record<PropertyKey, infer TValue> ? TValue : never;
declare const GENERATED_TO_LEGACY_INSTRUCTION_TYPE: {
readonly 4: "AdvanceNonceAccount";
readonly 8: "Allocate";
readonly 9: "AllocateWithSeed";
readonly 1: "Assign";
readonly 10: "AssignWithSeed";
readonly 7: "AuthorizeNonceAccount";
readonly 0: "Create";
readonly 13: "CreateAllowPrefund";
readonly 3: "CreateWithSeed";
readonly 6: "InitializeNonceAccount";
readonly 2: "Transfer";
readonly 11: "TransferWithSeed";
readonly 12: "UpgradeNonceAccount";
readonly 5: "WithdrawNonceAccount";
};
/**
* An enumeration of valid SystemInstructionType's
*/
export type SystemInstructionType = ValueOf<typeof GENERATED_TO_LEGACY_INSTRUCTION_TYPE>;
/**
* Factory class for transactions to interact with the System program
*/
export declare class SystemProgram {
/**
* Public key that identifies the System program
*/
static programId: PublicKey;
/**
* Generate a transaction instruction that creates a new account
*/
static createAccount(params: CreateAccountParams): TransactionInstruction;
/**
* Generate a transaction instruction that transfers lamports from one account to another
*/
static transfer(params: TransferParams | TransferWithSeedParams): TransactionInstruction;
/**
* Generate a transaction instruction that assigns an account to a program
*/
static assign(params: AssignParams | AssignWithSeedParams): TransactionInstruction;
/**
* Generate a transaction instruction that creates a new account at
* an address generated with `from`, a seed, and programId
*/
static createAccountWithSeed(params: CreateAccountWithSeedParams): TransactionInstruction;
/**
* Generate a transaction that creates a new Nonce account
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
static createNonceAccount(params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams): Transaction;
/**
* Generate an instruction to initialize a Nonce account
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
static nonceInitialize(params: InitializeNonceParams): TransactionInstruction;
/**
* Generate an instruction to advance the nonce in a Nonce account
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
/**
* Generate a transaction instruction that withdraws lamports from a Nonce account
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
/**
* Generate a transaction instruction that authorizes a new PublicKey as the authority
* on a Nonce account.
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
/**
* Generate a transaction instruction that allocates space in an account without funding
*/
static allocate(params: AllocateParams | AllocateWithSeedParams): TransactionInstruction;
}
/**
* Vote account info
*/
export declare class VoteInit {
nodePubkey: PublicKey;
authorizedVoter: PublicKey;
authorizedWithdrawer: PublicKey;
/** Expected percentage commission value, in the inclusive range [0, 100]. */
commission: number;
constructor(nodePubkey: PublicKey, authorizedVoter: PublicKey, authorizedWithdrawer: PublicKey, commission: number);
}
/**
* Create vote account transaction params
*/
export type CreateVoteAccountParams = {
fromPubkey: PublicKey;
votePubkey: PublicKey;
voteInit: VoteInit;
lamports: number;
};
/**
* InitializeAccount instruction params
*/
export type InitializeAccountParams = {
votePubkey: PublicKey;
nodePubkey: PublicKey;
voteInit: VoteInit;
};
/**
* Authorize instruction params
*/
export type AuthorizeVoteParams = {
votePubkey: PublicKey;
/** Current vote or withdraw authority, depending on `voteAuthorizationType` */
authorizedPubkey: PublicKey;
newAuthorizedPubkey: PublicKey;
voteAuthorizationType: VoteAuthorizationType;
};
/**
* AuthorizeWithSeed instruction params
*/
export type AuthorizeVoteWithSeedParams = {
currentAuthorityDerivedKeyBasePubkey: PublicKey;
currentAuthorityDerivedKeyOwnerPubkey: PublicKey;
currentAuthorityDerivedKeySeed: string;
newAuthorizedPubkey: PublicKey;
voteAuthorizationType: VoteAuthorizationType;
votePubkey: PublicKey;
};
/**
* AuthorizeChecked instruction params
*/
export type AuthorizeCheckedVoteParams = AuthorizeVoteParams;
/**
* AuthorizeCheckedWithSeed instruction params
*/
export type AuthorizeCheckedVoteWithSeedParams = AuthorizeVoteWithSeedParams;
/**
* Withdraw from vote account transaction params
*/
export type WithdrawFromVoteAccountParams = {
votePubkey: PublicKey;
authorizedWithdrawerPubkey: PublicKey;
lamports: number | bigint;
toPubkey: PublicKey;
};
export type DecodedWithdrawFromVoteAccountParams = Omit<WithdrawFromVoteAccountParams, 'lamports'> & {
lamports: bigint;
};
/**
* Update validator identity (node pubkey) vote account instruction params.
*/
export type UpdateValidatorIdentityParams = {
votePubkey: PublicKey;
authorizedWithdrawerPubkey: PublicKey;
nodePubkey: PublicKey;
};
/**
* UpdateCommission instruction params.
*/
export type UpdateCommissionVoteParams = {
votePubkey: PublicKey;
authorizedWithdrawerPubkey: PublicKey;
commission: number;
};
/**
* An enumeration of valid VoteInstructionType's
*/
export type VoteInstructionType = 'Authorize' | 'AuthorizeChecked' | 'AuthorizeCheckedWithSeed' | 'AuthorizeWithSeed' | 'InitializeAccount' | 'UpdateCommission' | 'Withdraw' | 'UpdateValidatorIdentity';
/**
* VoteAuthorize type
*/
export type VoteAuthorizationType = {
/** The VoteAuthorize index (from solana-vote-program) */
index: number;
};
/**
* An enumeration of valid VoteAuthorization layouts.
*/
export declare const VoteAuthorizationLayout: Readonly<{
readonly Voter: {
readonly index: 0;
};
readonly Withdrawer: {
readonly index: 1;
};
}>;
/**
* Vote Instruction class
*/
export declare class VoteInstruction {
/**
* Decode a vote instruction and retrieve the instruction type.
*/
static decodeInstructionType(instruction: TransactionInstruction): VoteInstructionType;
/**
* Decode an initialize vote instruction and retrieve the instruction params.
*/
static decodeInitializeAccount(instruction: TransactionInstruction): InitializeAccountParams;
/**
* Decode an authorize instruction and retrieve the instruction params.
*/
static decodeAuthorize(instruction: TransactionInstruction): AuthorizeVoteParams;
/**
* Decode an authorize-checked instruction and retrieve the instruction params.
*/
static decodeAuthorizeChecked(instruction: TransactionInstruction): AuthorizeCheckedVoteParams;
/**
* Decode an authorize instruction and retrieve the instruction params.
*/
static decodeAuthorizeWithSeed(instruction: TransactionInstruction): AuthorizeVoteWithSeedParams;
/**
* Decode an authorize-checked-with-seed instruction and retrieve the params.
*/
static decodeAuthorizeCheckedWithSeed(instruction: TransactionInstruction): AuthorizeCheckedVoteWithSeedParams;
/**
* Decode a withdraw instruction and retrieve the instruction params.
*/
static decodeWithdraw(instruction: TransactionInstruction): DecodedWithdrawFromVoteAccountParams;
/**
* Decode an update-validator-identity instruction and retrieve the params.
*/
static decodeUpdateValidatorIdentity(instruction: TransactionInstruction): UpdateValidatorIdentityParams;
/**
* Decode an update-commission instruction and retrieve the params.
*/
static decodeUpdateCommission(instruction: TransactionInstruction): UpdateCommissionVoteParams;
}
/**
* Factory class for transactions to interact with the Vote program
*/
export declare class VoteProgram {
/**
* Public key that identifies the Vote program
*/
static programId: PublicKey;
/**
* Max Space for newly created vote accounts using the current Agave vote-state
* layout targeted by this client.
*
* Vote Program v3.1.13 (https://docs.rs/solana-vote-program/3.1.13/solana_vote_program/) reports:
* - `VoteStateV4::size_of() == 3762`
* - `VoteStateV3::size_of() == 3762`
* - `VoteState1_14_11::size_of() == 3731`
*
* The smaller legacy `VoteState1_14_11` size does not change this
* constant: existing historical vote accounts may still use that older
* layout, but new accounts should allocate enough space for the current
* V3/V4 layout.
*
* Keep this in sync with Agave vote-program sizing in
* https://github.com/anza-xyz/agave/blob/3134055b562e95902233be308453fffa1c4a8902/programs/vote/src/vote_state/mod.rs.
*/
static space: number;
/**
* Generate an Initialize instruction.
*/
static initializeAccount(params: InitializeAccountParams): TransactionInstruction;
/**
* Generate a transaction that creates a new Vote account.
*/
static createAccount(params: CreateVoteAccountParams): Transaction;
/**
* Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
*/
static authorize(params: AuthorizeVoteParams): Transaction;
/**
* Generate a transaction that authorizes a new Voter or Withdrawer and requires the new
* authority to sign.
*/
static authorizeChecked(params: AuthorizeCheckedVoteParams): Transaction;
/**
* Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account
* where the current Voter or Withdrawer authority is a derived key.
*/
static authorizeWithSeed(params: AuthorizeVoteWithSeedParams): Transaction;
/**
* Generate a transaction that authorizes a new Voter or Withdrawer from a derived key and
* requires the new authority to sign.
*/
static authorizeCheckedWithSeed(params: AuthorizeCheckedVoteWithSeedParams): Transaction;
/**
* Generate a transaction to withdraw from a Vote account.
*/
static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
/**
* Generate a transaction to withdraw safely from a Vote account.
*
* This function was created as a safeguard for vote accounts running validators, `safeWithdraw`
* checks that the withdraw amount will not exceed the specified balance while leaving enough left
* to cover rent. If you wish to close the vote account by withdrawing the full amount, call the
* `withdraw` method directly.
*/
static safeWithdraw(params: WithdrawFromVoteAccountParams, currentVoteAccountBalance: number | bigint, rentExemptMinimum: number | bigint): Transaction;
/**
* Generate a transaction to update the commission on a Vote account.
*/
static updateCommission(params: UpdateCommissionVoteParams): Transaction;
/**
* Generate a transaction to update the validator identity (node pubkey) of a Vote account.
*/
static updateValidatorIdentity(params: UpdateValidatorIdentityParams): Transaction;
}
/**
* Message constructor arguments
*/
export type MessageV0Args = {
/** The message header, identifying signed and read-only `accountKeys` */
header: MessageHeader;
/** The static account keys used by this transaction */
staticAccountKeys: PublicKey[];
/** The hash of a recent ledger block */
recentBlockhash: Blockhash$1;
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
compiledInstructions: MessageCompiledInstruction[];
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
addressTableLookups: MessageAddressTableLookup[];
};
export type CompileV0Args = {
payerKey: PublicKey;
instructions: Array<InstructionInput>;
recentBlockhash: Blockhash$1;
addressLookupTableAccounts?: Array<AddressLookupTableAccount>;
};
export type GetAccountKeysArgs = {
accountKeysFromLookups?: AccountKeysFromLookups | null;
} | {
addressLookupTableAccounts?: AddressLookupTableAccount[] | null;
};
export declare class MessageV0 {
readonly header: Readonly<MessageHeader>;
staticAccountKeys: Array<PublicKey>;
recentBlockhash: Blockhash$1;
compiledInstructions: Array<MessageCompiledInstruction>;
addressTableLookups: Array<MessageAddressTableLookup>;
constructor(args: MessageV0Args);
get version(): 0;
get numAccountKeysFromLookups(): number;
getAccountKeys(args?: GetAccountKeysArgs): MessageAccountKeys;
isAccountSigner(index: number): boolean;
isAccountWritable(index: number): boolean;
resolveAddressTableLookups(addressLookupTableAccounts: AddressLookupTableAccount[]): AccountKeysFromLookups;
static compile(args: CompileV0Args): MessageV0;
serialize(): Uint8Array;
static deserialize(serializedMessage: Uint8Array): MessageV0;
}
/**
* Message constructor arguments
*/
export type MessageV1Args = {
/** The message header, identifying signed and read-only `accountKeys` */
header: MessageHeader;
/** The static account keys used by this transaction */
staticAccountKeys: PublicKey[];
/** The hash of a recent ledger block */
recentBlockhash: Blockhash$1;
/** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
compiledInstructions: MessageCompiledInstruction[];
/** Message-level resource limits and prioritization for this transaction */
transactionConfig?: V1TransactionConfig;
};
export type CompileV1Args = {
payerKey: PublicKey;
instructions: Array<InstructionInput>;
recentBlockhash: Blockhash$1;
transactionConfig?: V1TransactionConfig;
};
/**
* A v1 transaction message (SIMD-0385).
*
* Compared to v0, a v1 message:
* - carries resource limits and prioritization in a message-level
* {@link V1TransactionConfig} instead of Compute Budget program instructions
* (which are no-ops inside a v1 transaction),
* - does not support address lookup tables,
* - may be up to 4096 bytes when serialized as a transaction (vs. 1232), and
* - uses a message-first wire envelope when framed as a transaction.
*
* Fetching v1 transactions over RPC requires passing
* `maxSupportedTransactionVersion: 1` to `getTransaction`/`getBlock`.
*/
export declare class MessageV1 {
readonly header: Readonly<MessageHeader>;
staticAccountKeys: Array<PublicKey>;
recentBlockhash: Blockhash$1;
compiledInstructions: Array<MessageCompiledInstruction>;
/** Message-level resource limits and prioritization; `undefined` when no config values are set */
transactionConfig?: V1TransactionConfig;
constructor(args: MessageV1Args);
get version(): 1;
getAccountKeys(): MessageAccountKeys;
isAccountSigner(index: number): boolean;
isAccountWritable(index: number): boolean;
static compile(args: CompileV1Args): MessageV1;
serialize(): Uint8Array;
static deserialize(serializedMessage: Uint8Array): MessageV1;
}
export type VersionedMessage = Message | MessageV0 | MessageV1;
export declare const VersionedMessage: {
deserializeMessageVersion(serializedMessage: Uint8Array): "legacy" | number;
deserialize: (serializedMessage: Uint8Array) => VersionedMessage;
};
/**
* The message header, identifying signed and read-only account
*/
export type MessageHeader = {
/**
* The number of signatures required for this message to be considered valid. The
* signatures must match the first `numRequiredSignatures` of `accountKeys`.
*/
numRequiredSignatures: number;
/** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
numReadonlySignedAccounts: number;
/** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
numReadonlyUnsignedAccounts: number;
};
/**
* An address table lookup used to load additional accounts
*/
export type MessageAddressTableLookup = {
accountKey: PublicKey;
writableIndexes: Array<number>;
readonlyIndexes: Array<number>;
};
/**
* An instruction to execute by a program
*
* @property {number} programIdIndex
* @property {number[]} accountKeyIndexes
* @property {Uint8Array} data
*/
export type MessageCompiledInstruction = {
/** 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 */
accountKeyIndexes: number[];
/** The program input data */
data: Uint8Array;
};
export declare const NONCE_ACCOUNT_LENGTH: number;
/**
* A durable nonce is a 32 byte value encoded as a base58 string.
*/
export type DurableNonce = Blockhash$1;
/**
* NonceAccount class
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
export declare class NonceAccount {
authorizedPubkey: PublicKey;
nonce: DurableNonce;
feeCalculator: {
lamportsPerSignature: number;
};
/**
* Deserialize NonceAccount from the account data.
*
* @param buffer account data
* @return NonceAccount
*/
static fromAccountData(buffer: Uint8Array | Array<number>): NonceAccount;
}
type SubscriptionChannelConfig = Readonly<{
intervalMs?: number;
maxSubscriptionsPerChannel?: number;
minChannels?: number;
}>;
type ClientSubscriptionId = number;
/**
* Extra contextual information for RPC responses
*/
export type Context = {
slot: bigint;
};
/**
* Information describing an account
*/
export type AccountInfo<T> = {
/** `true` if this account's data contains a loaded program */
executable: boolean;
/** Identifier of the program that owns the account */
owner: PublicKey;
/** Number of lamports assigned to the account */
lamports: bigint;
/** Optional data assigned to the account */
data: T;
/** Rent epoch info for account */
rentEpoch: bigint;
};
export type AccountInfoWithSpace<T> = Readonly<AccountInfo<T> & {
space: bigint;
}>;
/**
* Account information identified by pubkey.
*
* The payload is generic so subscription callbacks can surface either raw
* bytes or parsed account data depending on the requested encoding.
*/
export type KeyedAccountInfo<T = Uint8Array> = {
accountId: PublicKey;
accountInfo: AccountInfoWithSpace<T>;
};
/**
* Information about the latest slot being processed by a node
*/
export type SlotInfo = {
/** Currently processing slot */
slot: bigint;
/** Parent of the current slot */
parent: bigint;
/** The root block of the current slot's fork */
root: bigint;
};
/**
* A slot update notification.
*
* - `"firstShredReceived"`: connected node received the first shred of a block.
* - `"completed"`: connected node received all shreds of a block.
* - `"createdBank"`: connected node has started validating this block.
* - `"frozen"`: connected node has validated this block.
* - `"dead"`: connected node failed to validate this block.
* - `"optimisticConfirmation"`: block was optimistically confirmed by the cluster.
* - `"root"`: the connected node rooted this block.
*/
export type SlotUpdate = {
type: 'firstShredReceived';
slot: bigint;
timestamp: bigint;
} | {
type: 'completed';
slot: bigint;
timestamp: bigint;
} | {
type: 'createdBank';
slot: bigint;
timestamp: bigint;
parent: bigint;
} | {
type: 'frozen';
slot: bigint;
timestamp: bigint;
stats: {
numTransactionEntries: bigint;
numSuccessfulTransactions: bigint;
numFailedTransactions: bigint;
maxTransactionsPerEntry: bigint;
};
} | {
type: 'dead';
slot: bigint;
timestamp: bigint;
err: string;
} | {
type: 'optimisticConfirmation';
slot: bigint;
timestamp: bigint;
} | {
type: 'root';
slot: bigint;
timestamp: bigint;
};
/**
* Transaction error
*/
export type TransactionError = TransactionError$1;
/**
* Signature result
*/
export type SignatureResult = {
err: TransactionError | null;
};
/**
* Signature status notification
*/
export type SignatureStatusNotification = {
type: 'status';
result: SignatureResult;
};
/**
* Signature received notification
*/
export type SignatureReceivedNotification = {
type: 'received';
};
/**
* Vote observed in gossip.
*
* These votes are pre-consensus and are not guaranteed to land in the ledger.
*/
export type Vote = {
hash: Blockhash$1;
signature: TransactionSignature;
slots: bigint[];
timestamp: bigint | null;
votePubkey: PublicKey;
};
/**
* Logs result.
*/
export type Logs = {
err: TransactionError | null;
logs: string[];
signature: string;
};
type Overwrite<T, U extends Partial<Record<keyof T, unknown>>> = Omit<T, keyof U> & U;
export type TokenAccountsFilter = {
mint: PublicKey;
} | {
programId: PublicKey;
};
/**
* Options for sending transactions
*/
export type SendOptions = Omit<NonNullable<Parameters<SendTransactionApi['sendTransaction']>[1]>, 'encoding'>;
/**
* Options for confirming transactions
*/
export type ConfirmOptions = SendOptions & {
/** desired commitment level */
commitment?: Commitment;
};
/**
* Options for getSignaturesForAddress
*/
export type SignaturesForAddressOptions = {
/**
* Start searching backwards from this transaction signature.
* @remarks If not provided the search starts from the highest max confirmed block.
*/
before?: TransactionSignature;
/** Search until this transaction signature is reached, if found before `limit`. */
until?: TransactionSignature;
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
limit?: number;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* A range comparison applied to a slot or block time. All bounds are optional and combined with AND.
*/
export type TransactionsForAddressNumericComparison = {
gt?: number | bigint;
gte?: number | bigint;
lt?: number | bigint;
lte?: number | bigint;
};
/**
* A range comparison applied to a transaction's signature ordering. All bounds are optional and
* combined with AND.
*/
export type TransactionsForAddressSignatureComparison = {
gt?: TransactionSignature;
gte?: TransactionSignature;
lt?: TransactionSignature;
lte?: TransactionSignature;
};
/**
* Server-side filters for `getTransactionsForAddress`. Supplying more than one combines them with AND.
*/
export type TransactionsForAddressFilters = {
/** Restrict results to a range of block times. Unlike the other comparisons, also supports an exact `eq` match */
blockTime?: TransactionsForAddressNumericComparison & {
eq?: number | bigint;
};
/** Restrict results to a range of signature orderings */
signature?: TransactionsForAddressSignatureComparison;
/** Restrict results to a range of slots */
slot?: TransactionsForAddressNumericComparison;
/** Restrict results by execution status (default: `'any'`) */
status?: 'any' | 'failed' | 'succeeded';
/** Control whether activity on token accounts owned by the address is included (default: `'none'`) */
tokenAccounts?: 'all' | 'balanceChanged' | 'none';
};
/**
* Configuration object for changing `getTransactionsForAddress` query behavior
*/
export type GetTransactionsForAddressConfig = {
/** The level of finality desired */
commitment?: Finality;
/** Optional server-side filters that narrow the set of returned transactions */
filters?: TransactionsForAddressFilters;
/** Maximum number of results to return. Caps vary by provider, commonly 1,000 for signatures and 100 for full transactions */
limit?: number;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
/** A cursor returned as `paginationToken` by a previous response */
paginationToken?: string;
/** The order in which transactions are returned (default: `'desc'`) */
sortOrder?: 'asc' | 'desc';
};
/**
* Configuration object for fetching full transactions with `getTransactionsForAddress`
*/
export type GetFullTransactionsForAddressConfig = GetTransactionsForAddressConfig & {
/** How each transaction is encoded in the response (default: `'json'`) */
encoding?: 'base64' | 'json' | 'jsonParsed';
/** The max transaction version to return in responses. If a matching transaction is a higher version, an error will be returned */
maxSupportedTransactionVersion?: GetVersionedTransactionConfig['maxSupportedTransactionVersion'];
/** Return full transactions instead of signature-level results */
transactionDetails: 'full';
};
/**
* A page of results returned by `getTransactionsForAddress`
*/
export interface TransactionsForAddressResponse<T> {
/** The matching transactions, ordered according to the requested `sortOrder` */
readonly data: T[];
/** A cursor to pass as `paginationToken` to continue scanning, or `null` when there are no more results */
readonly paginationToken: string | null;
}
/**
* RPC Response with extra contextual information
*/
export type RpcResponseAndContext<T> = {
/** response context */
context: Context;
/** response value */
value: T;
};
type GetBalanceKitResult = ReturnType<GetBalanceApi['getBalance']>;
type GetBlocksResult = ReturnType<GetBlocksApi['getBlocks']>;
type GetBlocksWithLimitResult = ReturnType<GetBlocksWithLimitApi['getBlocksWithLimit']>;
type GetSignaturesForAddressKitResult = ReturnType<GetSignaturesForAddressApi['getSignaturesForAddress']>;
type GetTransactionsForAddressSignaturesKitResult = ReturnType<GetTransactionsForAddressApi['getTransactionsForAddress']>;
export type BlockhashWithExpiryBlockHeight = Readonly<{
blockhash: Blockhash$1;
/**
* Last block height at which the blockhash will be considered a valid
* lifetime specifier with which to land a transaction.
*/
lastValidBlockHeight: bigint;
}>;
/**
* A strategy for confirming transactions that uses the last valid
* block height for a given blockhash to check for transaction expiration.
*/
export type BlockheightBasedTransactionConfirmationStrategy = BaseTransactionConfirmationStrategy & Readonly<Overwrite<BlockhashWithExpiryBlockHeight, {
lastValidBlockHeight: number | bigint;
}>>;
/**
* A strategy for confirming durable nonce transactions.
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
export type DurableNonceTransactionConfirmationStrategy = BaseTransactionConfirmationStrategy & {
/**
* The lowest slot at which to fetch the nonce value from the
* nonce account. This should be no lower than the slot at
* which the last-known value of the nonce was fetched. When
* omitted, the nonce account is read at the current slot.
*/
minContextSlot?: number | bigint;
/**
* The account where the current value of the nonce is stored.
*/
nonceAccountPubkey: PublicKey;
/**
* The nonce value that was used to sign the transaction
* for which confirmation is being sought.
*/
nonceValue: DurableNonce;
};
/**
* Properties shared by all transaction confirmation strategies
*/
export type BaseTransactionConfirmationStrategy = Readonly<{
/** A signal that, when aborted, cancels any outstanding transaction confirmation operations */
abortSignal?: AbortSignal;
signature: TransactionSignature;
}>;
export type SubscriptionReadyConfig = Readonly<{
/**
* A signal that, when aborted, cancels waiting for a subscription to become
* ready.
*/
abortSignal?: AbortSignal;
}>;
/**
* This type represents all transaction confirmation strategies
*/
export type TransactionConfirmationStrategy = BlockheightBasedTransactionConfirmationStrategy | DurableNonceTransactionConfirmationStrategy;
/**
* A subset of Commitment levels, which are at least optimistically confirmed
* <pre>
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
* 'finalized': Query the most recent block which has been finalized by the cluster
* </pre>
*/
export type Finality = 'confirmed' | 'finalized';
/**
* Filter for largest accounts query
* <pre>
* 'circulating': Return the largest accounts that are part of the circulating supply
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
* </pre>
*/
export type LargestAccountsFilter = 'circulating' | 'nonCirculating';
/**
* Configuration object for changing `getAccountInfo` query behavior
*/
export type GetAccountInfoConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
};
/**
* Configuration object for changing `getBalance` query behavior
*/
export type GetBalanceConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getBlock` query behavior
*/
export type GetBlockConfig = {
/** The level of finality desired */
commitment?: Finality;
/**
* Whether to populate the rewards array. If parameter not provided, the default includes rewards.
*/
rewards?: boolean;
/**
* Level of transaction detail to return, either "full", "accounts", "signatures", or "none". If
* parameter not provided, the default detail level is "full". If "accounts" are requested,
* transaction details only include signatures and an annotated list of accounts in each
* transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances,
* pre_token_balances, and post_token_balances.
*/
transactionDetails?: 'accounts' | 'full' | 'none' | 'signatures';
};
/**
* Configuration object for changing `getBlock` query behavior
*/
export type GetVersionedBlockConfig = {
/** The level of finality desired */
commitment?: Finality;
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
maxSupportedTransactionVersion?: number;
/**
* Whether to populate the rewards array. If parameter not provided, the default includes rewards.
*/
rewards?: boolean;
/**
* Level of transaction detail to return, either "full", "accounts", "signatures", or "none". If
* parameter not provided, the default detail level is "full". If "accounts" are requested,
* transaction details only include signatures and an annotated list of accounts in each
* transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances,
* pre_token_balances, and post_token_balances.
*/
transactionDetails?: 'accounts' | 'full' | 'none' | 'signatures';
};
/**
* Configuration object for changing `getStakeMinimumDelegation` query behavior
*/
export type GetStakeMinimumDelegationConfig = {
/** The level of commitment desired */
commitment?: Commitment;
};
/**
* Configuration object for changing `getBlockHeight` query behavior
*/
export type GetBlockHeightConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getEpochInfo` query behavior
*/
export type GetEpochInfoConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getLeaderSchedule` query behavior
*/
export type GetLeaderScheduleConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** Only return results for this validator identity */
identity?: string;
/** Key the returned schedule by vote account instead of validator identity */
keyByVoteAccount?: boolean;
};
/**
* Configuration object for changing `getInflationReward` query behavior
*/
export type GetInflationRewardConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** An epoch for which the reward occurs. If omitted, the previous epoch will be used */
epoch?: number | bigint;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getLatestBlockhash` query behavior
*/
export type GetLatestBlockhashConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getFeeForMessage` query behavior
*/
export type GetFeeForMessageConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `requestAirdrop` query behavior
*/
export type RequestAirdropConfig = {
/** The level of commitment desired */
commitment?: Commitment;
};
/**
* Configuration object for changing `isBlockhashValid` query behavior
*/
export type IsBlockhashValidConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getSlot` query behavior
*/
export type GetSlotConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getSlotLeader` query behavior
*/
export type GetSlotLeaderConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getTransaction` query behavior
*/
export type GetTransactionConfig = {
/** The level of finality desired */
commitment?: Finality;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getTransaction` query behavior
*/
export type GetVersionedTransactionConfig = {
/** The level of finality desired */
commitment?: Finality;
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
maxSupportedTransactionVersion?: number;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for changing `getLargestAccounts` query behavior
*/
export type GetLargestAccountsConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** Filter largest accounts by whether they are part of the circulating supply */
filter?: LargestAccountsFilter;
};
/**
* Configuration object for changing `getSupply` request behavior
*/
export type GetSupplyConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** Exclude non circulating accounts list from response */
excludeNonCirculatingAccountsList?: boolean;
};
/**
* Configuration object for changing query behavior
*/
export type SignatureStatusConfig = {
/** The level of commitment desired */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
/** enable searching status history, not needed for recent transactions */
searchTransactionHistory?: boolean;
};
/**
* Information describing a cluster node
*/
export type ContactInfo = {
/** Identity public key of the node */
pubkey: string;
/** Gossip network address for the node */
gossip: string | null;
/** TPU network address for the node (null if not available) */
tpu: string | null;
/** JSON RPC network address for the node (null if not available) */
rpc: string | null;
/** Software version of the node (null if not available) */
version: string | null;
};
/**
* Information describing a vote account
*/
type GetVoteAccountsKitResult = ReturnType<GetVoteAccountsApi['getVoteAccounts']>;
export type VoteAccountInfo = Overwrite<GetVoteAccountsKitResult['current'][number], {
rootSlot: bigint | null;
}>;
/**
* A collection of cluster vote accounts
*/
export type VoteAccountStatus = Overwrite<GetVoteAccountsKitResult, {
current: readonly VoteAccountInfo[];
delinquent: readonly VoteAccountInfo[];
}>;
/**
* Network Inflation
* (see https://docs.solana.com/implemented-proposals/ed_overview)
*/
export type InflationGovernor = {
foundation: number;
foundationTerm: number;
initial: number;
taper: number;
terminal: number;
};
/**
* The inflation reward for an epoch
*/
export type InflationReward = NonNullable<ReturnType<GetInflationRewardApi['getInflationReward']>[number]>;
type RecentPrioritizationFeesKitResult = ReturnType<GetRecentPrioritizationFeesApi['getRecentPrioritizationFees']>[number];
export type RecentPrioritizationFees = Overwrite<RecentPrioritizationFeesKitResult, {
/**
* The smallest per-compute-unit fee paid by at least one successfully
* landed transaction, in micro-lamports (0.000001 lamports).
*/
prioritizationFee: RecentPrioritizationFeesKitResult['prioritizationFee'];
}>;
/**
* Configuration object for changing `getRecentPrioritizationFees` query behavior
*/
export type GetRecentPrioritizationFeesConfig = {
/**
* If this parameter is provided, the response will reflect a fee to land a transaction locking
* all of the provided accounts as writable.
*/
lockedWritableAccounts?: PublicKey[];
};
export type InflationRate = ReturnType<GetInflationRateApi['getInflationRate']>;
/**
* Information about the current epoch
*/
export type EpochInfo = ReturnType<GetEpochInfoApi['getEpochInfo']>;
/**
* Leader schedule
* (see https://docs.solana.com/terminology#leader-schedule)
*/
export type LeaderSchedule = {
[address: string]: bigint[];
};
/**
* Identity for an RPC node.
*/
export type Identity = {
identity: PublicKey;
};
export type SimulatedTransactionAccountInfo = {
/** `true` if this account's data contains a loaded program */
executable: boolean;
/** Identifier of the program that owns the account */
owner: string;
/** Number of lamports assigned to the account */
lamports: bigint;
/** Optional data assigned to the account */
data: string[];
/** Optional rent epoch info for account */
rentEpoch?: bigint;
/** Size of the account data */
space: bigint;
};
export type TransactionReturnDataEncoding = 'base64';
export type TransactionReturnData = {
programId: string;
data: [string, TransactionReturnDataEncoding];
};
export type SimulateTransactionConfig = {
/** Optional parameter used to enable signature verification before simulation */
sigVerify?: boolean;
/** Optional parameter used to replace the simulated transaction's recent blockhash with the latest blockhash */
replaceRecentBlockhash?: boolean;
/** Optional parameter used to set the commitment level when selecting the latest block */
commitment?: Commitment;
/** Optional parameter used to specify a list of base58-encoded account addresses to return post simulation state for */
accounts?: {
/** The encoding of the returned account's data */
encoding: 'base64';
addresses: string[];
};
/** Optional parameter used to specify the minimum block slot that can be used for simulation */
minContextSlot?: number | bigint;
/** Optional parameter used to include inner instructions in the simulation */
innerInstructions?: boolean;
};
export type SimulatedTransactionResponse = {
err: TransactionError | null;
logs: Array<string> | null;
accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
fee?: bigint | null;
preBalances?: bigint[] | null;
postBalances?: bigint[] | null;
preTokenBalances?: TokenBalance[] | null;
postTokenBalances?: TokenBalance[] | null;
loadedAddresses?: LoadedAddresses | null;
loadedAccountsDataSize?: number;
replacementBlockhash?: BlockhashWithExpiryBlockHeight;
unitsConsumed?: bigint;
returnData?: TransactionReturnData | null;
innerInstructions?: ParsedInnerInstruction[] | null;
};
export type ParsedInnerInstruction = {
index: number;
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
};
export type TokenBalance = {
accountIndex: number;
mint: string;
owner?: string;
programId?: string;
uiTokenAmount: TokenAmount;
};
/**
* Metadata for a parsed confirmed transaction on the ledger
*
* @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionMeta} instead.
*/
export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
/**
* Collection of addresses loaded by a transaction using address table lookups
*/
export type LoadedAddresses = {
writable: Array<PublicKey>;
readonly: Array<PublicKey>;
};
/**
* Inner instructions invoked during processing of a top-level instruction
*/
export type CompiledInnerInstruction = {
index: number;
instructions: (CompiledInstruction & {
/** The invocation depth of this instruction: top-level instructions have a stack height of 1, their CPIs 2, and so on */
stackHeight?: number;
})[];
};
type RpcParsedMessageInstruction = TransactionForFullJsonParsed<0 | 1>['transaction']['message']['instructions'][number];
type RpcPartiallyDecodedInstruction = Exclude<RpcParsedMessageInstruction, Readonly<{
parsed: unknown;
}>>;
type RpcParsedInstruction = Extract<RpcParsedMessageInstruction, Readonly<{
parsed: unknown;
}>>;
type RpcParsedMessageAccount = TransactionForAccounts<0 | 1>['transaction']['accountKeys'][number];
type RpcParsedAddressTableLookup = NonNullable<NonNullable<TransactionForFullJson<0 | 1>['transaction']['message']['addressTableLookups']>>[number];
type RpcParsedTransaction = TransactionForFullJsonParsed<0 | 1>['transaction'];
/**
* Metadata for a confirmed transaction on the ledger
*/
export type ConfirmedTransactionMeta = Overwrite<Omit<NonNullable<TransactionForFullJson<0 | 1>['meta']>, 'status'>, {
/** The fee charged for processing the transaction */
fee: bigint;
/** An array of cross program invoked instructions */
innerInstructions?: CompiledInnerInstruction[] | null;
/** The balances of the transaction accounts before processing */
preBalances: Array<bigint>;
/** The balances of the transaction accounts after processing */
postBalances: Array<bigint>;
/** An array of program log messages emitted during a transaction */
logMessages?: Array<string> | null;
/** The token balances of the transaction accounts before processing */
preTokenBalances?: Array<TokenBalance> | null;
/** The token balances of the transaction accounts after processing */
postTokenBalances?: Array<TokenBalance> | null;
/** The error result of transaction processing */
err: TransactionError | null;
/** The collection of addresses loaded using address lookup tables */
loadedAddresses?: LoadedAddresses;
/** The compute units consumed after processing the transaction */
computeUnitsConsumed?: bigint;
/** The return data from the transaction */
returnData?: TransactionReturnData | null;
/** Rewards credited or debited by the transaction */
rewards?: Array<RpcBlockRewardLike> | null;
}> & {
/** The cost units consumed after processing the transaction */
costUnits?: bigint;
};
/**
* Metadata for a parsed transaction on the ledger
*/
export type ParsedTransactionMeta = Overwrite<Omit<NonNullable<TransactionForFullJsonParsed<0 | 1>['meta']>, 'status'>, {
/** The fee charged for processing the transaction */
fee: bigint;
/** An array of cross program invoked parsed instructions */
innerInstructions?: ParsedInnerInstruction[] | null;
/** The balances of the transaction accounts before processing */
preBalances: Array<bigint>;
/** The balances of the transaction accounts after processing */
postBalances: Array<bigint>;
/** An array of program log messages emitted during a transaction */
logMessages?: Array<string> | null;
/** The token balances of the transaction accounts before processing */
preTokenBalances?: Array<TokenBalance> | null;
/** The token balances of the transaction accounts after processing */
postTokenBalances?: Array<TokenBalance> | null;
/** The error result of transaction processing */
err: TransactionError | null;
/** The collection of addresses loaded using address lookup tables */
loadedAddresses?: LoadedAddresses;
/** The compute units consumed after processing the transaction */
computeUnitsConsumed?: bigint;
/** The return data from the transaction */
returnData?: TransactionReturnData | null;
/** Rewards credited or debited by the transaction */
rewards?: Array<RpcBlockRewardLike> | null;
}> & {
/** The cost units consumed after processing the transaction */
costUnits?: bigint;
};
type TransactionResponseBase = {
slot: bigint;
blockTime?: bigint | null;
};
/**
* A processed transaction from the RPC API
*/
export type TransactionResponse = TransactionResponseBase & Overwrite<TransactionForFullJson<void>, {
/** The transaction */
transaction: {
/** The transaction message */
message: Message;
/** The transaction signatures */
signatures: string[];
};
/** Metadata produced from the transaction */
meta: ConfirmedTransactionMeta | null;
}>;
/**
* A processed transaction from the RPC API
*/
export type VersionedTransactionResponse = TransactionResponseBase & Overwrite<TransactionForFullJson<0 | 1>, {
/** The transaction */
transaction: {
/** The transaction message */
message: VersionedMessage;
/** The transaction signatures */
signatures: string[];
};
/** Metadata produced from the transaction */
meta: ConfirmedTransactionMeta | null;
/** The transaction version */
version?: TransactionVersion;
}>;
/**
* A confirmed transaction on the ledger
*
* @deprecated Deprecated since RPC v1.8.0.
*/
export type ConfirmedTransaction = {
/** The slot during which the transaction was processed */
slot: bigint;
/** The details of the transaction */
transaction: Transaction;
/** Metadata produced from the transaction */
meta: ConfirmedTransactionMeta | null;
/** The unix timestamp of when the transaction was processed */
blockTime?: bigint | null;
};
/**
* A partially decoded transaction instruction
*/
export type PartiallyDecodedInstruction = Overwrite<RpcPartiallyDecodedInstruction, {
/** Program id called by this instruction */
programId: PublicKey;
/** Public keys of accounts passed to this instruction */
accounts: Array<PublicKey>;
/** Raw base-58 instruction data */
data: string;
}>;
/**
* A parsed transaction message account
*/
export type ParsedMessageAccount = Overwrite<RpcParsedMessageAccount, {
/** Public key of the account */
pubkey: PublicKey;
/** Indicates if the account signed the transaction */
signer: boolean;
/** Indicates if the account is writable for this transaction */
writable: boolean;
/** Indicates if the account key came from the transaction or a lookup table */
source?: 'transaction' | 'lookupTable';
}>;
/**
* A parsed transaction instruction
*/
export type ParsedInstruction = Overwrite<RpcParsedInstruction, {
/** ID of the program for this instruction */
programId: PublicKey;
/** Parsed instruction info */
parsed: any;
}>;
/**
* A parsed address table lookup
*/
export type ParsedAddressTableLookup = Overwrite<RpcParsedAddressTableLookup, {
/** Address lookup table account key */
accountKey: PublicKey;
/** Parsed instruction info */
writableIndexes: number[];
/** Parsed instruction info */
readonlyIndexes: number[];
}>;
/**
* A parsed transaction message
*/
export type ParsedMessage = Overwrite<Omit<RpcParsedTransaction['message'], 'header'>, {
/** Accounts used in the instructions */
accountKeys: ParsedMessageAccount[];
/** The atomically executed instructions for the transaction */
instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
/** Recent blockhash */
recentBlockhash: string;
/** Address table lookups used to load additional accounts */
addressTableLookups?: ParsedAddressTableLookup[] | null;
/** Message-level resource limits and prioritization (v1 transactions only) */
transactionConfig?: V1TransactionConfig;
}>;
/**
* A parsed transaction
*/
export type ParsedTransaction = Overwrite<RpcParsedTransaction, {
/** Signatures for the transaction */
signatures: Array<string>;
/** Message of the transaction */
message: ParsedMessage;
}>;
/**
* A parsed and confirmed transaction on the ledger
*
* @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
*/
export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
/**
* A parsed transaction on the ledger with meta
*/
export type ParsedTransactionWithMeta = TransactionResponseBase & Overwrite<TransactionForFullJsonParsed<0 | 1>, {
/** The details of the transaction */
transaction: ParsedTransaction;
/** Metadata produced from the transaction */
meta: ParsedTransactionMeta | null;
/** The version of the transaction message */
version?: TransactionVersion;
}>;
type WithNullableFields<T, K extends keyof T> = Omit<T, K> & { [P in K]?: T[P] | null; };
type BlockResponseTransactionMeta = WithNullableFields<NonNullable<TransactionForFullJson<void>['meta']>, 'innerInstructions' | 'postTokenBalances' | 'preTokenBalances'> & {
costUnits?: bigint;
};
type ParsedBlockResponseTransactionMeta = Overwrite<WithNullableFields<NonNullable<TransactionForFullJsonParsed<0 | 1>['meta']>, 'postTokenBalances' | 'preTokenBalances'>, {
innerInstructions?: ParsedInnerInstruction[] | null;
loadedAddresses?: LoadedAddresses;
}> & {
costUnits?: bigint;
};
type AccountsModeBlockResponseTransactionMeta = WithNullableFields<NonNullable<TransactionForAccounts<0 | 1>['meta']>, 'postTokenBalances' | 'preTokenBalances'> & {
costUnits?: bigint;
};
type VersionedBlockResponseTransactionMeta = Overwrite<WithNullableFields<NonNullable<TransactionForFullJson<0 | 1>['meta']>, 'innerInstructions' | 'postTokenBalances' | 'preTokenBalances'>, {
loadedAddresses?: LoadedAddresses;
}> & {
costUnits?: bigint;
};
type NormalizedBlockSubscriptionMetaFields = {
computeUnitsConsumed?: bigint;
fee: bigint;
postBalances: Array<bigint>;
preBalances: Array<bigint>;
};
type BlockSubscriptionMetaWithCostUnits = {
costUnits?: bigint;
};
type OptionalBlockSubscriptionLoadedAddresses = {
loadedAddresses?: NonNullable<TransactionForFullJson<0 | 1>['meta']>['loadedAddresses'];
};
type BlockSubscriptionTransactionMeta = Overwrite<WithNullableFields<NonNullable<TransactionForFullJson<0 | 1>['meta']>, 'innerInstructions' | 'postTokenBalances' | 'preTokenBalances'>, NormalizedBlockSubscriptionMetaFields & OptionalBlockSubscriptionLoadedAddresses> & BlockSubscriptionMetaWithCostUnits;
type BlockSubscriptionParsedTransactionMeta = Overwrite<WithNullableFields<NonNullable<TransactionForFullJsonParsed<0 | 1>['meta']>, 'innerInstructions' | 'postTokenBalances' | 'preTokenBalances'>, NormalizedBlockSubscriptionMetaFields & OptionalBlockSubscriptionLoadedAddresses> & BlockSubscriptionMetaWithCostUnits;
type BlockSubscriptionAccountsTransactionMeta = Overwrite<WithNullableFields<NonNullable<TransactionForAccounts<0 | 1>['meta']>, 'postTokenBalances' | 'preTokenBalances'>, NormalizedBlockSubscriptionMetaFields> & BlockSubscriptionMetaWithCostUnits;
type BlockResponseBase = {
blockhash: Blockhash$1;
previousBlockhash: Blockhash$1;
parentSlot: bigint;
blockTime: bigint | null;
blockHeight: bigint | null;
rewards?: Array<{
commission?: number | null;
lamports: bigint;
postBalance: bigint | null;
pubkey: string;
rewardType: string | null;
}>;
};
/**
* A processed block fetched from the RPC API
*/
export type BlockResponse = BlockResponseBase & {
/** Vector of transactions with status meta and original message */
transactions: Array<Overwrite<TransactionForFullJson<void>, {
transaction: {
message: Message;
signatures: string[];
};
meta: BlockResponseTransactionMeta | null;
}>>;
};
/**
* A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`
*/
export type AccountsModeBlockResponse = VersionedAccountsModeBlockResponse;
/**
* A processed block fetched from the RPC API where the `transactionDetails` mode is `none`
*/
export type NoneModeBlockResponse = VersionedNoneModeBlockResponse;
/**
* A processed block fetched from the RPC API where the `transactionDetails` mode is `signatures`
*/
export type SignaturesModeBlockResponse = VersionedSignaturesModeBlockResponse;
/**
* A block with parsed transactions
*/
export type ParsedBlockResponse = BlockResponseBase & {
/** Vector of transactions with status meta and original message */
transactions: Array<Overwrite<TransactionForFullJsonParsed<0 | 1>, {
transaction: ParsedTransaction;
meta: ParsedBlockResponseTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A block with parsed transactions where the `transactionDetails` mode is `accounts`
*/
export type ParsedAccountsModeBlockResponse = Omit<ParsedBlockResponse, 'transactions'> & {
transactions: Array<Overwrite<TransactionForAccounts<0 | 1>, {
transaction: Pick<ParsedTransaction, 'signatures'> & {
accountKeys: ParsedMessageAccount[];
};
meta: AccountsModeBlockResponseTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A block with parsed transactions where the `transactionDetails` mode is `none`
*/
export type ParsedNoneModeBlockResponse = Omit<ParsedBlockResponse, 'transactions'>;
/**
* A block with parsed transactions where the `transactionDetails` mode is `signatures`
*/
export type ParsedSignaturesModeBlockResponse = Omit<ParsedBlockResponse, 'transactions'> & {
signatures: Array<string>;
};
/**
* A processed block fetched from the RPC API
*/
export type VersionedBlockResponse = BlockResponseBase & {
/** Vector of transactions with status meta and original message */
transactions: Array<Overwrite<TransactionForFullJson<0 | 1>, {
transaction: {
message: VersionedMessage;
signatures: string[];
};
meta: VersionedBlockResponseTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`
*/
export type VersionedAccountsModeBlockResponse = Omit<VersionedBlockResponse, 'transactions'> & {
transactions: Array<Overwrite<TransactionForAccounts<0 | 1>, {
transaction: Pick<VersionedTransactionResponse['transaction'], 'signatures'> & {
accountKeys: ParsedMessageAccount[];
};
meta: AccountsModeBlockResponseTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A processed block fetched from the RPC API where the `transactionDetails` mode is `none`
*/
export type VersionedNoneModeBlockResponse = Omit<VersionedBlockResponse, 'transactions'>;
/**
* A processed block fetched from the RPC API where the `transactionDetails` mode is `signatures`
*/
export type VersionedSignaturesModeBlockResponse = Omit<VersionedBlockResponse, 'transactions'> & {
signatures: Array<string>;
};
/**
* A block subscription response where the `transactionDetails` mode is `accounts`.
*/
export type BlockSubscriptionAccountsModeBlockResponse = BlockResponseBase & {
transactions: Array<Overwrite<TransactionForAccounts<0 | 1>, {
meta: BlockSubscriptionAccountsTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A block subscription response where transactions are base58 encoded.
*/
export type BlockSubscriptionBase58BlockResponse = BlockResponseBase & {
transactions: Array<Overwrite<TransactionForFullBase58<0 | 1>, {
meta: BlockSubscriptionTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A block subscription response where transactions are base64 encoded.
*/
export type BlockSubscriptionBase64BlockResponse = BlockResponseBase & {
transactions: Array<Overwrite<TransactionForFullBase64<0 | 1>, {
meta: BlockSubscriptionTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A block subscription response where transactions are JSON encoded.
*/
export type BlockSubscriptionJsonBlockResponse = BlockResponseBase & {
transactions: Array<Overwrite<TransactionForFullJson<0 | 1>, {
meta: BlockSubscriptionTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A block subscription response where transactions are JSON parsed.
*/
export type BlockSubscriptionJsonParsedBlockResponse = BlockResponseBase & {
transactions: Array<Overwrite<TransactionForFullJsonParsed<0 | 1>, {
meta: BlockSubscriptionParsedTransactionMeta | null;
version?: TransactionVersion;
}>>;
};
/**
* A confirmed block on the ledger
*
* @deprecated Deprecated since RPC v1.8.0.
*/
export type ConfirmedBlock = {
/** Blockhash of this block */
blockhash: Blockhash$1;
/** Blockhash of this block's parent */
previousBlockhash: Blockhash$1;
/** Slot index of this block's parent */
parentSlot: bigint;
/** Vector of transactions and status metas */
transactions: Array<{
transaction: Transaction;
meta: ConfirmedTransactionMeta | null;
}>;
/** Vector of block rewards */
rewards?: Array<{
pubkey: string;
lamports: bigint;
postBalance: bigint | null;
rewardType: string | null;
commission?: number | null;
}>;
/** The unix timestamp of when the block was processed */
blockTime: bigint | null;
};
/**
* A Block on the ledger with signatures only
*/
export type BlockSignatures = {
/** Blockhash of this block */
blockhash: Blockhash$1;
/** Blockhash of this block's parent */
previousBlockhash: Blockhash$1;
/** Slot index of this block's parent */
parentSlot: bigint;
/** Vector of signatures */
signatures: Array<string>;
/** The unix timestamp of when the block was processed */
blockTime: bigint | null;
/** The number of blocks beneath this block */
blockHeight: bigint | null;
};
/**
* Amount of stake committed to a block at each depth.
*/
export type BlockCommitment = {
/**
* Amount of cluster stake in lamports that has voted on the block at each lockout depth.
*/
commitment: Array<bigint> | null;
/** Total active stake, in lamports, for the current epoch. */
totalStake: bigint;
};
/**
* recent block production information
*/
export type BlockProduction = ReturnType<GetBlockProductionApi['getBlockProduction']>['value'];
export type GetBlockProductionConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Slot range to return block production for. If parameter not provided, defaults to current epoch. */
range?: {
/** first slot to return block production information for (inclusive) */
firstSlot: number | bigint;
/** last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot */
lastSlot?: number | bigint;
};
/** Only return results for this validator identity (base-58 encoded) */
identity?: string;
};
/**
* Supply
*/
type GetSupplyKitResult = ReturnType<GetSupplyApi['getSupply']>;
export type Supply = Overwrite<GetSupplyKitResult['value'], {
nonCirculatingAccounts: Array<PublicKey>;
}>;
type GetSupplyResult = Overwrite<GetSupplyKitResult, {
value: Supply;
}>;
/**
* Token amount object which returns a token amount in different formats
* for various client use cases.
*/
export type TokenAmount = {
/** Raw amount of tokens as string ignoring decimals */
amount: string;
/** Number of decimals configured for token's mint */
decimals: number;
/** Token amount as float, accounts for decimals */
uiAmount: number | null;
/** Token amount as string, accounts for decimals */
uiAmountString?: string;
};
/**
* Token address and balance.
*/
export type TokenAccountBalancePair = {
/** PublicKey of the token account */
address: PublicKey;
/** Raw amount of tokens as string ignoring decimals */
amount: string;
/** Number of decimals configured for token's mint */
decimals: number;
/** Token amount as float, accounts for decimals */
uiAmount: number | null;
/** Token amount as string, accounts for decimals */
uiAmountString?: string;
};
type GetTokenLargestAccountsKitResult = ReturnType<GetTokenLargestAccountsApi['getTokenLargestAccounts']>;
type GetLargestAccountsKitResult = ReturnType<GetLargestAccountsApi['getLargestAccounts']>;
type GetTokenLargestAccountsWithPublicKeys = Overwrite<GetTokenLargestAccountsKitResult, {
value: ReadonlyArray<Overwrite<GetTokenLargestAccountsKitResult['value'][number], {
address: PublicKey;
}>>;
}>;
type GetLargestAccountsWithPublicKeys = Overwrite<GetLargestAccountsKitResult, {
value: ReadonlyArray<Overwrite<GetLargestAccountsKitResult['value'][number], {
address: PublicKey;
}>>;
}>;
/**
* Pair of an account address and its balance
*/
export type AccountBalancePair = {
readonly address: PublicKey;
readonly lamports: bigint;
};
type RpcBlockRewardLike = Overwrite<Reward, {
commission?: number | null;
lamports: number | bigint;
postBalance: number | bigint | null;
pubkey: string;
rewardType: string | null;
}>;
/**
* Parsed account data
*/
export type ParsedAccountData = {
/** Name of the program that owns this account */
program: string;
/** Parsed account data */
parsed: any;
/** Space used by account data */
space: bigint;
};
/**
* Data slice argument for getProgramAccounts
*/
export type DataSlice = {
/** offset of data slice */
offset: number;
/** length of data slice */
length: number;
};
/**
* Memory comparison filter for getProgramAccounts
*/
export type MemcmpFilter = {
memcmp: {
/** offset into program account data to start comparison */
offset: number | bigint;
} & ({
encoding?: 'base58';
/** data to match, as base-58 encoded string and limited to less than 129 bytes */
bytes: string;
} | {
encoding: 'base64';
/** data to match, as base-64 encoded string */
bytes: string;
});
};
/**
* Data size comparison filter for getProgramAccounts
*/
export type DataSizeFilter = {
/** Size of data for program account data length comparison */
dataSize: number | bigint;
};
/**
* A filter object for getProgramAccounts
*/
export type GetProgramAccountsFilter = MemcmpFilter | DataSizeFilter;
/**
* Configuration object for getProgramAccounts requests
*/
export type GetProgramAccountsConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Optional encoding for account data (default base64)
* To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
* */
encoding?: 'base64';
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
/** Optional array of filters to apply to accounts */
filters?: GetProgramAccountsFilter[];
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
/** wrap the result in an RpcResponse JSON object */
withContext?: boolean;
};
export type GetProgramAccountsResponse = readonly Readonly<{
account: AccountInfoWithSpace<Uint8Array>;
/** the account Pubkey as base-58 encoded string */
pubkey: PublicKey;
}>[];
/**
* Configuration object for getParsedProgramAccounts
*/
export type GetParsedProgramAccountsConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Optional array of filters to apply to accounts */
filters?: GetProgramAccountsFilter[];
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for getMultipleAccounts
*/
export type GetMultipleAccountsConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
};
/**
* Configuration object for `getTokenAccountsByOwner`
*/
export type GetTokenAccountsByOwnerConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Optional encoding for account data (default base64) */
encoding?: 'base64';
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for `getParsedTokenAccountsByOwner`
*/
export type GetParsedTokenAccountsByOwnerConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for `getTokenAccountsByDelegate`
*/
export type GetTokenAccountsByDelegateConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Optional encoding for account data (default base64) */
encoding?: 'base64';
/** Optional data slice to limit the returned account data */
dataSlice?: DataSlice;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for `getTransactionCount`
*/
export type GetTransactionCountConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for `getBlocks` and `getBlocksWithLimit`
*/
export type GetBlocksConfig = {
/** Optional finality level */
commitment?: Finality;
};
/**
* Configuration object for `getTokenSupply`
*/
export type GetTokenSupplyConfig = {
/** Optional commitment level */
commitment?: Commitment;
};
/**
* Configuration object for `getTokenAccountBalance`
*/
export type GetTokenAccountBalanceConfig = {
/** Optional commitment level */
commitment?: Commitment;
};
/**
* Configuration object for `getTokenLargestAccounts`
*/
export type GetTokenLargestAccountsConfig = {
/** Optional commitment level */
commitment?: Commitment;
};
/**
* Configuration object for `getInflationGovernor`
*/
export type GetInflationGovernorConfig = {
/** Optional commitment level */
commitment?: Commitment;
};
/**
* Configuration object for `getVoteAccounts`
*/
export type GetVoteAccountsConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Return only results for this validator vote account */
votePubkey?: string;
/** Keep unstaked delinquent validators */
keepUnstakedDelinquents?: boolean;
/** Custom delinquent slot distance */
delinquentSlotDistance?: number | bigint;
};
/**
* Configuration object for `getMinimumBalanceForRentExemption`
*/
export type GetMinimumBalanceForRentExemptionConfig = {
/** Optional commitment level */
commitment?: Commitment;
};
/**
* Configuration object for `getNonce`
*/
export type GetNonceConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Configuration object for `getNonceAndContext`
*/
export type GetNonceAndContextConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number | bigint;
};
/**
* Transaction confirmation status
* <pre>
* 'processed': Transaction landed in a block which has reached 1 confirmation by the connected node
* 'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster
* 'finalized': Transaction landed in a block which has been finalized by the cluster
* </pre>
*/
export type TransactionConfirmationStatus = 'processed' | 'confirmed' | 'finalized';
/**
* Signature status
*/
export type SignatureStatus = {
/** when the transaction was processed */
slot: bigint;
/** the number of blocks that have been confirmed and voted on in the fork containing `slot` */
confirmations: bigint | null;
/** transaction error, if any */
err: TransactionError | null;
/** cluster confirmation status, if data available. Possible responses: `processed`, `confirmed`, `finalized` */
confirmationStatus: TransactionConfirmationStatus | null;
};
/**
* A confirmed signature with its status
*/
export type ConfirmedSignatureInfo = Readonly<Overwrite<GetSignaturesForAddressKitResult[number], {
signature: string;
}>>;
/**
* A signature-level result returned by `getTransactionsForAddress`
*/
export interface TransactionsForAddressSignatureInfo extends Omit<GetTransactionsForAddressSignaturesKitResult['data'][number], 'signature'> {
/** The transaction signature as a base-58 encoded string */
readonly signature: string;
}
/**
* A full transaction result returned by `getTransactionsForAddress`
*/
export type TransactionsForAddressTransaction = VersionedTransactionResponse & Readonly<{
/** The 0-based index of the transaction within its block */
transactionIndex: number;
}>;
/**
* A full, `jsonParsed`-encoded transaction result returned by `getTransactionsForAddress`
*/
export type TransactionsForAddressParsedTransaction = ParsedTransactionWithMeta & Readonly<{
/** The 0-based index of the transaction within its block */
transactionIndex: number;
}>;
/**
* A full, `base64`-encoded transaction result returned by `getTransactionsForAddress`
*/
export type TransactionsForAddressBase64Transaction = TransactionResponseBase & Overwrite<TransactionForFullBase64<0 | 1>, {
/** Metadata produced from the transaction */
meta: ConfirmedTransactionMeta | null;
/** The transaction version */
version?: TransactionVersion;
}> & Readonly<{
/** The 0-based index of the transaction within its block */
transactionIndex: number;
}>;
/**
* An object defining headers to be passed to the RPC server
*/
export type HttpHeaders = {
[header: string]: string;
} & {
'solana-client'?: never;
};
/**
* A callback used to augment the outgoing HTTP request.
*/
export type FetchMiddleware = (url: string, options: any, fetch: (modifiedUrl: string, modifiedOptions: any) => void) => void;
/**
* Configuration for instantiating a Connection
*/
export type ConnectionConfig = {
/** Optional commitment level */
commitment?: Commitment;
/** Optional endpoint URL to the fullnode JSON RPC PubSub WebSocket Endpoint */
wsEndpoint?: string;
/** Optional subscriptions runtime configuration */
subscriptions?: Readonly<{
/** Optional websocket channel pool configuration */
channelConfig?: SubscriptionChannelConfig;
}>;
/** Optional HTTP headers object */
httpHeaders?: HttpHeaders;
/** Optional custom fetch function */
fetch?: typeof globalThis.fetch;
/** Optional fetch middleware callback */
fetchMiddleware?: FetchMiddleware;
/** Optional Disable retrying calls when server responds with HTTP 429 (Too Many Requests) */
disableRetryOnRateLimit?: boolean;
/** time to allow for the server to initially process a transaction (in milliseconds) */
confirmTransactionInitialTimeout?: number;
};
/**
* A connection to a fullnode JSON RPC endpoint
*/
export declare class Connection implements ClientWithGetMinimumBalance, ClientWithRpc<SolanaRpcApi>, ClientWithRpcSubscriptions<SolanaRpcSubscriptionsApi> {
/**
* The Kit `Rpc` client backing this connection. Exposed to satisfy Kit's
* [`ClientWithRpc`](https://www.solanakit.com/api/type-aliases/ClientWithRpc)
* interface so a `Connection` can be passed to Kit-based libraries; for
* direct calls, prefer the `Connection` methods.
*/
readonly rpc: Rpc<SolanaRpcApi>;
/**
* The Kit `RpcSubscriptions` client backing this connection. Exposed to
* satisfy Kit's
* [`ClientWithRpcSubscriptions`](https://www.solanakit.com/api/type-aliases/ClientWithRpcSubscriptions)
* interface; for direct subscriptions, prefer the `Connection` `on*Change`
* methods.
*/
readonly rpcSubscriptions: RpcSubscriptions<SolanaRpcSubscriptionsApi>;
/**
* Establish a JSON RPC connection
*
* @param endpoint URL to the fullnode JSON RPC endpoint
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
*/
constructor(endpoint: string, commitmentOrConfig?: Commitment | ConnectionConfig);
/**
* The default commitment used for requests
*/
get commitment(): Commitment | undefined;
/**
* The RPC endpoint
*/
get rpcEndpoint(): string;
/**
* The HTTP headers used by this connection for JSON-RPC requests.
*/
get rpcHttpHeaders(): HttpHeaders | undefined;
/**
* Fetch the balance for the specified public key, return with context
*/
getBalanceAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<GetBalanceKitResult>;
/**
* Fetch the balance for the specified public key
*/
getBalance(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<GetBalanceKitResult['value']>;
/**
* Fetch the estimated production time of a block
*/
getBlockTime(slot: number | bigint): Promise<ReturnType<GetBlockTimeApi['getBlockTime']>>;
/**
* Fetch the lowest slot that the node has information about in its ledger.
* This value may increase over time if the node is configured to purge older ledger data
*/
getMinimumLedgerSlot(): Promise<ReturnType<MinimumLedgerSlotApi['minimumLedgerSlot']>>;
/**
* Fetch the slot of the lowest confirmed block that has not been purged from the ledger
*/
getFirstAvailableBlock(): Promise<ReturnType<GetFirstAvailableBlockApi['getFirstAvailableBlock']>>;
/**
* Fetch information about the current supply
*/
getSupply(config?: GetSupplyConfig | Commitment): Promise<GetSupplyResult>;
/**
* Fetch the current supply of a token mint
*/
getTokenSupply(tokenMintAddress: PublicKey, commitmentOrConfig?: Commitment | GetTokenSupplyConfig): Promise<ReturnType<GetTokenSupplyApi['getTokenSupply']>>;
/**
* Fetch the current balance of a token account
*/
getTokenAccountBalance(tokenAddress: PublicKey, commitmentOrConfig?: Commitment | GetTokenAccountBalanceConfig): Promise<ReturnType<GetTokenAccountBalanceApi['getTokenAccountBalance']>>;
/**
* Fetch all the token accounts owned by the specified account
*
* @return {Promise<RpcResponseAndContext<GetProgramAccountsResponse>}
*/
getTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitmentOrConfig?: Commitment | GetTokenAccountsByOwnerConfig): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
/**
* Fetch all the token accounts delegated to the specified account
*
* @return {Promise<RpcResponseAndContext<GetProgramAccountsResponse>}
*/
getTokenAccountsByDelegate(delegateAddress: PublicKey, filter: TokenAccountsFilter, commitmentOrConfig?: Commitment | GetTokenAccountsByDelegateConfig): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
/**
* Fetch parsed token accounts owned by the specified account
*
* @return {Promise<RpcResponseAndContext<Array<{pubkey: PublicKey, account: AccountInfo<ParsedAccountData>}>>>}
*/
getParsedTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitmentOrConfig?: Commitment | GetParsedTokenAccountsByOwnerConfig): Promise<RpcResponseAndContext<Array<{
pubkey: PublicKey;
account: AccountInfoWithSpace<ParsedAccountData>;
}>>>;
/**
* Fetch the 20 largest accounts with their current balances
*/
getLargestAccounts(config?: GetLargestAccountsConfig): Promise<GetLargestAccountsWithPublicKeys>;
/**
* Fetch the 20 largest token accounts with their current balances
* for a given mint.
*/
getTokenLargestAccounts(mintAddress: PublicKey, commitmentOrConfig?: Commitment | GetTokenLargestAccountsConfig): Promise<GetTokenLargestAccountsWithPublicKeys>;
/**
* Fetch all the account info for the specified public key, return with context
*/
getAccountInfoAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfoWithSpace<Uint8Array> | null>>;
/**
* Fetch parsed account info for the specified public key
*/
getParsedAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfoWithSpace<Uint8Array | ParsedAccountData> | null>>;
/**
* Fetch all the account info for the specified public key
*/
getAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<AccountInfoWithSpace<Uint8Array> | null>;
/**
* Fetch all the account info for multiple accounts specified by an array of public keys, return with context
*/
getMultipleParsedAccounts(publicKeys: PublicKey[], rawConfig?: GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfoWithSpace<Uint8Array | ParsedAccountData> | null)[]>>;
/**
* Fetch all the account info for multiple accounts specified by an array of public keys, return with context
*/
getMultipleAccountsInfoAndContext(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfoWithSpace<Uint8Array> | null)[]>>;
/**
* Fetch all the account info for multiple accounts specified by an array of public keys
*/
getMultipleAccountsInfo(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<(AccountInfoWithSpace<Uint8Array> | null)[]>;
/**
* Fetch all the accounts owned by the specified program id
*
* @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Uint8Array>}>>}
*/
getProgramAccounts(programId: PublicKey, configOrCommitment: GetProgramAccountsConfig & Readonly<{
withContext: true;
}>): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
getProgramAccounts(programId: PublicKey, configOrCommitment?: GetProgramAccountsConfig | Commitment): Promise<GetProgramAccountsResponse>;
/**
* Fetch and parse all the accounts owned by the specified program id
*
* @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Uint8Array | ParsedAccountData>}>>}
*/
getParsedProgramAccounts(programId: PublicKey, configOrCommitment?: GetParsedProgramAccountsConfig | Commitment): Promise<Array<{
pubkey: PublicKey;
account: AccountInfoWithSpace<Uint8Array | ParsedAccountData>;
}>>;
confirmTransaction(strategy: TransactionConfirmationStrategy, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
confirmTransaction(strategy: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
private getCancellationPromise;
private _resolveCommitment;
private _resolveSupportedFinality;
private _resolveSubscriptionCommitment;
/**
* Normalize a subscription's commitment-or-config input into a config object
* with an explicit commitment.
*/
private _resolveSubscriptionConfig;
private getTransactionConfirmationPromise;
private confirmTransactionUsingBlockHeightExceedanceStrategy;
private confirmTransactionUsingDurableNonceStrategy;
private confirmTransactionUsingLegacyTimeoutStrategy;
/**
* Return the list of nodes that are currently participating in the cluster
*/
getClusterNodes(): Promise<ReturnType<GetClusterNodesApi['getClusterNodes']>>;
/**
* Fetch the RPC node health status.
*/
getHealth(): Promise<ReturnType<GetHealthApi['getHealth']>>;
/**
* Fetch the RPC node identity.
*/
getIdentity(): Promise<Identity>;
/**
* Fetch the highest full and incremental snapshot slots available on the RPC node.
*/
getHighestSnapshotSlot(): Promise<ReturnType<GetHighestSnapshotSlotApi['getHighestSnapshotSlot']>>;
/**
* Fetch the highest slot seen by retransmit stage.
*/
getMaxRetransmitSlot(): Promise<ReturnType<GetMaxRetransmitSlotApi['getMaxRetransmitSlot']>>;
/**
* Fetch the highest slot seen by blockstore.
*/
getMaxShredInsertSlot(): Promise<ReturnType<GetMaxShredInsertSlotApi['getMaxShredInsertSlot']>>;
/**
* Return the list of nodes that are currently participating in the cluster
*/
getVoteAccounts(commitmentOrConfig?: Commitment | GetVoteAccountsConfig): Promise<VoteAccountStatus>;
/**
* Fetch the current slot that the node is processing
*/
getSlot(commitmentOrConfig?: Commitment | GetSlotConfig): Promise<ReturnType<GetSlotApi['getSlot']>>;
/**
* Fetch the current slot leader of the cluster
*/
getSlotLeader(commitmentOrConfig?: Commitment | GetSlotLeaderConfig): Promise<string>;
/**
* Fetch `limit` number of slot leaders starting from `startSlot`
*
* @param startSlot fetch slot leaders starting from this slot
* @param limit number of slot leaders to return
*/
getSlotLeaders(startSlot: number | bigint, limit: number): Promise<Array<PublicKey>>;
/**
* Fetch the current status of a signature
*/
getSignatureStatus(signature: TransactionSignature, config?: SignatureStatusConfig): Promise<RpcResponseAndContext<SignatureStatus | null>>;
/**
* Fetch the current statuses of a batch of signatures
*/
getSignatureStatuses(signatures: Array<TransactionSignature>, config?: SignatureStatusConfig): Promise<RpcResponseAndContext<Array<SignatureStatus | null>>>;
/**
* Fetch the current transaction count of the cluster
*/
getTransactionCount(commitmentOrConfig?: Commitment | GetTransactionCountConfig): Promise<bigint>;
/**
* Fetch the cluster InflationGovernor parameters
*/
getInflationGovernor(commitmentOrConfig?: Commitment | GetInflationGovernorConfig): Promise<InflationGovernor>;
/**
* Fetch the inflation reward for a list of addresses for an epoch
*/
getInflationReward(addresses: PublicKey[], epoch?: number | bigint, commitmentOrConfig?: Commitment | GetInflationRewardConfig): Promise<(InflationReward | null)[]>;
/**
* Fetch the specific inflation values for the current epoch
*/
getInflationRate(): Promise<InflationRate>;
/**
* Fetch the Epoch Info parameters
*/
getEpochInfo(commitmentOrConfig?: Commitment | GetEpochInfoConfig): Promise<EpochInfo>;
/**
* Fetch the Epoch Schedule parameters
*/
getEpochSchedule(): Promise<EpochSchedule>;
/**
* Fetch the leader schedule for the current epoch
* @return {Promise<RpcResponseAndContext<LeaderSchedule>>}
*/
getLeaderSchedule(slotOrCommitmentOrConfig?: number | bigint | null | Commitment | GetLeaderScheduleConfig, commitmentOrConfig?: Commitment | GetLeaderScheduleConfig): Promise<LeaderSchedule | null>;
/**
* Fetch the minimum balance needed to exempt an account of `dataLength`
* size from rent
*/
getMinimumBalanceForRentExemption(dataLength: number, commitmentOrConfig?: Commitment | GetMinimumBalanceForRentExemptionConfig): Promise<ReturnType<GetMinimumBalanceForRentExemptionApi['getMinimumBalanceForRentExemption']>>;
/**
* Fetch the minimum rent-exempt balance for an account with `space` bytes of
* data, including the 128-byte account header unless `withoutHeader` is set.
* Satisfies Kit's
* [`ClientWithGetMinimumBalance`](https://www.solanakit.com/api/type-aliases/ClientWithGetMinimumBalance)
* interface.
*/
getMinimumBalance: (space: number, config?: GetMinimumBalanceConfig) => Promise<Lamports>;
/**
* Fetch recent performance samples
* @return {Promise<readonly PerfSample[]>}
*/
getRecentPerformanceSamples(limit?: number): Promise<ReturnType<GetRecentPerformanceSamplesApi['getRecentPerformanceSamples']>>;
/**
* Fetch the fee for a message from the cluster, return with context
*/
getFeeForMessage(message: VersionedMessage, commitmentOrConfig?: Commitment | GetFeeForMessageConfig): Promise<ReturnType<GetFeeForMessageApi['getFeeForMessage']>>;
/**
* Fetch a list of prioritization fees from recent blocks.
*/
getRecentPrioritizationFees(config?: GetRecentPrioritizationFeesConfig): Promise<readonly RecentPrioritizationFees[]>;
/**
* Fetch the latest blockhash from the cluster
* @return {Promise<BlockhashWithExpiryBlockHeight>}
*/
getLatestBlockhash(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<BlockhashWithExpiryBlockHeight>;
/**
* Fetch the latest blockhash from the cluster
* @return {Promise<BlockhashWithExpiryBlockHeight>}
*/
getLatestBlockhashAndContext(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
/**
* Returns whether a blockhash is still valid or not
*/
isBlockhashValid(blockhash: Blockhash$1, rawConfig?: IsBlockhashValidConfig): Promise<ReturnType<IsBlockhashValidApi['isBlockhashValid']>>;
/**
* Fetch the Alpenglow genesis certificate, or `null` if the node does not
* have one.
*/
getAgGenesisCert(): Promise<ReturnType<GetAgGenesisCertApi['getAgGenesisCert']>>;
/**
* Fetch the node version
*/
getVersion(): Promise<ReturnType<GetVersionApi['getVersion']>>;
/**
* Fetch the genesis hash
*/
getGenesisHash(): Promise<ReturnType<GetGenesisHashApi['getGenesisHash']>>;
/**
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
* setting the `maxSupportedTransactionVersion` property.
*/
getBlock(slot: number | bigint, rawConfig: GetBlockConfig & {
transactionDetails: 'accounts';
}): Promise<AccountsModeBlockResponse | null>;
/**
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
* setting the `maxSupportedTransactionVersion` property.
*/
getBlock(slot: number | bigint, rawConfig: GetBlockConfig & {
transactionDetails: 'none';
}): Promise<NoneModeBlockResponse | null>;
/**
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
* setting the `maxSupportedTransactionVersion` property.
*/
getBlock(slot: number | bigint, rawConfig: GetBlockConfig & {
transactionDetails: 'signatures';
}): Promise<SignaturesModeBlockResponse | null>;
/**
* Fetch a processed block from the cluster.
*
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
* setting the `maxSupportedTransactionVersion` property.
*/
getBlock(slot: number | bigint, rawConfig?: GetBlockConfig): Promise<BlockResponse | null>;
/**
* Fetch a processed block from the cluster.
*/
getBlock(slot: number | bigint, rawConfig: GetVersionedBlockConfig & {
transactionDetails: 'accounts';
}): Promise<VersionedAccountsModeBlockResponse | null>;
getBlock(slot: number | bigint, rawConfig: GetVersionedBlockConfig & {
transactionDetails: 'none';
}): Promise<VersionedNoneModeBlockResponse | null>;
getBlock(slot: number | bigint, rawConfig: GetVersionedBlockConfig & {
transactionDetails: 'signatures';
}): Promise<VersionedSignaturesModeBlockResponse | null>;
getBlock(slot: number | bigint, rawConfig?: GetVersionedBlockConfig): Promise<VersionedBlockResponse | null>;
/**
* Fetch parsed transaction details for a confirmed or finalized block
*/
getParsedBlock(slot: number | bigint, rawConfig: GetVersionedBlockConfig & {
transactionDetails: 'accounts';
}): Promise<ParsedAccountsModeBlockResponse | null>;
getParsedBlock(slot: number | bigint, rawConfig: GetVersionedBlockConfig & {
transactionDetails: 'none';
}): Promise<ParsedNoneModeBlockResponse | null>;
getParsedBlock(slot: number | bigint, rawConfig: GetVersionedBlockConfig & {
transactionDetails: 'signatures';
}): Promise<ParsedSignaturesModeBlockResponse | null>;
getParsedBlock(slot: number | bigint, rawConfig?: GetVersionedBlockConfig): Promise<ParsedBlockResponse | null>;
getBlockHeight: (commitmentOrConfig?: Commitment | GetBlockHeightConfig) => Promise<bigint>;
getBlockProduction(configOrCommitment?: GetBlockProductionConfig | Commitment): Promise<ReturnType<GetBlockProductionApi['getBlockProduction']>>;
/**
* Fetch a confirmed or finalized transaction from the cluster.
*
* @deprecated Instead, call `getTransaction` using a
* `GetVersionedTransactionConfig` by setting the
* `maxSupportedTransactionVersion` property.
*/
getTransaction(signature: string, rawConfig?: GetTransactionConfig): Promise<TransactionResponse | null>;
/**
* Fetch a confirmed or finalized transaction from the cluster.
*/
getTransaction(signature: string, rawConfig: GetVersionedTransactionConfig): Promise<VersionedTransactionResponse | null>;
/**
* Fetch parsed transaction details for a confirmed or finalized transaction
*/
getParsedTransaction(signature: TransactionSignature, commitmentOrConfig?: GetVersionedTransactionConfig | Finality): Promise<ParsedTransactionWithMeta | null>;
/**
* Fetch parsed transaction details for a batch of confirmed transactions
*/
getParsedTransactions(signatures: TransactionSignature[], commitmentOrConfig?: GetVersionedTransactionConfig | Finality): Promise<(ParsedTransactionWithMeta | null)[]>;
/**
* Fetch transaction details for a batch of confirmed transactions.
* Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
*
* @deprecated Instead, call `getTransactions` using a
* `GetVersionedTransactionConfig` by setting the
* `maxSupportedTransactionVersion` property.
*/
getTransactions(signatures: TransactionSignature[], commitmentOrConfig?: GetTransactionConfig | Finality): Promise<(TransactionResponse | null)[]>;
/**
* Fetch transaction details for a batch of confirmed transactions.
* Similar to {@link getParsedTransactions} but returns a {@link
* VersionedTransactionResponse}.
*/
getTransactions(signatures: TransactionSignature[], commitmentOrConfig: GetVersionedTransactionConfig | Finality): Promise<(VersionedTransactionResponse | null)[]>;
/**
* Fetch a list of Transactions and transaction statuses from the cluster
* for a confirmed block.
*
* @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlock} instead.
*/
getConfirmedBlock(slot: number | bigint, commitment?: Finality): Promise<ConfirmedBlock>;
/**
* Fetch confirmed blocks between two slots
*/
getBlocks(startSlot: number | bigint, endSlot?: number | bigint, commitment?: Finality): Promise<GetBlocksResult>;
getBlocks(startSlot: number | bigint, endSlot?: number | bigint, config?: GetBlocksConfig): Promise<GetBlocksResult>;
getBlocks(startSlot: number | bigint, config?: GetBlocksConfig): Promise<GetBlocksResult>;
/**
* Fetch confirmed blocks starting at the provided slot, limited to the requested length.
*/
getBlocksWithLimit(startSlot: number | bigint, limit: number, commitment?: Finality): Promise<GetBlocksWithLimitResult>;
getBlocksWithLimit(startSlot: number | bigint, limit: number, config?: GetBlocksConfig): Promise<GetBlocksWithLimitResult>;
/**
* Fetch the amount of cluster stake that has voted on a block.
*/
getBlockCommitment(slot: number | bigint): Promise<ReturnType<GetBlockCommitmentApi['getBlockCommitment']>>;
/**
* Fetch a list of Signatures from the cluster for a block, excluding rewards
*/
getBlockSignatures(slot: number | bigint, commitment?: Finality): Promise<BlockSignatures>;
/**
* Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
*
* @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlockSignatures} instead.
*/
getConfirmedBlockSignatures(slot: number | bigint, commitment?: Finality): Promise<BlockSignatures>;
/**
* Fetch a transaction details for a confirmed transaction
*
* @deprecated Deprecated since RPC v1.7.0. Please use {@link getTransaction} instead.
*/
getConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ConfirmedTransaction | null>;
/**
* Fetch parsed transaction details for a confirmed transaction
*
* @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransaction} instead.
*/
getParsedConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ParsedConfirmedTransaction | null>;
/**
* Fetch parsed transaction details for a batch of confirmed transactions
*
* @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransactions} instead.
*/
getParsedConfirmedTransactions(signatures: TransactionSignature[], commitment?: Finality): Promise<(ParsedConfirmedTransaction | null)[]>;
/**
* Returns confirmed signatures for transactions involving an
* address backwards in time from the provided signature or most recent confirmed block
*
*
* @param address queried address
* @param options
*/
getSignaturesForAddress(address: PublicKey, options?: SignaturesForAddressOptions, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
/**
* Returns signature-level results for transactions involving an address, with server-side
* filtering, sorting, and cursor-based pagination. This is the default when
* `transactionDetails` is omitted.
*
* Note: This is not a native Solana validator RPC method and is only available from RPC
* providers that implement it. Check your RPC provider for support before calling it.
*
* @param address queried address
* @param config
*/
getTransactionsForAddress(address: PublicKey, config?: GetTransactionsForAddressConfig & {
transactionDetails?: 'signatures';
}): Promise<TransactionsForAddressResponse<TransactionsForAddressSignatureInfo>>;
/**
* Returns full transactions involving an address, with server-side filtering, sorting, and
* cursor-based pagination. With `encoding: 'jsonParsed'`, each result is a
* `ParsedTransactionWithMeta` plus its `transactionIndex`.
*
* Note: This is not a native Solana validator RPC method and is only available from RPC
* providers that implement it. Check your RPC provider for support before calling it.
*
* @param address queried address
* @param config
*/
getTransactionsForAddress(address: PublicKey, config: GetFullTransactionsForAddressConfig & {
encoding: 'jsonParsed';
}): Promise<TransactionsForAddressResponse<TransactionsForAddressParsedTransaction>>;
/**
* Returns full transactions involving an address, with server-side filtering, sorting, and
* cursor-based pagination. With `encoding: 'base64'`, each result carries the wire transaction
* as a `[data, 'base64']` tuple alongside its mapped `meta` and `transactionIndex`.
*
* Note: This is not a native Solana validator RPC method and is only available from RPC
* providers that implement it. Check your RPC provider for support before calling it.
*
* @param address queried address
* @param config
*/
getTransactionsForAddress(address: PublicKey, config: GetFullTransactionsForAddressConfig & {
encoding: 'base64';
}): Promise<TransactionsForAddressResponse<TransactionsForAddressBase64Transaction>>;
/**
* Returns full transactions involving an address, with server-side filtering, sorting, and
* cursor-based pagination. With `encoding` omitted or `'json'`, each result is a
* `VersionedTransactionResponse` plus its `transactionIndex`.
*
* Note: This is not a native Solana validator RPC method and is only available from RPC
* providers that implement it. Check your RPC provider for support before calling it.
*
* @param address queried address
* @param config
*/
getTransactionsForAddress(address: PublicKey, config: GetFullTransactionsForAddressConfig & {
encoding?: 'json';
}): Promise<TransactionsForAddressResponse<TransactionsForAddressTransaction>>;
/**
* Returns full transactions involving an address, with server-side filtering, sorting, and
* cursor-based pagination. Used when `encoding` is not known statically; narrow the result by
* the `encoding` that was requested.
*
* Note: This is not a native Solana validator RPC method and is only available from RPC
* providers that implement it. Check your RPC provider for support before calling it.
*
* @param address queried address
* @param config
*/
getTransactionsForAddress(address: PublicKey, config: GetFullTransactionsForAddressConfig): Promise<TransactionsForAddressResponse<TransactionsForAddressTransaction | TransactionsForAddressParsedTransaction | TransactionsForAddressBase64Transaction>>;
/**
* Returns transactions involving an address, with server-side filtering, sorting, and
* cursor-based pagination. Used when `transactionDetails` is not known statically; the result
* holds signature-level results unless `transactionDetails` is `'full'`.
*
* Note: This is not a native Solana validator RPC method and is only available from RPC
* providers that implement it. Check your RPC provider for support before calling it.
*
* @param address queried address
* @param config
*/
getTransactionsForAddress(address: PublicKey, config?: (GetTransactionsForAddressConfig & {
transactionDetails?: 'signatures';
}) | GetFullTransactionsForAddressConfig): Promise<TransactionsForAddressResponse<TransactionsForAddressSignatureInfo | TransactionsForAddressTransaction | TransactionsForAddressParsedTransaction | TransactionsForAddressBase64Transaction>>;
getAddressLookupTable(accountKey: PublicKey, config?: GetAccountInfoConfig): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
/**
* Fetch the contents of a Nonce account from the cluster, return with context
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
getNonceAndContext(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceAndContextConfig): Promise<RpcResponseAndContext<NonceAccount | null>>;
/**
* Fetch the contents of a Nonce account from the cluster
*
* Durable nonces are planned for deprecation on Solana. They remain valid on
* mainnet today and no removal date is set. See
* {@link https://solana.com/upgrades/durable-nonce-deprecation} for the
* timeline and migration guidance.
*/
getNonce(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceConfig): Promise<NonceAccount | null>;
/**
* Request an allocation of lamports to the specified address
*
* ```typescript
* import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
*
* (async () => {
* const connection = new Connection("https://api.testnet.solana.com", "confirmed");
* const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM");
* const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);
* await connection.confirmTransaction(signature);
* })();
* ```
*/
requestAirdrop(to: PublicKey, lamports: number, commitmentOrConfig?: Commitment | RequestAirdropConfig): Promise<TransactionSignature>;
/**
* get the stake minimum delegation
*/
getStakeMinimumDelegation(config?: GetStakeMinimumDelegationConfig): Promise<ReturnType<GetStakeMinimumDelegationApi['getStakeMinimumDelegation']>>;
/**
* Simulate a transaction
*
* @deprecated Instead, call {@link simulateTransaction} with {@link
* VersionedTransaction} and {@link SimulateTransactionConfig} parameters
*/
simulateTransaction(transactionOrMessage: Transaction | Message, signers?: Array<TransactionPartialSigner>, includeAccounts?: boolean | Array<PublicKey>): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**
* Simulate a transaction
*/
simulateTransaction(transaction: VersionedTransaction, config?: SimulateTransactionConfig): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**
* Sign and send a transaction
*
* @deprecated Instead, call {@link sendTransaction} with a {@link
* VersionedTransaction}
*/
sendTransaction(transaction: Transaction, signers: Array<TransactionPartialSigner>, options?: SendOptions): Promise<TransactionSignature>;
/**
* Send a signed transaction
*/
sendTransaction(transaction: VersionedTransaction, options?: SendOptions): Promise<TransactionSignature>;
/**
* Send a transaction that has already been signed and serialized into the
* wire format
*/
sendRawTransaction(rawTransaction: Uint8Array | Array<number>, options?: SendOptions): Promise<TransactionSignature>;
/**
* Send a transaction that has already been signed, serialized into the
* wire format, and encoded as a base64 string
*/
sendEncodedTransaction(encodedTransaction: string, options?: SendOptions): Promise<TransactionSignature>;
/**
* Wait until an active subscription has either been established or failed.
*
* This rejects if the supplied subscription id is not active when
* observation begins, or if the subscription becomes inactive before setup
* reaches a terminal state.
*/
awaitSubscriptionReady(clientSubscriptionId: ClientSubscriptionId, config?: SubscriptionReadyConfig): Promise<void>;
/**
* Register a callback to be invoked whenever the specified account changes
*
* @param publicKey Public key of the account to monitor
* @param callback Function to invoke whenever the account is changed
* @param config
* @return subscription id
*/
onAccountChange(publicKey: PublicKey, callback: ParsedAccountChangeCallback, config: AccountSubscriptionParsedConfig): ClientSubscriptionId;
onAccountChange(publicKey: PublicKey, callback: Base64ZstdAccountChangeCallback, config: AccountSubscriptionBase64ZstdConfig): ClientSubscriptionId;
onAccountChange(publicKey: PublicKey, callback: AccountChangeCallback, config?: AccountSubscriptionBinaryConfig): ClientSubscriptionId;
/** @deprecated Instead, pass in an {@link AccountSubscriptionConfig} */
onAccountChange(publicKey: PublicKey, callback: AccountChangeCallback, commitment?: Commitment): ClientSubscriptionId;
/**
* Deregister an account notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked whenever accounts owned by the
* specified program change
*
* @param programId Public key of the program to monitor
* @param callback Function to invoke whenever the account is changed
* @param config
* @return subscription id
*/
onProgramAccountChange(programId: PublicKey, callback: ParsedProgramAccountChangeCallback, config: ProgramAccountSubscriptionParsedConfig): ClientSubscriptionId;
onProgramAccountChange(programId: PublicKey, callback: Base64ZstdProgramAccountChangeCallback, config: ProgramAccountSubscriptionBase64ZstdConfig): ClientSubscriptionId;
onProgramAccountChange(programId: PublicKey, callback: ProgramAccountChangeCallback, config?: ProgramAccountSubscriptionBinaryConfig): ClientSubscriptionId;
/** @deprecated Instead, pass in a {@link ProgramAccountSubscriptionConfig} */
onProgramAccountChange(programId: PublicKey, callback: ProgramAccountChangeCallback, commitment?: Commitment, filters?: GetProgramAccountsFilter[]): ClientSubscriptionId;
/**
* Deregister an account notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeProgramAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Registers a callback to be invoked whenever logs are emitted.
*/
onLogs(filter: LogsFilter, callback: LogsCallback, commitment?: Commitment): ClientSubscriptionId;
/**
* Deregister a logs callback.
*
* @param clientSubscriptionId client subscription id to deregister.
*/
removeOnLogsListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked upon slot changes
*
* @param callback Function to invoke whenever the slot changes
* @return subscription id
*/
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
/**
* Deregister a slot notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeSlotChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
* may be useful to track live progress of a cluster.
*
* @param callback Function to invoke whenever the slot updates
* @return subscription id
*/
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
/**
* Deregister a slot update notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeSlotUpdateListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked upon signature updates
*
* @param signature Transaction signature string in base 58
* @param callback Function to invoke on signature notifications
* @param commitment Specify the commitment level signature must reach before notification
* @return subscription id
*/
onSignature(signature: TransactionSignature, callback: SignatureResultCallback, commitment?: Commitment): ClientSubscriptionId;
/**
* Register a callback to be invoked when a transaction is
* received and/or processed.
*
* @param signature Transaction signature string in base 58
* @param callback Function to invoke on signature notifications
* @param options Enable received notifications and set the commitment
* level that signature must reach before notification
* @return subscription id
*/
onSignatureWithOptions(signature: TransactionSignature, callback: SignatureResultCallback, options?: SignatureSubscriptionStatusOptions): ClientSubscriptionId;
onSignatureWithOptions(signature: TransactionSignature, callback: SignatureSubscriptionCallback, options: SignatureSubscriptionReceivedOptions): ClientSubscriptionId;
/**
* Deregister a signature notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeSignatureListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked upon root changes
*
* @param callback Function to invoke whenever the root changes
* @return subscription id
*/
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
/**
* Deregister a root notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeRootChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked whenever a matching block is observed.
*
* This subscription is unstable and requires the validator to be started with
* `--rpc-pubsub-enable-block-subscription`.
*
* @param filter Blocks will only be published if they match this filter
* @param callback Function to invoke whenever a matching block is published
* @param config Subscription configuration
* @return subscription id
*/
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionCallback, config?: undefined): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionAccountsCallback, config: BlockSubscriptionAccountsConfig): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionNoneCallback, config: BlockSubscriptionNoneConfig): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionSignaturesCallback, config: BlockSubscriptionSignaturesConfig): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionBase58Callback, config: BlockSubscriptionBase58Config): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionBase64Callback, config: BlockSubscriptionBase64Config): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionJsonParsedCallback, config: BlockSubscriptionJsonParsedConfig): ClientSubscriptionId;
onBlock(filter: BlockSubscriptionFilter, callback: BlockSubscriptionJsonCallback, config: BlockSubscriptionJsonConfig): ClientSubscriptionId;
/**
* Deregister a block notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeBlockListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
/**
* Register a callback to be invoked when a new vote is observed in gossip.
*
* This subscription is unstable and requires the validator to be started with
* `--rpc-pubsub-enable-vote-subscription`.
*
* @param callback Function to invoke whenever a vote is observed
* @return subscription id
*/
onVote(callback: VoteCallback): ClientSubscriptionId;
/**
* Deregister a vote notification callback
*
* @param clientSubscriptionId client subscription id to deregister
*/
removeVoteListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
}
/**
* @deprecated Deprecated since Solana v1.17.20.
*/
export declare const BPF_LOADER_PROGRAM_ID: PublicKey;
/**
* Factory class for transactions to interact with a program loader
*
* @deprecated Deprecated since Solana v1.17.20.
*/
export declare class BpfLoader {
/**
* Minimum number of signatures required to load a program not including
* retries
*
* Can be used to calculate transaction fees
*/
static getMinNumSignatures(dataLength: number): number;
/**
* Load a SBF program
*
* @param connection The connection to use
* @param payer Account that will pay program loading fees
* @param program Account to load the program into
* @param elf The entire ELF containing the SBF program
* @param loaderProgramId The program id of the BPF loader to use
* @return true if program was loaded successfully, false if program was already loaded
*/
static load(connection: Connection, payer: TransactionPartialSigner, program: TransactionPartialSigner, elf: Uint8Array | Array<number>, loaderProgramId: PublicKey): Promise<boolean>;
}
export declare class SendTransactionError extends Error {
private signature;
private transactionMessage;
private transactionLogs;
constructor({ action, signature, transactionMessage, logs }: {
action: 'send' | 'simulate';
signature: TransactionSignature;
transactionMessage: string;
logs?: string[];
});
get transactionError(): {
message: string;
logs?: string[];
};
get logs(): string[] | undefined;
getLogs(connection: Connection): Promise<string[]>;
}
export declare const SolanaJSONRPCErrorCode: {
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
readonly JSON_RPC_SCAN_ERROR: -32012;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
};
export type SolanaJSONRPCErrorCodeEnum = (typeof SolanaJSONRPCErrorCode)[keyof typeof SolanaJSONRPCErrorCode];
export declare class SolanaJSONRPCError extends Error {
code: SolanaJSONRPCErrorCodeEnum | unknown;
data?: any;
constructor({ code, message, data }: Readonly<{
code: unknown;
message: string;
data?: any;
}>, customMessage?: string);
}
/**
* A Kit signer that can sign both transactions and arbitrary messages.
*/
export type Signer = MessagePartialSigner & TransactionPartialSigner;
/**
* An account keypair backed by WebCrypto.
*
* Implements Kit's `KeyPairSigner` (and therefore `MessagePartialSigner`
* and `TransactionPartialSigner`), so instances can be passed directly to
* Kit APIs and generated program clients that accept a `TransactionSigner`
* or `KeyPairSigner`.
*/
export declare class Keypair implements KeyPairSigner {
#private;
private constructor();
/**
* Generate a new random keypair.
*/
static generate(): Promise<Keypair>;
/**
* Create a keypair from a raw 64-byte secret key (32-byte private key
* followed by 32-byte public key).
*/
static fromSecretKey(secretKey: Uint8Array): Promise<Keypair>;
/**
* Create a keypair from a 32-byte seed (private-key bytes).
*/
static fromSeed(seed: Uint8Array): Promise<Keypair>;
/**
* Returns the base-58 address as a Kit-compatible branded `Address` string.
*
* This property is provided for structural compatibility with
* `@solana/signers` / Kit (so `Keypair` can be used where a
* `TransactionSigner` is expected).
*
* Most users of this library should use {@link publicKey} instead.
*/
get address(): Address;
/**
* The PublicKey for this keypair
*
* @returns {PublicKey} PublicKey
*/
get publicKey(): PublicKey;
/**
* The underlying WebCrypto `CryptoKeyPair`.
*/
get keyPair(): CryptoKeyPair;
/**
* Returns this keypair's 64-byte secret key bytes
*/
get secretKey(): Uint8Array;
/**
* Sign one or more messages as a Kit `MessagePartialSigner`.
*
* Declared as an arrow-function field so callers can destructure
* (`const {signMessages} = keypair`) without losing `this` binding.
*/
signMessages: MessagePartialSigner<Address>['signMessages'];
/**
* Sign one or more transactions as a Kit `TransactionPartialSigner`.
*
* Declared as an arrow-function field so callers can destructure
* (`const {signTransactions} = keypair`) without losing `this` binding.
*/
signTransactions: TransactionPartialSigner<Address>['signTransactions'];
/**
* Sign raw message bytes and return the 64-byte ed25519 signature.
*/
signBytes(message: Uint8Array): Promise<Uint8Array>;
/**
* Verify a signature against the provided message using this keypair's
* public key.
*/
verifySignature(signature: Uint8Array, message: Uint8Array): Promise<boolean>;
}
/**
* Program loader interface
*/
export declare class Loader {
/**
* Amount of program data placed in each load Transaction
*/
static chunkSize: number;
/**
* Minimum number of signatures required to load a program not including
* retries
*
* Can be used to calculate transaction fees
*/
static getMinNumSignatures(dataLength: number): number;
/**
* Loads a generic program
*
* @param connection The connection to use
* @param payer System account that pays to load the program
* @param program Account to load the program into
* @param programId Public key that identifies the loader
* @param data Program octets
* @return true if program was loaded successfully, false if program was already loaded
*/
static load(connection: Connection, payer: TransactionPartialSigner, program: TransactionPartialSigner, programId: PublicKey, data: Uint8Array | Array<number>): Promise<boolean>;
}
export declare const VALIDATOR_INFO_KEY: PublicKey;
/**
* Info used to identity validators.
*/
export type Info = {
/** validator name */
name: string;
/** optional, validator website */
website?: string;
/** optional, extra information the validator chose to share */
details?: string;
/** optional, validator logo URL */
iconUrl?: string;
/** optional, used to identify validators on keybase.io */
keybaseUsername?: string;
};
/**
* ValidatorInfo class
*/
export declare class ValidatorInfo {
/**
* validator public key
*/
key: PublicKey;
/**
* validator information
*/
info: Info;
/**
* Construct a valid ValidatorInfo
*
* @param key validator public key
* @param info validator information
*/
constructor(key: PublicKey, info: Info);
/**
* Deserialize ValidatorInfo from the config account data. Exactly two config
* keys are required in the data.
*
* @param buffer config account data
* @return null if info was not found
*/
static fromConfigData(buffer: Uint8Array | Array<number>): ValidatorInfo | null;
}
export declare const VOTE_PROGRAM_ID: PublicKey;
/**
* Vote account state versions
*/
export declare const VoteStateVersion: {
readonly V1_14_11: 1;
readonly V3: 2;
readonly V4: 3;
};
export type VoteStateVersion = (typeof VoteStateVersion)[keyof typeof VoteStateVersion];
export type Lockout = {
slot: bigint;
confirmationCount: number;
};
/**
* History of how many credits earned by the end of each epoch
*/
export type EpochCredits = Readonly<{
epoch: bigint;
credits: bigint;
prevCredits: bigint;
}>;
export type AuthorizedVoter = Readonly<{
epoch: bigint;
authorizedVoter: PublicKey;
}>;
type AuthorizedVoterRaw = Readonly<{
authorizedVoter: Uint8Array;
epoch: bigint;
}>;
type PriorVoters = Readonly<{
buf: PriorVoterRaw[];
idx: bigint;
isEmpty: number;
}>;
export type PriorVoter = Readonly<{
authorizedPubkey: PublicKey;
epochOfLastAuthorizedSwitch: bigint;
targetEpoch: bigint;
}>;
type PriorVoterRaw = Readonly<{
authorizedPubkey: Uint8Array;
epochOfLastAuthorizedSwitch: bigint;
targetEpoch: bigint;
}>;
export type BlockTimestamp = Readonly<{
slot: bigint;
timestamp: bigint;
}>;
export type VoteAccountData = Readonly<{
authorizedVoters: AuthorizedVoterRaw[];
authorizedWithdrawer: Uint8Array;
commission: number;
epochCredits: EpochCredits[];
lastTimestamp: BlockTimestamp;
nodePubkey: Uint8Array;
priorVoters: PriorVoters;
rootSlot: bigint;
rootSlotValid: number;
votes: Lockout[];
}>;
/**
* VoteAccount class
*/
export declare class VoteAccount {
nodePubkey: PublicKey;
authorizedWithdrawer: PublicKey;
blsPubkeyCompressed: Uint8Array | null;
blockRevenueCollector: PublicKey | null;
blockRevenueCommissionBps: number | null;
commission: number;
rootSlot: bigint | null;
votes: Lockout[];
authorizedVoters: AuthorizedVoter[];
inflationRewardsCollector: PublicKey | null;
inflationRewardsCommissionBps: number | null;
priorVoters: PriorVoter[];
epochCredits: EpochCredits[];
lastTimestamp: BlockTimestamp;
pendingDelegatorRewards: bigint | null;
/**
* Deserialize VoteAccount from the account data.
*
* @param bufferLike account data
* @return VoteAccount
*/
static fromAccountData(bufferLike: Uint8Array | Array<number>): VoteAccount;
}
export declare const SYSVAR_CLOCK_PUBKEY: PublicKey;
export declare const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
export declare const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
export declare const SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey;
export declare const SYSVAR_RENT_PUBKEY: PublicKey;
export declare const SYSVAR_REWARDS_PUBKEY: PublicKey;
export declare const SYSVAR_SLOT_HASHES_PUBKEY: PublicKey;
export declare const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
export declare const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
export type Cluster = 'devnet' | 'testnet' | 'mainnet' | 'mainnet-beta';
/**
* Retrieves the RPC API URL for the mainnet cluster
* @param {boolean} [tls=true] - Use TLS (https). Pass `false` for http.
*
* @returns {string} URL string of the RPC endpoint
*
* @deprecated `'mainnet-beta'` is kept for compatibility; use `'mainnet'` instead.
*/
export declare function clusterApiUrl(cluster: 'mainnet-beta', tls?: boolean): string;
/**
* Retrieves the RPC API URL for the specified cluster
* @param {Cluster} [cluster="devnet"] - The cluster name of the RPC API URL to use. Possible options: 'devnet' | 'testnet' | 'mainnet' | 'mainnet-beta'
* @param {boolean} [tls=true] - Use TLS (https). Pass `false` for http.
*
* @returns {string} URL string of the RPC endpoint
*/
export declare function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
/**
* Send and confirm a raw transaction
*
* If `commitment` option is not specified, falls back to the connection's
* commitment, then to 'finalized'.
*
* @param {Connection} connection
* @param {Uint8Array | Array<number>} rawTransaction
* @param {TransactionConfirmationStrategy} confirmationStrategy
* @param {ConfirmOptions} [options]
* @returns {Promise<TransactionSignature>}
*/
export declare function sendAndConfirmRawTransaction(connection: Connection, rawTransaction: Uint8Array | Array<number>, confirmationStrategy: TransactionConfirmationStrategy, options?: ConfirmOptions): Promise<TransactionSignature>;
/**
* @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
* is no longer supported and will be removed in a future version.
*/
export declare function sendAndConfirmRawTransaction(connection: Connection, rawTransaction: Uint8Array | Array<number>, options?: ConfirmOptions): Promise<TransactionSignature>;
/**
* Sign, send and confirm a transaction.
*
* If `commitment` option is not specified, falls back to the connection's
* commitment, then to 'finalized'.
*
* @param {Connection} connection
* @param {Transaction} transaction
* @param {Array<TransactionPartialSigner>} signers
* @param {ConfirmOptions} [options]
* @returns {Promise<TransactionSignature>}
*/
export declare function sendAndConfirmTransaction(connection: Connection, transaction: Transaction, signers: Array<TransactionPartialSigner>, options?: ConfirmOptions & Readonly<{
abortSignal?: AbortSignal;
}>): Promise<TransactionSignature>;
/**
* There are 1-billion lamports in one SOL
*/
export declare const LAMPORTS_PER_SOL = 1000000000;
export type { AccountChangeCallback, AccountSubscriptionBase64ZstdConfig, AccountSubscriptionBinaryConfig, AccountSubscriptionConfig, AccountSubscriptionParsedConfig, Base64ZstdAccountChangeCallback, Base64ZstdProgramAccountChangeCallback, BlockNotificationBlock, BlockNotificationResult, BlockSubscriptionAccountsCallback, BlockSubscriptionAccountsConfig, BlockSubscriptionAccountsResult, BlockSubscriptionBase58Callback, BlockSubscriptionBase58Config, BlockSubscriptionBase58Result, BlockSubscriptionBase64Callback, BlockSubscriptionBase64Config, BlockSubscriptionBase64Result, BlockSubscriptionCallback, BlockSubscriptionConfig, BlockSubscriptionFilter, BlockSubscriptionJsonCallback, BlockSubscriptionJsonConfig, BlockSubscriptionJsonParsedCallback, BlockSubscriptionJsonParsedConfig, BlockSubscriptionJsonParsedResult, BlockSubscriptionJsonResult, BlockSubscriptionNoneCallback, BlockSubscriptionNoneConfig, BlockSubscriptionNoneResult, BlockSubscriptionSignaturesCallback, BlockSubscriptionSignaturesConfig, BlockSubscriptionSignaturesResult, Blockhash, Commitment, LogsCallback, LogsFilter, ParsedAccountChangeCallback, ParsedProgramAccountChangeCallback, ProgramAccountChangeCallback, ProgramAccountSubscriptionBase64ZstdConfig, ProgramAccountSubscriptionBinaryConfig, ProgramAccountSubscriptionConfig, ProgramAccountSubscriptionParsedConfig, RootChangeCallback, SignatureResultCallback, SignatureSubscriptionCallback, SignatureSubscriptionOptions, SignatureSubscriptionReceivedOptions, SignatureSubscriptionStatusOptions, SlotChangeCallback, SlotUpdateCallback, TransactionVersion, V1TransactionConfig, VoteCallback };