Commit 732438b
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
2 files changed
+263
-89
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 31 | | |
37 | | - | |
38 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | | - | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
0 commit comments