Defi Integrations
Switchboard Feed Simulation
Learn how to simulate Switchboard oracle price feeds
Solana Agent Kit provides integration with Switchboard for simulating oracle price feeds. This integration allows you to fetch simulated price data for any Switchboard feed on mainnet.
Key Features
- Price feed simulation
- Customizable Crossbar endpoint
- Mainnet feed support
- LangChain tool integration
- Error handling and validation
Basic Usage
Simulating a Price Feed
Input Parameters
Feed Simulation Parameters
Response Type
LangChain Integration
Solana Agent Kit provides a LangChain tool for feed simulation:
Simulate Feed Tool
Example Prompts
For LangChain AI tools, here are example prompts:
Feed Simulation
Important Notes
-
Feed Public Keys
- Must be valid Switchboard feed addresses
- Only mainnet feeds are supported
- Feed hash must be base58 encoded
-
Crossbar Configuration
- Default URL: https://crossbar.switchboard.xyz
- Custom URLs must be valid Crossbar instances
- SSL validation is enabled by default
-
Response Handling
- Values are returned as integers
- Empty results indicate invalid feed hash
- Network errors are propagated
Best Practices
-
Error Handling
-
Feed Validation
-
Response Processing
Technical Details
Constants
CrossbarClient Configuration
Common Feed Addresses
Network Configuration
Error Messages
Common error messages and their meanings:
Examples
-
Basic Feed Simulation
-
Custom Crossbar Instance
-
Error Handling
Was this page helpful?