Skip to content

fix(ts-sdk): map hosted order provenance fields#1137

Open
realfishsam wants to merge 1 commit into
mainfrom
fix/ts-order-v0-provenance-1122
Open

fix(ts-sdk): map hosted order provenance fields#1137
realfishsam wants to merge 1 commit into
mainfrom
fix/ts-order-v0-provenance-1122

Conversation

@realfishsam

Copy link
Copy Markdown
Contributor

Summary

  • Map hosted v0 order provenance and fill metadata into the TypeScript Order object.
  • Covers filled_shares, fee_rate_bps, tx_hash, chain, and block_number, with camelCase fallbacks for already-normalized payloads.
  • Adds a focused regression test for the hosted order mapper.

Fixes #1122

Test Plan

  • npm test --workspace=pmxtjs -- --runTestsByPath tests/hosted-mappers.test.ts --runInBand
  • git diff --check

Blocked/local environment note:

  • npm run build --workspace=pmxtjs currently fails before this change is typechecked because this focused checkout does not include generated TypeScript artifacts at sdks/typescript/generated/src/index.js.

@realfishsam

Copy link
Copy Markdown
Contributor Author

Focused validation passed:

  • npm test --workspace=pmxtjs -- --runTestsByPath tests/hosted-mappers.test.ts --runInBand
  • git diff --check

CI generated-sync blockers appear unrelated to this focused mapper change: the failed diffs are in generated client methods/API reference (fetch_order_book/fetchMatchedMarkets signatures and UnifiedMarket.question docs), while this PR only touches sdks/typescript/pmxt/hosted-mappers.ts and a focused regression test. Per PMXT focused-PR generated-drift guidance, I am keeping this PR scoped rather than committing broad unrelated generator churn into it.

@realfishsam

Copy link
Copy Markdown
Contributor Author

PR Review: PASS (NOT VERIFIED)

What This Does

Adds TypeScript hosted-v0 order mapper coverage for provenance/fill fields (filledShares, feeRateBps, txHash, chain, blockNumber). This matters because hosted order responses could already include these fields, but TypeScript SDK consumers lost them when orderFromV0 converted the wire payload to the public Order shape.

Blast Radius

TypeScript SDK hosted trading mapper only: sdks/typescript/pmxt/hosted-mappers.ts plus a focused Jest test. No sidecar route, OpenAPI schema, Python SDK, or exchange normalizer change.

Consumer Verification

Before (base branch):
orderFromV0 only copied the base order fields plus optional price and fee; provenance/fill metadata such as filled_shares, fee_rate_bps, tx_hash, chain, and block_number was dropped from the public Order object.

After (PR branch):
Focused Jest coverage verifies a hosted-v0 payload containing:

{"filled_shares":"19","fee_rate_bps":"100","tx_hash":"0xabc123","chain":"polygon","block_number":"12345678"}

maps to:

filledShares=19, feeRateBps=100, txHash="0xabc123", chain="polygon", blockNumber=12345678

I did not hit the live hosted API because this review environment does not have hosted PMXT credentials.

Test Results

  • Build: NOT VERIFIED (npm run build --workspace=pmxtjs is blocked by missing generated TypeScript SDK artifacts: ../generated/src/index.js; npm run build --workspace=pmxt-core is separately blocked by missing @buidlrrr/rain-sdk / Rain type errors)
  • Unit tests: PASS for the focused new test (npm test --workspace=pmxtjs -- tests/hosted-mappers.test.ts: 1 suite, 1 test passed); full workspace test is NOT VERIFIED because suites importing pmxt/client.ts fail on the missing generated SDK artifacts, while unrelated mapper/error/ws tests pass
  • Server starts: NOT VERIFIED (not needed for mapper-only static conversion)
  • E2E smoke: NOT VERIFIED (hosted API credentials unavailable)

Findings

No blocking findings.

PMXT Pipeline Check

  • Field propagation (3-layer): OK for this layer — the TypeScript hosted-v0 mapper now preserves fields already present in the hosted order wire payload/public Order type; no OpenAPI/sidecar response field is introduced here
  • OpenAPI sync: N/A
  • Financial precision: OK for mapper parity; it uses the repository's existing numeric floatOrUndefined approach for order metadata fields
  • Type safety: OK — no new any surface beyond the existing Record<string, unknown> mapper input
  • Auth safety: N/A

Semver Impact

patch -- fixes TypeScript SDK field preservation for hosted order objects.

Risk

Not live-verified against hosted PMXT, so this confirms mapper behavior but not that every upstream hosted order endpoint currently emits these fields with exactly these snake/camel spellings.

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: orderFromV0 in TypeScript does not map filledShares, feeRateBps, txHash, chain, blockNumber from V0 payload; Python order_from_v0 does

1 participant