from agentipy import SolanaAgentKit, create_solana_tools
# Initialize with private key and optional RPC URL
agent = SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
)
# Create LangChain tools
tools = create_solana_tools(agent)
it is showing the error below when implementing the first example
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-sdk-1.18.1/src/signer/keypair.rs:71:64:
called `Result::unwrap()` on an `Err` value: signature::Error { source: Some(PublicKey must be 32 bytes in length) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "/Users/hanesque/Desktop/code/python/swarms/agentipy-main/test.py", line 4, in <module>
agent = SolanaAgentKit(
^^^^^^^^^^^^^^^
File "/Users/hanesque/Desktop/code/python/swarms/agentipy-main/agentipy/agent/__init__.py", line 34, in __init__
self.wallet = Keypair.from_base58_string(private_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: signature::Error { source: Some(PublicKey must be 32 bytes in length) }
The private key is replaced my own private key from phantom wallet.
it is showing the error below when implementing the first example
The private key is replaced my own private key from phantom wallet.