pub struct BalanceItem {Show 13 fields
pub contract_address: String,
pub contract_ticker_symbol: Option<String>,
pub contract_name: Option<String>,
pub balance: String,
pub contract_decimals: Option<u32>,
pub quote_rate: Option<f64>,
pub quote: Option<f64>,
pub token_type: Option<String>,
pub is_spam: Option<bool>,
pub logo_url: Option<String>,
pub last_transferred_at: Option<String>,
pub native_token: Option<bool>,
pub metadata: Option<Value>,
}Expand description
Represents a token balance item returned by the API.
Fields§
§contract_address: StringThe contract address of the token.
contract_ticker_symbol: Option<String>The token symbol/ticker.
contract_name: Option<String>The token name.
balance: StringThe raw balance amount as a string (to handle large numbers).
contract_decimals: Option<u32>The number of decimal places for this token.
quote_rate: Option<f64>The current quote rate for the token.
quote: Option<f64>The quote value (balance * quote_rate).
token_type: Option<String>The type of token (e.g., “cryptocurrency”, “stablecoin”, etc.).
is_spam: Option<bool>Whether this token is spam.
logo_url: Option<String>The logo URL for the token.
last_transferred_at: Option<String>Last transferred timestamp.
native_token: Option<bool>Whether this token is native to the chain.
metadata: Option<Value>Additional metadata.
Implementations§
Source§impl BalanceItem
impl BalanceItem
Sourcepub fn symbol(&self) -> &str
pub fn symbol(&self) -> &str
Get the display symbol for this token (ticker symbol or “Unknown”).
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Get the display name for this token (name or ticker symbol or “Unknown”).
Sourcepub fn balance_as_float(&self) -> Option<f64>
pub fn balance_as_float(&self) -> Option<f64>
Parse the balance as a floating point number, accounting for decimals.
Sourcepub fn has_balance(&self) -> bool
pub fn has_balance(&self) -> bool
Check if this token has a non-zero balance.
Sourcepub fn has_quote_value(&self) -> bool
pub fn has_quote_value(&self) -> bool
Check if this token has quote value information.
Trait Implementations§
Source§impl Clone for BalanceItem
impl Clone for BalanceItem
Source§fn clone(&self) -> BalanceItem
fn clone(&self) -> BalanceItem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more