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: boolWhether 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
impl Clone for WalletCoinsResult
Source§fn clone(&self) -> WalletCoinsResult
fn clone(&self) -> WalletCoinsResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more