Skip to content

Commit 768ef22

Browse files
committed
Set default signature type to 2 for supporting proxy contract
1 parent b9356ad commit 768ef22

3 files changed

Lines changed: 59 additions & 1 deletion

File tree

.changeset/tiny-suns-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@iqai/mcp-polymarket": patch
3+
---
4+
5+
Makes default signature type to 2 for supporting proxy contract

src/script.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env node
2+
3+
import { tradeApi } from "./services/trading.js";
4+
5+
/**
6+
* Script to place a market order on Polymarket
7+
*
8+
* This script demonstrates how to place a BUY market order
9+
* with specific parameters.
10+
*/
11+
async function placeMarketOrder() {
12+
try {
13+
console.log("🚀 Placing market order...");
14+
15+
// Market order parameters
16+
const params = {
17+
side: "BUY" as const,
18+
tokenId:
19+
"60487116984468020978247225474488676749601001829886755968952521846780452448915",
20+
amount: 1, // For BUY orders, this is the dollar amount ($USD) to spend
21+
};
22+
23+
console.log("📋 Order parameters:", JSON.stringify(params, null, 2));
24+
25+
// Execute the market order
26+
const result = await tradeApi.placeMarketOrder(params);
27+
28+
console.log("✅ Market order placed successfully!");
29+
console.log("📊 Result:", JSON.stringify(result, null, 2));
30+
31+
return result;
32+
} catch (error) {
33+
console.error("❌ Error placing market order:", error);
34+
35+
// Check if it's an approval error
36+
if (error && typeof error === "object" && "message" in error) {
37+
console.error("Error details:", error.message);
38+
}
39+
40+
throw error;
41+
}
42+
}
43+
44+
// Run the script
45+
placeMarketOrder()
46+
.then(() => {
47+
console.log("🎉 Script completed successfully");
48+
process.exit(0);
49+
})
50+
.catch((error) => {
51+
console.error("💥 Script failed:", error);
52+
process.exit(1);
53+
});

src/services/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function getConfig(overrides: Partial<BaseConfig> = {}): BaseConfig {
2727
const chainId = Number(overrides.chainId ?? process.env.CHAIN_ID ?? 137);
2828

2929
const signatureType = Number(
30-
overrides.signatureType ?? process.env.SIGNATURE_TYPE ?? 0,
30+
overrides.signatureType ?? process.env.SIGNATURE_TYPE ?? 2,
3131
);
3232

3333
const rpcUrl =

0 commit comments

Comments
 (0)