Skip to main content

Official Python client for the WaveLedger post-quantum testnet.

Project description

waveledger — Python client

Official Python client for the WaveLedger post-quantum testnet. One class for every messenger surface (auth, chat, wallet, explorer, playground, admin) plus an iterator over the SSE event stream.

Install

pip install waveledger-sdk

The PyPI distribution is waveledger-sdk; the importable module is waveledger (so your code stays from waveledger import Client).

From the WaveLedger source tree:

pip install -e clients/python

Or vendor clients/python/waveledger/ into your project — it's pure-Python with one dep (requests).

Quickstart

from waveledger import Client

c = Client("https://api.waveledger.net")

# Sign up with an invite (instant approval + 100 testnet WAVE)
c.signup("alice", invite_code="WAVE-ABC123")

# Post a chat message — real on-chain tx
c.send_message("hello world")

# Send WAVE to another address
c.wallet_send(to="34378b1ba5be9d0999acd60be3a8a1f1", amount=1.0)

# Subscribe to every block as it lands
for ev in c.subscribe(types=["block"]):
    b = ev["block"]
    print(f"block {b['height']} from {b['miner'][:16]}")

Surfaces

The Client exposes everything as either a method or a sub-surface:

c.signup(...)           c.login(...)            c.me()
c.send_message(...)     c.messages()
c.wallet()              c.wallet_send(...)      c.wallet_export(...)
c.subscribe(...)        # SSE: block / tx / message / receipt events

c.explorer.stats()
c.explorer.blocks(limit=25, offset=0)
c.explorer.block(height)
c.explorer.tx(tx_id)
c.explorer.address(address)

c.playground.compile(source)
c.playground.deploy(source)
c.playground.call(contract=..., method=..., args=[...])
c.playground.receipt(tx_id)
c.playground.contracts()

# Admin endpoints — pass HTTP Basic at construction time
ac = Client("https://api.waveledger.net", admin=("admin", "PASSWORD"))
ac.admin.pending()
ac.admin.approve("alice")
ac.admin.block("spammer", reason="abuse")
ac.admin.unblock("spammer")
ac.admin.invite_create(max_uses=10)

Filtering the event stream

# Block events only
for ev in c.subscribe(types=["block"]): ...

# Everything that touches one address
for ev in c.subscribe(address="34378b1ba5be9d0999acd60be3a8a1f1"): ...

# Both
for ev in c.subscribe(types=["tx", "receipt"],
                       address="34378b1ba5be9d0999acd60be3a8a1f1"): ...

Filtering happens server-side, so the client pays no bandwidth or CPU cost for events it doesn't care about.

Errors

Every HTTP error maps to a specific exception class:

from waveledger import (
    AuthError, NotFoundError, RateLimitedError,
    ValidationError, ServerError, WaveLedgerError,
)
HTTP Exception
400 ValidationError
401 / 403 AuthError
404 NotFoundError
429 RateLimitedError
5xx ServerError
anything else WaveLedgerError

Each exception carries .status (int) and .payload (the server's JSON response if any).

Self-hosted nodes

Point the client at your own node:

c = Client("http://localhost:8081")

The messenger serves on 8081 by default (node.py --messenger-port).

Tests

cd clients/python
python3 -m pytest tests/ -q

The test suite uses a MockSession that captures every HTTP call — no network, no fixtures, no external test deps.

Versioning

Pre-1.0. Method names and response shapes track the REST API, which is itself under active development on testnet. See CHANGELOG on the docs site.

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

waveledger_sdk-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

waveledger_sdk-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file waveledger_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: waveledger_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for waveledger_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 427424a789c481050bbda9762ec4fb584040647b51b397a107fd2ab24d6c3e2e
MD5 8ffe35b6d8b19962759c3ec58c1ed6cf
BLAKE2b-256 ffd742e02f3d19d20f0fd665fbdd30613a02dd1e6e953d66eb8c6d73064844de

See more details on using hashes here.

File details

Details for the file waveledger_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: waveledger_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for waveledger_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f519aec20858c4bef47bdc71c8404d28c5d0542ad535e807810b8e840148e5e2
MD5 5a56e27b0af024bff49bb1635e17b12f
BLAKE2b-256 d1219bb66bcfad9acc16bdec679ab36c764427456239c7c684df265b5b340212

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