Skip to content

Python plugin: add faucet/reward tx support + custom RPC endpoints#430

Open
demarco2016 wants to merge 1 commit into
canopy-network:mainfrom
demarco2016:custom-rpc-endpoints-python
Open

Python plugin: add faucet/reward tx support + custom RPC endpoints#430
demarco2016 wants to merge 1 commit into
canopy-network:mainfrom
demarco2016:custom-rpc-endpoints-python

Conversation

@demarco2016

Copy link
Copy Markdown

Implements the Python SDK counterpart of the Go custom RPC endpoint support (PR #414).

Changes (5 files in plugin/python/):

contract/proto/tx.proto + tx_pb2.py

  • Added Faucet, Reward, MessageFaucet, MessageReward proto messages

contract/contract.py

  • Added prefixes 0x64/0x65 (outside core reserved range 1-15)
  • Key generators: key_for_faucet / key_for_reward
  • check_tx / deliver_tx dispatch for faucet and reward messages
  • Registered custom state prefixes in CONTRACT_CONFIG
  • _check_message_faucet, _check_message_reward stateless validation
  • _deliver_message_faucet, _deliver_message_reward stateful execution

contract/rpc.py

  • Route dispatch for /v1/query/faucets and /v1/query/rewards
  • Handlers using asyncio.run_coroutine_threadsafe
  • Supports single-address exact lookup (?address=hex) and full prefix scan

Matches the Go plugin behavior:

  • Admin penalty on reward (fee deducted from admin)
  • Detached read-only queries (no tx lifecycle coupling)
  • Collision-safe custom prefixes (0x64/0x65)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant