GET_ACCOUNT
Get account from a program
Last updated
Get account from a program
Last updated
This method returns specific account data for a program based on an accountName and pubkey.
Program - Cypher Protocol
Description - Get data about the specifc OrdersAccount at the given pubkey: Fbpf...oPHk
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 --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"
}
}'
Get account from a program
the API key
Should be set to 'GET_ACCOUNT'. This is the type of query you want to perform.
GET_ACCOUNT
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}"
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"
}
}
}