pub enum XfrAmount {
    Confidential((CompressedRistretto, CompressedRistretto)),
    NonConfidential(u64),
}
Expand description

Amount in blind asset record: if confidential, provide commitments for lower and hight 32 bits

Variants§

§

Confidential((CompressedRistretto, CompressedRistretto))

Confidential amount.

§

NonConfidential(u64)

Transparent amount.

Implementations§

Return true only if amount is confidential.

Example:
use noah_api::xfr::structs::XfrAmount;
use noah_algebra::ristretto::CompressedRistretto;
let xfr_amount = XfrAmount::Confidential((CompressedRistretto::default(), CompressedRistretto::default()));
assert!(xfr_amount.is_confidential());
let xfr_amount = XfrAmount::NonConfidential(100u64);
assert!(!xfr_amount.is_confidential());
Run

Return Some(amount) if amount is non-confidential. Otherwise, return None

Example:
use noah_api::xfr::structs::XfrAmount;
use noah_algebra::ristretto::CompressedRistretto;
let xfr_amount = XfrAmount::NonConfidential(100u64);
assert_eq!(xfr_amount.get_amount().unwrap(), 100u64);
let xfr_amount = XfrAmount::Confidential((CompressedRistretto::default(), CompressedRistretto::default()));
assert!(xfr_amount.get_amount().is_none());
Run

Return Some((c1,c2)), where (c1,c2) is a commitment to the amount if amount is confidential. Otherwise, return None

Example:
use noah_api::xfr::structs::XfrAmount;
use noah_algebra::ristretto::CompressedRistretto;
let xfr_amount = XfrAmount::NonConfidential(100u64);
assert!(xfr_amount.get_commitments().is_none());
let xfr_amount = XfrAmount::Confidential((CompressedRistretto::default(), CompressedRistretto::default()));
assert_eq!(xfr_amount.get_commitments().unwrap(), (CompressedRistretto::default(), CompressedRistretto::default()));
Run

Construct a confidential amount with an amount and an amount blind.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Checks if this value is equivalent to the given key. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.