Skip to content

SDK drift: BuiltOrder.tx is a typed struct in TypeScript but untyped Dict[str, Any] in Python #501

@realfishsam

Description

@realfishsam

Drift

The tx field of BuiltOrder carries an EVM transaction payload for on-chain AMM exchanges (e.g. Baozi). In TypeScript it is a precisely typed inline object with four required fields; in Python it is an untyped Dict[str, Any]. Users cannot discover the structure of the transaction payload from Python type annotations.

TypeScript SDK

sdks/typescript/pmxt/models.ts, lines 582–588:

export interface BuiltOrder {
    ...
    /** For on-chain AMM exchanges: the EVM transaction payload. */
    tx?: {
        to: string;
        data: string;
        value: string;
        chainId: number;
    };
    ...
}

Python SDK

sdks/python/pmxt/models.py, lines 420–422:

@dataclass
class BuiltOrder:
    ...
    tx: Optional[Dict[str, Any]] = None
    """For on-chain AMM exchanges: the EVM transaction payload."""

No field names (to, data, value, chainId) are declared; all access must be via string keys.

Expected

Python BuiltOrder.tx should be typed with a TypedDict (e.g. TxPayload) that declares:

class TxPayload(TypedDict):
    to: str
    data: str
    value: str
    chain_id: int

and the field annotated as tx: Optional[TxPayload] = None.

Impact

Python users who handle the EVM transaction path (e.g. on-chain AMM exchanges) have no type-safe way to access tx.to, tx.data, tx.value, tx.chain_id (or tx["chainId"]?). The correct key name (chain_id vs chainId) is undiscoverable without reading source code.


Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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