Skip to content

fix(python-sdk): accept wallet address in Hunch client#1376

Merged
realfishsam merged 1 commit into
mainfrom
fix/issue-1372-hunch-wallet-address
Jun 30, 2026
Merged

fix(python-sdk): accept wallet address in Hunch client#1376
realfishsam merged 1 commit into
mainfrom
fix/issue-1372-hunch-wallet-address

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Add wallet_address to the Python Hunch convenience client constructor.
  • Forward the value to the shared Exchange base class so hosted-mode reads/writes can resolve wallet-scoped endpoints.
  • Add a regression covering the Hunch constructor.

Fixes #1372

Test Plan

  • python3 -m py_compile sdks/python/pmxt/_exchanges.py sdks/python/tests/test_hosted_dispatch.py
  • PYTHONPATH=/tmp/pmxt-pystub:sdks/python python3 -m pytest sdks/python/tests/test_hosted_dispatch.py::test_hunch_constructor_accepts_wallet_address_for_hosted_mode -q

Note: the local checkout lacks committed generated pmxt_internal artifacts, so the focused pytest used an untracked /tmp/pmxt-pystub generated-client stub only for importability.

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: FAIL

What This Does

This attempts to let Python SDK consumers construct Hunch(pmxt_api_key=..., wallet_address=...) so hosted Hunch wallet-scoped calls can carry the wallet address through the shared Exchange base class.

Blast Radius

Python SDK exchange wrapper generation only: sdks/python/pmxt/_exchanges.py and the hosted dispatch test file. This affects the public Python Hunch constructor; no core sidecar exchange logic or OpenAPI schemas are changed.

Consumer Verification

Before (base branch):
Static constructor inspection of origin/main:sdks/python/pmxt/_exchanges.py shows Hunch.__init__ has no wallet_address kwarg:

base False ['self', 'private_key', 'base_url', 'auto_start_server', 'pmxt_api_key']

A Python SDK consumer passing wallet_address= would therefore hit TypeError: Hunch.__init__() got an unexpected keyword argument 'wallet_address'.

After (PR branch):
Static constructor inspection of pr-1376-review:sdks/python/pmxt/_exchanges.py shows the PR adds the kwarg:

pr True ['self', 'private_key', 'base_url', 'auto_start_server', 'pmxt_api_key', 'wallet_address']

However, the file header says _exchanges.py is generated and must not be edited manually. I ran the declared generator path on the PR worktree:

npm run generate:python-exchanges --workspace=pmxt-core

The regenerated diff removes the new Hunch wallet_address kwarg again:

@@ class Hunch(Exchange):
-        wallet_address: Optional[str] = None,
@@
-            wallet_address: EVM wallet address used for hosted reads/writes
@@
-            wallet_address=wallet_address,

So the consumer-visible fix is not durable: any normal SDK regeneration will drop it.

Test Results

  • Build: NOT VERIFIED for full SDK; not needed to demonstrate the generator regression.
  • Unit tests: NOT VERIFIED; direct Python import in this worktree is blocked by missing local generated pmxt_internal, but AST/generator checks are sufficient for the blocking generated-file issue.
  • Server starts: N/A (constructor-only Python SDK wrapper change).
  • E2E smoke: N/A (no sidecar behavior changed).

Findings

  1. sdks/python/pmxt/_exchanges.py:1 / sdks/python/pmxt/_exchanges.py:545 — blocking generated-file edit. The PR changes _exchanges.py directly, but its header states it is generated from core/scripts/generate-python-exchanges.js. Running the generator on the PR removes the new Hunch wallet_address constructor parameter, so the fix will be silently lost during the next SDK regeneration/release. The durable fix needs to update the generator/source-of-truth (for example an override for Hunch hosted wallet params) and commit the regenerated output.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A
  • OpenAPI sync: N/A
  • Financial precision: N/A
  • Type safety: ISSUE — public constructor surface is only present in generated output, not in its generator/source of truth.
  • Auth safety: OK — no credentials are logged/exposed by this change.

Semver Impact

patch -- intended Python SDK constructor compatibility fix.

Risk

Until the generator/source-of-truth is updated, the Hunch hosted wallet-address support can disappear during routine SDK generation, causing the same consumer wallet_address constructor failure to recur.

@realfishsam realfishsam merged commit 539052b into main Jun 30, 2026
12 checks passed
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.

Python SDK: Hunch class missing wallet_address constructor parameter

1 participant