IQLabs Solana SDK for Python — on-chain data storage, database tables, and connections
Project description
IQLabs Solana SDK (Python)
Python port of the IQLabs Solana SDK.
Installation
pip install -e .
Or install dependencies manually:
pip install solana solders anchorpy pycryptodome
Quick Start
import asyncio
from solders.keypair import Keypair
from solana.rpc.async_api import AsyncClient
from iqlabs import reader, writer, set_rpc_url
async def main():
# Configure RPC
set_rpc_url("https://api.devnet.solana.com")
connection = AsyncClient("https://api.devnet.solana.com")
keypair = Keypair() # Use your funded keypair
# Write data
signature = await writer.code_in(connection, keypair, ["hello"])
# Read data back
result = await reader.read_code_in(signature)
print(result)
asyncio.run(main())
Running Tests
Unit Tests (No network required)
# Run all tests
pytest tests/
# Run specific test file
pytest tests/contract/test_smoke.py -v
pytest tests/sdk/test_smoke.py -v
# Run tests directly
python tests/contract/test_smoke.py
python tests/sdk/test_smoke.py
Example Scripts
# Test concurrency/rate limiter (no network)
python examples/concurrency_test.py
# Full example (requires funded keypair)
python examples/hello.py
Project Structure
iqlabs/
├── __init__.py # Main entry point
├── constants.py # Global constants
├── contract/ # Contract definitions
│ ├── constants.py # Program IDs, seeds
│ ├── pda.py # PDA derivation
│ ├── instructions.py # Instruction builders
│ └── profile.py # Runtime selection
└── sdk/
├── constants.py # SDK constants
├── reader/ # Read operations
│ ├── read_code_in.py
│ ├── iqdb.py
│ └── ...
├── writer/ # Write operations
│ ├── code_in.py
│ ├── iqdb.py
│ └── ...
└── utils/ # Utilities
├── connection_helper.py
├── wallet.py
├── seed.py
└── ...
Environment Variables
| Variable | Description |
|---|---|
IQLABS_RPC_ENDPOINT |
Primary RPC URL |
SOLANA_RPC_ENDPOINT |
Fallback RPC URL |
HELIUS_RPC_URL |
Helius RPC URL |
FRESH_RPC_URL |
RPC for fresh data |
RECENT_RPC_URL |
RPC for recent data |
API Reference
Writer
writer.code_in(connection, signer, chunks, ...)- Upload datawriter.write_row(...)- Write to tablewriter.request_connection(...)- Request DM connection
Reader
reader.read_code_in(tx_signature)- Read uploaded datareader.read_table_rows(...)- Read table rowsreader.read_connection(...)- Check connection status
iqlabs-solana-sdk-python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iqlabs_solana_sdk-0.1.4.tar.gz
(33.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iqlabs_solana_sdk-0.1.4.tar.gz.
File metadata
- Download URL: iqlabs_solana_sdk-0.1.4.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4d642faaa33d2fa6e3a6e5841dcec97a9e5c79e621383c41b6d0a62d9f131c2
|
|
| MD5 |
e73d4f8466d705cc187acf0ca7fa2d54
|
|
| BLAKE2b-256 |
f891836f394ac213d4c3732dd043e60d30b96adb67bb50d6a6ac32b948eb7745
|
File details
Details for the file iqlabs_solana_sdk-0.1.4-py3-none-any.whl.
File metadata
- Download URL: iqlabs_solana_sdk-0.1.4-py3-none-any.whl
- Upload date:
- Size: 43.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e90a64758d2debcd6dffa0e77676ca57eb566392b75c5f63ee544b028f390f01
|
|
| MD5 |
841d108f7ab45792e72d290cc876aed3
|
|
| BLAKE2b-256 |
756c31c06d62ef180b988357d70ef3c7912ed63003365f6f23bd93f0b00b0363
|