Skip to main content
The Token Plugin provides a complete suite of tools for managing Solana tokens, including SOL and SPL tokens. It integrates with Jupiter Exchange for swaps and staking, DEXScreener for token data, and provides robust balance checking and transfer capabilities.

Plugin structure

The Token Plugin is organized into three main modules:

Solana tools

Core wallet and token operations

Jupiter tools

Token swaps and liquid staking

DEXScreener tools

Token data and price information

Installation

The Token Plugin is included by default in Synto Mobile. It’s automatically initialized with the agent:
import TokenPlugin from '@/utils/syntoUtils/agent/plugins/plugin-token';

// Plugin is registered automatically
const agent = new SolanaAgentKit({
  plugins: [TokenPlugin]
});

Available methods

The Token Plugin exposes the following methods through the agent:

Solana operations

get_balance
function
Get the balance of SOL or SPL tokens for the agent’s wallet
get_balance_other
function
Get the balance of any wallet address (not just the agent’s)
get_token_balance
function
Get detailed token balances including names, symbols, and decimals
transfer
function
Transfer SOL or SPL tokens to a recipient
getWalletAddress
function
Get the agent’s wallet address as a base58 string
request_faucet_funds
function
Request SOL from faucet (devnet/testnet only)
getTPS
function
Get current Solana network transactions per second
closeEmptyTokenAccounts
function
Close empty SPL token accounts to reclaim rent

Jupiter integration

trade
function
Swap tokens using Jupiter Exchange aggregator
stakeWithJup
function
Stake SOL with Jupiter to receive jupSOL liquid staking tokens
fetchPrice
function
Fetch token price in USDC from Jupiter API

DEXScreener integration

getTokenDataByAddress
function
Get comprehensive token data from DEXScreener by mint address
getTokenAddressFromTicker
function
Look up token mint address from ticker symbol

Quick examples

Check SOL balance

import { get_balance } from '@/utils/syntoUtils/agent/plugins/plugin-token/solana/tools';

const balance = await get_balance(agent);
console.log(`Balance: ${balance} SOL`);

Transfer tokens

import { transfer } from '@/utils/syntoUtils/agent/plugins/plugin-token/solana/tools';
import { PublicKey } from '@solana/web3.js';

const recipient = new PublicKey('8x2dR8Mpzuz2YqyZyZjUbYWKSWesBo5jMx2Q9Y86udVk');
const signature = await transfer(agent, recipient, 1.5);
console.log(`Transfer complete: ${signature}`);

Swap tokens

import { trade } from '@/utils/syntoUtils/agent/plugins/plugin-token/jupiter/tools';
import { PublicKey } from '@solana/web3.js';
import { TOKENS } from '@/utils/syntoUtils/agent/plugins/plugin-token/jupiter/tools/utils/constants';

// Swap 10 USDC for SOL
const outputMint = TOKENS.SOL;
const inputMint = TOKENS.USDC;
const signature = await trade(agent, outputMint, 10, inputMint);

Actions

The plugin includes AI-friendly actions that can be triggered by natural language:
  • BALANCE_ACTION: Check wallet and token balances
  • TRANSFER: Send SOL or SPL tokens
  • TRADE: Swap tokens using Jupiter
  • STAKE_WITH_JUPITER: Stake SOL for jupSOL
  • FETCH_PRICE: Get token prices
  • GET_TOKEN_DATA: Fetch token information from DEXScreener
Actions are automatically registered when the plugin initializes and can be invoked through the agent’s natural language interface.

Error handling

All Token Plugin functions throw descriptive errors that can be caught and handled:
try {
  const signature = await transfer(agent, recipient, amount, mint);
} catch (error) {
  console.error(`Transfer failed: ${error.message}`);
}

Next steps

Balance operations

Learn about checking and managing token balances

Transfer functions

Transfer SOL and SPL tokens

Jupiter integration

Swap and stake with Jupiter Exchange

DeFi plugin

Explore DeFi lending and borrowing

Build docs developers (and LLMs) love