Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.soo.network/llms.txt

Use this file to discover all available pages before exploring further.

getTokenAccountsByOwner RPC Method

Returns all SPL Token accounts by token owner.

Parameters

string required
Pubkey of account owner to query
  • Base-58 encoded string
object required
A JSON object with one of the following fields:
  • mint: <string> - Pubkey of the specific token Mint
    • Base-58 encoded string
  • programId: <string> - Pubkey of the Token program that owns the accounts
    • Base-58 encoded string
object optional
Configuration object containing the following fields:
commitment string optional
The level of commitment desired when querying state
minContextSlot number optional
The minimum slot that the request can be evaluated at
dataSlice object optional
Request a slice of the account’s data
  • length: <usize> - number of bytes to return
  • offset: <usize> - byte offset from which to start reading
encoding string optional
Encoding format for Account data
  • Default: not specified
Allowed Encoding Values:
  • base58
  • base64
  • base64+zstd
  • jsonParsed

Data Slicing Note

Data slicing is only available for base58, base64, or base64+zstd encodings.

Code Sample

curl https://rpc.testnet.soo.network/rpc \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountsByOwner",
"params": [
  "FVP39NNZMKfEDzbg3BWWZEiYPH3wyFp5kmtuN3M2AZFo",
  {
    "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
  },
  {
    "encoding": "jsonParsed"
  }
]
}'

Response

{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 369624
    },
    "value": [
      {
        "pubkey": "BESTc6u4kKPDrdAXHTKPgCm9bwBzDn2Nq9g4gk1Ld3P4",
        "account": {
          "lamports": 1000000,
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "data": {
            "program": "spl-token",
            "parsed": {
              "info": {
                "tokenAmount": {
                  "amount": "1000000",
                  "decimals": 6,
                  "uiAmount": 1.0,
                  "uiAmountString": "1.0"
                }
              }
            }
          },
          "executable": false,
          "rentEpoch": 123,
          "space": 165
        }
      }
    ]
  },
  "id": 1
}

Result Details

The result is an RpcResponse JSON object with value as an array of account objects:
  • pubkey: <string>
    • Account Pubkey as a base-58 encoded string
    • Uniquely identifies the token account
  • account: <object>
    • Detailed account information:
      • lamports: <u64> - Number of lamports in the account
      • owner: <string> - Pubkey of the program owning the account
      • data: <object> - Token state data
      • executable: <bool> - Indicates if the account contains a program
      • rentEpoch: <u64> - Epoch when rent is next due
      • space: <u64> - Size of the account data

Additional Notes

  • When using jsonParsed encoding, expect a Token Balances Structure
  • tokenAmount provides detailed token balance information
  • Optional delegatedAmount may be present in the parsed data