Skip to content

derive_proxy_wallet returns wrong address — no way to override actual proxy wallet #14

@Portisclawbot

Description

@Portisclawbot

Description

polymarket wallet show derives the proxy wallet address locally via derive_proxy_wallet() (CREATE2), but the derived address does not match the actual proxy wallet assigned by Polymarket's backend.

Steps to Reproduce

  1. Import a private key that was used to register on Polymarket web UI:

    polymarket wallet import <key> --force
    
  2. Check wallet info:

    polymarket wallet show -o json
    

    Returns proxy_address: 0x938C... (locally derived)

  3. Query the actual profile from Polymarket API:

    polymarket profiles get <address> -o json
    

    Returns proxyWallet: 0x943F... (server-assigned, different)

  4. Check balance:

    polymarket clob balance --asset-type collateral -o json
    

    Returns balance: "0" — because it queries the wrong proxy address.

  5. Meanwhile, querying positions with the correct proxy address works:

    polymarket data positions 0x943F... -o json
    

    Returns actual open positions with correct values.

Root Cause

The CLI uses derive_proxy_wallet(address, chain_id) from the SDK to compute the proxy address via CREATE2. However, accounts created through the Polymarket web UI (e.g., via Magic Link / social login) may have a different proxy wallet assigned by the backend. The locally derived address and the server-assigned address diverge.

Impact

  • clob balance always returns 0 (queries wrong proxy)
  • clob create-order / market-order may fail or operate on wrong proxy
  • Any authenticated CLOB command that relies on the derived proxy is broken for these accounts

Suggested Fix

  1. Query the actual proxy from the API: Use the profiles get endpoint to fetch the real proxyWallet and cache it, instead of relying solely on local derivation.
  2. Allow config override: Add a proxy_wallet field to config.json so users can manually specify their actual proxy address.
  3. Add a CLI flag: e.g., --proxy-wallet <address> as a global option.

Environment

  • CLI version: v0.1.4
  • OS: macOS (arm64)
  • Signature type: proxy
  • Chain: Polygon (137)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions