SolanaAccounts Interface
software.sava.core.accounts.SolanaAccounts
Provides constants for all Solana system programs, common programs, and sysvar accounts.
Constants
Pre-configured instance with all mainnet program addresses.
Factory Method
static SolanaAccounts createAddressConstants(
String systemProgram,
String configProgram,
String stakeProgram,
// ... all other program addresses
)
System program address (11111111111111111111111111111111)
SPL Token program address
Token-2022 program address
Program Accessors
All methods return PublicKey or AccountMeta instances:
Native Programs
PublicKey systemProgram();
AccountMeta invokedSystemProgram();
AccountMeta readSystemProgram();
PublicKey stakeProgram();
PublicKey voteProgram();
PublicKey addressLookupTableProgram();
Common Programs
PublicKey computeBudgetProgram();
AccountMeta invokedComputeBudgetProgram();
PublicKey tokenProgram();
AccountMeta invokedTokenProgram();
AccountMeta readTokenProgram();
PublicKey token2022Program();
PublicKey associatedTokenAccountProgram();
PublicKey memoProgram();
Sysvar Accounts
PublicKey clockSysVar();
AccountMeta readClockSysVar();
PublicKey rentSysVar();
PublicKey epochScheduleSysVar();
PublicKey instructionsSysVar();
Example Usage
import software.sava.core.accounts.SolanaAccounts;
var accounts = SolanaAccounts.MAIN_NET;
// Get system program
var systemProgram = accounts.systemProgram();
// Get token program as invoked account meta
var tokenProgramMeta = accounts.invokedTokenProgram();
// Get rent sysvar as read-only account meta
var rentSysVar = accounts.readRentSysVar();
AccountWithSeed
software.sava.core.accounts.AccountWithSeed
Represents an account derived from a base key and seed.
Factory Methods
static AccountWithSeed createAccount(
PublicKey baseKey,
PublicKey publicKey,
byte[] asciiSeed,
PublicKey program
)
Base public key for derivation
ASCII seed bytes (max 32 bytes)
Program ID used in derivation
static AccountWithSeed createAccount(
PublicKey baseKey,
PublicKey publicKey,
String seed,
PublicKey program
)
Methods
Returns the base public key
Returns the derived public key
Returns the ASCII seed bytes
Address Lookup Tables
AddressLookupTable
software.sava.core.accounts.lookup.AddressLookupTable
Stores up to 256 account addresses for transaction compression.
Constants
int LOOKUP_TABLE_MAX_ADDRESSES = 256;
int LOOKUP_TABLE_META_SIZE = 56;
Factory Methods
static AddressLookupTable read(PublicKey address, byte[] data)
Lookup table account address
Parsed lookup table with reverse lookup map
static AddressLookupTable readWithoutReverseLookup(
PublicKey address,
byte[] data
)
Parsed lookup table without reverse lookup (lighter weight)
Methods
True if the lookup table is active (not deactivated)
PublicKey account(int index)
Public key at the specified index
int indexOf(PublicKey publicKey)
Index of public key, or -1 if not found
byte indexOfOrThrow(PublicKey publicKey)
Index as byte, throws if not found
long deactivationSlot()
long lastExtendedSlot()
PublicKey authority()
int numAccounts()
int numUniqueAccounts()
Example Usage
import software.sava.core.accounts.lookup.AddressLookupTable;
// Read lookup table from account data
var lookupTable = AddressLookupTable.read(tableAddress, accountData);
// Check if active
if (lookupTable.isActive()) {
// Get account at index
var account = lookupTable.account(0);
// Find index of account
int index = lookupTable.indexOf(myPublicKey);
// Get metadata
var authority = lookupTable.authority();
var numAccounts = lookupTable.numAccounts();
}
AddressLookupTableRoot
software.sava.core.accounts.lookup.AddressLookupTableRoot
Base implementation with core lookup table functionality.
Filters
static Filter activeFilter()
RPC filter for active lookup tables
static Filter authorityFilter(PublicKey authority)
Authority public key to filter by
RPC filter for tables with specified authority