polynode 0.9.2__py3-none-any.whl → 0.10.0__py3-none-any.whl

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.
@@ -256,8 +256,8 @@ CTF (ERC-1155) : 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045
256
256
  CTF_EXCHANGE_V2 : 0xe111180000d2663c0091e4f400237545b87b996b
257
257
  NEG_RISK_EXCHANGE_V2_A : 0xe2222d279d744050d28e00520010520000310f59
258
258
  NegRiskAdapter (V1) : 0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296
259
- CtfCollateralAdapter : 0xADa100874d00e3331D00F2007a9c336a65009718
260
- NegRiskCtfCollateralAdapter : 0xAdA200001000ef00D07553cEE7006808F895c6F1
259
+ CtfCollateralAdapter : 0xAdA100Db00Ca00073811820692005400218FcE1f
260
+ NegRiskCtfCollateralAdapter : 0xadA2005600Dec949baf300f4C6120000bDB6eAab
261
261
 
262
262
  CLOB_V2_HOST : https://clob-v2.polymarket.com
263
263
  RELAYER : https://relayer-v2.polymarket.com
@@ -12,7 +12,7 @@ NEG_RISK_CTF_EXCHANGE = "0xC5d563A36AE78145C45a50134d48A1215220f80a"
12
12
  NEG_RISK_ADAPTER = "0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296"
13
13
 
14
14
  # ── V2 ──
15
- CLOB_HOST_V2 = "https://clob-v2.polymarket.com"
15
+ CLOB_HOST_V2 = "https://clob.polymarket.com"
16
16
  CTF_EXCHANGE_V2 = "0xe111180000d2663c0091e4f400237545b87b996b"
17
17
  NEG_RISK_CTF_EXCHANGE_V2_A = "0xe2222d279d744050d28e00520010520000310f59"
18
18
  NEG_RISK_CTF_EXCHANGE_V2_B = "0xe2222d002000ba0053cef3375333610f64600036"
@@ -30,6 +30,10 @@ SAFE_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715
30
30
  PROXY_FACTORY = "0xaB45c5A4B0c941a2F231C04C3f49182e1A254052"
31
31
  PROXY_INIT_CODE_HASH = "0xd21df8dc65880a8606f09fe0ce3df9b8869287ab0b058be05aa9e8af6330a00b"
32
32
 
33
+ # Deposit wallet derivation (Solady ERC-1967 clones)
34
+ DEPOSIT_WALLET_FACTORY = "0x00000000000Fb5C9ADea0298D729A0CB3823Cc07"
35
+ DEPOSIT_WALLET_IMPL = "0x58CA52ebe0DadfdF531Cde7062e76746de4Db1eB"
36
+
33
37
  # All spender contracts that need approval
34
38
  SPENDERS = [CTF_EXCHANGE, NEG_RISK_CTF_EXCHANGE, NEG_RISK_ADAPTER]
35
39
 
