getProgramAccounts

All the specifications for getProgramAccounts RPC Method on Solana

Returns all accounts owned by the provided program address.

Parameters required for this RPC call

  • The address of the program whose accounts we are trying to fetch, as base-58 encoded string.

  • configuration : This contains the following parameters, all are optional fields.

    • commitment: The commitment describes how finalized a block is at that point in time. Only confirmed and finalized are supported, defaults to finalized.

    • encoding: Encoding format for each returned transaction. The supported options are json, jsonParsed, base58 and base64. You can know more about Parsed responses more on Solana docs.

    • minContextSlot: The minimum slot that the request can be evaluated at. This is a number.

    • withContext: Wrap the result in an RpcResponse JSON object.

    • filters: Filter results using up to 4 filter objects.

    • dataSlice: Request a slice of the account's data.

      • length: <usize> - number of bytes to return

      • offset: <usize> - byte offset from which to start reading

curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
  POST -H "Content-Type: application/json" -d ' 
   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "getMultipleAccounts",
     "params": [
       [
         "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
         "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
       ],
       {
         "encoding": "base58",
         "commitment": "finalized"
       }
     ]
   }
 '

Last updated

Was this helpful?