Skip to content

Instantly share code, notes, and snippets.

@Maxim-Mazurok
Created June 25, 2025 07:55
Show Gist options
  • Save Maxim-Mazurok/11107d8f66cd78df2bed076f8504cccb to your computer and use it in GitHub Desktop.
Save Maxim-Mazurok/11107d8f66cd78df2bed076f8504cccb to your computer and use it in GitHub Desktop.
TS order - not working ;(
import { Wallet } from "@ethersproject/wallet";
import { Chain, ClobClient, OrderType, Side } from "@polymarket/clob-client";
import { SignatureType } from "@polymarket/order-utils";
// === Config ===
const host = "https://clob.polymarket.com";
const privateKey =
"0x0000000000000000000000000000000000000000000000000000000000000000"; // from exported wallet
const funder = "0x0000000000000000000000000000000000000000"; // from the Polymarket profile (not the USDC wallet)
const chainId = Chain.POLYGON; // 137
const signatureType = SignatureType.POLY_PROXY; // 1
const signer = new Wallet(privateKey);
console.log({ signer });
// === Main ===
(async () => {
const creds = await new ClobClient(host, chainId, signer).deriveApiKey();
console.log("API Key Dreived:", creds);
const client = new ClobClient(
host,
chainId,
signer,
creds,
signatureType,
funder
);
const order = await client.createOrder(
{
tokenID:
"52843799572381181810558076423316491787675005787611777123737394981466193718404",
side: Side.BUY,
size: 15,
price: 0.01,
},
{
tickSize: "0.01",
negRisk: false,
}
);
const result = await client.postOrder(order, OrderType.GTC);
console.log(result);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment