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
programId
required
string
The public key of the program, as a base-58 encoded string.
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.

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
mint
required
string
The public key of the token mint, as a base-58 encoded string.
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'

getTokenAccountsByOwner
Available
Returns all SPL Token accounts by owner.
Parameters
owner
required
string
The public key of the account owner, as a base-58 encoded string.
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.

getTokenAccountsByDelegate
Available
Returns all SPL Token accounts by delegate.
Parameters
delegate
required
string
The public key of the delegate, as a base-58 encoded string.
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.

getAccountInfo
Available
Returns detailed information about an account given its public key.
Parameters
pubkey
required
string
The public key of the account to query, as a base-58 encoded string.
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.

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
pubkeys
required
array[string]
An array of public keys to query, as base-58 encoded strings.
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.

getTokenAccountBalance
Available
Returns the balance of a token account, given its public key.
Parameters
pubkey
required
string
The public key of the token account to query, as a base-58 encoded string.
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'

getTokenSupply
Available
Returns the total supply of a token, given its mint address.
Parameters
mint
required
string
The public key of the token mint, as a base-58 encoded string.
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'