@@ -15,6 +15,8 @@ from .constants import (
15
15
  CTF,
16
16
  CTF_EXCHANGE,
17
17
  CTF_EXCHANGE_V2,
18
+ DEPOSIT_WALLET_FACTORY,
19
+ DEPOSIT_WALLET_IMPL,
18
20
  NEG_RISK_ADAPTER,
19
21
  NEG_RISK_CTF_EXCHANGE,
20
22
  NEG_RISK_CTF_EXCHANGE_V2_A,
@@ -76,22 +78,55 @@ def derive_proxy_address(eoa: str) -> str:
76
78
  return to_checksum_address("0x" + addr_bytes[-20:].hex())
77
79
 
78
80
 
81
+ def derive_deposit_wallet_address(eoa: str) -> str:
82
+ """Derive the CREATE2 deposit wallet address for an EOA (Solady ERC-1967)."""
83
+ try:
84
+ from eth_abi import encode
85
+ from eth_utils import keccak, to_checksum_address
86
+ except ImportError:
87
+ raise ImportError("eth-account/web3 required. Install with: pip install polynode[trading]")
88
+
89
+ factory_bytes = bytes.fromhex(DEPOSIT_WALLET_FACTORY[2:])
90
+ impl_bytes = bytes.fromhex(DEPOSIT_WALLET_IMPL[2:])
91
+ eoa_bytes = bytes.fromhex(eoa[2:] if eoa.startswith("0x") else eoa)
92
+
93
+ wallet_id = eoa_bytes.rjust(32, b"\x00")
94
+ args = encode(["address", "bytes32"], [DEPOSIT_WALLET_FACTORY, wallet_id])
95
+ salt = keccak(args)
96
+
97
+ n = len(args)
98
+ prefix = 0x61003d3d8160233d3973
99
+ combined = prefix + (n << 56)
100
+ cb = combined.to_bytes(10, "big")
101
+
102
+ c2 = bytes.fromhex("5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076")
103
+ c1 = bytes.fromhex("cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3")
104
+
105
+ init_code = cb + impl_bytes + b"\x60\x09" + c2 + c1 + args
106
+ bytecode_hash = keccak(init_code)
107
+
108
+ addr_bytes = keccak(b"\xff" + factory_bytes + salt + bytecode_hash)
109
+ return to_checksum_address("0x" + addr_bytes[-20:].hex())
110
+
111
+
79
112
  async def derive_funder_address(eoa: str, sig_type: SignatureType) -> str:
80
113
  """Derive the funder address based on signature type."""
81
114
  if sig_type == SignatureType.POLY_GNOSIS_SAFE:
82
115
  return derive_safe_address(eoa)
83
116
  elif sig_type == SignatureType.POLY_PROXY:
84
117
  return derive_proxy_address(eoa)
118
+ elif sig_type == SignatureType.POLY_1271:
119
+ return derive_deposit_wallet_address(eoa)
85
120
  return eoa
86
121
 
87
122
 
88
123
  async def detect_wallet_type(eoa: str) -> dict:
89
- """Auto-detect if a Safe or Proxy is deployed for this EOA."""
124
+ """Auto-detect if a Safe, Proxy, or deposit wallet is deployed for this EOA."""
90
125
  safe_addr = derive_safe_address(eoa)
91
126
  proxy_addr = derive_proxy_address(eoa)
92
127
 
93
128
  async with httpx.AsyncClient(timeout=10.0) as http:
94
- # Check Safe first (most common)
129
+ # Check Safe first (most common for existing users)
95
130
  try:
96
131
  resp = await http.get(f"{RELAYER_HOST}/deployed?owner={eoa}&salt={eoa}")
97
132
  if resp.is_success:
@@ -117,7 +152,18 @@ async def detect_wallet_type(eoa: str) -> dict:
117
152
  except Exception:
118
153
  pass
119
154
 
120
- # Neither deployed default to Safe
155
+ # Check deposit wallet (newer accounts)
156
+ try:
157
+ dw_addr = derive_deposit_wallet_address(eoa)
158
+ if await is_safe_deployed(dw_addr):
159
+ return {
160
+ "signature_type": SignatureType.POLY_1271,
161
+ "funder_address": dw_addr,
162
+ }
163
+ except Exception:
164
+ pass
165
+
166
+ # Nothing deployed — default to Safe
121
167
  return {
122
168
  "signature_type": SignatureType.POLY_GNOSIS_SAFE,
123
169
  "funder_address": safe_addr,
polynode/trading/types.py CHANGED
@@ -11,6 +11,7 @@ class SignatureType(IntEnum):
11
11
  EOA = 0
12
12
  POLY_PROXY = 1
13
13
  POLY_GNOSIS_SAFE = 2
14
+ POLY_1271 = 3 # ERC-1271 signatures for deposit wallets (V2 only)
14
15
 
15
16
 
16
17
  class ExchangeVersion(IntEnum):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polynode
3
- Version: 0.9.2
3
+ Version: 0.10.0
4
4
  Summary: Python SDK for the PolyNode real-time prediction market data platform
5
5
  Project-URL: Homepage, https://polynode.dev
6
6
  Project-URL: Documentation, https://docs.polynode.dev
@@ -11,21 +11,21 @@ polynode/subscription.py,sha256=O2yKfdllI0px-1qrVK-0Qq9S4KUmIiXjjYCNC7QW0jM,4121
11
11
  polynode/testing.py,sha256=bSSgV18ZSaRoLZPlNRCCLmRNwNIQDS35qi7NhuTg8Bg,2802
12
12
  polynode/ws.py,sha256=VZdn2dkUJH2-CYBu_L45YnvCU0kQejxHcy2Ji2pRu60,9653
13
13
  polynode/cache/__init__.py,sha256=A9lXcIE3ISKKo1r0o3o-CkmQpBhLdKwdQfCR0eW5i9o,519
14
- polynode/trading/V2_ORDER_FLOW.md,sha256=Ppd7iwZjtmVwok-fP4Ofo4UBQ9pIAg0t57RJ-OzqRHs,10926
14
+ polynode/trading/V2_ORDER_FLOW.md,sha256=87QD9AetMieS7Gy-tdPOkG7KfnYoj-5x1Zu6upkng3I,10926
15
15
  polynode/trading/__init__.py,sha256=sPv30j9eyvqjnUBxGAYaKpAPQZ2jTw3UwA4DZXYZ21s,923
16
16
  polynode/trading/clob_api.py,sha256=Sfb8XLN9MMzVE6jARNqEQxiD608OC_6Xjc7uiJbDQEc,7274
17
- polynode/trading/constants.py,sha256=IEdrwC4bPjo4MoVlDKYqXphlmIKsoxO4f_s_pyZ3x08,2702
17
+ polynode/trading/constants.py,sha256=xWWVfl1P3N1jbiIWrjTsv4WRhmiwBu-zZ8IftyGhqVE,2890
18
18
  polynode/trading/cosigner.py,sha256=Fww9OgaKdHQAHd8Kom1AJBtmMGC8FbNZxdFaFALNBY8,3058
19
19
  polynode/trading/eip712.py,sha256=PKLfMt58Diy419jiQXysnX1kSlU_QcWDRofGEb3u_JI,9744
20
20
  polynode/trading/escrow.py,sha256=T2v5bv3wIyQTcFoxcHXlDBlzyeWDYbxRIqQamqlhaog,6513
21
- polynode/trading/onboarding.py,sha256=GdQh1aM9F0LuCL3uqNTguXX5Sxe1_0hSVdHR7kksKZ0,15777
21
+ polynode/trading/onboarding.py,sha256=zCKK1HxHxNJoVUE9NC10K7dzNy5D3GY13i7FZo3iEIk,17534
22
22
  polynode/trading/position_management.py,sha256=z2pYls4ErhyRE6thQdOs45BF4llKvKNNruQgcMEFT_U,3827
23
23
  polynode/trading/privy.py,sha256=iiUQZsBqjj29C7oUiFFktoT2muZY06bcMzABKstFKqE,4523
24
24
  polynode/trading/relayer.py,sha256=adTo-aclWnaqrFtfWEOQ2Ye859CZMc9q_fsd3DePDGA,10542
25
25
  polynode/trading/signer.py,sha256=piifRquwnwFwrKLL24jsRQYMh_cdkz8wNz99Vx8_KTY,3413
26
26
  polynode/trading/sqlite_backend.py,sha256=zfo4WevuunWV-7i6Z3gQi_e7Tonw-7m1TsEd88O5I4w,9486
27
27
  polynode/trading/trader.py,sha256=EEwF_U2DXVPRnENY5azk8FgzSx_zXns27apQQj9isus,37188
28
- polynode/trading/types.py,sha256=mo5zJRlfQLWuXwrkS9AaGqKWrt7FMf6bPGRE-0T62J0,5698
28
+ polynode/trading/types.py,sha256=o4fq5zAeRA5IDR63L619VdXh_T_YowGjx5mUvEdU7uE,5769
29
29
  polynode/types/__init__.py,sha256=0v_CByqG-zT1xucbT2So_77YDmsPj9u956at94nyrLM,280
30
30
  polynode/types/enums.py,sha256=2cx9l10A-LUeDNBJZn7l0XBTka2YfxRQcXW0s7s3_4k,1082
31
31
  polynode/types/events.py,sha256=MJGZqxBFKfT1y44dZ96bHbwvoPpGvtutBwYE6OTT6nU,6880
@@ -33,6 +33,6 @@ polynode/types/orderbook.py,sha256=MwD6P3poo3F70bONUZ5i3ajk1sgw39hHTOw6D0fP5_8,1
33
33
  polynode/types/rest.py,sha256=ftJKQZH0wBrR_l199rDMqnVS8cyt8YnCvo9cKIsTcCw,7012
34
34
  polynode/types/short_form.py,sha256=xfGklDi587u6K2aXaRWiwbxqkipW8BiEPeNIDT45v2Y,799
35
35
  polynode/types/ws.py,sha256=EzE9Vzrb6cILemfssmnqM8fbHt4USn3latpUHKatwk4,994
36
- polynode-0.9.2.dist-info/METADATA,sha256=-FqTxtI_g04JQ7AxM9kzp9RxfnF6dGNADA3CmfXORK8,3777
37
- polynode-0.9.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
38
- polynode-0.9.2.dist-info/RECORD,,
36
+ polynode-0.10.0.dist-info/METADATA,sha256=fmGx3QZXcAkhm0g3BFW_D01R-HposCha4yl82jhHjz0,3778
37
+ polynode-0.10.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
38
+ polynode-0.10.0.dist-info/RECORD,,