Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdks/typescript/pmxt/hosted-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface HostedClientLike {
*/
export function ensureHostedTradingSupported(client: HostedClientLike): void {
if (!client.pmxtApiKey) return;
if (!HOSTED_TRADING_VENUES.has(client.exchangeName)) {
if (!HOSTED_TRADING_VENUES.has(client.exchangeName.toLowerCase())) {
throw new NotSupported(
`Hosted trading is only supported for Polymarket, Opinion, and Limitless; ${client.exchangeName} is not supported with pmxtApiKey.`,
);
Expand Down
11 changes: 11 additions & 0 deletions sdks/typescript/tests/hosted-dispatch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jest.mock("../pmxt/hosted-typed-data", () => ({

import { Polymarket } from "../pmxt/client";
import {
ensureHostedTradingSupported,
HOSTED_TRADING_BASE_URL,
} from "../pmxt/hosted-routing";
import { NotSupported } from "../pmxt/errors";
Expand Down Expand Up @@ -162,6 +163,16 @@ describe("hosted read methods raise MissingWalletAddress locally", () => {
// --------------------------------------------------------------------------

describe("hosted NotSupported", () => {
it.each(["Polymarket", "OPINION", "LiMiTlEsS"])(
"accepts supported venue %s regardless of casing",
(exchangeName) => {
expect(() => ensureHostedTradingSupported({
pmxtApiKey: PMXT_API_KEY,
exchangeName,
})).not.toThrow();
},
);

it("fetchClosedOrders raises NotSupported without touching network", async () => {
const spy = installFetchSpy(() => jsonResponse({}));
const api = makePolymarket();
Expand Down