Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.

createAndPostOrder returns 'balance: 0' on most markets despite valid balance (sigType=2, proxy wallet) #344

Description

@ferranma

Description

When using @polymarket/clob-client@5.8.1 with signatureType=2 (GNOSIS_SAFE) and a proxy wallet created via polymarket.com, createAndPostOrder fails with "not enough balance / allowance: the balance is not enough -> balance: 0" on most markets, despite:

  • getBalanceAllowance({ asset_type: 'COLLATERAL' }) returning correct balance ($8 USDC.e)
  • All on-chain approvals confirmed (USDC.e → CTF Exchange, NegRisk Exchange, NegRisk Adapter + ERC1155 setApprovalForAll)
  • Valid API credentials derived via createOrDeriveApiKey()

Reproduction

Setup:

  • EOA signer: 0x76a22D91bcb74261EB53354e25CE4F37dDa32934
  • Proxy wallet (created via polymarket.com "Enable Trading"): 0x22da6635e16e2f540fbe16d253a89dc8a4674edc
  • Proxy wallet holds 8 USDC.e with unlimited approvals to all 3 exchange contracts
  • signatureType=2, funderAddress=proxyWallet

Code:

const fc = new ClobClient(url, 137, viemWalletClient, creds, 2, proxyWallet);
await fc.updateBalanceAllowance({ asset_type: 'COLLATERAL' });

// This WORKS (WTI Crude Oil market):
await fc.createAndPostOrder(
  { tokenID: '10281909509596543...', price: 0.01, side: 0, size: 1, feeRateBps: 1000 },
  { tickSize: '0.01', negRisk: false }, 'GTC'
);
// → SUCCESS: order placed and matched

// This FAILS (Crypto Up/Down, Sports, etc.):
await fc.createAndPostOrder(
  { tokenID: '60717035396676988...', price: 0.01, side: 0, size: 1, feeRateBps: 1000 },
  { tickSize: '0.01', negRisk: false }, 'GTC'
);
// → {"error":"not enough balance / allowance: balance: 0, order amount: 1000000"}

Key observations

  1. Same code, same wallet, same params — only the tokenID differs
  2. getBalanceAllowance returns correct balance for both
  3. /neg-risk endpoint returns false for both tokens
  4. If we force negRisk: true, we get "invalid signature" instead (tested with both viem WalletClient and ethers v5 Wallet as signer)
  5. The WTI market (Will WTI Crude Oil hit $200) is the only market that works
  6. Sport markets (MLB, NBA, Tennis) and Crypto Up/Down (BTC/ETH/XRP 5min) all fail with balance: 0
  7. The web UI (polymarket.com) CAN trade these markets with the same proxy wallet

Questions

  1. Is there a different exchange contract being used for newer markets that we need to approve?
  2. Does getNegRisk() return incorrect values for some markets?
  3. Is there a known issue with negRisk order signing when using signatureType=2?
  4. Are Crypto Up/Down and Sports markets handled differently at the CLOB level?

Environment

  • @polymarket/clob-client: 5.8.1
  • Node.js: 25.2.1
  • Signer: tested with both viem WalletClient and ethers v5 Wallet
  • Chain: Polygon PoS (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