You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SDK drift: Escrow.approveTx's amount_wei serializes as a JSON string in TypeScript but as a JSON number in Python #1923
For the same semantic amount_wei value passed to Escrow.approveTx/Escrow.approve_tx, the two SDKs put different JSON types on the wire: TypeScript always serializes it as a string, Python always serializes it as a number.
TypeScript SDK
sdks/typescript/pmxt/escrow.ts:51-62 — normalizeAmountWei(amountWei: bigint | undefined): string | undefined always returns amountWei.toString(). sdks/typescript/pmxt/escrow.ts:120-133 — approveTx() puts that string directly into the request body: ...(approvalAmount === undefined ? {} : { amount_wei: approvalAmount }), so e.g. 1000000n is sent as "amount_wei": "1000000".
Python SDK
sdks/python/pmxt/escrow.py:46-56 — _amount_wei(value: int | None) -> int | None returns the raw int unchanged (no string conversion). sdks/python/pmxt/escrow.py:114-123 — approve_tx() puts that int directly into the request body: **({} if approval_amount is None else {"amount_wei": approval_amount}), so e.g. 1000000 is sent as "amount_wei": 1000000 (a JSON number).
Expected
Both SDKs should serialize amount_wei on the wire the same way (either both as a string or both as a number), matching whatever the hosted trading API actually expects.
Impact
A server integration for the /v0/escrow/approve endpoint must accept amount_wei as either a JSON string or a JSON number depending on which SDK the caller used, since the two SDKs never agree. This is the same category of bug as #1713 (which covers amount on deposit_tx/withdraw_tx) but for a different field (amount_wei) on a different method (approveTx/approve_tx); #1025 only covers the language-level type annotation (bigint vs int), not the actual wire serialization format.
Closing as duplicate of #1025. Same underlying finding: Escrow.approveTx/approve_tx's amount_wei serializes as a JSON string in TypeScript but a JSON number in Python — the same wire-format mismatch #1025 already documents (and already has an in-progress fix, PR #1045). The precise line-number detail from this issue has been copied over to #1025 as a comment.
Activity
realfishsam commentedon Sep 4, 2026
Closing as duplicate of #1025. Same underlying finding:
Escrow.approveTx/approve_tx'samount_weiserializes as a JSON string in TypeScript but a JSON number in Python — the same wire-format mismatch #1025 already documents (and already has an in-progress fix, PR #1045). The precise line-number detail from this issue has been copied over to #1025 as a comment.Generated by Claude Code
Escrow.approveTxamountWeiis typedbigintin TypeScript butintin Python #1025