GET_ACCOUNTS_WITH_LAMPORTS
Get accounts within a range of lamports
Overview
This method will return accounts that lay within the specified lamport range or value. Running with only required body params will return all recent instructions and default to 10 objects. Feel free to make use of all non-required body params for more advanced queries. Refer to the Body "Schema" tab for help
Get accounts within a range of lamports
the API key
Should be set to 'GET_ACCOUNTS_WITH_LAMPORTS'. This is the type of query you want to perform.
GET_ACCOUNTS_WITH_LAMPORTS
POST /query/solana HTTP/1.1
Host: mainnet.carpool.dev
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 264
"{\n \"type\": \"GET_ACCOUNTS_WITH_LAMPORTS\",\n \"query\": {\n \"programId\": \"CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3\",\n \"accountName\": \"OrdersAccount\",\n \"lamports\": {\n \"gte\": 10000000\n }\n }\n}"
Successful Response
{
"response": {
"accounts": [
{
"slot": 205002240,
"lamports": 11679092720,
"writeVersion": 776455606905,
"data": "{\"authority\":\"war1yxneGq1Sd63ZF4K6X621rovAEoLuuNAwtqJoaSE\",\"data\":{\"creators\":[{\"address\":\"5oEEgeGe4NXZTdPvFxpZaBBKRimYbXmf6kX1rsK4cet3\",\"share\":100,\"verified\":false}],\"goLiveDate\":1667757600,\"isMutable\":true,\"itemsAvailable\":6969,\"maxSupply\":0,\"price\":0,\"retainAuthority\":true,\"sellerFeeBasisPoints\":500,\"symbol\":\"WFZ\",\"uuid\":\"#00000\"},\"itemsRedeemed\":1731,\"wallet\":\"qVQboST4STjh7uPeUPLyiFuVVQ3JaLaJtfmskE1wxhz\"}",
"timestamp": 1689201867561,
"pubKey": "ALrVvXCNr339eXCZF6FPJiXZ7QSUc7AGs2VF2Fzqw9mE",
"programId": "cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ"
}
]
}
}
Lamports Type
The 'lamports' field follows the below type. You can make use of the 'gte', 'lte', or 'eq' params to achieve your desired result:
// Either an equality check, or GTE/LTE range, one of which must be set.
export type NumericRange = XOR<XOR<{
gte: number;
lte?: number;
}, {
gte?: number;
lte: number;
}>, { eq: number }>;
Example - Basic
Program - Candy Machine
Description - Return all CandyMachine accounts with a lamports balance greater than 10000000
Javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<API_KEY>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"type": "GET_ACCOUNTS_WITH_LAMPORTS",
"query": {
"programId": "cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ",
"accountName": "CandyMachine",
"lamports": {
"gte": 10000000
}
}
});
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_ACCOUNTS_WITH_LAMPORTS",
"query": {
"programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
"accountName": "OrdersAccount",
"lamports": {
"gte": 10000000
}
}
}'
Example - Advanced
Program - Cypher Protocol
Description - Return all OrdersAccount accounts with a lamports balance greater than 10000000. Look Only in the specific time range and return all response body fields.
Javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<API_KEY>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"type": "GET_ACCOUNTS_WITH_LAMPORTS",
"query": {
"programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
"accountName": "OrdersAccount",
"lamports": {
"gte": 10000000
},
"pagination": {
"offset": 0,
"limit": 10
},
"sort": {
"order": "desc"
},
"fields": [],
"timeRange": {
"before": "2023-07-17T22:53:09+0000",
"after": "2023-07-11T22:53:09+0000"
}
}
});
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_ACCOUNTS_WITH_LAMPORTS",
"query": {
"programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
"accountName": "OrdersAccount",
"lamports": {
"gte": 10000000
},
"pagination": {
"offset": 0,
"limit": 10
},
"sort": {
"order": "desc"
},
"fields": [],
"timeRange": {
"before": "2023-07-17T22:53:09+0000",
"after": "2023-07-11T22:53:09+0000"
}
}
}'
Last updated