polynode 0.6.0__tar.gz → 0.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {polynode-0.6.0 → polynode-0.6.1}/PKG-INFO +1 -1
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/__init__.py +1 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/clob_api.py +8 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/cosigner.py +7 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/trader.py +5 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/types.py +9 -0
- {polynode-0.6.0 → polynode-0.6.1}/pyproject.toml +1 -1
- {polynode-0.6.0 → polynode-0.6.1}/.gitignore +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/README.md +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/__init__.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/_version.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/cache/__init__.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/client.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/engine.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/errors.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/orderbook.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/orderbook_state.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/redemption_watcher.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/short_form.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/subscription.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/testing.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/constants.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/eip712.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/onboarding.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/privy.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/signer.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/trading/sqlite_backend.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/__init__.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/enums.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/events.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/orderbook.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/rest.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/short_form.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/types/ws.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/polynode/ws.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/tests/__init__.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/tests/conftest.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/tests/test_client.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/tests/test_orderbook.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/tests/test_trading.py +0 -0
- {polynode-0.6.0 → polynode-0.6.1}/tests/test_types.py +0 -0
|
@@ -17,6 +17,7 @@ async def post_order(
|
|
|
17
17
|
credentials: dict[str, str],
|
|
18
18
|
wallet_address: str,
|
|
19
19
|
order_body: str,
|
|
20
|
+
builder_credentials: Any | None = None,
|
|
20
21
|
) -> dict[str, Any]:
|
|
21
22
|
"""Submit a signed order to the CLOB."""
|
|
22
23
|
from .cosigner import send_via_cosigner
|
|
@@ -36,6 +37,7 @@ async def post_order(
|
|
|
36
37
|
polynode_key,
|
|
37
38
|
fallback_direct,
|
|
38
39
|
{"method": "POST", "path": "/order", "body": order_body, "headers": headers},
|
|
40
|
+
builder_credentials=builder_credentials,
|
|
39
41
|
)
|
|
40
42
|
|
|
41
43
|
|
|
@@ -46,6 +48,7 @@ async def cancel_order(
|
|
|
46
48
|
credentials: dict[str, str],
|
|
47
49
|
wallet_address: str,
|
|
48
50
|
order_id: str,
|
|
51
|
+
builder_credentials: Any | None = None,
|
|
49
52
|
) -> dict[str, Any]:
|
|
50
53
|
"""Cancel a specific order."""
|
|
51
54
|
from .cosigner import send_via_cosigner
|
|
@@ -67,6 +70,7 @@ async def cancel_order(
|
|
|
67
70
|
polynode_key,
|
|
68
71
|
fallback_direct,
|
|
69
72
|
{"method": "DELETE", "path": "/order", "body": body, "headers": headers},
|
|
73
|
+
builder_credentials=builder_credentials,
|
|
70
74
|
)
|
|
71
75
|
|
|
72
76
|
|
|
@@ -77,6 +81,7 @@ async def cancel_all_orders(
|
|
|
77
81
|
credentials: dict[str, str],
|
|
78
82
|
wallet_address: str,
|
|
79
83
|
market: str | None = None,
|
|
84
|
+
builder_credentials: Any | None = None,
|
|
80
85
|
) -> dict[str, Any]:
|
|
81
86
|
"""Cancel all orders, optionally for a specific market."""
|
|
82
87
|
from .cosigner import send_via_cosigner
|
|
@@ -99,6 +104,7 @@ async def cancel_all_orders(
|
|
|
99
104
|
polynode_key,
|
|
100
105
|
fallback_direct,
|
|
101
106
|
{"method": "DELETE", "path": path, "body": body, "headers": headers},
|
|
107
|
+
builder_credentials=builder_credentials,
|
|
102
108
|
)
|
|
103
109
|
|
|
104
110
|
|
|
@@ -110,6 +116,7 @@ async def get_open_orders(
|
|
|
110
116
|
wallet_address: str,
|
|
111
117
|
market: str | None = None,
|
|
112
118
|
asset_id: str | None = None,
|
|
119
|
+
builder_credentials: Any | None = None,
|
|
113
120
|
) -> list[dict[str, Any]]:
|
|
114
121
|
"""Get open orders from the CLOB."""
|
|
115
122
|
from .cosigner import send_via_cosigner
|
|
@@ -137,6 +144,7 @@ async def get_open_orders(
|
|
|
137
144
|
polynode_key,
|
|
138
145
|
fallback_direct,
|
|
139
146
|
{"method": "GET", "path": path, "headers": headers},
|
|
147
|
+
builder_credentials=builder_credentials,
|
|
140
148
|
)
|
|
141
149
|
|
|
142
150
|
if isinstance(result, list):
|
|
@@ -48,10 +48,17 @@ async def send_via_cosigner(
|
|
|
48
48
|
polynode_key: str,
|
|
49
49
|
fallback_direct: bool,
|
|
50
50
|
request: dict[str, Any],
|
|
51
|
+
builder_credentials: Any | None = None,
|
|
51
52
|
) -> Any:
|
|
52
53
|
"""Send a request through the co-signer with optional fallback to direct CLOB."""
|
|
53
54
|
if cosigner_url:
|
|
54
55
|
try:
|
|
56
|
+
if builder_credentials is not None:
|
|
57
|
+
request["builder_credentials"] = {
|
|
58
|
+
"key": builder_credentials.key,
|
|
59
|
+
"secret": builder_credentials.secret,
|
|
60
|
+
"passphrase": builder_credentials.passphrase,
|
|
61
|
+
}
|
|
55
62
|
async with httpx.AsyncClient(timeout=10.0) as http:
|
|
56
63
|
resp = await http.post(
|
|
57
64
|
f"{cosigner_url}/submit",
|
|
@@ -60,6 +60,7 @@ class PolyNodeTrader:
|
|
|
60
60
|
self._fallback_direct = c.fallback_direct
|
|
61
61
|
self._default_sig_type = c.default_signature_type
|
|
62
62
|
self._rpc_url = c.rpc_url
|
|
63
|
+
self._builder_credentials = c.builder_credentials
|
|
63
64
|
|
|
64
65
|
self._db: TradingSqliteBackend | None = None
|
|
65
66
|
self._active_signer: NormalizedSigner | None = None
|
|
@@ -382,6 +383,7 @@ class PolyNodeTrader:
|
|
|
382
383
|
result = await send_via_cosigner(
|
|
383
384
|
self._cosigner_url, self._polynode_key, self._fallback_direct,
|
|
384
385
|
{"method": "POST", "path": "/order", "body": body_str, "headers": headers},
|
|
386
|
+
builder_credentials=self._builder_credentials,
|
|
385
387
|
)
|
|
386
388
|
|
|
387
389
|
order_id = result.get("orderID") or result.get("orderId")
|
|
@@ -409,6 +411,7 @@ class PolyNodeTrader:
|
|
|
409
411
|
self._cosigner_url, self._polynode_key, self._fallback_direct,
|
|
410
412
|
{"apiKey": creds.api_key, "apiSecret": creds.api_secret, "apiPassphrase": creds.api_passphrase},
|
|
411
413
|
creds.wallet_address, order_id,
|
|
414
|
+
builder_credentials=self._builder_credentials,
|
|
412
415
|
)
|
|
413
416
|
return CancelResult(
|
|
414
417
|
canceled=result.get("canceled", []),
|
|
@@ -421,6 +424,7 @@ class PolyNodeTrader:
|
|
|
421
424
|
self._cosigner_url, self._polynode_key, self._fallback_direct,
|
|
422
425
|
{"apiKey": creds.api_key, "apiSecret": creds.api_secret, "apiPassphrase": creds.api_passphrase},
|
|
423
426
|
creds.wallet_address, market,
|
|
427
|
+
builder_credentials=self._builder_credentials,
|
|
424
428
|
)
|
|
425
429
|
return CancelResult(
|
|
426
430
|
canceled=result.get("canceled", []),
|
|
@@ -435,6 +439,7 @@ class PolyNodeTrader:
|
|
|
435
439
|
self._cosigner_url, self._polynode_key, self._fallback_direct,
|
|
436
440
|
{"apiKey": creds.api_key, "apiSecret": creds.api_secret, "apiPassphrase": creds.api_passphrase},
|
|
437
441
|
creds.wallet_address, market, asset_id,
|
|
442
|
+
builder_credentials=self._builder_credentials,
|
|
438
443
|
)
|
|
439
444
|
return [
|
|
440
445
|
OpenOrder(
|
|
@@ -33,6 +33,14 @@ class GeneratedWallet:
|
|
|
33
33
|
address: str
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
@dataclass
|
|
37
|
+
class BuilderCredentials:
|
|
38
|
+
"""Polymarket builder credentials for order attribution."""
|
|
39
|
+
key: str
|
|
40
|
+
secret: str
|
|
41
|
+
passphrase: str
|
|
42
|
+
|
|
43
|
+
|
|
36
44
|
@dataclass
|
|
37
45
|
class TraderConfig:
|
|
38
46
|
polynode_key: str = ""
|
|
@@ -41,6 +49,7 @@ class TraderConfig:
|
|
|
41
49
|
fallback_direct: bool = True
|
|
42
50
|
default_signature_type: SignatureType = SignatureType.POLY_GNOSIS_SAFE
|
|
43
51
|
rpc_url: str = "https://polygon-bor-rpc.publicnode.com"
|
|
52
|
+
builder_credentials: BuilderCredentials | None = None
|
|
44
53
|
|
|
45
54
|
|
|
46
55
|
@dataclass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|