Skip to main content

TokenApi

Struct TokenApi 

Source
pub struct TokenApi<'a> { /* private fields */ }
Expand description

API for token operations

Implementations§

Source§

impl<'a> TokenApi<'a>

Source

pub fn new(client: &'a Client) -> Self

Create a new token API client

Source

pub async fn get_metadata( &self, address: &str, chain: Option<&str>, ) -> Result<TokenMetadata>

Get token metadata

Source

pub async fn get_price( &self, address: &str, chain: Option<&str>, ) -> Result<TokenPrice>

Get token price

Source

pub async fn get_transfers( &self, address: &str, chain: Option<&str>, ) -> Result<Vec<TokenTransfer>>

Get token transfers for an address

Moralis API returns transfers wrapped in a paginated response object.

Source

pub async fn get_pairs( &self, address: &str, chain: Option<&str>, ) -> Result<Vec<TokenPair>>

Get token pairs (DEX liquidity pools)

Source

pub async fn get_holders( &self, address: &str, chain: Option<&str>, ) -> Result<TokenHoldersResponse>

Get top token holders

Source

pub async fn get_swaps( &self, address: &str, chain: Option<&str>, ) -> Result<TokenResponse<TokenSwap>>

Get token swaps

Source

pub async fn get_wallet_swaps( &self, address: &str, chain: Option<&str>, ) -> Result<TokenResponse<TokenSwap>>

Get wallet swaps

Source

pub async fn get_pair_swaps( &self, pair_address: &str, chain: Option<&str>, ) -> Result<TokenResponse<TokenSwap>>

Get pair swaps

Source

pub async fn get_stats( &self, address: &str, chain: Option<&str>, ) -> Result<TokenStats>

Get token stats

Source

pub async fn search( &self, query_str: &str, chain: Option<&str>, ) -> Result<Vec<TokenSearchResult>>

Search tokens

Get trending tokens

Source

pub async fn get_categories(&self) -> Result<Vec<TokenCategory>>

Get token categories

Source

pub async fn get_pair_ohlcv( &self, pair_address: &str, query: Option<&PairOhlcvQuery>, ) -> Result<Vec<PairOhlcv>>

Get pair OHLCV data

The Moralis API requires at minimum a timeframe parameter. Use PairOhlcvQuery to set timeframe, from_date, to_date, and chain.

Source

pub async fn get_pair_stats( &self, pair_address: &str, chain: Option<&str>, ) -> Result<PairStats>

Get pair stats

Source

pub async fn get_exchange_new_tokens( &self, exchange_name: &str, chain: Option<&str>, ) -> Result<TokenResponse<NewToken>>

Get new tokens on an exchange

Source

pub async fn get_exchange_bonding_tokens( &self, exchange_name: &str, chain: Option<&str>, ) -> Result<TokenResponse<NewToken>>

Get bonding tokens on an exchange (e.g., pump.fun)

Source

pub async fn get_exchange_graduated_tokens( &self, exchange_name: &str, chain: Option<&str>, ) -> Result<TokenResponse<NewToken>>

Get graduated tokens on an exchange

Source

pub async fn get_multiple_prices( &self, request: &GetMultiplePricesRequest, chain: Option<&str>, ) -> Result<Vec<TokenPrice>>

Get multiple token prices (batch)

Source

pub async fn get_by_symbols( &self, symbols: &[&str], chain: Option<&str>, ) -> Result<Vec<TokenMetadata>>

Get tokens by symbols

Source

pub async fn get_contract_transfers( &self, address: &str, chain: Option<&str>, ) -> Result<TokenResponse<TokenTransfer>>

Get contract transfers for a token (not wallet transfers)

Source

pub async fn get_holders_summary( &self, address: &str, chain: Option<&str>, ) -> Result<TokenHoldersSummary>

Get holders summary for a token

Source

pub async fn get_holders_historical( &self, address: &str, chain: Option<&str>, ) -> Result<Vec<HistoricalHolders>>

Get historical holders data for a token

Source

pub async fn get_pairs_stats( &self, address: &str, chain: Option<&str>, ) -> Result<AggregatedPairStats>

Get aggregated token pair stats

Source

pub async fn get_top_gainers( &self, address: &str, chain: Option<&str>, ) -> Result<Vec<TopTrader>>

Get top traders/gainers for a token

Source

pub async fn get_pair_snipers( &self, pair_address: &str, chain: Option<&str>, ) -> Result<Vec<PairSniper>>

Get pair snipers

Source

pub async fn get_bonding_status( &self, address: &str, chain: Option<&str>, ) -> Result<TokenBondingStatus>

Get token bonding status (for pump.fun, etc)

Auto Trait Implementations§

§

impl<'a> Freeze for TokenApi<'a>

§

impl<'a> !RefUnwindSafe for TokenApi<'a>

§

impl<'a> Send for TokenApi<'a>

§

impl<'a> Sync for TokenApi<'a>

§

impl<'a> Unpin for TokenApi<'a>

§

impl<'a> !UnwindSafe for TokenApi<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more