Skip to main content

arete-sdk

Work in Progress: This SDK is under active development and has not yet been published to PyPI.

Python SDK for Arete — real-time Solana program data streaming. The Python SDK is an idiomatic projection of the same core API exposed by @usearete/sdk (TypeScript), @usearete/react, and the arete-sdk Rust crate: same nouns, same semantics, native Python idiom. See docs/internal/sdk-core-api.md for the canonical surface.

Installation

# Not yet published - install from source for development
pip install -e .

Requires Python 3.9+. Runtime dependencies: websockets, httpx.

Quick start

import arete
from my_generated_stack import ORE_STREAM_STACK  # generated by `a4 sdk create --python`

async def main():
    async with await arete.Arete.connect(
        ORE_STREAM_STACK,
        auth=arete.AuthConfig(publishable_key="a4_pk_..."),
    ) as a4:
        # Live stream of merged entities (patches applied, removals filtered)
        async for round in a4.views.ore_round.latest.use(take=10):
            print(round)
            break

        # Keyed state view, one-shot read
        round = await a4.views.ore_round.state.get(round_id=42)

        # Raw update stream with the full taxonomy (upsert | patch | remove | delete)
        async for update in a4.views.ore_round.latest.watch(filters={"state.status": "open"}):
            print(update.op, update.key)
            break

Program SDKs

Raw builders are pure and work offline — no connection required. Instruction parameters use the IDL wire names, and unknown parameters fail closed.

from my_generated_stack import programs

async def build_and_send(a4, wallet_address):
    # Pure, offline instruction building (also on the connected client:
    # a4.programs.ore.raw.deploy.build(...))
    ix = programs.ore_deploy(
        amount=1_000_000,
        squares=3,
        signer=wallet_address,
        authority=wallet_address,
        round="11111111111111111111111111111111",
        entropyVar="11111111111111111111111111111111",
        entropyProgram=programs.ENTROPY_PROGRAM_ID,
    )

    # Typed PDA derivation
    miner, bump = programs.OrePdas.miner.derive(authority=wallet_address)

    # Release-addressed account reads over HTTP
    miner_account = await a4.programs.ore.accounts.miner.fetch(miner)

    # Execute built instructions through your wallet
    receipt = await a4.transaction([ix])
    return receipt

Stacks that ship semantic operations (via SDK extensions) also expose instructions / transactions / flows, which prepare portable operations:

async def execute_semantic(a4):
    prepared = await a4.programs.ore.instructions.deploy.prepare(amount=1_000_000)
    receipt = await a4.execute(prepared)
    if receipt.transaction.slot is not None:
        await a4.wait_for_processed_slot(receipt.transaction.slot)

Wallets implement the arete.WalletAdapter protocol (async sign_and_send(...)). Execution outcomes follow the shared four-state model (confirmed | not-submitted | submitted-unknown | chain-failed), and wait_for_processed_slot bridges writes back to view state.

Chain and transaction relay

async def read_chain(a4, address):
    clock = await a4.chain.clock()
    lamports = await a4.chain.lamports(address)
    # One request per batch, up to 100 addresses; items align with the input.
    accounts = await a4.chain.accounts([address])
    blockhash = await a4.transactions.get_latest_blockhash()
    return clock, lamports, accounts, blockhash

Sessions (multi-stack)

async def stream_session(auth):
    session = await arete.create_session(stacks={"ore": ORE_STREAM_STACK}, auth=auth)
    async for round in session.stacks.ore.views.ore_round.latest.use():
        print(round)
        break
    await session.close()

Development

pip install -e '.[dev]'
python -m pytest tests/ -q

License

MIT

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arete_sdk-0.11.0.tar.gz (170.6 kB view details)

Uploaded Source

Built Distribution

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

arete_sdk-0.11.0-py3-none-any.whl (117.5 kB view details)

Uploaded Python 3

File details

Details for the file arete_sdk-0.11.0.tar.gz.

File metadata

  • Download URL: arete_sdk-0.11.0.tar.gz
  • Upload date:
  • Size: 170.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arete_sdk-0.11.0.tar.gz
Algorithm Hash digest
SHA256 6266d7cf6363cce98d83d8fdc879dd3c28858cbbff069db5a723f9a7ca3053d5
MD5 202057eb4605c7719f8d6c7834198945
BLAKE2b-256 be67fd2ad712ffe5006c588e57df605a7b0e9bf9aacf50f15ed68dc08a9dfc2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for arete_sdk-0.11.0.tar.gz:

Publisher: release-please.yml on AreteA4/arete

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arete_sdk-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: arete_sdk-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 117.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arete_sdk-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e53891458c4f7a4c9c5d11f2fb11e538a3e3bcd1ef1fbad4dfc6317cd2955b4
MD5 cee998831b660b5453e14fd4a45f6fb0
BLAKE2b-256 190f1b2a0e8f5180bd77e24a13f3f1acedaa5e4f2510a355f557683ed665565b

See more details on using hashes here.

Provenance

The following attestation bundles were made for arete_sdk-0.11.0-py3-none-any.whl:

Publisher: release-please.yml on AreteA4/arete

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.13.0

2 files

0.12.0

2 files

This release

0.11.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page