Solana Python API built on the JSON RPC API.
Python version of solana-web3.js for interacting with Solana.
Read the Documentation.
pip install solana
import solana
from solana.rpc.api import Client
http_client = Client("https://api.devnet.solana.com")
import asyncio
from solana.rpc.async_api import AsyncClient
async def main():
async with AsyncClient("https://api.devnet.solana.com") as client:
res = await client.is_connected()
print(res) # True
# Alternatively, close the client explicitly instead of using a context manager:
client = AsyncClient("https://api.devnet.solana.com")
res = await client.is_connected()
print(res) # True
await client.close()
asyncio.run(main())
- Install pipenv.
brew install pipenv
- Install dev dependencies.
pipenv install --dev
- Activate the pipenv shell.
pipenv shell
make lint
# All tests
make tests
# Unit tests only
make unit-tests
# Integration tests only
make int-tests
Install docker.
# Update/pull latest docker image
pipenv run update-localnet
# Start localnet instance
pipenv run start-localnet
make notebook