GET_INSTRUCTIONS_IN_TRANSACTION

Get instructions in an associated transaction

Overview

This method will return instruction data within an associated transaction. Running with only required body params will return all relevant instructions. Feel free to make use of all non-required body params for more advanced queries. Refer to the Body "Schema" tab for help.

GET_INSTRUCTIONS_IN_TRANSACTION

post

Get instructions in an associated transaction

Header parameters
x-api-keystringRequired

the API key

Body
typestringRequired

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

Example: GET_INSTRUCTIONS_IN_TRANSACTION
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: 625

"{\n    \"type\": \"GET_INSTRUCTIONS_IN_TRANSACTION\",\n    \"query\": {\n        \"programId\": \"CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3\",\n        \"instructionName\": \"\",\n        \"txSignature\": \"2FYrQaKkVBvaBtDwTgjx1oQtaxAShqjiWtAXREz2Vf2oeBBwZnb9paSKxvjTEToyqmM1YXi2CxpG5H6WmHy8sRe9\",\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": "2FYrQaKkVBvaBtDwTgjx1oQtaxAShqjiWtAXREz2Vf2oeBBwZnb9paSKxvjTEToyqmM1YXi2CxpG5H6WmHy8sRe9",
        "slot": 205943641,
        "args": {
          "accountBump": 254,
          "accountNumber": 0,
          "subAccountAlias": [
            67,
            89,
            80,
            72,
            48,
            48,
            48,
            48,
            77,
            97,
            105,
            110,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
          ],
          "subAccountBump": 255,
          "subAccountNumber": 0
        },
        "logs": [
          "Program log: Instruction: CreateAccount",
          "Program 11111111111111111111111111111111 invoke [2]",
          "Program 11111111111111111111111111111111 success",
          "Program data: EiEYjZKPB31JyGthKGNlDLK2VsY1uuZnwrNrooeqAz9iQq9V962QKbHwDNmPeeyjCJn9wp4oXmGJwUkdq2gsGulUeW2lMvkEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
        ],
        "timestamp": 1689626722478,
        "isFailure": false,
        "errorCode": "text",
        "balances": [
          {
            "pubKey": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
            "lamports": {
              "pre": 66436150,
              "post": 3067309,
              "delta": -63368841
            },
            "token": {
              "pre": 0,
              "post": 40145280,
              "delta": 40145280
            }
          }
        ],
        "accounts": {
          "masterAccount": "5y21op357zX9jTSV7g4T6cT11NdXR3DxBiK3vEhpqjA8",
          "authority": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
          "subAccount": "AL8iLzD5nvhmHTThtxY3oFu1xLkB27yd37K1Tkf5nMb4",
          "payer": "CybTvGzBRYSwGZugchRVfjyc67wzDT45dbzsn7pjRw3y",
          "systemProgram": "11111111111111111111111111111111"
        }
      }
    ]
  }
}

Example - Basic

Program - Cypher Protocol

Description - Get all instructions in tx hash: 2FYr...sRe9

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_IN_TRANSACTION",
  "query": {
    "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
    "txSignature": "2FYrQaKkVBvaBtDwTgjx1oQtaxAShqjiWtAXREz2Vf2oeBBwZnb9paSKxvjTEToyqmM1YXi2CxpG5H6WmHy8sRe9"
  }
});

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_IN_TRANSACTION",
    "query": {
        "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
        "txSignature": "2FYrQaKkVBvaBtDwTgjx1oQtaxAShqjiWtAXREz2Vf2oeBBwZnb9paSKxvjTEToyqmM1YXi2CxpG5H6WmHy8sRe9"
    }
}'

Example - Advanced

Program - Cypher Protocol

Description - Get all instructions for tx hash: 2FYr...sRe9, returning only the specified fields in the response body. Return up to 20 results if they exist 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_IN_TRANSACTION",
  "query": {
    "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
    "instructionName": "",
    "txSignature": "2FYrQaKkVBvaBtDwTgjx1oQtaxAShqjiWtAXREz2Vf2oeBBwZnb9paSKxvjTEToyqmM1YXi2CxpG5H6WmHy8sRe9",
    "timeRange": {
      "before": "",
      "after": ""
    },
    "failures": false,
    "fields": [
      "txSignature",
      "slot",
      "args",
      "logs"
    ],
    "sort": {
      "order": "desc"
    },
    "pagination": {
      "limit": 20,
      "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_IN_TRANSACTION",
    "query": {
        "programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
        "instructionName": "",
        "txSignature": "2FYrQaKkVBvaBtDwTgjx1oQtaxAShqjiWtAXREz2Vf2oeBBwZnb9paSKxvjTEToyqmM1YXi2CxpG5H6WmHy8sRe9",
        "timeRange": {
            "before": "",
            "after": ""
        },
        "failures": false,
        "fields": ["txSignature", "slot", "args", "logs"],
        "sort": {
            "order": "desc"
        },
        "pagination": {
            "limit": 20,
            "offset": 0
        }
    }
}'

Last updated