GET_ACCOUNT

Get account from a program

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"
    }
}'

Last updated