Skip to content

SDK drift: orderFromV0 in TypeScript does not map filledShares, feeRateBps, txHash, chain, blockNumber from V0 payload; Python order_from_v0 does #1122

Description

@realfishsam

Summary

The V0-wire-to-Order mappers diverge in which fields they extract from the hosted API response. Python's order_from_v0 reads tx_hash, chain, block_number, and raw from the V0 payload and surfaces them on the returned Order object. TypeScript's orderFromV0 maps only the basic trading fields and silently discards all on-chain provenance fields. An Order returned from a hosted call in TypeScript is therefore missing fields that the same call in Python populates.

TypeScript

sdks/typescript/pmxt/hosted-mappers.ts (orderFromV0, ~lines 47–77) maps:

// Fields mapped:
id, marketId, outcomeId, side, type, amount, status,
filled, remaining, timestamp, price?, fee?
// NOT mapped from V0 payload:
// filledShares, feeRateBps, txHash, chain, blockNumber, raw

Order in models.ts does define filledShares?, feeRateBps?, txHash?, chain?, blockNumber? on the interface, but orderFromV0 never reads those keys from the wire payload.

Python

sdks/python/pmxt/_hosted_mappers.py (order_from_v0, ~lines 32–53) additionally maps:

# Extra fields mapped from V0 payload:
tx_hash     -> order.tx_hash
chain       -> order.chain
block_number -> order.block_number
raw         -> order.raw  (entire payload stored verbatim)

Impact

  • A TypeScript hosted-mode caller that inspects order.txHash after createOrder / submitOrder always receives undefined, even when the trading API populated tx_hash in the response.
  • The filledShares field (V0 key filled_shares) and feeRateBps field (V0 key fee_rate_bps) are defined on the TypeScript Order interface but are never set by orderFromV0, making them perpetually undefined for hosted orders.
  • Python callers can access the full on-chain provenance (tx_hash, chain, block_number) and the raw server payload; TypeScript callers cannot without re-parsing the raw HTTP response themselves.
  • Related: the same gap for built_order_from_v0 (missing entirely in TypeScript) is tracked in SDK drift: Python _hosted_mappers.py has built_order_from_v0/built_order_to_v0; TypeScript hosted-mappers.ts has no equivalents #1027.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions