The Token Plugin provides three functions for checking balances, each optimized for different use cases.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Juiiceee/synto-mobile/llms.txt
Use this file to discover all available pages before exploring further.
get_balance
Get the balance of SOL or an SPL token for the agent’s wallet.Function signature
Parameters
The agent instance containing wallet and connection information
Optional SPL token mint address. If not provided, returns SOL balance in UI units (not lamports)
Returns
The balance in UI units (for SOL: actual SOL amount, not lamports; for tokens: amount based on token decimals)
Example usage
Implementation details
For SOL balances, the function queries the network and converts lamports to SOL:The function returns
0 if a token account doesn’t exist, rather than throwing an error.get_balance_other
Get the balance of SOL or an SPL token for any wallet address (not just the agent’s wallet).Function signature
Parameters
The agent instance used for blockchain connection
The wallet address to check balance for
Optional SPL token mint address. If not provided, returns SOL balance
Returns
The balance in UI units, or
0 if the account doesn’t existExample usage
Error handling
The function throws descriptive errors if the balance check fails:get_token_balance
Get comprehensive token balances for a wallet, including SOL and all SPL tokens with metadata.Function signature
Parameters
The agent instance for blockchain connection
The wallet address to check. Defaults to the agent’s wallet if not provided
Returns
The SOL balance in UI units
Array of token balances with metadata. Zero-balance tokens are automatically filtered out.
Example usage
Implementation details
The function performs the following steps:- Queries SOL balance and all token accounts in parallel for efficiency
- Filters out zero-balance token accounts
- Fetches metadata (name, symbol) for each token mint
- Returns a structured object with all balances and metadata
This function is ideal for building portfolio views or wallet dashboards, as it returns all necessary information in a single call.
Additional utilities
getWalletAddress
Get the agent’s wallet address as a base58-encoded string.getTPS
Get the current Solana network transactions per second.request_faucet_funds
Request 5 SOL from the Solana faucet (devnet/testnet only).This function only works on devnet and testnet. It will fail on mainnet-beta.
Best practices
Use the right function for your use case
Use the right function for your use case
- Use
get_balance()for quick checks of the agent’s own balance - Use
get_balance_other()when you need to check other wallets - Use
get_token_balance()when building portfolio views or dashboards
Handle zero balances gracefully
Handle zero balances gracefully
All balance functions return
0 for non-existent accounts instead of throwing errors. Always check for zero balances in your UI:Cache balance data when appropriate
Cache balance data when appropriate
Balance queries require network calls. Consider caching results for a few seconds if you’re displaying balances in a frequently-updated UI:
Next steps
Transfer functions
Learn how to transfer SOL and SPL tokens
Jupiter integration
Swap tokens using Jupiter Exchange