pub struct SolanaTokenAmount {
pub amount: SolanaTokenAmountAmount,
pub decimals: i64,
}
Expand description
Amount of a given Solana token.
JSON schema
{
"description": "Amount of a given Solana token.",
"examples": [
{
"amount": "1250000000",
"decimals": 9
}
],
"type": "object",
"required": [
"amount",
"decimals"
],
"properties": {
"amount": {
"description": "The amount is denominated in the smallest indivisible unit of the token. For SOL, the smallest indivisible unit is lamports (10^-9 SOL). For SPL tokens, the smallest unit is defined by the token's decimals configuration.",
"examples": [
"1250000000"
],
"type": "string",
"pattern": "^[0-9]+$"
},
"decimals": {
"description": "'decimals' is the exponential value N that satisfies the equation `amount * 10^-N = standard_denomination`. The standard denomination is the most commonly used denomination for the token.\n- For native SOL, `decimals` is 9 (1 SOL = 10^9 lamports). - For SPL tokens, `decimals` is defined in the token's mint configuration.",
"examples": [
9
],
"type": "integer",
"format": "int64"
}
}
}
Fields§
§amount: SolanaTokenAmountAmount
The amount is denominated in the smallest indivisible unit of the token. For SOL, the smallest indivisible unit is lamports (10^-9 SOL). For SPL tokens, the smallest unit is defined by the token’s decimals configuration.
decimals: i64
‘decimals’ is the exponential value N that satisfies the equation amount * 10^-N = standard_denomination
. The standard denomination is the most commonly used denomination for the token.
- For native SOL, decimals
is 9 (1 SOL = 10^9 lamports). - For SPL tokens, decimals
is defined in the token’s mint configuration.
Implementations§
Source§impl SolanaTokenAmount
impl SolanaTokenAmount
pub fn builder() -> SolanaTokenAmount
Trait Implementations§
Source§impl Clone for SolanaTokenAmount
impl Clone for SolanaTokenAmount
Source§fn clone(&self) -> SolanaTokenAmount
fn clone(&self) -> SolanaTokenAmount
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 SolanaTokenAmount
impl Debug for SolanaTokenAmount
Source§impl<'de> Deserialize<'de> for SolanaTokenAmount
impl<'de> Deserialize<'de> for SolanaTokenAmount
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 From<&SolanaTokenAmount> for SolanaTokenAmount
impl From<&SolanaTokenAmount> for SolanaTokenAmount
Source§fn from(value: &SolanaTokenAmount) -> Self
fn from(value: &SolanaTokenAmount) -> Self
Converts to this type from the input type.
Source§impl From<SolanaTokenAmount> for SolanaTokenAmount
impl From<SolanaTokenAmount> for SolanaTokenAmount
Source§fn from(value: SolanaTokenAmount) -> Self
fn from(value: SolanaTokenAmount) -> Self
Converts to this type from the input type.
Source§impl Serialize for SolanaTokenAmount
impl Serialize for SolanaTokenAmount
Source§impl TryFrom<SolanaTokenAmount> for SolanaTokenAmount
impl TryFrom<SolanaTokenAmount> for SolanaTokenAmount
Source§type Error = ConversionError
type Error = ConversionError
The type returned in the event of a conversion error.
Source§fn try_from(value: SolanaTokenAmount) -> Result<Self, ConversionError>
fn try_from(value: SolanaTokenAmount) -> Result<Self, ConversionError>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for SolanaTokenAmount
impl RefUnwindSafe for SolanaTokenAmount
impl Send for SolanaTokenAmount
impl Sync for SolanaTokenAmount
impl Unpin for SolanaTokenAmount
impl UnwindSafe for SolanaTokenAmount
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