Skip to content

Instantly share code, notes, and snippets.

export async function getPriorityFeeEstimateForIxs(
ixs: TransactionInstruction[],
priorityLevel: PriorityConfigLevel = PriorityConfigLevel.NORMAL,
): Promise<number | null> {
try {
const heliusPriorityLevel: string = (() => {
switch (priorityLevel) {
case PriorityConfigLevel.NORMAL:
return 'Medium'
case PriorityConfigLevel.HIGH:
use reqwest::Client;
use serde_json::json;
use solana_client::{
client_error::{ClientError, ClientErrorKind, Result as ClientResult},
nonblocking::rpc_client::RpcClient,
rpc_config::RpcSimulateTransactionConfig,
};
use solana_program::instruction::Instruction;
use solana_sdk::{
commitment_config::CommitmentConfig,
export async function newTxWithComputeAndPriorityFees(
ixs: TransactionInstruction[],
userWallet: string,
lookupTables?: AddressLookupTableAccount[],
): Promise<Transaction> {
const ixsWithComputeAndPriorityFees = await prependComputeAndPriorityFees(
ixs,
userWallet,
lookupTables,
)
@adilcpm
adilcpm / example usage.ts
Created January 31, 2024 22:19
Json To TransactionInstruction
const data = await axios.post(
'http://localhost:3001/api/dev/transactions/buySingleListing',
{
nftMint: 'E2Lo6nxNC6bGP1JZHTsce4ebVCn3cE6uDagbmhvUoit',
wallet_address: 'BGQDmkQDrxZjNiUHCsSZYuKP4XJMfoJ6AXtmJh7CaxLH',
},
)
const reconstructedInstructions = reconstructTransactionInstructions(
data.data as JsonTransactionInstruction[],
)