Documentation
¶
Overview ¶
Package mintinfo provides a small shared cache of SPL Mint decimals, populated opportunistically by every prefetcher that discovers a mint (Orca, Raydium AMM/CPMM/CLMM) so a mint referenced by many pools (USDC, wSOL) is only ever fetched once per run, not once per pool.
Index ¶
Constants ¶
const MintAccountSize = 82
MintAccountSize is the fixed on-chain byte size of an SPL Token Mint account (mint_authority Option<Pubkey>(36) + supply u64(8) + decimals u8(1) + is_initialized bool(1) + freeze_authority Option<Pubkey>(36)).
Variables ¶
var Schema string
Functions ¶
func DecodeDecimals ¶
DecodeDecimals parses an SPL Mint account body and returns its decimals field. body must be exactly MintAccountSize bytes.
func ExportJSON ¶
ExportJSON writes every mint_info row to path as a JSON array of MintDecimals -- the same table build.rs currently reads three separate times (a soft-degrade decimals lookup for the router graph, a hard- panic lookup for curated symbol mints, and a soft-skip lookup for the trade-universe filter); this is one full snapshot all three can build their own in-memory map from.
Types ¶
type MintDecimals ¶
MintDecimals is one mint_info row, JSON-shaped for catscope-rust-bot's build.rs to read instead of opening prefetch.db directly. mint_info has no dedicated Go struct today (Tracker only tracks which mints are known, not their decimals, in memory) -- this is a fresh, minimal type for exactly this export.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker deduplicates mint-decimals discovery across concurrently running prefetchers and persists results to the mint_info table.
func New ¶
New loads any already-known mints from db (so a resumed run doesn't re-fetch decimals for mints a previous run already discovered) and returns a ready-to-use Tracker.
func (*Tracker) Known ¶
Known reports whether mint's decimals are already saved.
func (*Tracker) MarkPending ¶
MarkPending records that a decimals fetch for mint is about to be issued. It returns true only the first time it's called for a given mint (across every prefetcher sharing this Tracker), telling the caller to actually subscribe; it returns false if the mint is already known or another prefetcher already has a fetch in flight for it.
func (*Tracker) Save ¶
Save persists mint's decimals using the tracker's own database handle. Only safe to call when the caller does NOT already hold an open transaction on the same database -- store.DB opens with a single- connection pool, so requesting a second connection from a goroutine that already holds the only one (via an open *sql.Tx) would deadlock. Callers that run inside their own CommitStart/CommitFinish transaction (Raydium AMM/CPMM/CLMM) must use SaveTx instead.
Source Files
¶
- export.go
- mintinfo.go
- schema.go