public static interface AccountInfo.AccountInfoData
-
Represents account information data in a Solana transaction.
- This interface provides access to both encoded and parsed account information,
- allowing clients to retrieve details in a flexible format.
Returns the encoded account information.
- This data is represented as a list of base64-encoded strings, providing a compact form
- of the account information for efficient storage and transmission.
-
-
Returns:
-
a list of base64-encoded strings representing the account information
Returns the parsed account information.
- This data provides a structured representation of account details, including the associated program,
- allocated space, and any additional parsed data fields.
public enum Commitment
-extends java.lang.Enum<Commitment>
-
Represents the commitment level of a transaction or query on the Solana blockchain.
- The commitment level defines how finalized the data is at the point of querying or processing.
- The levels are ordered by the certainty of the data, from most recent (less confirmed) to fully finalized.
The "Confirmed" commitment level indicates that the transaction has been confirmed
- by a sufficient number of validators, but it is not fully finalized.
The "Processed" commitment level indicates that the transaction has been processed,
- but it may not have been confirmed by a sufficient number of validators.
The "Processed" commitment level indicates that the transaction has been processed,
- but it may not have been confirmed by a sufficient number of validators.
- This is the lowest commitment level.
The "Confirmed" commitment level indicates that the transaction has been confirmed
- by a sufficient number of validators, but it is not fully finalized.
The "Finalized" commitment level indicates that the transaction has been fully finalized
- and incorporated into the Solana blockchain.
- This is the highest commitment level, representing full certainty that the transaction
- will not be rolled back.
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (Commitment c : Commitment.values())
- System.out.println(c);
-
-
-
Returns:
-
an array containing the constants of this enum type, in the order they are declared
public static Commitment valueOf(java.lang.String name)
-
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
Parameters:
-
name - the name of the enum constant to be returned.
-
Returns:
-
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
-
java.lang.NullPointerException - if the argument is null
Represents an instruction in a Solana transaction.
- Instructions define actions to be executed on the Solana blockchain, specifying accounts involved,
- the data for the instruction, and the program responsible for executing the instruction.
Returns a list of account indices involved in the instruction.
- Each index refers to an account in the transaction's account list that is affected by this instruction.
Returns the base58-encoded data associated with the instruction.
- This data contains the arguments or parameters needed for the execution of the instruction.
-
-
Returns:
-
the base58-encoded string representing the instruction data
Returns the index of the program ID that is responsible for executing the instruction.
- The index refers to the program in the transaction's account list that defines the instruction's logic.
Returns the name or identifier of the program responsible for executing the instruction.
- This program is associated with the program ID and specifies the logic that the instruction will follow.
-
-
Returns:
-
a string representing the program's name or identifier
Returns the program ID associated with the instruction.
- The program ID is a unique base58-encoded string that identifies the Solana program
- responsible for processing the instruction's actions on the blockchain.
-
-
Returns:
-
the base58-encoded string representing the program ID
Returns a map representation of the parsed instruction data.
- The parsed instruction data is represented as a Map with string keys and object values,
- allowing dynamic access to the fields of the instruction without a predefined structure.
-
- This method is useful for cases where the instruction data may have a variable or unknown format.
- Nested objects within the instruction data will also be represented as maps,
- providing a flexible way to query the instruction's content.
-
-
-
Returns:
-
a Map where keys are field names and values are the corresponding data,
- potentially nested as Map<String, Object> for complex structures
Returns the stack height at which this instruction operates, if applicable.
- The stack height may indicate the depth or order in which the instruction is processed
- within a series of instructions. A null value indicates that the stack height is unspecified.
-
-
Returns:
-
the stack height as an Integer, or null if not specified
Represents the status of a transaction signature on the Solana blockchain.
- This interface provides details about the confirmation status, including the number of confirmations,
- the slot in which the transaction was processed, any errors, and the level of confirmation.
Returns the number of confirmations for the transaction.
- The number of confirmations indicates how many blocks have been confirmed
- since the transaction was processed.
-
-
Returns:
-
the number of confirmations, or null if the information is not available
Returns the slot in which the transaction was processed.
- The slot represents a specific block in the Solana blockchain where the transaction was included.
-
-
Returns:
-
the slot number where the transaction was processed
Returns the error information, if any, for the transaction.
- This method returns an object representing the error encountered during the transaction,
- or null if the transaction was successful.
-
-
Returns:
-
an object representing the error, or null if no error occurred
Returns the confirmation status of the transaction.
- The confirmation status indicates the level of finality reached for the transaction, such as processed,
- confirmed, or finalized.
-
-
Returns:
-
the Commitment representing the confirmation status of the transaction
Returns the status of the transaction as a key-value pair.
- The key represents the status type, and the value provides additional information about the status.
-
-
Returns:
-
a Map.Entry containing the status type and corresponding information
Represents the response from simulating a transaction on the Solana blockchain.
- This interface provides access to various details resulting from the simulation,
- including errors, logs, account information, inner instructions, replacement blockhash,
- return data, and the number of compute units consumed.
Retrieves the list of log messages generated during the transaction simulation.
- These logs provide insights into the execution flow and can be useful for debugging.
Retrieves the account information data resulting from the transaction simulation.
- This includes details about the accounts involved in the transaction, such as balances,
- ownership, and other relevant metadata.
-
-
Returns:
-
a list of AccountInfo objects representing the account information.
Retrieves the list of inner instructions executed during the transaction simulation.
- Inner instructions are program invocations that occur within the main transaction.
Retrieves the replacement blockhash used during the transaction simulation.
- The blockhash ensures the transaction is processed within a specific timeframe
- and prevents it from being replayed.
-
-
Returns:
-
a Blockhash object representing the replacement blockhash
Retrieves the return data generated by an instruction during the transaction simulation.
- This data includes the program ID and the associated data returned by the instruction.
Retrieves the number of compute units consumed during the transaction simulation.
- Compute units represent the computational resources used to process the transaction.
Represents the API for interacting with the Solana blockchain.
- This interface provides methods for sending transactions, querying account balances, requesting airdrops,
- fetching block and slot information, and retrieving account data.
Sends a transaction to the Solana blockchain.
- The transaction is encoded as a base64-encoded string (transaction blob).
- Additional optional parameters can be passed to customize the transaction request.
-
-
Parameters:
-
transactionBlob - the base64-encoded string representing the transaction
-
optionalParams - a map of optional parameters to customize the transaction request,
- such as `skipPreflight`, `preflightCommitment`, or other Solana JSON-RPC options
-
Returns:
-
the signature of the transaction, which is a base58-encoded string
Retrieves the account information for the specified address.
- The account information includes the balance, ownership, and data stored in the account.
-
-
Parameters:
-
address - the base58-encoded public key of the account
Retrieves the minimum balance required for rent exemption for an account of the given size.
- This is the minimum balance needed to ensure the account is rent-exempt.
-
-
Parameters:
-
size - the size of the account in bytes
-
Returns:
-
the minimum balance in lamports for rent exemption
Retrieves the minimum balance required for rent exemption for an account of the given size,
- with additional parameters to customize the request.
- This is the minimum balance needed to ensure the account is rent-exempt.
-
-
Parameters:
-
size - the size of the account in bytes
-
optionalParams - additional parameters to customize the rent exemption query
-
Returns:
-
the minimum balance in lamports for rent exemption
Retrieves a list of transaction signatures for a specified address with optional parameters.
- Allows for additional filters or customizations when querying the transaction history.
-
-
Parameters:
-
addressBase58 - the base58-encoded public key of the address.
-
optionalParams - optional parameters for the query, such as limiting results or setting commitment levels.
Retrieves the statuses of one or more transaction signatures with optional parameters.
- Allows for additional filters or customizations when querying transaction statuses.
-
-
Parameters:
-
transactionSignatures - a list of base58-encoded transaction signatures.
-
optionalParams - optional parameters for the query, such as searching transaction history.
Retrieves token accounts owned by a specific address, filtered by criteria, with optional parameters.
- Allows for additional customization, such as setting a specific commitment level.
-
-
Parameters:
-
accountDelegate - the base58-encoded public key of the account owner.
-
filter - a key-value pair specifying the filter criteria (e.g., token mint or program ID).
-
optionalParams - optional parameters for the query.
Simulates a transaction without broadcasting it to the Solana blockchain, with optional parameters.
- This allows for additional customizations, such as setting the commitment level or enabling signature verification.
-
-
Parameters:
-
transaction - the base64-encoded string representing the transaction.
-
optionalParams - additional parameters for the simulation.
T - the type of the value returned by the RPC response
-
-
-
public interface SolanaRpcResponse<T>
-
Represents a generic response from the Solana RPC (Remote Procedure Call) API.
- This interface provides access to the context of the response and the value returned by the RPC call.
Returns the value of the RPC response.
- The type of the value depends on the specific RPC request and can vary (e.g., an account balance, transaction details, etc.).
Returns an array containing the constants of this enum type, in
-the order they are declared. This method may be used to iterate
-over the constants as follows:
-
-for (TransactionResponse.Message.AccountKeys.AccountKeyParsed.KeySource c : TransactionResponse.Message.AccountKeys.AccountKeyParsed.KeySource.values())
- System.out.println(c);
-
-
-
Returns:
-
an array containing the constants of this enum type, in the order they are declared
Returns the enum constant of this type with the specified name.
-The string must match exactly an identifier used to declare an
-enum constant in this type. (Extraneous whitespace characters are
-not permitted.)
-
-
Parameters:
-
name - the name of the enum constant to be returned.
-
Returns:
-
the enum constant with the specified name
-
Throws:
-
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
-
java.lang.NullPointerException - if the argument is null
public static interface TransactionResponse.Message.AccountKeys.AccountKeyParsed
-
Represents an account key used in Solana transactions.
- This interface provides access to the key's properties, such as its source,
- whether it is a signer, and whether it is writable.
public static interface TransactionResponse.Message.AccountKeys
-
Represents a collection of account keys used in a Solana transaction.
- Account keys are public addresses associated with accounts involved in a transaction.
- This interface provides access to both encoded and parsed representations of these keys,
- allowing detailed inspection of each key's properties, such as its origin, whether it is a signer, and if it is writable.
Returns a list of parsed account keys, each providing detailed information on
- the account's role in the transaction, including its source, signing status, and write permissions.
Returns a list of parsed account keys, each providing detailed information on
- the account's role in the transaction, including its source, signing status, and write permissions.
Returns a list of base58-encoded account keys involved in the transaction.
- Each key is a compact string representing the public address of an account referenced in the transaction.
-
-
Returns:
-
a list of base58-encoded strings representing the account keys
public static interface TransactionResponse.Message
-
Represents a message in a Solana transaction.
- A message contains all the necessary data for the transaction, including the account keys,
- instructions to be executed, and metadata such as the recent blockhash and address table lookups.
Returns a list of account keys used in the message.
- Each account key is a base58-encoded string representing an account involved in the transaction defined by the message.
- These account keys identify the accounts that participate in the transaction, either as read-only or writable accounts.
Returns the header of the message.
- The header contains metadata about the transaction, such as the number of required
- signatures and readonly accounts.
Returns the recent blockhash for the message.
- The blockhash ensures the transaction is processed within a specific timeframe
- and prevents it from being replayed.
-
-
Returns:
-
the base58-encoded string representing the recent blockhash
public static interface TransactionResponse.TransactionData.TransactionDataParsed
-
Represents the core data of a transaction on the Solana blockchain.
- This interface provides access to the transaction's message, account keys, and signatures.
Returns the list of signatures for the transaction.
- Each signature is a base58-encoded string that verifies the authenticity of the transaction.
- These signatures confirm that the transaction has been authorized by the corresponding account holders.
-
-
Returns:
-
a list of base58-encoded strings representing the transaction's signatures
Returns the parsed core data of the transaction.
- This parsed data provides structured access to essential elements of the transaction,
- such as messages, account keys, and signatures.
Returns the encoded transaction data.
- This data is represented as a list of base64-encoded strings, which provide a compact form of the
- transaction details for efficient storage and transmission.
-
-
Returns:
-
a list of base64-encoded strings representing the transaction data
Returns a list of read-only addresses loaded during the transaction.
- These addresses provide data necessary for the transaction's execution but cannot be modified.
-
-
Returns:
-
a list of base58-encoded strings representing read-only addresses
public static interface TransactionResponse.TransactionMetadata.TokenBalance
-
Represents the balance of an SPL token in a Solana transaction or account.
- This interface provides details about the token, including the account index,
- the token mint, the owner of the account, the program managing the token, and the user-friendly token amount.
Returns the index of the account in the transaction or account list.
- The account index represents the position of the account within the transaction or account list.
-
-
Returns:
-
the index of the account holding the token balance
Returns the program ID managing the token.
- The program ID is the base58-encoded public key of the program responsible for managing the token,
- typically the SPL token program.
-
-
Returns:
-
the base58-encoded string representing the program ID managing the token
public static interface TransactionResponse.TransactionMetadata
-
Represents metadata associated with a transaction on the Solana blockchain.
- This interface provides detailed information about the transaction, such as errors, fees, balances, log messages, rewards, and more.
Returns any error information associated with the transaction.
- If the transaction was successful, this method returns null; otherwise, it returns an object representing the error.
-
-
Returns:
-
an object representing the error, or null if the transaction was successful
Returns a list of inner instructions executed within the transaction.
- Inner instructions are additional program invocations that occur as part of the transaction.
Returns the log messages generated during the transaction.
- These messages can provide insights into the execution of the transaction, including program-specific logging.
Returns a list of balances before the transaction was processed.
- Each balance corresponds to an account involved in the transaction, represented in lamports.
Returns a list of balances after the transaction was processed.
- Each balance corresponds to an account involved in the transaction, represented in lamports.
Returns a list of token balances before the transaction was processed.
- This provides the pre-transaction SPL token balances for accounts that hold tokens.
Returns a list of token balances after the transaction was processed.
- This provides the post-transaction SPL token balances for accounts that hold tokens.
Returns the number of compute units consumed during the transaction's execution.
- Compute units represent the computational resources used to process the transaction.
Returns the addresses that were loaded during the transaction.
- Loaded addresses may include writable or read-only addresses that provide data
- or permissions necessary for the transaction's execution.
Returns the transaction status, including the status type and message.
- The status provides additional information on whether the transaction was successful
- and any related messages.
-
-
Returns:
-
a Map.Entry containing the status type as the key and the status message as the value
Represents the response of a transaction on the Solana blockchain.
- This interface provides access to various details of a confirmed transaction, including
- its slot number, timestamp, version, core transaction data, and associated metadata.
Returns the slot in which the transaction was confirmed.
- The slot represents a specific point in time on the Solana blockchain when the transaction was processed.
-
-
Returns:
-
the slot number where the transaction was confirmed
Returns the block time when the transaction was confirmed.
- The block time is a Unix timestamp representing the approximate time at which the block containing
- the transaction was confirmed. This value may be null if the block time is not available.
-
-
Returns:
-
the block time as a Unix timestamp, or null if not available
Returns the version of the transaction.
- The version represents the transaction version used when encoding the transaction data.
- This can be used to distinguish between different encoding versions of Solana transactions.
Returns the core transaction data and its encoding.
- The transaction data contains essential components such as instructions, signatures, and account keys
- involved in the transaction. This data provides the fundamental elements that make up the transaction.
Returns the metadata associated with the transaction.
- The metadata provides detailed information such as fees, balances, log messages, and other execution details
- generated during the transaction's processing. This information helps to analyze the transaction's outcome.
Implementation of SolanaClientOptionalParams that provides support for adding
- and retrieving optional parameters to be used in Solana JSON-RPC requests.
Returns a list of parsed account keys, each providing detailed information on
- the account's role in the transaction, including its source, signing status, and write permissions.
public final class SolanaJsonRpcClient
-extends java.lang.Object
-implements SolanaApi
-
Implementation of the SolanaApi interface for interacting with the Solana blockchain via JSON-RPC.
- This client provides methods to perform various operations such as requesting airdrops, sending transactions,
- retrieving account information, and more.
Sends a transaction to the Solana blockchain.
- The transaction is encoded as a base64-encoded string (transaction blob).
- Additional optional parameters can be passed to customize the transaction request.
transactionBlob - the base64-encoded string representing the transaction
-
optionalParams - a map of optional parameters to customize the transaction request,
- such as `skipPreflight`, `preflightCommitment`, or other Solana JSON-RPC options
-
Returns:
-
the signature of the transaction, which is a base58-encoded string
Retrieves the account information for the specified address.
- The account information includes the balance, ownership, and data stored in the account.
Retrieves the minimum balance required for rent exemption for an account of the given size.
- This is the minimum balance needed to ensure the account is rent-exempt.
Retrieves the minimum balance required for rent exemption for an account of the given size,
- with additional parameters to customize the request.
- This is the minimum balance needed to ensure the account is rent-exempt.
Retrieves a list of transaction signatures for a specified address with optional parameters.
- Allows for additional filters or customizations when querying the transaction history.
Retrieves the statuses of one or more transaction signatures with optional parameters.
- Allows for additional filters or customizations when querying transaction statuses.
Retrieves token accounts owned by a specific address, filtered by criteria, with optional parameters.
- Allows for additional customization, such as setting a specific commitment level.
Simulates a transaction without broadcasting it to the Solana blockchain, with optional parameters.
- This allows for additional customizations, such as setting the commitment level or enabling signature verification.
public class SolanaJsonRpcClientException
-extends java.lang.Exception
-
Exception thrown when an error occurs during communication with the Solana JSON RPC.
- This exception encapsulates details about the error, including a message, an optional
- cause, and a flag indicating whether the error is recoverable.
public final class SolanaJsonRpcClientOptionalParams
-extends java.lang.Object
-implements SolanaClientOptionalParams
-
Implementation of SolanaClientOptionalParams that provides support for adding
- and retrieving optional parameters to be used in Solana JSON-RPC requests.
public static java.util.Map<java.lang.String,java.lang.Object> defaultOptionalParams()
-
Creates and returns a default instance of SolanaClientOptionalParams as a Map.
- This instance contains a set of commonly used default parameters for JSON-RPC requests.
- By default, it includes the following parameters:
-
-
encoding: "base64" - Specifies that the data should be encoded in base64 format.
-
commitment: "finalized" - Sets the commitment level to "finalized" for queries, ensuring the request is processed with finalized data.
-
maxSupportedTransactionVersion: 0 - Indicates the maximum supported version of the transaction.
- Setting it to 0 specifies the use of versioned transactions.
-
-
-
Returns:
-
a Map containing default parameters to be used in JSON-RPC requests