Documentation
¶
Overview ¶
Package helpers provides pure-logic decoders and statistics used by the client package. It holds no RPC calls and no I/O — only data transforms on wire shapes (DecodeTransactionError) and summary statistics (PriorityFeeStatsFromFees).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnchorAccountDisc ¶ added in v0.1.8
AnchorAccountDisc returns the 8-byte tag Anchor writes at the start of a program account's data: sha256("account:" + name)[:8]. name is the PascalCase Rust struct (e.g. "Pool", "UserPosition").
func AnchorMethodDisc ¶ added in v0.1.8
AnchorMethodDisc returns the 8-byte discriminator Anchor emits at the start of an instruction's data: sha256("global:" + name)[:8]. name is the snake_case Rust method on the program (e.g. "initialize", "swap").
func AnchorSighash ¶ added in v0.1.8
AnchorSighash returns the first 8 bytes of sha256(namespace + ":" + name). Anchor uses this scheme for several discriminators; AnchorMethodDisc and AnchorAccountDisc wrap it with the common namespaces. Exposed for non-standard namespaces (e.g. "state:" on legacy state methods).
Types ¶
type PriorityFeeStats ¶
type PriorityFeeStats struct {
// P50 is the median observed prioritization fee.
P50 uint64
// P75 is the 75th percentile observed prioritization fee.
P75 uint64
// P95 is the 95th percentile observed prioritization fee.
P95 uint64
// Max is the highest observed prioritization fee.
Max uint64
// Samples is the number of slots that contributed to the statistics.
// A low Samples count means the percentiles are based on sparse data
// and should be treated as advisory.
Samples int
}
PriorityFeeStats summarises a window of recent prioritization fees as ordered percentiles. Values are in micro-lamports per compute unit, matching the units getRecentPrioritizationFees returns.
func PriorityFeeStatsFromFees ¶
func PriorityFeeStatsFromFees(fees []solana.PrioritizationFee) *PriorityFeeStats
PriorityFeeStatsFromFees computes ordered-percentile statistics from a pre-fetched slice of fees (typically from Client.GetRecentPrioritizationFees).
The input slice is not mutated.