plugins/plugin-wallet/src/chains/solana/README.md
Core Solana blockchain plugin for Eliza OS that provides essential services and actions for token operations, trading, and DeFi integrations.
The Solana plugin serves as a foundational component of Eliza OS, bridging Solana blockchain capabilities with the Eliza ecosystem. It provides crucial services for token operations, trading, portfolio management, and DeFi integrations, enabling both automated and user-directed interactions with the Solana blockchain.
npm install @elizaos/plugin-solana
Configure the plugin by setting the following environment variables:
const solanaEnvSchema = {
WALLET_SECRET_SALT: string(optional),
WALLET_SECRET_KEY: string,
WALLET_PUBLIC_KEY: string,
SOL_ADDRESS: string,
SLIPPAGE: string,
SOLANA_RPC_URL: string,
HELIUS_API_KEY: string,
BIRDEYE_API_KEY: string,
};
import { solanaPlugin } from "@elizaos/plugin-solana";
// Initialize the plugin
const runtime = await initializeRuntime({
plugins: [solanaPlugin],
});
Manages token operations and information retrieval.
const tokenProvider = new TokenProvider(
tokenAddress,
walletProvider,
cacheManager,
);
await tokenProvider.getTokensInWallet(runtime);
Handles wallet operations and portfolio management.
const walletProvider = new WalletProvider(connection, publicKey);
await walletProvider.getFormattedPortfolio(runtime);
Evaluates and manages trust scores for tokens and trading activities.
const trustScore = await runtime.getProvider("trustScore");
Executes a token swap using Jupiter aggregator.
// Example usage
const result = await runtime.executeAction("EXECUTE_SWAP", {
inputTokenSymbol: "SOL",
outputTokenSymbol: "USDC",
amount: 0.1,
});
Transfers tokens between wallets.
// Example usage
const result = await runtime.executeAction("SEND_TOKEN", {
tokenAddress: "TokenAddressHere",
recipient: "RecipientAddressHere",
amount: "1000",
});
Transfers SOL between wallets.
// Example usage
const result = await runtime.executeAction("SEND_SOL", {
recipient: "RecipientAddressHere",
amount: "1000",
});
Places a buy order based on conviction level.
// Example usage
const result = await runtime.executeAction("TAKE_ORDER", {
ticker: "SOL",
contractAddress: "ContractAddressHere",
});
Creates and buys tokens on pump.fun.
// Example usage
const result = await runtime.executeAction("CREATE_AND_BUY_TOKEN", {
tokenMetadata: {
name: "TokenName",
symbol: "SYMBOL",
description: "Token description",
image_description: "Image description",
},
buyAmountSol: 0.1,
});
Creates and buys tokens on fomo.fund.
// Example usage
const result = await runtime.executeAction("CREATE_AND_BUY_TOKEN", {
tokenMetadata: {
name: "TokenName",
symbol: "SYMBOL",
description: "Token description",
image_description: "Image description",
},
buyAmountSol: 0.1,
requiredLiquidity: 1000,
});
Executes token swaps for DAO operations.
// Example usage
const result = await runtime.executeAction("EXECUTE_SWAP_DAO", {
inputTokenSymbol: "SOL",
outputTokenSymbol: "USDC",
amount: 0.1,
});
Cache Management
RPC Optimization
Transaction Management
Error: Failed to connect to wallet
Error: Transaction simulation failed
Error: Unable to fetch price data
Environment Variables
Transaction Limits
Monitoring
Recovery
Cache Management
RPC Optimization
Transaction Management
For issues and feature requests, please:
Contributions are welcome! Please see the CONTRIBUTING.md file for more information.
This plugin integrates with and builds upon several key technologies:
Special thanks to:
For more information about Solana blockchain capabilities:
This plugin is part of the Eliza project. See the main project repository for license information.