Skip to main content
The Light Token SDK calls these methods internally via interface functions like transferInterface and getAtaInterface. You rarely need to call them directly.Call these methods directly if you are building a block explorer, custom indexer, or working with legacy compressed tokens.
The Light Token SDK exposes interface methods that check both hot (on-chain) and cold (compressed) state:
Light SDK interface methodSolana RPCPhoton RPC
getAccountInfoInterfacegetAccountInfogetCompressedAccount
getBalanceInterfacegetBalancegetCompressedBalanceByOwner
getAtaInterfacegetAccountInfogetCompressedTokenAccountsByOwner
getTokenAccountBalanceInterfacegetTokenAccountBalancegetCompressedTokenBalancesByOwner
getSignaturesForAddressInterfacegetSignaturesForAddressgetCompressionSignaturesForAddress
getSignaturesForOwnerInterfacegetSignaturesForAddressgetCompressionSignaturesForOwner
Each interface method executes both calls in parallel and merges the results.

Create an RPC connection

// Helius exposes Solana and Photon RPC endpoints through a single URL
import { createRpc, Rpc } from '@lightprotocol/stateless.js';

const RPC_ENDPOINT = 'https://mainnet.helius-rpc.com?api-key=YOUR_KEY';
const connection: Rpc = createRpc(RPC_ENDPOINT, RPC_ENDPOINT);

Best practices

Best practiceDescription
Commitment levelsUse appropriate commitment levels: processed (fastest), confirmed (balanced), finalized (most reliable).
Rate limitingImplement retry logic and respect rate limits. Public endpoints: 100 req/s, Private: 1000+ req/s.
Batch requestsUse batch requests when possible to reduce API calls.
CachingCache frequently accessed data to reduce API calls.

Error codes

CodeMessageDescription
-32600Invalid RequestThe JSON sent is not a valid Request object.
-32601Method not foundThe method does not exist / is not available.
-32602Invalid paramsInvalid method parameter(s).
-32603Internal errorInternal JSON-RPC error.
-32000Account not foundThe compressed account was not found.
-32001Invalid account hashThe provided account hash is invalid.

Methods

These methods are called internally by the Light Token SDK. Call them directly for custom indexing, block explorers, or debugging.
GetCompressedAccountReturns a compressed account by address or hash.
GetCompressedAccountsByOwnerReturns all compressed accounts for an owner.
GetCompressedBalanceByOwnerReturns the total compressed balance for an owner.
GetCompressedTokenAccountsByOwnerReturns all compressed token accounts for an owner.
GetCompressedTokenBalancesByOwnerReturns all token balances for compressed accounts owned by an address.
GetValidityProofReturns a validity proof for compressed state transitions.
GetCompressionSignaturesForAddressReturns signatures for transactions involving an address.
GetCompressionSignaturesForOwnerReturns signatures for transactions where an address is the owner.
GetTransactionWithCompressionInfoReturns transaction details with compression context.
GetIndexerHealthReturns the health status of the Photon indexer.
GetIndexerSlotReturns the current slot of the Photon indexer.

Legacy

Methods for direct compressed-token workflows. Not called by the Light Token SDK interface functions.
GetCompressedBalanceReturns the balance of a single compressed account.
GetCompressedMintTokenHoldersLists all holders of a compressed token mint.
GetCompressedTokenAccountBalanceReturns the token balance of a single compressed token account.
GetCompressedTokenAccountsByDelegateReturns all compressed token accounts delegated to an address.
GetCompressionSignaturesForAccountReturns signatures for transactions involving a compressed account.
GetCompressionSignaturesForTokenOwnerReturns signatures for token transactions by owner.
GetLatestCompressionSignaturesReturns the most recent compression-related signatures.
GetLatestNonVotingSignaturesReturns recent non-voting transaction signatures.
GetMultipleCompressedAccountsReturns multiple compressed accounts in a single request.
GetMultipleNewAddressProofsReturns proofs that new addresses can be created.