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.
Transaction history is only limited to past 3-4 days. From both RPCs and APIs.
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.
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.
encoded_transaction: string - Base64 encoded and signed transaction string.
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.
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);
}
}
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));