For the complete documentation index, see llms.txt. This page is also available as Markdown.

getAccountInfo

All the specifications for getAccountInfo RPC Method on Solana

Returns all information associated with the account of provided Pubkey

Parameters required for this RPC call

  • The account address for which we are fetching the account info. This is usually provided as a string.

  • configuration object: This contains the following methods.

    • commitment: The commitment describes how finalized a block is at that point in time.

    • encoding: The encoding format of the account data. The options can be base58, base64, base64+zstd, jsonParsed.

    • dataSlice: Requests a part of the account data instead of the full account data. This also has two parameters: length: <usize> - number of bytes to return & offset: <usize> - byte offset from which to start reading.

    • minContextSlot: The minimum slot that the request can be evaluated at.

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": "getAccountInfo",
    "params": [
      "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
      {
        "commitment": "finalized",
        "encoding": "base58"
      }
    ]
  }
'
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");
const publicKey = new PublicKey("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg");
const accountInfo = await connection.getAccountInfo(publicKey);

console.log("Account Info:", JSON.stringify(accountInfo, null, 2));

Last updated