Get Token Data
The Get Token Data tool, part of AgentiPy, allows users to retrieve information about SPL tokens on the Solana blockchain. It can fetch token details using either the token's mint address (from Jupiter's token list) or its ticker symbol (from DexScreener).
Functionality
This tool is implemented in the TokenDataManager class.
Key Methods:
get_token_data_by_address(mint: Pubkey) -> Optional[JupiterTokenData]:Takes a token
mintaddress (solders.pubkey.Pubkeyobject).Fetches a list of verified tokens from Jupiter's token API (
https://tokens.jup.ag/tokens?tags=verified).Searches for the token with the matching mint address in the list.
Returns a
JupiterTokenDataobject (containing address, symbol, name) if found, otherwiseNone.
get_token_address_from_ticker(ticker: str) -> Optional[str]:Takes a token
tickersymbol (e.g., "SOL", "USDC").Queries the DexScreener API (
https://api.dexscreener.com/latest/dex/search) for pairs matching the ticker.Filters for Solana pairs and sorts them, prioritizing those with higher Fully Diluted Valuation (FDV).
Returns the base token's mint address (string) for the best matching Solana pair if found, otherwise
None.
get_token_data_by_ticker(ticker: str) -> Optional[JupiterTokenData]:First calls
get_token_address_from_tickerto resolve the ticker to a mint address.If an address is found, it then calls
get_token_data_by_addresswith that address.Returns a
JupiterTokenDataobject orNone.
Note: This tool relies on external APIs (Jupiter and DexScreener). Their availability and rate limits apply.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/get_token_data.py
Last updated
