Skip to main content

SpendsListParams

Struct SpendsListParams 

Source
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::tokenpending / 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

Source

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.

Source

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

Source§

fn clone(&self) -> SpendsListParams

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ControlCall for SpendsListParams

Source§

const METHOD: ControlMethod = ControlMethod::SpendsList

The wire method this call invokes.
Source§

type Output = SpendsListResult

The typed result this call returns on success.
Source§

impl Debug for SpendsListParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SpendsListParams

Source§

fn default() -> SpendsListParams

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SpendsListParams

Source§

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.

Source§

impl Eq for SpendsListParams

Source§

impl PartialEq for SpendsListParams

Source§

fn eq(&self, other: &SpendsListParams) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SpendsListParams

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SpendsListParams

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.