Token Management
This section details API endpoints for managing the lifecycle of SPL tokens on Solana, including creation, transfer, and burning.
Create Tokens (POST /api/tokens/create
)
POST /api/tokens/create
)Mints a new SPL token on the Solana network. You define its name, symbol, decimals, initial supply, and the owner wallet which will have mint authority.
Request Endpoint: POST /api/tokens/create
Request Body: application/json
{
"name": "My Solana Token",
"symbol": "MST",
"decimals": 6, // Number of decimal places
"initialSupply": 100000000, // Total initial tokens (consider decimals)
"ownerAddress": "wallet_address_for_mint_authority"
}
Success Response (200 OK): Provides the new token's mint address and the creation transaction signature.
{
"success": true,
"tokenAddress": "new_token_mint_address",
"tx": "creation_transaction_signature",
"metadata": {} // Optional field, structure may vary
}
Common Errors:
500 Internal Server Error: On-chain creation failed (e.g., insufficient funds for rent).
Transfer Tokens (POST /api/tokens/transfer
)
POST /api/tokens/transfer
)Moves a specified amount of an existing SPL token from one wallet address to another.
Request Endpoint: POST /api/tokens/transfer
Request Body: application/json
{
"fromWalletAddress": "source_wallet_public_key",
"toWalletAddress": "destination_wallet_public_key",
"tokenAddress": "mint_address_of_token",
"amount": 500.0 // Amount of the token to transfer (raw amount)
}
Success Response (200 OK): Returns the transaction signature.
{
"success": true,
"tx": "transfer_transaction_signature"
}
Common Errors:
500 Internal Server Error: Insufficient token balance, invalid wallet addresses.
Burn Tokens (POST /api/tokens/burn
)
POST /api/tokens/burn
)Permanently destroys (burns) a specified amount of an SPL token held by a wallet.
Request Endpoint: POST /api/tokens/burn
Request Body: application/json
{
"walletAddress": "wallet_holding_tokens_to_burn",
"tokenAddress": "mint_address_of_token_to_burn",
"amount": 100.0 // Amount to destroy (raw amount)
}
Success Response (200 OK): Returns the burn transaction signature.
{
"success": true,
"tx": "burn_transaction_signature"
}
Common Errors:
500 Internal Server Error: Insufficient token balance.
Fetch Token Info (GET /api/tokens/{tokenAddress}/info
)
GET /api/tokens/{tokenAddress}/info
)Note: Confirm this endpoint exists and verify its exact path and response structure.
Retrieves on-chain details about a specific SPL token, such as its name, symbol, decimals, and current total supply.
Request Endpoint: GET /api/tokens/{tokenAddress}/info
Path Parameter:
tokenAddress
(string, required): The mint address of the token.
Request Example:
curl [Your_Service_Base_URL]/api/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/info
Success Response (200 OK - Example Structure):
{
"success": true,
"data": {
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"totalSupply": "50000000000000" // Example: Current supply as string or number
// Potentially other fields like mint authority, freeze authority etc.
}
}
Common Errors:
404 Not Found: If the token address is invalid or not found on-chain.
500 Internal Server Error: RPC node issues fetching data.
Last updated