pub struct CurrencyAmount {
pub amount: i64,
pub currency: Option<i32>,
pub string_amount: Option<String>,
pub bytes: Option<BytesData>,
pub decimals: Option<String>,
pub currency_id: Option<CurrencyId>,
}Fields§
§amount: i64§currency: Option<i32>§string_amount: Option<String>Support for arbitrary amount, used for multi-currency support
bytes: Option<BytesData>§decimals: Option<String>§currency_id: Option<CurrencyId>The currency type associated with the amount, used for multi-currency support
Implementations§
Source§impl CurrencyAmount
impl CurrencyAmount
Sourcepub fn currency(&self) -> SupportedCurrency
pub fn currency(&self) -> SupportedCurrency
Returns the enum value of currency, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_currency(&mut self, value: SupportedCurrency)
pub fn set_currency(&mut self, value: SupportedCurrency)
Sets currency to the provided enum value.
Sourcepub fn string_amount(&self) -> &str
pub fn string_amount(&self) -> &str
Returns the value of string_amount, or the default value if string_amount is unset.
Source§impl CurrencyAmount
impl CurrencyAmount
pub fn render_8_decimals(&self) -> String
pub fn amount_i64(&self) -> i64
pub fn from_fractional(a: impl Into<f64>) -> Result<Self, ErrorInfo>
pub fn from_fractional_basis( a: impl Into<f64>, basis: i64, ) -> Result<Self, ErrorInfo>
pub fn from_fractional_cur( a: impl Into<f64>, cur: SupportedCurrency, ) -> RgResult<Self>
pub fn from_usd(a: impl Into<f64>) -> RgResult<Self>
pub fn bigint_offset_denomination() -> BigInt
pub fn bigint_actual_denomination() -> BigInt
pub fn bigint_actual_float_denomination() -> f64
pub fn amount_i64_or(&self) -> i64
pub fn currency_or(&self) -> SupportedCurrency
pub fn is_rdg(&self) -> bool
pub fn is_zero(&self) -> bool
pub fn min_fee() -> Self
pub fn std_pool_fee() -> Self
pub fn bigint_amount(&self) -> Option<BigInt>
pub fn to_fractional(&self) -> f64
pub fn to_1e8(&self) -> i64
pub fn to_rounded_int(&self) -> i64
pub fn from(amount: i64) -> Self
pub fn from_usd_default(amount: f64) -> Self
pub fn from_currency(amount: i64, supported_currency: SupportedCurrency) -> Self
pub fn zero(supported_currency: SupportedCurrency) -> Self
pub fn from_string(amount: String) -> Self
pub fn from_btc(amount: i64) -> Self
pub fn from_eth_bigint_string(amount: impl Into<String>) -> Self
pub fn from_eth_network_bigint_string_currency_id_decimals( amount: impl Into<String>, currency_id: impl Into<CurrencyId>, decimals: Option<String>, ) -> Self
pub fn from_eth_bigint(amount: BigInt) -> Self
pub fn from_eth_i64(amount: i64) -> Self
pub fn from_eth_fractional(amount: f64) -> Self
pub fn from_rdg(amount: i64) -> Self
pub fn from_float_string(str: &String) -> Result<Self, ErrorInfo>
Source§impl CurrencyAmount
impl CurrencyAmount
pub fn test_send_amount_typed() -> CurrencyAmount
pub fn stake_test_amount_typed() -> CurrencyAmount
pub fn eth_gas_price_fixed_normal_testnet() -> CurrencyAmount
pub fn eth_gas_price_fixed_normal_mainnet() -> CurrencyAmount
pub fn gas_price_fixed_normal_by_env(env: &NetworkEnvironment) -> CurrencyAmount
pub fn eth_estimated_tx_gas_cost_fixed_normal() -> CurrencyAmount
pub fn eth_fee_fixed_normal_testnet() -> CurrencyAmount
pub fn eth_fee_fixed_normal_mainnet() -> CurrencyAmount
pub fn eth_fee_fixed_normal_by_env(env: &NetworkEnvironment) -> CurrencyAmount
Trait Implementations§
Source§impl Add for CurrencyAmount
impl Add for CurrencyAmount
Source§impl AddAssign for CurrencyAmount
impl AddAssign for CurrencyAmount
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl Clone for CurrencyAmount
impl Clone for CurrencyAmount
Source§fn clone(&self) -> CurrencyAmount
fn clone(&self) -> CurrencyAmount
Returns a duplicate 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 CurrencyAmount
impl Debug for CurrencyAmount
Source§impl Default for CurrencyAmount
impl Default for CurrencyAmount
Source§impl<'de> Deserialize<'de> for CurrencyAmount
impl<'de> Deserialize<'de> for CurrencyAmount
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Div for CurrencyAmount
impl Div for CurrencyAmount
Source§impl Hash for CurrencyAmount
impl Hash for CurrencyAmount
Source§impl Message for CurrencyAmount
impl Message for CurrencyAmount
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl Mul<i64> for CurrencyAmount
impl Mul<i64> for CurrencyAmount
Source§impl Mul for CurrencyAmount
impl Mul for CurrencyAmount
Source§impl Ord for CurrencyAmount
impl Ord for CurrencyAmount
Source§impl PartialEq for CurrencyAmount
impl PartialEq for CurrencyAmount
Source§impl PartialOrd for CurrencyAmount
impl PartialOrd for CurrencyAmount
Source§impl Serialize for CurrencyAmount
impl Serialize for CurrencyAmount
Source§impl Sub for CurrencyAmount
impl Sub for CurrencyAmount
Source§impl SubAssign for CurrencyAmount
impl SubAssign for CurrencyAmount
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreSource§impl Sum for CurrencyAmount
impl Sum for CurrencyAmount
Source§fn sum<I: Iterator<Item = CurrencyAmount>>(iter: I) -> Self
fn sum<I: Iterator<Item = CurrencyAmount>>(iter: I) -> Self
Takes an iterator and generates
Self from the elements by “summing up”
the items.impl Eq for CurrencyAmount
impl StructuralPartialEq for CurrencyAmount
Auto Trait Implementations§
impl Freeze for CurrencyAmount
impl RefUnwindSafe for CurrencyAmount
impl Send for CurrencyAmount
impl Sync for CurrencyAmount
impl Unpin for CurrencyAmount
impl UnwindSafe for CurrencyAmount
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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