Hosted trading works from ESM apps and Opinion orders pass pre-sign validation. Two independent bugs each blocked all hosted writes for affected callers: the ESM build could not lazy-load ethers (bare require is undefined in ESM, and the failure was silently swallowed — the signer was dropped and every write died with "hosted write requires a signer" even when a privateKey was passed), and the client-side economics validator demanded message.opinion_market_id from a trading-API message schema that no longer carries it (the signed economic identity is the outcome tokenId). Both verified live against trade.pmxt.dev from an ESM consumer.
Fixed
- TS
pmxt/signers.ts: NewloadEthers()helper used byEthersSigner— nativerequirein the CJS build,process.getBuiltinModule("node:module").createRequire(...)in the ESM build (Node >= 20.16). Previously the ESM build's barerequire("ethers")threwReferenceError, which the lazy-signer bridge in the Exchange constructor caught and swallowed, silently discarding the caller'sprivateKey. - TS
pmxt/hosted-typed-data.ts: signature verification now loads ethers via the same helper instead of barerequire. - TS
pmxt/hosted-typed-data.ts+ Pythonpmxt/_hosted_typeddata.py:validateOpinionMarketId/_validate_opinion_market_idnow validatemessage.tokenIdagainstresolved.token_id— the field that is actually signed. Theopinion_market_idequality check only applies when the message carries the field (legacy schema); requiring it unconditionally rejected every current-schema Opinion order pre-sign witheconomic mismatch: message.opinion_market_id missing. - Python
tests/test_hosted_typeddata.py: opinion economics tests updated to the tokenId-based contract (mismatch rejection onresolved.token_id, params-only quirks no longer block, legacyopinion_market_idmismatch still rejected when present in the message).
Installation
npm:
npm install pmxtjs@2.49.11
npm install -g @pmxt/cli@2.49.11PyPI:
pip install pmxt==2.49.11Links
Full Changelog: v2.49.10f...v2.49.11f