Live Walrus storage cost forecasting. Reads the on-chain Walrus System
object (versioned dynamic field) and applies the same math the dapp's
wizard renders.
Forecast the cost of storing bytesPerBlob × numBlobs for epochs Walrus
epochs. Pricing is fetched live unless you pass args.pricing (useful for
memoizing inside a UI render loop).
Walrus encodes data with RaptorQ + erasure coding across storage shards.
The exact factor depends on n_shards, but 5× is a safe upper bound for
UI display. The publisher does an authoritative calculation at PUT time,
so this estimate is approximate but tightly bounded.
Just the live Walrus pricing snapshot — useful if you want to memoize and
run calculateCost() yourself.
interface WalrusSystemSnapshot { currentEpoch: number; // committee epoch epochDurationMs: number; // 0 when not on System object epochDays: number; // rounded, 0 when unavailable storagePricePerUnitFrost: number; // FROST / unit / epoch writePricePerUnitFrost: number; // FROST / unit (one-time) isAvailable: boolean; // both prices > 0}
Where pricing lives on-chain
The Walrus System wrapper exposes only { id, version, package_id }. The
actual prices live in a dynamic object field keyed by u64 = version.
The SDK derives the field id via deriveDynamicFieldID and reads it —
the same path @mysten/walrus's WalrusClient.systemState() uses,
but without pulling in the full Walrus SDK as a dep.