From 87082938a0f11fc5dd93aec9db78a16fc89b082b Mon Sep 17 00:00:00 2001 From: jaxperro Date: Thu, 9 Jul 2026 14:38:44 -0400 Subject: [PATCH] =?UTF-8?q?host:=20allowance=20probe=20=E2=80=94=20balance?= =?UTF-8?q?=20vs=20exchange=20allowance=20on=20the=20live=20funder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- host/allowance_probe.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 host/allowance_probe.py diff --git a/host/allowance_probe.py b/host/allowance_probe.py new file mode 100644 index 00000000..4587037c --- /dev/null +++ b/host/allowance_probe.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +"""One-shot: print the live funder's USDC balance AND allowance (the thing +preflight's balance check didn't separately assert — an unapproved exchange +allowance rejects every order while the balance reads fine).""" +import os +from py_clob_client.client import ClobClient +from py_clob_client.clob_types import BalanceAllowanceParams, AssetType + +c = ClobClient(host="https://clob.polymarket.com", + key=os.environ["LIVE_PRIVATE_KEY"].strip(), chain_id=137, + signature_type=int(os.environ.get("LIVE_SIGNATURE_TYPE") or 1), + funder=os.environ["LIVE_FUNDER_ADDRESS"].strip()) +c.set_api_creds(c.create_or_derive_api_creds()) +r = c.get_balance_allowance(BalanceAllowanceParams(asset_type=AssetType.COLLATERAL)) +print("raw:", r) +bal = int(r.get("balance", 0)) / 1e6 +print(f"balance ${bal:,.2f}") +for k, v in r.items(): + if "allowance" in k.lower(): + print(f"{k}: {v}")