Skip to content

fix(python-sdk): resolve wallet address before include in escrow.withdrawals - #2586

Open
anyingiit wants to merge 1 commit into
pmxt-dev:mainfrom
anyingiit:fix/python-escrow-withdrawals-validation-order
Open

anyingiit wants to merge 1 commit into
pmxt-dev:mainfrom
anyingiit:fix/python-escrow-withdrawals-validation-order

Conversation

@anyingiit

Copy link
Copy Markdown

Requested by winshyon

Description

Escrow.withdrawals validated its inputs in opposite orders in the two SDKs: TypeScript resolves the wallet address first and then checks include, while Python checked include first. So withdrawals(include="") with no wallet address configured and no address override raised MissingWalletAddress in TypeScript but ValidationError("include must not be empty") in Python.

This PR moves the wallet-address resolution in sdks/python/pmxt/escrow.py ahead of the include check, matching the TypeScript SDK (and Python's own approve_tx). Behaviour for valid inputs and the generated request path are unchanged. A new sdks/python/tests/test_escrow_withdrawals.py covers the validation order (missing address + empty include → MissingWalletAddress; resolved address + blank include → ValidationError(field="include")) and the request path that gets built.

I only changed withdrawals here. The matching deposit_tx drift is tracked separately in #1892, and I didn't want to pre-empt how that one gets resolved. Address-first is what TypeScript does here and what Python's approve_tx already does, so this fix should line up with either outcome of #1892.

Motivation / disclosure: I had some spare AI-assistant quota (Claude Code) and am using it to try to help projects with open good-first-issues. The change was prepared with Claude Code and verified as listed below. If it doesn't fit, isn't up to your bar, or you'd simply rather not take it — please feel free to close it, no hard feelings at all 🙂

Related issue

Closes #2353

Checklist

  • Tests pass locally (cd sdks/python && pytest → 270 passed, 66 deselected (integration). The new test test_missing_wallet_address_is_checked_before_empty_include fails without the fix and passes with it. black --check passes on the new test file.)
  • CHANGELOG.md is updated (if applicable) — n/a, root changelog appears to be written at release time; happy to add an entry if you prefer
  • Documentation is updated (if applicable) — n/a, no public behaviour change for valid inputs

🤖 Generated with Claude Code

…drawals

Escrow.withdrawals in the Python SDK validated `include` before resolving
the wallet address, the reverse of the TypeScript SDK. Calling
withdrawals(include="") with no wallet address therefore raised
ValidationError in Python but MissingWalletAddress in TypeScript.

Resolve the wallet address first, matching the TypeScript SDK (and
Python's own approve_tx), and add regression tests for the validation
order.

Closes pmxt-dev#2353

This branch has not been deployed

No deployments
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.

SDK drift: Escrow.withdrawals validates wallet address vs. include in opposite order

1 participant