import { HttpsProxyAgent } from "https-proxy-agent"; import { type PrivateKeyAccount } from "viem/accounts"; import { ClobClient } from "@polymarket/clob-client-v2"; /** * Install a request interceptor on an axios instance that duplicates each * underscore auth header as its hyphenated form so it survives header-stripping * proxies. Idempotent per instance (guarded by the caller). */ export declare function installUnderscoreHeaderBridge(instance: { interceptors: { request: { use: (fn: (config: unknown) => unknown) => void; }; }; }): void; /** The local EOA account (BlockRun session key) used as the Polymarket signer. */ export declare function getPolymarketAccount(): PrivateKeyAccount; /** * The shared HttpsProxyAgent for POLYMARKET_CLOB_PROXY, or null when unset. * Built once. Reused for both the CLOB axios (v1, here) and the relayer's own * axios (0.27) instance (relayer.ts injects it), so a US-egress demo can route * ALL geoblockable Polymarket traffic — order placement AND the relayer * deploy/approve/redeem calls — through one permitted egress. */ export declare function getClobProxyAgent(): HttpsProxyAgent | null; /** * Route CLOB traffic through POLYMARKET_CLOB_PROXY when set. Applied to the * axios v1 defaults, which clob-client-v2 (and our l1-auth / geoblock / Data-API * calls) share via the hoisted axios install; @blockrun/llm and the other tools * use fetch (which ignores this), so it scopes to Polymarket traffic. Plain * HTTPS_PROXY is honored by BOTH axios copies natively (proxy-from-env) without * any of this — the simplest option for a US-egress demo. */ export declare function applyClobProxyOnce(): void; /** * Cached, authenticated ClobClient for the active signature mode. Requires * setup to have persisted the deposit wallet address first in POLY_1271 mode. */ export declare function getClobClient(): Promise; /** Drop the cached client (after creds invalidation or a sig-type switch). */ export declare function resetClobClient(): void; export interface GeoblockStatus { orderPlacement: "permitted" | "blocked" | "unknown"; country: string | null; ip: string | null; raw: unknown; } /** * Region check for ORDER PLACEMENT. The authoritative signal is the CLOB order * endpoint itself: an unauthenticated POST returns 403 ("Trading restricted in * your region") when geoblocked, or 401/400 (auth/validation) when NOT — and it * routes through POLYMARKET_CLOB_HOST, i.e. the exact egress real orders use. * * We deliberately do NOT trust polymarket.com/api/geoblock's boolean: it * reflects FRONTEND blocking, which can diverge from what the order API accepts * (e.g. Japan returns blocked=true on the frontend while its API still accepts * orders — POST /order there returns 401, not 403). The /api/geoblock call is * kept only for country/ip context. Cached 10 min; fail-open (unknown) on * network error so a hiccup never blocks a call that might succeed. */ export declare function checkGeoblock(): Promise;