0

enter image description here

Just how jupiter determines current global priority fees, is there any existing method in the JS SDK that would allow the same to be done? If not, then what is my best bet at setting a priority fee so that my transaction gets asap but also is not so high that it's a wastage of sol?

The screenshot is from https://lfg.jup.ag/wen

1 Answer 1

2

The Solana RPC spec supports a method called getRecentPriorityFees. This method pulls data from a cache on an RPC node that stores up to the last 150 blocks. The response is defined by GetRecentPriorityFeesResponse:

type GetRecentPriorityFeesResponse = Vec<RpcPrioritizationFee>

struct RpcPrioritizationFee {
    slot: u64
    prioritization_fee: u64 
}

Here, prioritization_fee is calculated on a per-slot basis: prioritization_fee(slot) = MAX(min_txn_fee, MAX(min_writeable_account_fee(tx))

A good way to approximate priority fees for a given transaction is to take the median of the data received from getRecentPriorityFees for given writable accounts. This ensures that the priority fees is above the minimum required but not wasteful either.

Helius also has an API for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.