Skip to content

SDK drift: Python Signer Protocol is a callable (__call__) but TypeScript Signer interface requires a signTypedData() method #1424

Description

@realfishsam

Summary

The signer abstraction has incompatible invocation protocols in the two SDKs.

SDK File Line Protocol
Python sdks/python/pmxt/signers.py 19 Signer Protocol defines __call__(self, typed_data: dict[str, Any]) -> str — signers are called as functions
TypeScript sdks/typescript/pmxt/signers.ts 33 Signer interface requires signTypedData(typedData: TypedData): Promise<string> — signers expose a named method

Reproduction

# Python: signer is called as a function
def my_signer(typed_data: dict) -> str:
    ...  # returns 0x-prefixed signature
// TypeScript: signer must implement signTypedData()
const mySigner = {
    address: "0x...",
    async signTypedData(typedData) { ... }
};

Detailed differences

  1. Invocation: Python calls signer(typed_data) (dunder __call__); TypeScript calls signer.signTypedData(typedData).
  2. Async: Python Signer.__call__ returns str (synchronous); TypeScript Signer.signTypedData returns Promise<string> (async).
  3. address property: Python Signer Protocol has no address field (tracked separately in SDK drift: Signer protocol in Python has no address property; TypeScript Signer interface requires it #1004); TypeScript Signer requires readonly address: string.
  4. Input type: Python receives dict[str, Any]; TypeScript receives the typed TypedData interface from signers.ts:16.

Impact

Custom signer implementations cannot be shared between SDKs without a wrapper. The Python EthAccountSigner concrete class (signers.py:38) would not satisfy the TypeScript Signer interface, and a TypeScript signer object would not satisfy the Python Signer Protocol — they target different structural shapes.

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