pmxt icon indicating copy to clipboard operation
pmxt copied to clipboard

fix(python-sdk): add wallet signer exchange options

Open realfishsam opened this issue 5 months ago • 1 comments

Summary

  • Add wallet_address and signer to the Python SDK ExchangeOptions TypedDict.
  • Aligns the Python public option type with the TypeScript ExchangeOptions fields for hosted wallet/signer flows.

Fixes #1132

Test Plan

  • python3 -m py_compile sdks/python/pmxt/models.py
  • python3 - <<'PY' ... import-by-path smoke check asserting ExchangeOptions includes wallet_address and signer

Note: python3 -m pytest sdks/python/tests/test_public_exports.py could not run in this cron environment because pytest is not installed.

realfishsam avatar Jun 17 '26 07:06 realfishsam

This focused PR is locally validated but currently blocked by repository-wide generated-sync drift that is unrelated to the touched file.

Local validation run by this cron:

  • python3 -m py_compile sdks/python/pmxt/models.py ✅
  • import-by-path smoke check asserting ExchangeOptions includes wallet_address and signer ✅

CI blockers observed:

  • Verify client.py methods are up-to-date wants a fetch_order_book(... params: Optional[dict]) generated change in sdks/python/pmxt/client.py unrelated to this PR.
  • Verify client.ts methods are up-to-date wants a fetchMatchedMarkets(params?: any) generated change in sdks/typescript/pmxt/client.ts unrelated to this PR.
  • Verify API_REFERENCE.md files are up-to-date wants removal of question from sdks/typescript/API_REFERENCE.md, unrelated to this Python TypedDict fix.

Per the PMXT focused-PR generated-drift rule, I am keeping this PR scoped instead of folding broad unrelated generated churn into it.

realfishsam avatar Jun 17 '26 07:06 realfishsam

PR Review: PASS (NOT VERIFIED)

What This Does

Adds wallet_address and signer to the Python SDK ExchangeOptions TypedDict so typed constructor-option dictionaries can include the hosted wallet/signing options already accepted by Exchange.__init__. This matters for Python SDK consumers using typed options around hosted trading flows.

Blast Radius

Python SDK type surface only: sdks/python/pmxt/models.py. No server, exchange normalizer, OpenAPI schema, or generated SDK transport changes.

Consumer Verification

Before (base branch): Static inspection/import of ExchangeOptions.__annotations__ on origin/main showed only signature_type among these related keys:

{'signature_type': 'typing.Union[str, int]'}

A typed options dict containing wallet_address / signer would therefore be invisible to type checkers even though the runtime constructor accepts those kwargs.

After (PR branch): Static inspection/import of ExchangeOptions.__annotations__ on this PR showed:

{'signature_type': 'typing.Union[str, int]', 'wallet_address': "<class 'str'>", 'signer': 'typing.Any'}

No hosted API credential-backed runtime call was performed because this is a type-surface-only change.

Test Results

  • Build: NOT VERIFIED (npm run build --workspace=pmxt-core is blocked in this checkout by pre-existing Rain SDK/tooling errors: missing @buidlrrr/rain-sdk plus Rain implicit-any errors)
  • Unit tests: NOT VERIFIED (not applicable to this type-only Python change; no focused Python type-check suite was found/run)
  • Server starts: NOT VERIFIED (not needed for this type-only change)
  • E2E smoke: NOT VERIFIED (not observable through sidecar HTTP API)
  • Python syntax: PASS (python3 -m py_compile sdks/python/pmxt/client.py sdks/python/pmxt/models.py sdks/python/pmxt/router.py sdks/python/pmxt/_exchanges.py)

Findings

No blocking findings.

PMXT Pipeline Check

  • Field propagation (3-layer): N/A — option typing only; no market/event/order response field added
  • OpenAPI sync: N/A
  • Financial precision: N/A
  • Type safety: OK — adds missing option keys and Any is already imported in models.py
  • Auth safety: OK — no credential logging/transport behavior changed

Semver Impact

patch -- Python SDK typing fix for already-supported constructor options.

Risk

Runtime behavior was not exercised because the PR only changes a TypedDict; a dedicated static type-check fixture would make this fully verifiable in CI.

realfishsam avatar Jun 17 '26 14:06 realfishsam