Skip to main content

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 data
  • writer.write_row(...) - Write to table
  • writer.request_connection(...) - Request DM connection

Reader

  • reader.read_code_in(tx_signature) - Read uploaded data
  • reader.read_table_rows(...) - Read table rows
  • reader.read_connection(...) - Check connection status

iqlabs-solana-sdk-python

Project details


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.2.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iqlabs_solana_sdk-0.1.2-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file iqlabs_solana_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: iqlabs_solana_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for iqlabs_solana_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ee87ed79a34b52509de3993d7c512d1c86184317a982a7edceef23d794f470b0
MD5 4941414b963e3dc6f241cdbcc12ffd67
BLAKE2b-256 26f03a845bafbd8c20cb46433e188d040bbf166f7cb45fa206679b78375d6ff2

See more details on using hashes here.

File details

Details for the file iqlabs_solana_sdk-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for iqlabs_solana_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 54e0f7ca8c5aafa2cf8a04d06998743db54756c2e8fbb7cf6738e6f638cedbd8
MD5 fa42b68a23c59eace5e05bc7020399db
BLAKE2b-256 b0693bab15dfb938d28e7b8c5ec2740316bdc0f6b1b6ee363e79632da4ff4bf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page