diff --git a/sdks/typescript/pmxt/client.ts b/sdks/typescript/pmxt/client.ts index 06846caa..280328b9 100644 --- a/sdks/typescript/pmxt/client.ts +++ b/sdks/typescript/pmxt/client.ts @@ -2691,7 +2691,7 @@ export abstract class Exchange { method: 'POST', headers: { 'Content-Type': 'application/json', - ...this.config.headers + ...this.getAuthHeaders() }, body: JSON.stringify(body) }); diff --git a/sdks/typescript/tests/hosted-dispatch.test.ts b/sdks/typescript/tests/hosted-dispatch.test.ts index 88223938..a5b99ccc 100644 --- a/sdks/typescript/tests/hosted-dispatch.test.ts +++ b/sdks/typescript/tests/hosted-dispatch.test.ts @@ -137,6 +137,25 @@ describe("hosted read dispatch", () => { expect(reqs[0].url).toContain("/v0/orders/abc"); expect(reqs[0].init?.method).toBe("GET"); }); + + it("getExecutionPriceDetailed sends hosted bearer auth header", async () => { + const spy = installFetchSpy(() => + jsonResponse({ + success: true, + data: { price: 0.51, total: 5.1, slippage: 0, fills: [] }, + }), + ); + const api = makePolymarket(); + + await api.getExecutionPriceDetailed({ bids: [], asks: [] } as any, "buy", 10); + + const reqs = captured(spy); + expect(reqs).toHaveLength(1); + expect(reqs[0].url).toContain("/api/polymarket/getExecutionPriceDetailed"); + expect(reqs[0].init?.method).toBe("POST"); + const headers = reqs[0].init?.headers as Record | undefined; + expect(headers?.Authorization).toBe(`Bearer ${PMXT_API_KEY}`); + }); }); // --------------------------------------------------------------------------