Transaction APIs
Developer friendly transaction APIs.
Parse Transaction Signature
This endpoint returns the parsed transaction details for a given txn signature.
GET /transaction/parsed
Query Params:
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
txn_signature: Transaction signature
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/transaction/parsed?network=mainnet-beta&txn_signature=3teBNmcLtXHWKFNWhkF8n4vJpyverF5njLK7xwyafydubNfUT8R9zZyEA8VkiUUAethwVavTJbPKCvhcfj8vN4AP", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
{
"success": true,
"message": "Transaction details fetched successfully",
"result": {
"timestamp": "2023-01-19T09:48:43.000Z",
"fee": 0.000005,
"fee_payer": "BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx",
"actions": [
{
"info": {
"amount": 100,
"receiver_address": "EsqozjiKUYMk2ToApSTyxJqvj5iqLWJoyuUg3wpAPdtL",
"token_address": "7yPeRofJpfPkjLJ8CLB7czuk4sKG9toXWVq8CcHr4DcU"
},
"type": "TOKEN_MINT"
}
],
"signers": [
"BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx"
],
"signatures": [
"3teBNmcLtXHWKFNWhkF8n4vJpyverF5njLK7xwyafydubNfUT8R9zZyEA8VkiUUAethwVavTJbPKCvhcfj8vN4AP"
]
}
}
Transaction History
Fetches a list of parsed transactions for an on-chain account. The response returns the transactions with the latest transactions first. The response can have results of a maximum of 100 transactions in 1 single API call.
GET /transaction/history
Query Params:
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
account: account address
tx_num: (optional) How many transactions (maximum 100 transactions at a time) do you want to fetch
before_tx_signature: (optional) Tx signature before which X number of transactions will be fetched, in reverse order going back in time
until_tx_signature: (optional) Tx signature until which X number of transactions will be fetched, in reverse order going back in time
enable_raw: (optional) boolean to send raw data along with parsed information. Send 'true' from raw data
enable_events: (optional) boolean to send parsed anchor events along with parsed information.
commitment: (optional) confirmed (default) or finalized.
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<API-KEY>");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(
"https://api.shyft.to/sol/v1/transaction/history?network=mainnet-beta&tx_num=2&account=Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj&enable_raw=true",
requestOptions
)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
{
"success": true,
"message": "Transaction history fetched successfully",
"result": [
{
"timestamp": "2023-02-17T05:59:59.000Z",
"fee": 0.000005,
"fee_payer": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
"signers": [
"9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
],
"signatures": [
"WVvRzZbHCSuji7MuQxbzV9X7YtUUNvNpBdLrw3qudHrqw8Mn3nKu3WXtR9CfEqctLav9NyDS7HnxYHmD6PpEoab"
],
"protocol": {
"address": "11111111111111111111111111111111",
"name": ""
},
"type": "SOL_TRANSFER",
"actions": [
{
"info": {
"sender": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
"receiver": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"amount": 0.1
},
"source_protocol": "11111111111111111111111111111111",
"type": "SOL_TRANSFER"
}
],
"raw": {
"blockTime": 1676613599,
"meta": {
"computeUnitsConsumed": 0,
"err": null,
"fee": 5000,
"innerInstructions": [],
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"postBalances": [
39019203960013220,
12380456480,
1
],
"postTokenBalances": [],
"preBalances": [
39019204060018216,
12280456480,
1
],
"preTokenBalances": [],
"rewards": [],
"status": {
"Ok": null
}
},
"slot": 196287434,
"transaction": {
"message": {
"accountKeys": [
{
"pubkey": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
"signer": true,
"source": "transaction",
"writable": true
},
{
"pubkey": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"signer": false,
"source": "transaction",
"writable": true
},
{
"pubkey": "11111111111111111111111111111111",
"signer": false,
"source": "transaction",
"writable": false
}
],
"addressTableLookups": null,
"instructions": [
{
"parsed": {
"info": {
"destination": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"lamports": 100000000,
"source": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
},
"type": "transfer"
},
"program": "system",
"programId": "11111111111111111111111111111111"
}
],
"recentBlockhash": "47xjhFKQL8GAfCJdmA29qUKzzb84s3hbY8sT2oeoY3iL"
},
"signatures": [
"WVvRzZbHCSuji7MuQxbzV9X7YtUUNvNpBdLrw3qudHrqw8Mn3nKu3WXtR9CfEqctLav9NyDS7HnxYHmD6PpEoab"
]
},
"version": "legacy"
}
},
{
"timestamp": "2023-02-17T05:55:54.000Z",
"fee": 0.000005,
"fee_payer": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
"signers": [
"9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
],
"signatures": [
"4RGrpBwAmZAKkC4endaRdZPZd9w2d6XEorjScNfa3HqFoH8v74NQBC1MgFYe8V9nQctaB6FGyzmVJTYKQg4Vg8cn"
],
"protocol": {
"address": "11111111111111111111111111111111",
"name": ""
},
"type": "SOL_TRANSFER",
"actions": [
{
"info": {
"sender": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
"receiver": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"amount": 0.1
},
"source_protocol": "11111111111111111111111111111111",
"type": "SOL_TRANSFER"
}
],
"raw": {
"blockTime": 1676613354,
"meta": {
"computeUnitsConsumed": 0,
"err": null,
"fee": 5000,
"innerInstructions": [],
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"postBalances": [
39019308060298216,
12280456480,
1
],
"postTokenBalances": [],
"preBalances": [
39019308160303220,
12180456480,
1
],
"preTokenBalances": [],
"rewards": [],
"status": {
"Ok": null
}
},
"slot": 196286805,
"transaction": {
"message": {
"accountKeys": [
{
"pubkey": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
"signer": true,
"source": "transaction",
"writable": true
},
{
"pubkey": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"signer": false,
"source": "transaction",
"writable": true
},
{
"pubkey": "11111111111111111111111111111111",
"signer": false,
"source": "transaction",
"writable": false
}
],
"addressTableLookups": null,
"instructions": [
{
"parsed": {
"info": {
"destination": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
"lamports": 100000000,
"source": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
},
"type": "transfer"
},
"program": "system",
"programId": "11111111111111111111111111111111"
}
],
"recentBlockhash": "HzRoRypHdBkbgF4sP5YEq7Ucj3yUTzxPU5fTDcLmdVxR"
},
"signatures": [
"4RGrpBwAmZAKkC4endaRdZPZd9w2d6XEorjScNfa3HqFoH8v74NQBC1MgFYe8V9nQctaB6FGyzmVJTYKQg4Vg8cn"
]
},
"version": "legacy"
}
}
]
}
Parse Multiple Transaction Signatures
Fetch parsed bulk transactions in a single call.
POST /transaction/parse_selected
Body params:
network: Solana blockchain environment (testnet/devnet/mainnet-beta)
transaction_signatures: array of strings) Selected transaction signatures (minimum 1 and maximum 100 transactions could be fetched)
enable_raw: (optional) boolean to send raw data along with parsed information. Send 'true' from raw data
enable_events: (optional) boolean to send parsed anchor events along with parsed information.
commitment: (optional) confirmed (default) or finalized.
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "YOUR_API_KEY");
var raw = JSON.stringify({
"network": "mainnet-beta",
"transaction_signatures": [
"67BJFsmeLhpPWLonvXyi46dh4UszCHZCWecUznfAdGX2KGEJxxGCoTiKAixMgZsBJBGTUQsDNHf697BQLceRdfd9",
"4NcmYNHKAdTFnm8y78wQoKMmGCedhTVFrWeHdEGYaThY4AYQ96fbeADY48B7XSgDz6RCZUDqnNPVWay34M18yXmg"
],
"enable_raw": false,
"enable_events": true
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/transaction/parse_selected", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
{
"success": true,
"message": "Selected transactions fetched successfully",
"result": [
{
"timestamp": "2023-10-27T10:41:34.000Z",
"fee": 0.0000066,
"fee_payer": "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC",
"signers": [
"Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC"
],
"signatures": [
"67BJFsmeLhpPWLonvXyi46dh4UszCHZCWecUznfAdGX2KGEJxxGCoTiKAixMgZsBJBGTUQsDNHf697BQLceRdfd9"
],
"protocol": {
"address": "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY",
"name": "BUBBLEGUM"
},
"type": "COMPRESSED_NFT_TRANSFER",
"status": "Success",
"actions": [
{
"info": {
"tree_authority": "zGyFUsKhko78FD7mpSZWsF4qjhWLsZZfmiA6pw7FvKd",
"merkle_tree": "7FjaYxpXjDteyhw12CQr7K3GQUQvEw98qZbBGQfBpACk",
"sender": "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC",
"receiver": "DPznZBrcA3jHB2TMtXQcJhp1eKmoQV1o2kgEJxMT2kwa",
"nft_address": "3X5TMvbL3FWwAxBpQZeKFXtbNo3FYU3gjdg9CzQcyiuJ",
"update_authority": "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC"
},
"source_protocol": {
"address": "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY",
"name": "BUBBLEGUM"
},
"type": "COMPRESSED_NFT_TRANSFER"
}
],
"events": []
},
{
"timestamp": "2023-10-27T11:38:42.000Z",
"fee": 0.000005,
"fee_payer": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
"signers": [
"AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt"
],
"signatures": [
"4NcmYNHKAdTFnm8y78wQoKMmGCedhTVFrWeHdEGYaThY4AYQ96fbeADY48B7XSgDz6RCZUDqnNPVWay34M18yXmg"
],
"protocol": {
"address": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp",
"name": "FOXY_CITRUS"
},
"type": "REPAY_LOAN",
"status": "Success",
"actions": [
{
"info": {
"lender": "HX66hhr7Ga5dS9M5wsQySGsaugdYx4kvPSfG4pVE72WJ",
"borrower": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
"loan": "BJbH1z8vbjQ5WmknjGgqiTxUUUjs8YeaeNtKsRvRhHro",
"currency": "So11111111111111111111111111111111111111112",
"amount": 13.431017779,
"fee_paid": null,
"nft_address": "2C5M6bNjnEgfZbSZdaX1eTyRYg13fPPeKHy7PriVrRzT",
"escrow": "",
"escrow_token_account": "",
"order_book": "",
"admin_payment": null,
"payback_to_liq_owner": null
},
"source_protocol": {
"address": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp",
"name": "FOXY_CITRUS"
},
"type": "REPAY_LOAN"
},
{
"info": {
"sender": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
"receiver": "HX66hhr7Ga5dS9M5wsQySGsaugdYx4kvPSfG4pVE72WJ",
"amount": 13.431017779
},
"source_protocol": {
"address": "11111111111111111111111111111111",
"name": "SYSTEM_PROGRAM"
},
"type": "SOL_TRANSFER",
"parent_protocol": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp"
},
{
"info": {
"sender": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
"receiver": "7e7qhwnJuLVDGBiLAGjB9FxfpizsPhQjoBxkNA5wVCCc",
"amount": 0.020162666
},
"source_protocol": {
"address": "11111111111111111111111111111111",
"name": "SYSTEM_PROGRAM"
},
"type": "SOL_TRANSFER",
"parent_protocol": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp"
}
],
"events": [
{
"data": {
"loanAccount": "BJbH1z8vbjQ5WmknjGgqiTxUUUjs8YeaeNtKsRvRhHro",
"lender": "HX66hhr7Ga5dS9M5wsQySGsaugdYx4kvPSfG4pVE72WJ",
"borrower": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
"mint": "2C5M6bNjnEgfZbSZdaX1eTyRYg13fPPeKHy7PriVrRzT",
"collectionConfig": "8nU7L3os6vhYQrx2dYvDMzEeZt5XEq52ToZbAqZZp8Wa",
"status": {
"repaid": {}
},
"loanTerms": {
"apyBps": 24000,
"duration": 259200,
"principal": 13296600000
},
"creationTime": 1698233153,
"startTime": 1698255801,
"endTime": 1698406722,
"fox": false,
"tokenAccount": "DaJFRQtMSFpT2eK98sFQUjtLM8QTm8QfFf7kDGiSCcNv",
"rulesAcc": null,
"mortgage": false,
"private": false,
"offerType": {
"global": {}
},
"listingPrice": 0,
"ltvTerms": {
"ltvBps": 8300,
"maxOffer": 15000000000
},
"pool": false,
"listedLoan": null
},
"name": "LoanUpdate"
}
]
}
]
}
Send Transaction
This API endpoint lets you submit your signed transaction into the Solana blockchain, via Shyft's dedicated RPC node, which reduces the risk of transaction drop to near 0.
API Working:
This endpoint can be used to submit transactions to blockchain using Shyft dedicated RPC nodes.
import { clusterApiUrl, Keypair, Transaction } from '@solana/web3.js';
async createSignedSerializedTxn(encodedTransaction: string, fromPrivateKey: string) : string {
try {
const connection = new Connection(clusterApiUrl("devnet"), 'confirmed');
const feePayer = Keypair.fromSecretKey(decode(fromPrivateKey));
const recoveredTransaction = Transaction.from(Buffer.from(encodedTransaction, 'base64'));
recoveredTransaction.partialSign(feePayer);
// This is the way that signed transactions can be serialized in base64 format. Needed to make a successful API call.
const txnToSendBackToShyft = recoveredTransaction.serialize().toString('base64');
return txnToSendBackToShyft;
} catch (error) {
console.log(error);
}
}
NOTE: Above code snippet uses private keys for signing a txn, but a txn can be signed using wallet adapters as well. Please refer to this function for signing using wallet adapter (https://github.com/Shyft-to/community-projects/blob/f2552c5e809a517ac9820dda0008d06f1d9e0013/demo-hh/src/shyft.js#L23)
POST /transaction/send_txn
Body params:
network: string [mainnet-beta, devnet]
encoded_transaction: string - Base64 encoded and signed transaction string.
var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"network": "devnet",
"encoded_transaction": "AVmMGj3kZrTdbQ+nFT55d59kaNkGvakYRJJ1ZFlyoSkIZSGNmjM2nAd+5YPj1kJh7uVCS+4kpZoy1X8f/k5dSAIBAAIFoml4osSZRwXqi2onReASLw930fViKFqc8clj9mwcrHlnmECCqlsIMcbFpqlapSWdgN1oYDA1x0VtmheYQvu7gc4uKRKiVfHE4b4WyDLcyJDaRxpH/74SupaQfQnHam2RBUpTWpkpIQZNJOhxYNo4fHw1td28kruB5B+oQEEFRI0G3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqXwrKau0iGDsINwwNq2yz3B2rQ48PACETYKxI6KT9uTnAgQDAQIACg4A5AtUAgAAAAkDAQAXU2h5ZnQgbWFrZXMgbGlmZSBlYXNpZXI="
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/transaction/send_txn", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
{
"success": true,
"message": "Transaction successfully submitted to blockchain",
"result": {
"signature": "2nqhCpcSHmKj4dcNPaatqQZp7hwP2msXXbQVVpyv6sFn5MwsXgxiUUpb84PUGD7RJidDXmoDZEABtzgwfitPsJZF"
}
}
Send Multiple Transactions
This API endpoint lets you send bulk transactions to Solana blockchain, via Shyft's dedicated RPC node, which reduces the risk of transaction drop to near 0.
POST /transaction/send_many_txns
Body params:
network: string - [mainnet-beta, devnet]
encoded_transactions: string - Array of base64 encoded and signed transaction strings (maximum 100).
commitment (optional): processed, confirmed, finalized. API returns after the desired commitment level is reached for all txs or they error out.
The response times may increase with commitment
levels. System waits for the transactions to reach the required commitment level.
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "YOUR_API_KEY");
var raw = JSON.stringify({
"network": "devnet",
"encoded_transactions": [
"ARfcRDj2D2q6Zib4/r9bBcDvONvJ9/lM+4834g2065NGTvQ5kEmIWepO1hTDV5oq6JYye75FJdIHBgk8TQrGcQwBAAEDGMqfUcVHHu2+lyU5gx9wU2rGxk2NoSXtodMSdev+DxVALAeVfwkorAqlrAeN8dOn8Jeu6H4u3ofHzGz4FntQPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/RWzWr+bM4lKfgjl47HKiqsxT/Jwcg1qYDkOI9MxN5wBAgIAAQwCAAAAQEIPAAAAAAA=",
"AT3owiHF0oxDqa0Mhqisawdq2sf0mb58TVe/REYwnFZOU1nB5uK9Fu9m/8z1ojVhHrZqdwvp22PXgzpvD0gKpwEBAAEDGMqfUcVHHu2+lyU5gx9wU2rGxk2NoSXtodMSdev+DxUsLagmF5c4a6vJhMr74YTUznxniMs9+z4QYlMJ1x2b+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoEdavLhXjxh1GQUyHcxHwCsR71IQrPe3nJ88rb7cqJUBAgIAAQ"
],
"commitment": "finalized"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shyft.to/sol/v1/transaction/send_many_txns", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
{
"success": true,
"message": "Transactions are successfully submitted to blockchain",
"result": [
{
"id": 1,
"signature": "UfnRjNLyu9AnoBG27tre9D4XEQN32WVbnoPnkPd3j1wpxfQWt5qd6xiKPuTfbmkTA9kDXGJeXjQ4gusvUFgHGm9",
"status": "finalized"
},
{
"id": 2,
"error": {
"code": -32602,
"message": "invalid base64 encoding: InvalidPadding"
},
"status": null
}
]
}
Last updated