pub struct SpendsListParams {
pub since_ms: Option<u64>,
pub until_ms: Option<u64>,
pub store_id: Option<String>,
pub kind: Option<String>,
pub status: Option<String>,
pub after_id: Option<String>,
pub limit: Option<u32>,
}Expand description
control.spends.list params: WHICH automated spends to read, and how much of the record at once.
§A read, and only a read
Nothing here initiates, signs, cancels or amends a spend, and the catalog offers no method that does. The record exists to make automatic signing accountable, and a surface able to edit it would be a surface able to edit the evidence.
§Every filter is an AND; an unset filter constrains nothing
Omitting a field means “do not narrow on this”, never “match nothing”. A client that sends no field at all asks for the newest page of the whole record.
§Paged, and the page boundary is the caller’s
Rows come newest-initiated first (the full ordering rule is on
SpendsListResult) and a caller resumes from
after_id — the id of the last row it was actually HANDED. An out-of-range
limit is REFUSED rather than clamped, matching
WalletCoinsByParentParams and for the same reason: a silently shrunk page hands back a cursor
for a position the caller did not ask about.
Fields§
§since_ms: Option<u64>Only spends INITIATED at or after this unix-ms instant. Inclusive.
until_ms: Option<u64>Only spends INITIATED strictly before this unix-ms instant. Exclusive.
Half-open with since_ms so consecutive windows tile the record exactly:
one window’s until_ms is the next window’s since_ms, and no spend is counted twice or
dropped between them.
store_id: Option<String>Only spends serving this store id.
kind: Option<String>Only this kind of spend — the stable token the producer stamped ("mirror-coin", …).
An open string rather than an enum, because a new producer must be able to appear in the record without a release of this crate. An unrecognised kind matches nothing rather than erroring, which is the same answer a caller gets for a real kind that has no rows yet.
status: Option<String>Only this outcome, by its SpendOutcome::token —
pending / submitted / confirmed / failed / unresolved.
failed does NOT mean “the money stayed put”, so a client filtering on it must still
read each row’s stage — see SpendOutcome::Failed. A UI
that offers a “failed” filter and renders its rows as untouched money asserts something the
node does not know.
after_id: Option<String>Resume STRICTLY AFTER this audit id, in the read’s documented order. None starts at the
newest matching row.
This is the value the previous page handed back as
cursor — never an id the caller kept for another
reason, and never a timestamp. Resuming by time would drop every spend sharing the boundary
millisecond.
limit: Option<u32>The page size. None asks for SPENDS_LIST_DEFAULT_LIMIT.
A zero, or a value above SPENDS_LIST_MAX_LIMIT, is REFUSED as INVALID_PARAMS rather
than clamped — see Self::validated.
Implementations§
Source§impl SpendsListParams
impl SpendsListParams
Sourcepub fn effective_limit(&self) -> u32
pub fn effective_limit(&self) -> u32
The page size this request asks for, resolving None to SPENDS_LIST_DEFAULT_LIMIT.
Stated once here so the node and the client cannot resolve the same omitted field to two different numbers.
Sourcepub fn validated(self) -> Result<Self, ControlError>
pub fn validated(self) -> Result<Self, ControlError>
Check the page bound, or reject as -32602 INVALID_PARAMS.
limit: 0 is refused because a page that can hold nothing makes no progress: a caller
looping until complete would loop forever. A limit
above the cap is refused rather than clamped so the caller’s model of the page and the node’s
stay identical.
The time window is deliberately NOT validated. since_ms > until_ms is a well-formed request
for an empty window, and an empty window has an honest answer — no rows — which is a
different thing from a malformed request.
Trait Implementations§
Source§impl Clone for SpendsListParams
impl Clone for SpendsListParams
Source§fn clone(&self) -> SpendsListParams
fn clone(&self) -> SpendsListParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ControlCall for SpendsListParams
impl ControlCall for SpendsListParams
Source§const METHOD: ControlMethod = ControlMethod::SpendsList
const METHOD: ControlMethod = ControlMethod::SpendsList
Source§type Output = SpendsListResult
type Output = SpendsListResult
Source§impl Debug for SpendsListParams
impl Debug for SpendsListParams
Source§impl Default for SpendsListParams
impl Default for SpendsListParams
Source§fn default() -> SpendsListParams
fn default() -> SpendsListParams
Source§impl<'de> Deserialize<'de> for SpendsListParams
impl<'de> Deserialize<'de> for SpendsListParams
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Validates on the way in, so a node cannot forget to call Self::validated.