SolanaRpcClient interface defines the complete API for interacting with Solana’s JSON-RPC endpoints. It provides type-safe, async methods for querying accounts, transactions, blocks, and network state.
Interface Definition
Package:software.sava.rpc.json.http.client
File: SolanaRpcClient.java:35
Constants
The interface defines important rate limit constants:Maximum number of accounts that can be requested in a single
getMultipleAccounts() callMaximum number of signatures that can be requested in
getSignaturesForAddress()Maximum number of signatures for
getSignatureStatuses()SolanaRpcClient.java:37-39.
Factory Methods
build()
Create a new builder for configuring the RPC client.SolanaRpcClientBuilder instance
Example:
SolanaRpcClient.java:41-43.
createClient()
Static factory methods for creating clients with various configurations.SolanaRpcClient.java:45-82.
Core Properties
endpoint()
Get the RPC endpoint URI.httpClient()
Get the underlying HTTP client.defaultCommitment()
Get the default commitment level for requests.Account Methods
getAccountInfo()
Fetch account information with optional custom deserialization.The account public key to query
Function to deserialize account data into type T
Account information with deserialized data
SolanaRpcClient.java:102-170):
- With commitment level
- With minContextSlot
- With data slice (length/offset)
- Raw bytes (using
BYTES_IDENTITY)
getMultipleAccounts()
Fetch multiple accounts in a single request (max 100).Collection of account public keys (max 100)
Deserialization factory function
List of account information (skips null entries)
getAccounts() for null preservation.
See SolanaRpcClient.java:344-418 for all variants.
getAccounts()
Fetch multiple accounts preserving null entries for non-existent accounts.getMultipleAccounts() but maintains null entries. See SolanaRpcClient.java:420-494.
getProgramAccounts()
Fetch all accounts owned by a program, with optional filters.Program public key
Optional filters (memcmp, dataSize)
Deserialization factory
All accounts owned by the program
PROGRAM_ACCOUNTS_TIMEOUT)
See SolanaRpcClient.java:496-708 for extensive variants with filters, commitment, data slicing, and custom timeouts.
getBalance()
Get account lamport balance.Account to query
Optional commitment level
Account balance with context
SolanaRpcClient.java:171-173.
Transaction Methods
getTransaction()
Fetch transaction details by signature.Transaction signature (base58)
Optional commitment level
Maximum transaction version (0 for versioned transactions)
Transaction details including metadata
SolanaRpcClient.java:819-824.
getSignaturesForAddress()
Fetch transaction signatures for an address.Address to query
Maximum signatures to return (max 1000)
Start searching backwards from this signature
Search until this signature
Transaction signatures with metadata
SolanaRpcClient.java:722-744.
getSignatureStatuses()
Get status of transaction signatures.Collection of transaction signatures (max 256)
Whether to search full transaction history
Map of signature to transaction status
SolanaRpcClient.java:746-758.
sendTransaction()
Send a signed transaction to the cluster.SolanaRpcClient.java:824+ (beyond line 824).
Block Methods
getBlock()
Fetch block information.Block slot number
Transaction detail level (full, signatures, none)
Include reward information
Maximum transaction version to support
Block information with transactions
SolanaRpcClient.java:175-236 for all variants.
getBlockHeight()
Get current block height.SolanaRpcClient.java:238-240.
getBlocks()
Get list of confirmed blocks.Starting slot
Ending slot (max 500,000 from start)
Array of block slot numbers
SolanaRpcClient.java:262-268.
getBlockTime()
Get estimated block production time.SolanaRpcClient.java:274.
Network Methods
getHealth()
Check node health status.SolanaRpcClient.java:90-100.
getLatestBlockHash()
Get latest blockhash for transaction signing.Optional commitment level
Latest blockhash with last valid block height
SolanaRpcClient.java:96-98.
getSlot()
Get current slot.SolanaRpcClient.java:760-762.
getEpochInfo()
Get information about the current epoch.SolanaRpcClient.java:278-280.
getClusterNodes()
Get information about cluster nodes.SolanaRpcClient.java:276.
getFeeForMessage()
Get fee for a message.Base64-encoded message
Fee calculation result
SolanaRpcClient.java:92-94.
Token Methods
getTokenAccountBalance()
Get token account balance.SolanaRpcClient.java:778-780.
getTokenAccountsForTokenMintByOwner()
Get all token accounts for a specific mint owned by an address.SolanaRpcClient.java:796-801.
Additional Methods
The interface includes many more methods for:- Block production:
getBlockProduction(),getBlockCommitment() - Leader schedule:
getLeaderSchedule(),getSlotLeader() - Inflation:
getInflationGovernor(),getInflationRate(),getInflationReward() - Supply:
getSupply(),getTokenSupply() - Stake:
getStakeMinimumDelegation() - Performance:
getRecentPerformanceSamples(),getRecentPrioritizationFees() - Identity:
getIdentity(),getGenesisHash()
SolanaRpcClient.java for complete method signatures.
See Also
- HTTP Client Implementation - SolanaJsonRpcClient class
- Response Types - All response type definitions
- Commitment Levels - Understanding commitment