pub struct MintView {
pub issuer: PublicKey,
pub layers: u32,
pub oldest: u64,
pub policy: Policy,
pub schedule: Option<Schedule>,
pub paused: bool,
}Expand description
What a holder knows about one mint: enough to tell, without asking it, whether a note can move now and when it dies.
A note’s layer follows from its serial: generations are consecutive, so a
note of generation g sits at position g − oldest. A view holds the
layers as the mint’s info gave them, and no clock moves it: a note counts
as expired only once the info says its layer was dropped. After a
rotation, read the info again.
Fields§
§issuer: PublicKeyThe mint’s issuer key.
layers: u32How many layers the mint has.
oldest: u64Generation of the first layer.
policy: PolicyThe rules the mint enforces.
schedule: Option<Schedule>The rotation schedule, if the mint has one.
paused: boolWhether the mint was paused when the view was read.
Implementations§
Source§impl MintView
impl MintView
Sourcepub fn position(&self, note: &Note) -> Option<u32>
pub fn position(&self, note: &Note) -> Option<u32>
Position of a note’s layer, 0 for the first, or None if the note
belongs to another mint, has expired or is newer than this view.
Sourcepub fn until_rotation(&self, now: u64) -> Option<u64>
pub fn until_rotation(&self, now: u64) -> Option<u64>
Seconds from Unix time now until the next scheduled rotation, if
the mint has a schedule and is not paused. 0 once now reaches that
rotation, however far past: as far as the view knows, the mint has
not made it yet, so it is the one about to come.
Sourcepub fn expires_at(&self, note: &Note) -> Option<u64>
pub fn expires_at(&self, note: &Note) -> Option<u64>
Unix time, in seconds, of the scheduled rotation that drops a note’s
layer, counted from the next rotation the view names. None when the
mint has no schedule or is paused, or the note is not live in the
view.