The Solana Agent Kit allows developers to build AI-driven agents that interact with Solana and Solayer seamlessly. It enables AI agents to perform on-chain transactions, including staking SOL on Solayer (sSOL staking) using Solana Blinks.With the Solana Agent Kit, AI-powered automation can integrate directly with Solayer’s DeFi ecosystem, supporting actions like staking, yield strategies, and more.
Import & Initialize the AgentFirst, import the required modules and initialize the Solana Agent Kit with your wallet private key, Solana RPC URL, and OpenAI API key.
Copy
import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit";// Initialize with private key and optional RPC URLconst agent = new SolanaAgentKit( "your-wallet-private-key-as-base58", "https://api.mainnet-beta.solana.com", "your-openai-api-key");// Create LangChain toolsconst tools = createSolanaTools(agent);
Stake SOL on Solayer (sSOL Staking)To stake SOL on Solayer using the AI agent, call the restake function:
Copy
const signature = await agent.restake( 1 // amount in SOL to stake);
The Solana Agent Kit is continuously evolving to support more DeFi integrations and automated smart contract interactions.For detailed documentation, examples, and latest updates, visit the GitHub repository: Solana Agent Kit on GitHub