Account Methods

These methods give developers access to account states, balances, token holdings, and program-specific storage. They are used to fetch, inspect, and query information about both native and SPL-token accounts.

getProgramAccounts
Available
Get program accounts owned by a specific program ID.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
length
integer (optional)
The length of the data slice.
offset
integer (optional)
The offset of the data slice.
encoding
string (optional)
The encoding for the account data.
filters
array (optional)
Filters to apply to the program accounts. Each filter is a base58-encoded string representing an address or a specific filter type.
minContextSlot
integer (optional)
The minimum context slot for the account info.
sortResults
boolean (optional)
Whether to sort the results.
withContext
boolean (optional)
Whether to include the context in the response.
programId
required
string
The public key of the program, as a base-58 encoded string.

getLargestAccounts
Available
Returns the 20 largest accounts by lamport balance.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
filter
string (optional)
The filter to apply to the largest accounts.

getSupply
Available
Returns information about the current token supply.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
excludeNonCirculatingAccountsList
boolean (optional)
Whether to exclude non-circulating accounts.

getTokenLargestAccounts
Available
Returns the largest accounts for a given token mint.
Parameters
commitment
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
mint
required
string
The public key of the token mint, as a base-58 encoded string.

getTokenAccountsByOwner
Available
Returns all SPL Token accounts by owner.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
length
integer (optional)
The length of the data slice.
offset
integer (optional)
The offset of the data slice.
encoding
string (optional)
The encoding for the account data.
minContextSlot
integer (optional)
The minimum context slot for the account info.
owner
required
string
The public key of the account owner, as a base-58 encoded string.

getTokenAccountsByDelegate
Available
Returns all SPL Token accounts by delegate.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
length
integer (optional)
The length of the data slice.
offset
integer (optional)
The offset of the data slice.
encoding
string (optional)
The encoding for the account data.
minContextSlot
integer (optional)
The minimum context slot for the account info.
delegate
required
string
The public key of the delegate, as a base-58 encoded string.

getAccountInfo
Available
Returns detailed information about an account given its public key.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
length
integer (optional)
The length of the data slice.
offset
integer (optional)
The offset of the data slice.
encoding
string (optional)
The encoding for the account data.
minContextSlot
integer (optional)
The minimum context slot for the account info.
pubkey
required
string
The public key of the account to query, as a base-58 encoded string.

getBlockCommitment
Available
Returns commitment levels for a given block (slot).
Parameters
block
required
integer
The slot to query for block commitment.

getMultipleAccounts
Available
Returns account information for multiple public keys in a single call.
Parameters
config
Configuration object for the query.
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
length
integer (optional)
The length of the data slice.
offset
integer (optional)
The offset of the data slice.
encoding
string (optional)
The encoding for the account data.
minContextSlot
integer (optional)
The minimum context slot for the account info.
pubkeys
required
array[string]
An array of public keys to query, as base-58 encoded strings.

getTokenAccountBalance
Available
Returns the balance of a token account, given its public key.
Parameters
commitment
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
pubkey
required
string
The public key of the token account to query, as a base-58 encoded string.

getTokenSupply
Available
Returns the total supply of a token, given its mint address.
Parameters
commitment
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
commitment
string | string | string (optional)
The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'
mint
required
string
The public key of the token mint, as a base-58 encoded string.