Skip to main content

Asset

Enum Asset 

Source
pub enum Asset {
    Xch,
    Cat(AssetId),
}
Expand description

The asset a wallet balance/coin read is denominated in: native XCH, or any CAT by asset id.

§Why there is no separate Dig variant

$DIG is a CAT, so it is Asset::DIG — an associated constant, not a variant. A three-variant {Xch, Dig, Cat(id)} would give $DIG two INEQUAL spellings, and a balance or coin list filtered by one of them would silently omit everything carrying the other: a wallet reporting half a balance as though it were the whole. One token, one value.

§Wire form (additive — CLAUDE.md §5.1)

ValueJSON
Asset::Xch"xch"
Asset::DIG"dig"
any other CAT{"cat":"<64-hex>"}

Both legacy tokens are still ACCEPTED and "dig" is still EMITTED, so a node or client built before this release keeps understanding, and being understood by, one built after it. {"cat":"<the $DIG asset id>"} is also accepted and normalizes to Asset::DIG.

Byte-identical to dig-app’s consumer type (dig-app-core::wallet::state::Asset), recorded in the canonical skill so the two implementations cannot drift.

Variants§

§

Xch

Native Chia (XCH), denominated in mojos.

§

Cat(AssetId)

A CAT, named by its asset id and denominated in its own base units.

Implementations§

Source§

impl Asset

Source

pub const DIG_ASSET_ID_HEX: &'static str = "a406d3a9de984d03c9591c10d917593b434d5263cabe2b42f6b367df16832f81"

Canonical $DIG CAT asset id (TAIL hash) on Chia mainnet, as lowercase hex.

CONTRACT: byte-identical to dig_constants::DIG_ASSET_ID, chip35_dl_coin::DIG_ASSET_ID, and digstore-chain’s. It is duplicated here rather than imported because this crate is a level-00 foundation crate and may not depend sideways on dig-constants (CLAUDE.md Appendix B). dig_asset_id_hex_and_bytes_are_the_same_id pins THIS crate’s two spellings of it together; agreement with the ecosystem constant is a source-of-truth obligation on whoever changes it, recorded in the canonical skill.

Source

pub const DIG: Asset

$DIG, the CAT every capsule payment is denominated in.

Source

pub fn is_dig(&self) -> bool

Whether this asset is $DIG, however it was spelled on the wire.

Source

pub fn asset_id(&self) -> Option<&AssetId>

The CAT asset id, or None for native XCH.

Trait Implementations§

Source§

impl Clone for Asset

Source§

fn clone(&self) -> Asset

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 Copy for Asset

Source§

impl Debug for Asset

Source§

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

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

impl<'de> Deserialize<'de> for Asset

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

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

impl Eq for Asset

Source§

impl Hash for Asset

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Asset

Source§

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

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

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

impl StructuralPartialEq for Asset

Auto Trait Implementations§

§

impl Freeze for Asset

§

impl RefUnwindSafe for Asset

§

impl Send for Asset

§

impl Sync for Asset

§

impl Unpin for Asset

§

impl UnsafeUnpin for Asset

§

impl UnwindSafe for Asset

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.