GET_INSTRUCTION
Get instruction from a specific parent transaction
Overview
This method will return data relative to a specific instruction within a parent transaction. Running with only required body params will return all fields in the response body. Feel free to make use of all non-required body params for more advanced queries. Refer to the Body "Schema" tab for help.
Get specific instruction for a tx
Header parameters
x-api-keystringRequired
the API key
Body
typestringRequiredExample:
should be set to 'GET_INSTRUCTION' This is the type of query you want to perform.
GET_INSTRUCTION
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: 534
"{\n \"type\": \"GET_INSTRUCTION\",\n \"query\": {\n \"programId\": \"CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3\",\n \"instructionName\": \"createAccount\",\n \"txSignature\": \"LqNexVeScmESKzQaNrzAFdkUFxzdYzPBQewABYeCCUQu7GCjxkKkHgx7ruFcPDLifK4f3GGH1QXvUGu29UkEdNY\",\n \"txIndex\": 2,\n \"timeRange\": {\n \"before\": \"2023-07-12T22:53:09+0000\",\n \"after\": \"2023-07-11T22:53:09+0000\"\n },\n \"failures\": false,\n \"fields\": []\n }\n}"
200
Successful Response
{
"response": {
"instruction": {
"txSignature": "LqNexVeScmESKzQaNrzAFdkUFxzdYzPBQewABYeCCUQu7GCjxkKkHgx7ruFcPDLifK4f3GGH1QXvUGu29UkEdNY",
"slot": 204804198,
"args": {
"accountBump": 255,
"accountNumber": 0
},
"logs": [
"Program log: Instruction: CreateAccount",
"Program 11111111111111111111111111111111 invoke [2]",
"Program 11111111111111111111111111111111 success",
"Program data: EiEYjZKPB30E/32LGCzCAzqoK48nuout/+Ii/i/YFIBqeQ4egaHJnVY3URSD1POxjdij9UUYI5u3A2gDRrte1bx/f52G+VsfAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
],
"timestamp": 1689114943338,
"isFailure": false,
"errorCode": "text",
"balances": [
"[{\"pubKey\":\"a69AEXw1JQ4EZJ81Aw6jgbhsyNi1egBvNQL1gQKVzrA\",\"lamports\":{\"pre\":0,\"post\":40145280,\"delta\":40145280}},{\"pubKey\":\"6oYz6WAZ3uycjVknBzAstiYZx3JAeysdRiMfG5SHRGva\",\"lamports\":{\"pre\":3655591567,\"post\":3592222726,\"delta\":-63368841}},{\"pubKey\":\"LWb6MgYfQp23sLPonVhTKK1q4MLTJtbdgcRrLjcVdGQ\",\"lamports\":{\"pre\":0,\"post\":23218560,\"delta\":23218560}}]"
],
"accounts": {
"systemProgram": "11111111111111111111111111111111",
"authority": "6oYz6WAZ3uycjVknBzAstiYZx3JAeysdRiMfG5SHRGva",
"masterAccount": "LWb6MgYfQp23sLPonVhTKK1q4MLTJtbdgcRrLjcVdGQ",
"clearing": "GhEdXiQgR5ckWXu8EAELQEgtqUUcrZfhAUjpLSSkQPke",
"payer": "6oYz6WAZ3uycjVknBzAstiYZx3JAeysdRiMfG5SHRGva"
}
}
}
}
Example
Program - Cypher Protocol
Description - get the instruction at the 2nd index of parent tx hash: LqNe...EdNY
Javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<API_KEY>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"type": "GET_INSTRUCTION",
"query": {
"programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
"instructionName": "createAccount",
"txSignature": "LqNexVeScmESKzQaNrzAFdkUFxzdYzPBQewABYeCCUQu7GCjxkKkHgx7ruFcPDLifK4f3GGH1QXvUGu29UkEdNY",
"txIndex": 2
}
});
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_INSTRUCTION",
"query": {
"programId": "CYPH3o83JX6jY6NkbproSpdmQ5VWJtxjfJ5P8veyYVu3",
"instructionName": "createAccount",
"txSignature": "LqNexVeScmESKzQaNrzAFdkUFxzdYzPBQewABYeCCUQu7GCjxkKkHgx7ruFcPDLifK4f3GGH1QXvUGu29UkEdNY",
"txIndex": 2
}
}'
Last updated