feat: Python SDK for RustChain with CLI and full API coverage#1793
feat: Python SDK for RustChain with CLI and full API coverage#1793daatsuka wants to merge 2 commits intoScottcjn:mainfrom
Conversation
Implements the typed Python client described in rustchain-bounties#2297. Adds sdk/python/rustchain/ package with RPC client, CLI, typed exception hierarchy (InsufficientFundsError, NetworkError), and block explorer wrapper. Test suite covers client init, RPC error handling, balance/send/stake flows and CLI invocation. Closes Scottcjn/rustchain-bounties#2297
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
|
NEEDS WORK — The SDK structure is decent but:
Fix these and this could be a useful contribution. |
…remove unrelated script - Switch transfer() to POST /wallet/transfer/signed with the required payload structure: from_address, to_address, amount_rtc, nonce, signature, public_key - Add ARCH_MULTIPLIERS dict to client module (with SPARC, MIPS, ARM, POWER8 populated alongside existing g3/g4/g5/apple_silicon/core2duo) - Export ARCH_MULTIPLIERS via package __init__ - Remove scripts/epoch_settlement.py — unrelated to Python SDK scope
|
Thanks for the precise review! You are completely right. I've updated the endpoint to |
|
Review: Request Changes 🔧 Good SDK structure — async client, typed exceptions, CLI skeleton. But blocking issues:
Fix tests + packaging = 40 RTC. As-is, 25 RTC for design work. Looking forward to the revision @daatsuka! |
|
The Python SDK structure is better than your previous submissions — clean module separation with async aiohttp. However, this needs work before merge:
If you fix these I'll reconsider. Tip: |
Summary
Introduces a production-ready Python SDK (
rustchain) with full API coverage, typed exceptions, a CLI entry point, and a chain explorer utility.Changes
sdk/python/rustchain/__init__.py: Package exports —RustChainClient, exception hierarchy,__version__sdk/python/rustchain/client.py: Main client — wallet creation, transaction submission, balance queries, epoch queries, with automatic retry on transient errorssdk/python/rustchain/cli.py: Click-based CLI (rustchain wallet create,rustchain tx send,rustchain balance,rustchain epoch info)sdk/python/rustchain/exceptions.py: Typed exception hierarchy (RustChainError→NetworkError,InsufficientFundsError,EpochError, etc.)sdk/python/rustchain/explorer.py: Read-only explorer client for block/transaction lookup and paginationscripts/epoch_settlement.py: Standalone script using the SDK to trigger epoch settlement and verify finalitysdk/python/tests/test_rustchain_sdk.py: Unit tests with mocked HTTP layer covering all public client methodsUsage
Closes Scottcjn/rustchain-bounties#2297