pub struct WalletCoinByIdParams {
pub coin_id: String,
}Expand description
control.wallet.coinById params: WHICH coin, named by its own id.
§Why there is no asset here
A coin id names one coin on one chain. It is not scoped to an address and not scoped to an
asset, and a node reading a coin record learns neither — so an asset parameter here could only
be a claim the read never checks. The answer’s
asset is null for the same reason.
§Why the method exists at all
WalletCoinsParams answers by ADDRESS and lists UNSPENT coins only. A mint’s evidence is the
opposite shape: the created DID coin (which sits at nobody’s wallet address) and the funding
coin the mint SPENT (which is, by then, gone from every unspent list). Without a by-id read a
pushed mint can never be observed — a permanent “pending” with the money already spent.
Fields§
§coin_id: StringThe coin id: lowercase 64-hex, unprefixed. A 0x prefix is TOLERATED on input (block
explorers print one) and normalized away by Self::validated; it is never emitted.
Implementations§
Source§impl WalletCoinByIdParams
impl WalletCoinByIdParams
Sourcepub fn validated(self) -> Result<Self, ControlError>
pub fn validated(self) -> Result<Self, ControlError>
Normalize and check the coin id, or reject the request as -32602 INVALID_PARAMS.
A malformed id is a malformed REQUEST, and the node refuses it here — before consulting any chain. That ordering is normative rather than an optimisation: were a bad id allowed through, the read would come back empty, and the caller would be told the honest-looking answer the chain holds nothing about a coin it never actually asked after. An unanswerable question and a chain that answered “no” must never wear the same shape.
Accepts exactly two spellings — 64 lowercase hex characters, or the same 64 preceded
by 0x. Uppercase, whitespace and every other length are refused, because the
contract’s hex wire form is lowercase and unprefixed everywhere else in this crate.
Trait Implementations§
Source§impl Clone for WalletCoinByIdParams
impl Clone for WalletCoinByIdParams
Source§fn clone(&self) -> WalletCoinByIdParams
fn clone(&self) -> WalletCoinByIdParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more