Skip to main content

WalletCoinsResult

Struct WalletCoinsResult 

Source
pub struct WalletCoinsResult {
    pub coins: Vec<WalletCoinRecord>,
    pub complete: Option<bool>,
    pub cursor: Option<String>,
    pub source: Option<WalletReadSource>,
    pub synced: bool,
    pub peak_height: Option<u32>,
}
Expand description

control.wallet.coins — an address’s spendable coins for one asset.

§An empty list is an ANSWER, never a fallback

coins: [] means the node consulted a chain and that address holds nothing. It is NEVER what a caller gets when the chain could not be reached: those are catalogued errors (crate::error::ControlErrorCode::WalletNoChainSource / WalletNotSynced / WalletReadFailed / WalletRateLimited). The distinction is the whole point of the method — a well-shaped empty result on an unreachable chain would tell somebody who holds funds that they hold nothing, and a spend built on that answer refuses with a shortfall that is not true.

§The order is part of the contract, because paging is meaningless without one

A node MUST return coins in ASCENDING coin_id order and MUST keep that order stable across the pages of one walk; after_coin_id means strictly after this id in that order. Coin ids are fixed-length lowercase hex, so ascending lexicographic order and ascending 32-byte numeric order are the SAME order and cannot disagree.

The order is what makes the boundary survive a CHANGING coin set, which is the case that matters here and does not arise for coinsByParent: a spent coin drops out of an address’s unspent set between two pages. Against a cursor, the rows before the boundary are simply gone and every row after it still follows the cursor. Against an OFFSET, every remaining row shifts one position earlier and the next page silently begins one row late — a coin the caller never sees, which on this read means funds it cannot spend and a spend that refuses with an untrue shortfall.

Fields§

§coins: Vec<WalletCoinRecord>

One page of the address’s spendable coins, ascending by coin_id, possibly empty (see the type docs). NOT necessarily the whole set — see complete.

§complete: Option<bool>

Is this page the WHOLE unspent set at this address for this asset?

Some(true) means every coin the node knows of is in coins. Some(false) means the answer was TRUNCATED and more coins exist — resume from cursor.

A node MUST derive this from whether rows remain BEYOND the page, never from whether the page filled. The two differ exactly when the coin count is a multiple of the page size, where the length-based reading declares a truncated page whole — so a caller summing a balance or selecting coins for a spend stops early on a set it believes it saw all of.

None means a node too old to disclose it (pre-0.25), which served this read UNPAGED and whose answer is therefore the whole set already. It is distinct from Some(false) on purpose: such a node also ignores after_coin_id, so a caller that read None as “truncated” and resumed would be re-served page one forever.

§cursor: Option<String>

The last coin in this page — the value to resume from — or null for an empty page, and from a pre-0.25 node that never paged at all.

It is the id the caller was HANDED, never a marker for where the chain got to. Pass it as after_coin_id to fetch the next page.

Unlike its coinsByParent twin the key is OMITTABLE, because this method predates paging and an older node emits no such key. complete is what carries the old-node case, and reading this field without it is what the doc above warns against.

§source: Option<WalletReadSource>

Which tier answered, or None from a node too old to disclose it. See WalletReadSource.

§synced: bool

Whether THESE coins reflect a caught-up view of the tier that ANSWERED, measured against that tier’s own peak — never against the node’s replica or its held peers.

true only when that peak came from the SAME read that produced these figures; a carried-over peak means false.

§peak_height: Option<u32>

The peak height of the tier that ANSWERED, or null when that tier tracks no peak.

It MUST be the height that tier reported in the SAME read that produced the figures, or null.

Trait Implementations§

Source§

impl Clone for WalletCoinsResult

Source§

fn clone(&self) -> WalletCoinsResult

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 Debug for WalletCoinsResult

Source§

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

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

impl<'de> Deserialize<'de> for WalletCoinsResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for WalletCoinsResult

Source§

impl PartialEq for WalletCoinsResult

Source§

fn eq(&self, other: &WalletCoinsResult) -> 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 WalletCoinsResult

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 WalletCoinsResult

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.