Skip to content

Commit 732438b

Browse files
Genminclaude
andcommitted
Add ethers v6 signer support, FOK/GTC orders with auto-retry, and remove leverage caps
Major SDK improvements for integrators: 1. **Privy & ethers v6 Signer Support** - Accept ethers v5 OR v6 Signers (e.g., Privy embedded wallets) - Auto-convert v6 signers to v5 for clob-client compatibility - Constructor now accepts: string | ethers.Signer | any 2. **FOK/GTC/GTD Orders with Auto-Retry** - Configurable order types: FOK (Fill-Or-Kill), GTC (Good-Til-Cancelled), GTD - Auto-cancel and retry unfilled orders with updated pricing - Exponential backoff retry logic (default: 3 retries, 2s delay) - Separate timeouts: FOK (10s), GTC/GTD (30s) 3. **Remove ALL Hard-Coded Leverage Caps** - DELETED: 10-loop hard cap - DELETED: Fallback safety caps - Max leverage now determined SOLELY by available SR/JR liquidity - Integrators can add frontend limits if desired 4. **Enhanced Order Execution** - True limit order support (GTC with tighter spreads) - Market-like execution (FOK with slippage protection) - Real-time orderbook price updates on retry - Detailed logging for order lifecycle 5. **Package Updates** - Version bump: 1.0.0 → 2.0.0 (breaking API changes) - Add peerDependencies: ethers 5.7.2 || ^6.0.0 - Updated keywords: privy, ethers-v6, fok-orders Breaking Changes: - TargetPositionParams now includes optional: orderType, maxRetries, retryDelayMs - Constructor signature widened to accept Signer (backward compatible) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e038dc0 commit 732438b

File tree

2 files changed

+263
-89
lines changed

2 files changed

+263
-89
lines changed

package.json

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,55 @@
11
{
2-
"name": "@forecast-protocol/leverage-sdk",
3-
"version": "1.0.0",
4-
"description": "Add leverage to Polymarket trading via Forecast Protocol",
2+
"name": "@forecast-protocol/sdk",
3+
"version": "2.0.0",
4+
"description": "TypeScript SDK for leveraged prediction market trading via Forecast Protocol. Supports ethers v5 and v6, Privy embedded wallets, FOK/GTC orders with auto-retry.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"files": [
88
"dist",
99
"README.md",
10-
"LICENSE"
10+
"INTEGRATION_GUIDE.md"
1111
],
1212
"scripts": {
1313
"build": "tsc",
14-
"test": "jest",
15-
"test:watch": "jest --watch",
16-
"prepublishOnly": "npm run build && npm test"
17-
},
18-
"repository": {
19-
"type": "git",
20-
"url": "https://github.com/Genmin/forecast-leverage-sdk"
14+
"test": "ts-node test_integrator.ts",
15+
"test:all": "ts-node run_all_tests.ts",
16+
"test:integrator": "ts-node test_integrator.ts",
17+
"prepublishOnly": "npm run build"
2118
},
2219
"keywords": [
2320
"polymarket",
2421
"leverage",
2522
"prediction-markets",
2623
"defi",
2724
"polygon",
28-
"forecast"
25+
"privy",
26+
"ethers-v6",
27+
"fok-orders"
2928
],
3029
"author": "Forecast Protocol",
3130
"license": "MIT",
32-
"bugs": {
33-
"url": "https://github.com/Genmin/forecast-leverage-sdk/issues"
34-
},
35-
"homepage": "https://github.com/Genmin/forecast-leverage-sdk#readme",
3631
"dependencies": {
37-
"@polymarket/clob-client": "^4.22.7",
38-
"ethers": "^5.7.2"
32+
"@polymarket/clob-client": "4.22.7",
33+
"ethers": "5.7.2"
34+
},
35+
"peerDependencies": {
36+
"ethers": "5.7.2 || ^6.0.0"
37+
},
38+
"peerDependenciesMeta": {
39+
"ethers": {
40+
"optional": false
41+
}
3942
},
4043
"devDependencies": {
41-
"@types/jest": "^29.5.0",
42-
"@types/node": "^20.0.0",
43-
"jest": "^29.5.0",
44-
"ts-jest": "^29.1.0",
45-
"typescript": "^5.0.0"
44+
"@types/node": "20.17.10",
45+
"typescript": "5.7.3",
46+
"ts-node": "10.9.2"
47+
},
48+
"repository": {
49+
"type": "git",
50+
"url": "https://github.com/forecast-protocol/sdk"
4651
},
4752
"engines": {
48-
"node": ">=18.0.0"
53+
"node": ">=16.0.0"
4954
}
5055
}

0 commit comments

Comments
 (0)