pub enum Asset {
Token(TokenAmount),
Item(ItemAsset),
}Expand description
Asset struct
Token- An asset struct representation of the ZNT tokenData- A data assetItem- A item for a payment. The value indicates the number of item assets
Variants§
Token(TokenAmount)
Item(ItemAsset)
Implementations§
Source§impl Asset
impl Asset
Sourcepub fn with_fixed_hash(self, out_point: &OutPoint) -> Self
pub fn with_fixed_hash(self, out_point: &OutPoint) -> Self
Modify self of Asset struct to obtain drs_tx_hash
from either the asset itself or its corresponding OutPoint
Sourcepub fn get_drs_tx_hash(&self) -> Option<&String>
pub fn get_drs_tx_hash(&self) -> Option<&String>
Get optional drs_tx_hash value for Asset
pub fn get_metadata(&self) -> Option<&String>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn token_u64(amount: u64) -> Self
pub fn item( amount: u64, drs_tx_hash: Option<String>, metadata: Option<String>, ) -> Self
Sourcepub fn add_assign(&mut self, rhs: &Self) -> bool
pub fn add_assign(&mut self, rhs: &Self) -> bool
Add an asset of the same variant to self asset.
TODO: Add handling for Data asset variant. Will return false when Data asset is presented.
§Note
This function will return false for Item assets
getting added together that do not have the same drs_tx_hash
§Arguments
rhs- The right-hand-side (RHS) asset to add toself
Sourcepub fn is_greater_or_equal_to(&self, rhs: &Asset) -> Option<bool>
pub fn is_greater_or_equal_to(&self, rhs: &Asset) -> Option<bool>
Determine if self asset is greater or equal to another asset of the same variant.
TODO: Add handling for Data asset variant. Will return None if Data asset is presented.
§Arguments
rhs- Reference to right-hand-side (RHS)Asset
Sourcepub fn get_excess(&self, rhs: &Asset) -> Option<Asset>
pub fn get_excess(&self, rhs: &Asset) -> Option<Asset>
Determine if self asset is greater than another asset of the same variant.
If self asset is greater, return the excess.
TODO: Add handling for Data asset variant. Will return None if Data asset is presented.
§Arguments
rhs- Reference to right-hand-side (RHS)Asset
Sourcepub fn is_same_type_as(&self, other: &Asset) -> bool
pub fn is_same_type_as(&self, other: &Asset) -> bool
Determine if the asset in question is of the same variant as self
§Arguments
other- Reference to otherAssetto test against
Sourcepub fn default_of_type(asset_type: &Self) -> Self
pub fn default_of_type(asset_type: &Self) -> Self
Creates a default asset of a given variant.
TODO: Add handling for Data asset variant
§Arguments
asset_type- Default asset variant type