Python SDK for the ChainCodec multichain transaction decoder API.
Project description
chaincodec-sdk (Python)
Python SDK for the ChainCodec multichain transaction decoder API.
ChainCodec normalizes transactions from multiple chains (Ethereum, Solana, Cosmos, Aptos, Sui, Polkadot, Bitcoin, Starknet) into a single JSON shape.
Installation
pip install chaincodec-sdk
For local development from this repository:
cd sdk/python
python3 -m pip install -e .
Quick Start
from chaincodec_sdk import ChainCodecClient
client = ChainCodecClient(
base_url="http://127.0.0.1:8080",
# api_key="optional-api-key",
)
tx = client.decode_tx(
chain="ethereum",
tx_hash="0xd5d0587189f3411699ae946baa2a7d3ebfaf13133f9014a22bab6948591611ad",
)
print(tx.chain, tx.tx_hash)
for event in tx.events:
if event.event_type == "token_transfer":
print(event.token, event.amount, event.from_address, event.to_address)
API
ChainCodecClient
ChainCodecClient(
base_url: str,
api_key: str | None = None,
timeout: float = 15.0,
)
base_url: ChainCodec API base URL (http://127.0.0.1:8080, etc.).api_key: Optional API key sent asx-api-key.timeout: Request timeout in seconds.
client.decode_tx(...)
decode_tx(chain: str, tx_hash: str, rpc_url: str | None = None) -> NormalizedTransaction
chain:solana|ethereum|cosmos|aptos|sui|polkadot|bitcoin|starknettx_hash: transaction hash stringrpc_url: optional per-request RPC URL override
Errors
Non-2xx API responses raise ChainCodecAPIError with:
status_codecode(backend error code, when present)retryable(when present)
Network and JSON decode issues raise ChainCodecTransportError.
Publishing
From sdk/python:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade build twine
python -m unittest discover -s tests -v
python -m build
python -m twine check dist/*
python -m twine upload dist/*
GitHub Actions Publish
This repository includes .github/workflows/publish-python-sdk.yml:
- Push tag
python-sdk-vX.Y.Zto publish to PyPI. - Manual run (
workflow_dispatch) supportstestpypiorpypi.
Required repository secrets:
PYPI_API_TOKENTEST_PYPI_API_TOKEN
Tag release example:
git tag python-sdk-v0.1.0
git push origin python-sdk-v0.1.0
Manual local publish example (TestPyPI):
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Manual local publish example (PyPI):
python3 -m build
python3 -m twine upload dist/*
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
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 chaincodec_sdk-0.1.0.tar.gz.
File metadata
- Download URL: chaincodec_sdk-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eff9bcf8c2a6396b6389a25fff042e30b0782c0877ef677be3b89c07b2eb43e
|
|
| MD5 |
142292a7e7552c1b94fbed69958fc7a9
|
|
| BLAKE2b-256 |
8098846cd90fd9b2dc6e5564e93edb34b1390eacee788b730337318d41b50a26
|
File details
Details for the file chaincodec_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chaincodec_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dbcf3cbc7e4b770c0ce85ab29e28720dca9d17495052b870d6dee2747f13505
|
|
| MD5 |
74e3d9aa98dbd9a3a6f5652a654f1161
|
|
| BLAKE2b-256 |
3760106e82e59fc0cc565378cce17ceaf0badc56a5b0d2971b0358056ac84d0f
|