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_ACCOUNTS_WITH_LAMPORTS

Get accounts within a range of lamports

PreviousGET_ACCOUNTNextSEARCH_ACCOUNTS

Last updated 1 year ago

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

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"
        }
    }
}'
⚙️
🗄️
  • Overview
  • POSTGET_ACCOUNTS_WITH_LAMPORTS
  • Lamports Type
  • Example - Basic
  • Example - Advanced

GET_ACCOUNTS_WITH_LAMPORTS

post

Get accounts within a range of lamports

Header parameters
x-api-keystringRequired

the API key

Body
typestringRequired

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

Example: GET_ACCOUNTS_WITH_LAMPORTS
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: 264

"{\n    \"type\": \"GET_ACCOUNTS_WITH_LAMPORTS\",\n    \"query\": {\n        \"programId\": \"CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3\",\n        \"accountName\": \"OrdersAccount\",\n        \"lamports\": {\n            \"gte\": 10000000\n        }\n    }\n}"
200

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