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.

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