#[repr(C)]pub struct ScaledUiAmountConfig {
pub authority: OptionalNonZeroPubkey,
pub multiplier: PodF64,
pub new_multiplier_effective_timestamp: UnixTimestamp,
pub new_multiplier: PodF64,
}
Expand description
Scaled UI amount extension data for mints
Fields§
Authority that can set the scaling amount and authority
multiplier: PodF64
Amount to multiply raw amounts by, outside of the decimal
new_multiplier_effective_timestamp: UnixTimestamp
Unix timestamp at which new_multiplier
comes into effective
new_multiplier: PodF64
Next multiplier, once new_multiplier_effective_timestamp
is reached
Implementations§
Source§impl ScaledUiAmountConfig
impl ScaledUiAmountConfig
Sourcepub fn amount_to_ui_amount(
&self,
amount: u64,
decimals: u8,
unix_timestamp: i64,
) -> Option<String>
pub fn amount_to_ui_amount( &self, amount: u64, decimals: u8, unix_timestamp: i64, ) -> Option<String>
Convert a raw amount to its UI representation using the given decimals field. Excess zeroes or unneeded decimal point are trimmed.
Sourcepub fn try_ui_amount_into_amount(
&self,
ui_amount: &str,
decimals: u8,
unix_timestamp: i64,
) -> Result<u64, ProgramError>
pub fn try_ui_amount_into_amount( &self, ui_amount: &str, decimals: u8, unix_timestamp: i64, ) -> Result<u64, ProgramError>
Try to convert a UI representation of a token amount to its raw amount using the given decimals field
Trait Implementations§
Source§impl Clone for ScaledUiAmountConfig
impl Clone for ScaledUiAmountConfig
Source§fn clone(&self) -> ScaledUiAmountConfig
fn clone(&self) -> ScaledUiAmountConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ScaledUiAmountConfig
impl Debug for ScaledUiAmountConfig
Source§impl Default for ScaledUiAmountConfig
impl Default for ScaledUiAmountConfig
Source§fn default() -> ScaledUiAmountConfig
fn default() -> ScaledUiAmountConfig
Returns the “default value” for a type. Read more
Source§impl Extension for ScaledUiAmountConfig
impl Extension for ScaledUiAmountConfig
Source§const TYPE: ExtensionType = ExtensionType::ScaledUiAmount
const TYPE: ExtensionType = ExtensionType::ScaledUiAmount
Associated extension type enum, checked at the start of TLV entries
Source§impl PartialEq for ScaledUiAmountConfig
impl PartialEq for ScaledUiAmountConfig
impl Copy for ScaledUiAmountConfig
impl Pod for ScaledUiAmountConfig
impl StructuralPartialEq for ScaledUiAmountConfig
Auto Trait Implementations§
impl Freeze for ScaledUiAmountConfig
impl RefUnwindSafe for ScaledUiAmountConfig
impl Send for ScaledUiAmountConfig
impl Sync for ScaledUiAmountConfig
impl Unpin for ScaledUiAmountConfig
impl UnwindSafe for ScaledUiAmountConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more