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. Instructions

GET_INSTRUCTIONS_INVOLVING_ACCOUNT

Get instructions associated with a specific account

PreviousGET_INSTRUCTIONS_IN_TRANSACTIONNextSEARCH_INSTRUCTION_LOGS

Last updated 1 year ago

Overview

This method will return instruction data associated with a specific account. Running with only required body params will search through all instructions and account fields. Feel free to make use of all non-required body params for more advanced queries. Refer to the Body "Schema" tab for help.

Example - Basic

Program - Cypher Protocol

Description - Get all instructions involving the account at the given pubkey: CybT...Rw3y

Javascript

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

var raw = JSON.stringify({
  "type": "GET_INSTRUCTIONS_INVOLVING_ACCOUNT",
  "query": {
    "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
    "accountPubKey": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y"
  }
});

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_INSTRUCTIONS_INVOLVING_ACCOUNT",
    "query": {
        "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
        "accountPubKey": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y"
    }
}'

Example - Advanced

Program - Cypher Protocol

Description - Get all instructions involving the account at the given pubkey: CybT...Rw3y for a set time range. Return all response body fields and do not include failed instructions.

javascript

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

var raw = JSON.stringify({
  "type": "GET_INSTRUCTIONS_INVOLVING_ACCOUNT",
  "query": {
    "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
    "instructionName": "",
    "accountPubKey": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
    "accountName": "",
    "timeRange": {
      "before": "2023-07-17T22:53:09+0000",
      "after": "2023-07-11T22:53:09+0000"
    },
    "failures": false,
    "fields": [],
    "sort": {
      "order": "desc"
    },
    "pagination": {
      "limit": 10,
      "offset": 0
    }
  }
});

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_INSTRUCTIONS_INVOLVING_ACCOUNT",
    "query": {
        "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
        "instructionName": "",
        "accountPubKey": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
        "accountName": "",
        "timeRange": {
            "before": "2023-07-17T22:53:09+0000",
            "after": "2023-07-11T22:53:09+0000"
        },
        "failures": false,
        "fields": [],
        "sort": {
            "order": "desc"
        },
        "pagination": {
            "limit": 10,
            "offset": 0
        }
    }
}'
⚙️
📝
  • Overview
  • POSTGET_INSTRUCTIONS_INVOLVING_ACCOUNT
  • Example - Basic
  • Example - Advanced

GET_INSTRUCTIONS_INVOLVING_ACCOUNT

post

Get instructions associated with a specific account

Header parameters
x-api-keystringRequired

the API key

Body
typestringRequired

should be set to 'GET_INSTRUCTIONS_INVOLVING_ACCOUNT' This is the type of query you want to perform.

Example: GET_INSTRUCTIONS_INVOLVING_ACCOUNT
Responses
200
Successful Response
application/json; charset=utf-8
post
POST /query/solana HTTP/1.1
Host: mainnet.carpool.dev
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 618

"{\n    \"type\": \"GET_INSTRUCTIONS_INVOLVING_ACCOUNT\",\n    \"query\": {\n        \"programId\": \"CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3\",\n        \"instructionName\": \"\",\n        \"accountPubKey\": \"CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y\",\n        \"accountName\": \"\",\n        \"timeRange\": {\n            \"before\": \"\",\n            \"after\": \"\"\n        },\n        \"failures\": false,\n        \"fields\": [],\n        \"sort\": {\n            \"order\": \"desc\"\n        },\n        \"pagination\": {\n            \"limit\": 10,\n            \"offset\": 0\n        }\n    }\n}"
200

Successful Response

{
  "response": {
    "instructions": [
      {
        "txSignature": "a2VJgMoRWZKodxkBZTKfHh4aFg1GfmuL8Z5uoB9atpNoZ57excHkwbfHqHZMfjfhaEgGbgufZ19L3MBvrseBnkF",
        "slot": 205951744,
        "args": {
          "args": {
            "isClientId": false,
            "orderId": 4.898901823655046e+23,
            "side": {
              "ask": {}
            }
          }
        },
        "logs": [
          "Program log: Instruction: CancelSpotOrder",
          "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX invoke [2]",
          "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX success",
          "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX invoke [2]",
          "Program srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX success"
        ],
        "timestamp": 1689630348489,
        "isFailure": false,
        "errorCode": "text",
        "balances": [
          {
            "pubKey": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
            "lamports": {
              "pre": 19132225472347,
              "post": 19134587472347,
              "delta": 2362000000
            },
            "token": {
              "owner": "234itWGBdtFT2VaPzoV8de9kGcDVCK33T9TNgVFmnpXN",
              "mint": "So11111111111111111111111111111111111111112",
              "pre": 19132223433067,
              "post": 19134585433067,
              "delta": 2362000000,
              "decimals": 9
            }
          }
        ],
        "accounts": {
          "assetMint": "So11111111111111111111111111111111111111112",
          "quoteVault": "FmpKZ81XZLx44ZtsD1c5MuFF5pwBEa35pJpJ8XX8Fcmk",
          "dex.coinVault": "CKxTHwM9fPMRRvZmFnFoqKNd9pQR21c5Aq9bh5h9oghX",
          "cacheAccount": "6x5U4c41tfUYGEbTXofFiHcfyx3rqJZsT4emrLisNGGL",
          "clearing": "GhEdXiQgR5ckWXu8EAELQEgtqUUcrZfhAUjpLSSkQPke",
          "assetVault": "A85tdpCV8EAA2hKjbjtvjqVoo1eCy7F4Y2JbWMiSUA8H",
          "dex.tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "subAccount": "AL8iLzD5nvhmHTThtxY3oFu1xLkB27yd37K1Tkf5nMb4",
          "dex.dexProgram": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX",
          "masterAccount": "5y21op357zX9jTSV7g4T6cT11NdXR3DxBiK3vEhpqjA8",
          "dex.asks": "EaXdHx7x3mdGA38j5RSmKYSXMzAFzzUXCLNBEDXDn1d5",
          "dex.openOrders": "X3HQxHKcuUkfYfTPNkuroP9eVpmyqVWCYN5PhGUikrj",
          "dex.market": "8BnEgHoWFysVcuFFX7QztDmzuH8r5ZFvyP3sYwn1XTh6",
          "assetPoolNode": "5bKS3K5vWVUC3g9qeDCDA7VSdMrcw5cuF8daygfvzdrP",
          "dex.eventQueue": "8CvwxZ9Db6XbLD46NZwwmVDZZRDy7eydFcAGkXKh9axa",
          "dex.vaultSigner": "CTz5UMLQm2SRWHzQnU62Pi4yJqbNGjgRBHqqp6oDHfF7",
          "authority": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
          "dex.bids": "5jWUncPNBMZJ3sTHKmMLszypVkoRK6bfEQMQUHweeQnh",
          "quotePoolNode": "HouRHBu1S1eeg47LzaYedYxBdACg1bbpJEFx11LbDN4N",
          "dex.pcVault": "6A5NHCj1yF6urc9wZNe6Bcjj4LVszQNj5DwAWG97yzMu"
        }
      }
    ]
  }
}