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/approve_tx serializes amount_wei as a JSON string in TypeScript but a native JSON number in Python #1705
TypeScript's normalizeAmountWei deliberately converts the bigintamountWei to a decimal string (.toString()) before putting it in the request body, avoiding IEEE-754 double precision loss for large values. Python's _amount_wei returns the raw int unchanged, which then serializes as a native JSON number literal via json.dumps(body, default=str).
TypeScript SDK
sdks/typescript/pmxt/escrow.ts:51-62, used in the request body at line 130:
functionnormalizeAmountWei(amountWei: bigint|undefined): string|undefined{
...
returnamountWei.toString();// returns a decimal STRING}
Python SDK
sdks/python/pmxt/escrow.py:46-56, used in the request body at line 121:
def_amount_wei(value: int|None) ->int|None:
...
returnvalue# returns the raw int, unchanged
Expected
Both SDKs should serialize amount_wei on the wire the same way — Python should stringify large integer values before including them in the request body, matching TypeScript.
Impact
This is different from existing issue #1025, which only concerns the SDK-facing parameter type (bigint vs int), not the wire serialization. amount_wei values for ERC-20 approvals are frequently very large (e.g. near uint256 max for "unlimited" approvals). Sending them as a bare JSON number risks precision loss/misinterpretation by any downstream JSON consumer that treats numbers as IEEE-754 doubles (e.g. a JS-based service) — exactly the failure mode TypeScript's pre-stringification is designed to avoid.
Closing as duplicate of #1025. Both issues report the identical underlying finding for Escrow.approveTx/approve_tx: TypeScript serializes amount_wei as a JSON string (via .toString()/normalizeAmountWei) while Python sends it as a native JSON number (via _amount_wei), producing a wire-format mismatch. #1025 already documents this wire-format divergence (not just the bigint/int type difference) and proposes the same fix (Python should serialize as a string to match TypeScript). Extra detail from this issue has been copied into a comment on #1025.
Activity
Escrow.approveTxamountWeiis typedbigintin TypeScript butintin Python #1025realfishsam commentedon Jul 18, 2026
Closing as duplicate of #1025. Both issues report the identical underlying finding for
Escrow.approveTx/approve_tx: TypeScript serializesamount_weias a JSON string (via.toString()/normalizeAmountWei) while Python sends it as a native JSON number (via_amount_wei), producing a wire-format mismatch. #1025 already documents this wire-format divergence (not just thebigint/inttype difference) and proposes the same fix (Python should serialize as a string to match TypeScript). Extra detail from this issue has been copied into a comment on #1025.Generated by Claude Code