Carpool
WebsiteTwitter
  • 👋Welcome
    • 🚘What is Carpool?
    • ☕Getting Started
  • 📘Guides
    • 🔖Onboarding Programs
    • ❓Querying
    • 🚨Alerting
    • 📖Organization Management
  • ⚙️API Reference
    • 📚About our Query API
    • 📝Instructions
      • LIST_INSTRUCTIONS
      • GET_INSTRUCTION
      • GET_INSTRUCTIONS_IN_TRANSACTION
      • GET_INSTRUCTIONS_INVOLVING_ACCOUNT
      • SEARCH_INSTRUCTION_LOGS
      • SEARCH_INSTRUCTIONS
      • COUNT_INSTRUCTIONS
      • FIELD_STATISTIC_INSTRUCTION
      • MOST_COMMON_VALUES_INSTRUCTION
      • MOST_COMMON_ACCOUNTS_INSTRUCTION
    • 🗄️Accounts
      • LIST_ACCOUNTS
      • GET_ACCOUNT
      • GET_ACCOUNTS_WITH_LAMPORTS
      • SEARCH_ACCOUNTS
      • COUNT_ACCOUNTS
      • FIELD_STATISTIC_ACCOUNT
      • MOST_COMMON_VALUES_ACCOUNT
    • ⏳Account Archive
      • GET_ACCOUNT_SNAPSHOT
      • GET_ACCOUNT_SNAPSHOT_AT_SLOT
      • LIST_ACCOUNT_SNAPSHOTS
    • 🗃️Filters
      • 👓Instruction Filters
      • 🎛️Account Filters
  • ❔Resources
    • 🔗Links
    • 📄Blog Posts
Powered by GitBook
On this page
  1. API Reference
  2. Accounts

GET_ACCOUNT

Get account from a program

PreviousLIST_ACCOUNTSNextGET_ACCOUNTS_WITH_LAMPORTS

Last updated 1 year ago

Overview

This method returns specific account data for a program based on an accountName and pubkey.

Example

Program - Cypher Protocol

Description - Get data about the specifc OrdersAccount at the given pubkey: Fbpf...oPHk

Javascript

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<API_KEY>");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "type": "GET_ACCOUNT",
  "query": {
    "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
    "accountName": "OrdersAccount",
    "accountPubKey": "FbpfJWThAJ3DRb42GuFTJxrUjxsDQ4TyWqXQZofWoPHk"
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://mainnet.carpool.dev/query/solana", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

cURL

curl --location 'https://mainnet.carpool.dev/query/solana' \
--header 'x-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "type": "GET_ACCOUNT",
    "query": {
        "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
        "accountName": "OrdersAccount",
        "accountPubKey": "FbpfJWThAJ3DRb42GuFTJxrUjxsDQ4TyWqXQZofWoPHk"
    }
}'
⚙️
🗄️
  • Overview
  • POSTGET_ACCOUNT
  • Example

GET_ACCOUNT

post

Get account from a program

Header parameters
x-api-keystringRequired

the API key

Body
typestringRequired

Should be set to 'GET_ACCOUNT'. This is the type of query you want to perform.

Example: GET_ACCOUNT
Responses
200
Successful Response
application/json
post
POST /query/solana HTTP/1.1
Host: mainnet.carpool.dev
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 259

"{\n    \"type\": \"GET_ACCOUNT\",\n    \"query\": {\n        \"programId\": \"CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3\",\n        \"accountName\": \"OrdersAccount\",\n        \"accountPubKey\": \"FbpfJWThAJ3DRb42GuFTJxrUjxsDQ4TyWqXQZofWoPHk\"\n    }\n}"
200

Successful Response

{
  "response": {
    "account": {
      "slot": 208273283,
      "lamports": 23218560,
      "writeVersion": 799761746134,
      "data": {
        "accountNumberSeed": [
          0
        ],
        "accountType": "{\"regular\":{}}",
        "authority": "FHXYJh7iZ52mE5r8AmgxKP5rk7LTVvf6SUdLBSdja3mc",
        "bumpSeed": [
          252
        ],
        "clearing": "GhEdXiQgR5ckWXu8EAELQEgtqUUcrZfhAUjpLSSkQPke",
        "delegate": "11111111111111111111111111111111",
        "feeTier": 1,
        "padding": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ],
        "padding2": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ],
        "subAccountCaches": [
          {
            "subAccount": "GAhNFnvkUCVViqCjpJGmQr6VP6hineWaZzEQ29UeBFuJ",
            "assetsValue": 101969121886736140,
            "cRatio": 394748217280645,
            "liabilitiesValue": 72709020463719170,
            "updatedAt": 189173418,
            "volatileAssetsValue": 0,
            "volatileLiabilitiesValue": 0,
            "margining": {
              "cross": {}
            },
            "padding": [
              0,
              0,
              0,
              0,
              0,
              0,
              0
            ]
          },
          {
            "subAccount": "11111111111111111111111111111111",
            "assetsValue": 0,
            "cRatio": 0,
            "liabilitiesValue": 0,
            "updatedAt": 0,
            "volatileAssetsValue": 0,
            "volatileLiabilitiesValue": 0,
            "margining": {
              "cross": {}
            },
            "padding": [
              0,
              0,
              0,
              0,
              0,
              0,
              0
            ]
          }
        ],
        "updatedAt": 189173418
      },
      "timestamp": 1690660835287,
      "pubKey": "2y1EKbD5GxrdiAJS7YduJc7L1HDPnTB46VYcq4L12Ry6",
      "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3"
    }
  }
}