Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

elizaOS Plugin Solana (Python)

Python implementation of the Solana blockchain plugin for elizaOS agents.

Installation

pip install elizaos-plugin-solana

Quick Start

import asyncio
from elizaos_plugin_solana import SolanaClient, WalletConfig

async def main():
    # Read-only mode (just need a public key)
    config = WalletConfig.read_only(
        "https://api.mainnet-beta.solana.com",
        "YourPublicKeyHere"
    )

    async with SolanaClient(config) as client:
        # Get SOL balance
        balance = await client.get_sol_balance()
        print(f"Balance: {balance} SOL")

        # Get token accounts
        tokens = await client.get_token_accounts()
        for token in tokens:
            print(f"{token.mint}: {token.ui_amount}")

asyncio.run(main())

With Signing Capability

from elizaos_plugin_solana import SolanaClient, WalletConfig
from decimal import Decimal

# Full access mode (with private key)
config = WalletConfig.with_keypair(
    "https://api.mainnet-beta.solana.com",
    "YourPrivateKeyHere"
)

async with SolanaClient(config) as client:
    # Transfer SOL
    recipient = "RecipientPublicKey"
    result = await client.transfer_sol(recipient, Decimal("0.1"))
    print(f"Transfer signature: {result.signature}")

Environment Variables

Load configuration from environment:

config = WalletConfig.from_env()

Required environment variables:

  • SOLANA_RPC_URL - Solana RPC endpoint (defaults to mainnet)
  • SOLANA_PRIVATE_KEY or WALLET_PRIVATE_KEY - Private key for signing
  • SOLANA_PUBLIC_KEY or WALLET_PUBLIC_KEY - Public key (if no private key)

Optional:

  • SLIPPAGE - Slippage tolerance in basis points (default: 50)
  • HELIUS_API_KEY - For enhanced RPC
  • BIRDEYE_API_KEY - For token price data

Token Swaps via Jupiter

from elizaos_plugin_solana import SwapQuoteParams

params = SwapQuoteParams(
    input_mint="So11111111111111111111111111111111111111112",  # SOL
    output_mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",  # USDC
    amount="1000000000",  # 1 SOL in lamports
    slippage_bps=50,
)

quote = await client.get_swap_quote(params)
print(f"Expected output: {quote.out_amount}")

# Execute the swap
result = await client.execute_swap(quote)
print(f"Swap signature: {result.signature}")

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Run linting
ruff check .
ruff format .

# Run type checking
mypy elizaos_plugin_solana

License

MIT

Metadata

Release files for elizaos-plugin-solana 2.0.0a5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elizaos-plugin-solana 2.0.0a5
File Size Uploaded
elizaos_plugin_solana-2.0.0a5.tar.gz 16.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elizaos-plugin-solana 2.0.0a5
File Interpreter ABI Platform
elizaos_plugin_solana-2.0.0a5-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / elizaos_plugin_solana-2.0.0a5.tar.gz

Download URL elizaos_plugin_solana-2.0.0a5.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
73a7aeec28e7c3c7345e1ec76573b2901d787aeed252977ceadbe582dd165a16
BLAKE2b-256 checksum
How to use checksums
d8028b2c5d5e6eb2b242c63e0381bb31ecfca074bcf4109ba247d45800023138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / elizaos_plugin_solana-2.0.0a5-py3-none-any.whl

Download URL elizaos_plugin_solana-2.0.0a5-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59cc474d76713b0729cdf44026c60372d4c76fbabdc346357b2e174db48fd0da
BLAKE2b-256 checksum
How to use checksums
77b9754ccd28579256195b6b97a3bd23c913c34627115f463e9ad9a970c259f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

2.0.0a5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page