Skip to main content

Dilithia Python SDK

Python SDK for the Dilithia RPC surface.

Current SDK line: 0.3.0

Install

pip install dilithia-sdk

httpx is installed automatically. For the optional Rust-backed crypto bridge:

pip install dilithia-sdk[native]

Quick start (sync)

from dilithia_sdk import DilithiaClient

with DilithiaClient("https://rpc.example/rpc") as client:
    bal = client.balance("alice")
    print(f"{bal.address}: {bal.balance.formatted()} DILI")

    info = client.network_info()
    print(f"chain={info.chain_id} height={info.block_height}")

Quick start (async)

import asyncio
from dilithia_sdk import AsyncDilithiaClient

async def main():
    async with AsyncDilithiaClient("https://rpc.example/rpc") as client:
        bal = await client.balance("alice")
        print(f"{bal.address}: {bal.balance.formatted()} DILI")

asyncio.run(main())

Typed responses

All read methods return frozen dataclasses:

  • Balance with address: Address and balance: TokenAmount
  • Nonce with address: Address and next_nonce: int
  • Receipt with tx_hash: TxHash, block_height, status, etc.
  • NetworkInfo with chain_id, block_height, base_fee
  • GasEstimate with gas_limit, base_fee, estimated_cost
  • NameRecord with name and address: Address
  • QueryResult wrapping any contract query return value

Token amounts use Decimal to avoid floating-point issues:

from dilithia_sdk import TokenAmount

t = TokenAmount.dili("1.5")
raw = t.to_raw()        # 1500000000000000000
back = TokenAmount.from_raw(raw)
print(back.formatted())  # 1.500000000000000000

Exception hierarchy

All exceptions inherit from DilithiaError:

  • RpcError(code, message) -- JSON-RPC error
  • HttpError(status_code, body) -- non-2xx HTTP response
  • TimeoutError -- request or polling timeout
  • CryptoError -- native crypto failures
  • ValidationError -- invalid input

Gas sponsor

from dilithia_sdk import DilithiaClient, DilithiaGasSponsorConnector

client = DilithiaClient("https://rpc.example/rpc")
sponsor = DilithiaGasSponsorConnector(client, "wasm:gas_sponsor", paymaster="gas_sponsor")
call = client.build_contract_call("wasm:amm", "swap", {"amount": 100})
sponsor.send_sponsored_call(call, signer)

Crypto adapter

from dilithia_sdk import load_native_crypto_adapter

crypto = load_native_crypto_adapter()
if crypto:
    mnemonic = crypto.generate_mnemonic()
    account = crypto.recover_hd_wallet(mnemonic)

Commands

python -m pip install -e .
python -m unittest discover -s tests
python -m build

Requires Python 3.11--3.14.

Metadata

Release files for dilithia-sdk 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dilithia-sdk 0.3.0
File Size Uploaded Provenance
dilithia_sdk-0.3.0.tar.gz 29.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dilithia-sdk 0.3.0
File Interpreter ABI Platform
dilithia_sdk-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.2 kB

Release files / dilithia_sdk-0.3.0.tar.gz

Download URL dilithia_sdk-0.3.0.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c96ddc7df819a9f6d06d33fa653dc6c0e4d78798eb95cd3c4d3388e2cbc906b8
BLAKE2b-256 checksum
How to use checksums
df991a25eead7666e5cd18a60d38e19aed493542d177009c24d43a09db13f43d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.

Transparency log

Release files / dilithia_sdk-0.3.0-py3-none-any.whl

Download URL dilithia_sdk-0.3.0-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fce12947f579862f35aee2f07c7ce5fbb23b62e144d2a20002d9d6bce69fbf07
BLAKE2b-256 checksum
How to use checksums
89e447d828097e2c243e0824dad1873f24844219acc79cd0c975a91c005cab89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.

Transparency log

Security for dilithia-sdk 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dilithia_sdk-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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