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.3.tar.gz
(34.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.3.tar.gz.
File metadata
- Download URL: iqlabs_solana_sdk-0.1.3.tar.gz
- Upload date:
- Size: 34.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 |
677df19c4df69ad39e2ca0b12c4ee1ae3f44e49938e6363de88327aeb84aff72
|
|
| MD5 |
729857f0ca94203e3f53337f8a405301
|
|
| BLAKE2b-256 |
ac904a788e9353af7cf3b15d0b5e0444b168c572250bad89e2304b929a9d22ae
|
File details
Details for the file iqlabs_solana_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: iqlabs_solana_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 44.9 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 |
3b21eb7563471697ae6e3fced349489923aed1f47b76cb335a40edd615ecffc9
|
|
| MD5 |
aa2163377efa302782b024f392d8d053
|
|
| BLAKE2b-256 |
ba3b85db8b9b9d08ece9105f5660a5386851494f93ba8e9149b6776ef1e8070b
|