Documentation Index
Fetch the complete documentation index at: https://docs.sendai.fun/llms.txt
Use this file to discover all available pages before exploring further.
Solana Agent Kit provides comprehensive integration with Allora’s API for accessing price inferences and topics. The integration supports both mainnet and testnet environments with configurable API settings.
Key Features
- Price inference for multiple tokens and timeframes
- Topic management and retrieval
- Inference data by topic ID
- LangChain tool integration
- Configurable network environment
Configuration
The Allora integration uses the following configuration parameters:
const config: AlloraAPIClientConfig = {
apiKey: string, // Your Allora API key
chainSlug: ChainSlug, // MAINNET or TESTNET
baseAPIUrl: string // Optional custom API URL
};
Basic Usage
Getting All Topics
const topics = await agent.methods.getAllTopics();
Getting Inference by Topic ID
const inference = await agent.methods.getInferenceByTopicId(topicId);
Getting Price Inference
const priceInference = await agent.methods.getPriceInference(
tokenSymbol, // e.g., "BTC"
timeframe // e.g., "5m"
);
LangChain Integration
Solana Agent Kit provides LangChain tools for automated Allora data retrieval:
import { SolanaAlloraGetAllTopics } from 'solana-agent-kit';
const getAllTopicsTool = new SolanaAlloraGetAllTopics(agent);
// Tool returns JSON response:
{
status: "success",
message: "Topics fetched successfully",
topics: AlloraTopic[]
}
import { SolanaAlloraGetInferenceByTopicId } from 'solana-agent-kit';
const getInferenceByTopicIdTool = new SolanaAlloraGetInferenceByTopicId(agent);
// Tool input: topic ID as string
const input = "42";
// Tool returns JSON response:
{
status: "success",
message: "Inference fetched successfully",
topicId: number,
inference: AlloraInference
}
import { SolanaAlloraGetPriceInference } from 'solana-agent-kit';
const getPriceInferenceTool = new SolanaAlloraGetPriceInference(agent);
// Tool input format (JSON string):
const input = JSON.stringify({
tokenSymbol: "BTC",
timeframe: "5m"
});
// Tool returns JSON response:
{
status: "success",
message: "Price inference fetched successfully",
tokenSymbol: string,
timeframe: string,
priceInference: string
}
Example Prompts
For LangChain AI tools, here are example prompts:
Getting Topics
"Get all available Allora topics"
"List the current topics from Allora"
Getting Inferences
"Get the inference for topic ID 42"
"What's the current inference for BTC with 5-minute timeframe"
Important Notes
-
API Key Configuration
- Default API key provided but recommended to use your own
- Can be configured via ALLORA_API_KEY environment variable
-
Network Environment
- Supports both mainnet and testnet
- Configured via ALLORA_NETWORK environment variable
- Defaults to testnet if not specified
-
API Response Handling
- All methods return structured responses
- Error handling included for network and API issues
- Status and message fields in all responses
Error Handling
try {
await agent.methods.getAllTopics();
} catch (error) {
if (error.message.includes("API key invalid")) {
// Handle authentication error
} else if (error.message.includes("network error")) {
// Handle connection issues
}
}
Technical Details
Available Timeframes
enum PriceInferenceTimeframe {
FIVE_MIN = "5m",
FIFTEEN_MIN = "15m",
THIRTY_MIN = "30m",
ONE_HOUR = "1h",
FOUR_HOUR = "4h",
ONE_DAY = "1d"
}
Supported Token Types
enum PriceInferenceToken {
BTC = "BTC",
ETH = "ETH",
SOL = "SOL"
// Additional tokens based on API support
}
Default Values
const DEFAULT_CONFIG = {
ALLORA_API_KEY: "UP-d33e797de5134909854be2b7",
ALLORA_NETWORK: "testnet"
};