py-clob-client-v2 0.0.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.
Files changed (68) hide show
  1. py_clob_client_v2-0.0.1/PKG-INFO +36 -0
  2. py_clob_client_v2-0.0.1/README.md +1 -0
  3. py_clob_client_v2-0.0.1/examples/__init__.py +0 -0
  4. py_clob_client_v2-0.0.1/examples/abi/__init__.py +0 -0
  5. py_clob_client_v2-0.0.1/examples/abi/ctf_abi.py +121 -0
  6. py_clob_client_v2-0.0.1/examples/abi/usdc_abi.py +117 -0
  7. py_clob_client_v2-0.0.1/py_clob_client_v2/__init__.py +92 -0
  8. py_clob_client_v2-0.0.1/py_clob_client_v2/client.py +1027 -0
  9. py_clob_client_v2-0.0.1/py_clob_client_v2/clob_types.py +455 -0
  10. py_clob_client_v2-0.0.1/py_clob_client_v2/config.py +36 -0
  11. py_clob_client_v2-0.0.1/py_clob_client_v2/constants.py +36 -0
  12. py_clob_client_v2-0.0.1/py_clob_client_v2/endpoints.py +94 -0
  13. py_clob_client_v2-0.0.1/py_clob_client_v2/exceptions.py +32 -0
  14. py_clob_client_v2-0.0.1/py_clob_client_v2/headers/__init__.py +10 -0
  15. py_clob_client_v2-0.0.1/py_clob_client_v2/headers/headers.py +69 -0
  16. py_clob_client_v2-0.0.1/py_clob_client_v2/http_helpers/__init__.py +20 -0
  17. py_clob_client_v2-0.0.1/py_clob_client_v2/http_helpers/helpers.py +226 -0
  18. py_clob_client_v2-0.0.1/py_clob_client_v2/order_builder/__init__.py +9 -0
  19. py_clob_client_v2-0.0.1/py_clob_client_v2/order_builder/builder.py +319 -0
  20. py_clob_client_v2-0.0.1/py_clob_client_v2/order_builder/constants.py +2 -0
  21. py_clob_client_v2-0.0.1/py_clob_client_v2/order_builder/helpers.py +25 -0
  22. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/__init__.py +16 -0
  23. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/abi/__init__.py +0 -0
  24. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/abi/abis.py +13 -0
  25. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/exchange_order_builder_v1.py +103 -0
  26. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/exchange_order_builder_v2.py +112 -0
  27. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/__init__.py +15 -0
  28. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/ctf_exchange_v1_typed_data.py +25 -0
  29. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/ctf_exchange_v2_typed_data.py +24 -0
  30. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/order_data_v1.py +76 -0
  31. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/order_data_v2.py +76 -0
  32. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/side.py +11 -0
  33. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/signature_type_v1.py +16 -0
  34. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/model/signature_type_v2.py +19 -0
  35. py_clob_client_v2-0.0.1/py_clob_client_v2/order_utils/utils.py +6 -0
  36. py_clob_client_v2-0.0.1/py_clob_client_v2/rfq/__init__.py +61 -0
  37. py_clob_client_v2-0.0.1/py_clob_client_v2/rfq/rfq_client.py +520 -0
  38. py_clob_client_v2-0.0.1/py_clob_client_v2/rfq/rfq_helpers.py +161 -0
  39. py_clob_client_v2-0.0.1/py_clob_client_v2/rfq/rfq_types.py +439 -0
  40. py_clob_client_v2-0.0.1/py_clob_client_v2/signer.py +22 -0
  41. py_clob_client_v2-0.0.1/py_clob_client_v2/signing/__init__.py +3 -0
  42. py_clob_client_v2-0.0.1/py_clob_client_v2/signing/eip712.py +28 -0
  43. py_clob_client_v2-0.0.1/py_clob_client_v2/signing/hmac.py +24 -0
  44. py_clob_client_v2-0.0.1/py_clob_client_v2/signing/model.py +8 -0
  45. py_clob_client_v2-0.0.1/py_clob_client_v2/utilities.py +82 -0
  46. py_clob_client_v2-0.0.1/py_clob_client_v2.egg-info/PKG-INFO +36 -0
  47. py_clob_client_v2-0.0.1/py_clob_client_v2.egg-info/SOURCES.txt +66 -0
  48. py_clob_client_v2-0.0.1/py_clob_client_v2.egg-info/dependency_links.txt +1 -0
  49. py_clob_client_v2-0.0.1/py_clob_client_v2.egg-info/requires.txt +7 -0
  50. py_clob_client_v2-0.0.1/py_clob_client_v2.egg-info/top_level.txt +3 -0
  51. py_clob_client_v2-0.0.1/setup.cfg +4 -0
  52. py_clob_client_v2-0.0.1/setup.py +37 -0
  53. py_clob_client_v2-0.0.1/tests/__init__.py +0 -0
  54. py_clob_client_v2-0.0.1/tests/headers/__init__.py +0 -0
  55. py_clob_client_v2-0.0.1/tests/headers/test_headers.py +77 -0
  56. py_clob_client_v2-0.0.1/tests/http_helpers/__init__.py +0 -0
  57. py_clob_client_v2-0.0.1/tests/http_helpers/test_helpers.py +138 -0
  58. py_clob_client_v2-0.0.1/tests/order_builder/__init__.py +0 -0
  59. py_clob_client_v2-0.0.1/tests/order_builder/test_builder.py +756 -0
  60. py_clob_client_v2-0.0.1/tests/order_builder/test_helpers.py +9 -0
  61. py_clob_client_v2-0.0.1/tests/order_utils/__init__.py +0 -0
  62. py_clob_client_v2-0.0.1/tests/order_utils/test_exchange_order_builder_v1.py +261 -0
  63. py_clob_client_v2-0.0.1/tests/order_utils/test_utils.py +18 -0
  64. py_clob_client_v2-0.0.1/tests/signing/__init__.py +0 -0
  65. py_clob_client_v2-0.0.1/tests/signing/test_eip712.py +20 -0
  66. py_clob_client_v2-0.0.1/tests/signing/test_hmac.py +176 -0
  67. py_clob_client_v2-0.0.1/tests/test_client_fee_cache.py +227 -0
  68. py_clob_client_v2-0.0.1/tests/test_utilities.py +333 -0
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: py_clob_client_v2
3
+ Version: 0.0.1
4
+ Summary: Python client for the Polymarket CLOBV2
5
+ Home-page: https://github.com/Polymarket/py-clob-client-v2
6
+ Author: Polymarket Engineering
7
+ Author-email: engineering@polymarket.com
8
+ Maintainer: Polymarket Engineering
9
+ Maintainer-email: engineering@polymarket.com
10
+ Project-URL: Bug Tracker, https://github.com/Polymarket/py-clob-client-v2/issues
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.9.10
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: eth-account>=0.13.0
17
+ Requires-Dist: eth-utils>=4.1.1
18
+ Requires-Dist: poly_eip712_structs>=0.0.1
19
+ Requires-Dist: py-order-utils>=0.3.2
20
+ Requires-Dist: python-dotenv
21
+ Requires-Dist: py-builder-signing-sdk>=0.0.2
22
+ Requires-Dist: httpx[http2]>=0.27.0
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: maintainer
30
+ Dynamic: maintainer-email
31
+ Dynamic: project-url
32
+ Dynamic: requires-dist
33
+ Dynamic: requires-python
34
+ Dynamic: summary
35
+
36
+ # py-clob-client-v2
@@ -0,0 +1 @@
1
+ # py-clob-client-v2
File without changes
File without changes
@@ -0,0 +1,121 @@
1
+ CTF_ABI = [
2
+ {
3
+ "constant": True,
4
+ "inputs": [{"name": "owner", "type": "address"}, {"name": "id", "type": "uint256"}],
5
+ "name": "balanceOf",
6
+ "outputs": [{"name": "", "type": "uint256"}],
7
+ "payable": False,
8
+ "stateMutability": "view",
9
+ "type": "function",
10
+ },
11
+ {
12
+ "constant": False,
13
+ "inputs": [
14
+ {"name": "from", "type": "address"},
15
+ {"name": "to", "type": "address"},
16
+ {"name": "ids", "type": "uint256[]"},
17
+ {"name": "values", "type": "uint256[]"},
18
+ {"name": "data", "type": "bytes"},
19
+ ],
20
+ "name": "safeBatchTransferFrom",
21
+ "outputs": [],
22
+ "payable": False,
23
+ "stateMutability": "nonpayable",
24
+ "type": "function",
25
+ },
26
+ {
27
+ "constant": True,
28
+ "inputs": [
29
+ {"name": "owners", "type": "address[]"},
30
+ {"name": "ids", "type": "uint256[]"},
31
+ ],
32
+ "name": "balanceOfBatch",
33
+ "outputs": [{"name": "", "type": "uint256[]"}],
34
+ "payable": False,
35
+ "stateMutability": "view",
36
+ "type": "function",
37
+ },
38
+ {
39
+ "constant": False,
40
+ "inputs": [
41
+ {"name": "operator", "type": "address"},
42
+ {"name": "approved", "type": "bool"},
43
+ ],
44
+ "name": "setApprovalForAll",
45
+ "outputs": [],
46
+ "payable": False,
47
+ "stateMutability": "nonpayable",
48
+ "type": "function",
49
+ },
50
+ {
51
+ "constant": True,
52
+ "inputs": [
53
+ {"name": "owner", "type": "address"},
54
+ {"name": "operator", "type": "address"},
55
+ ],
56
+ "name": "isApprovedForAll",
57
+ "outputs": [{"name": "", "type": "bool"}],
58
+ "payable": False,
59
+ "stateMutability": "view",
60
+ "type": "function",
61
+ },
62
+ {
63
+ "constant": False,
64
+ "inputs": [
65
+ {"name": "from", "type": "address"},
66
+ {"name": "to", "type": "address"},
67
+ {"name": "id", "type": "uint256"},
68
+ {"name": "value", "type": "uint256"},
69
+ {"name": "data", "type": "bytes"},
70
+ ],
71
+ "name": "safeTransferFrom",
72
+ "outputs": [],
73
+ "payable": False,
74
+ "stateMutability": "nonpayable",
75
+ "type": "function",
76
+ },
77
+ {
78
+ "constant": False,
79
+ "inputs": [
80
+ {"name": "collateralToken", "type": "address"},
81
+ {"name": "parentCollectionId", "type": "bytes32"},
82
+ {"name": "conditionId", "type": "bytes32"},
83
+ {"name": "partition", "type": "uint256[]"},
84
+ {"name": "amount", "type": "uint256"},
85
+ ],
86
+ "name": "splitPosition",
87
+ "outputs": [],
88
+ "payable": False,
89
+ "stateMutability": "nonpayable",
90
+ "type": "function",
91
+ },
92
+ {
93
+ "constant": False,
94
+ "inputs": [
95
+ {"name": "collateralToken", "type": "address"},
96
+ {"name": "parentCollectionId", "type": "bytes32"},
97
+ {"name": "conditionId", "type": "bytes32"},
98
+ {"name": "partition", "type": "uint256[]"},
99
+ {"name": "amount", "type": "uint256"},
100
+ ],
101
+ "name": "mergePositions",
102
+ "outputs": [],
103
+ "payable": False,
104
+ "stateMutability": "nonpayable",
105
+ "type": "function",
106
+ },
107
+ {
108
+ "constant": False,
109
+ "inputs": [
110
+ {"name": "collateralToken", "type": "address"},
111
+ {"name": "parentCollectionId", "type": "bytes32"},
112
+ {"name": "conditionId", "type": "bytes32"},
113
+ {"name": "indexSets", "type": "uint256[]"},
114
+ ],
115
+ "name": "redeemPositions",
116
+ "outputs": [],
117
+ "payable": False,
118
+ "stateMutability": "nonpayable",
119
+ "type": "function",
120
+ },
121
+ ]
@@ -0,0 +1,117 @@
1
+ USDC_ABI = [
2
+ {
3
+ "constant": True,
4
+ "inputs": [],
5
+ "name": "name",
6
+ "outputs": [{"name": "", "type": "string"}],
7
+ "payable": False,
8
+ "stateMutability": "view",
9
+ "type": "function",
10
+ },
11
+ {
12
+ "constant": False,
13
+ "inputs": [
14
+ {"name": "_spender", "type": "address"},
15
+ {"name": "_value", "type": "uint256"},
16
+ ],
17
+ "name": "approve",
18
+ "outputs": [{"name": "", "type": "bool"}],
19
+ "payable": False,
20
+ "stateMutability": "nonpayable",
21
+ "type": "function",
22
+ },
23
+ {
24
+ "constant": True,
25
+ "inputs": [],
26
+ "name": "totalSupply",
27
+ "outputs": [{"name": "", "type": "uint256"}],
28
+ "payable": False,
29
+ "stateMutability": "view",
30
+ "type": "function",
31
+ },
32
+ {
33
+ "constant": False,
34
+ "inputs": [
35
+ {"name": "_from", "type": "address"},
36
+ {"name": "_to", "type": "address"},
37
+ {"name": "_value", "type": "uint256"},
38
+ ],
39
+ "name": "transferFrom",
40
+ "outputs": [{"name": "", "type": "bool"}],
41
+ "payable": False,
42
+ "stateMutability": "nonpayable",
43
+ "type": "function",
44
+ },
45
+ {
46
+ "constant": True,
47
+ "inputs": [],
48
+ "name": "decimals",
49
+ "outputs": [{"name": "", "type": "uint8"}],
50
+ "payable": False,
51
+ "stateMutability": "view",
52
+ "type": "function",
53
+ },
54
+ {
55
+ "constant": True,
56
+ "inputs": [{"name": "account", "type": "address"}],
57
+ "name": "balanceOf",
58
+ "outputs": [{"name": "", "type": "uint256"}],
59
+ "payable": False,
60
+ "stateMutability": "view",
61
+ "type": "function",
62
+ },
63
+ {
64
+ "constant": False,
65
+ "inputs": [
66
+ {"name": "_to", "type": "address"},
67
+ {"name": "_amount", "type": "uint256"},
68
+ ],
69
+ "name": "mint",
70
+ "outputs": [{"name": "", "type": "bool"}],
71
+ "payable": False,
72
+ "stateMutability": "nonpayable",
73
+ "type": "function",
74
+ },
75
+ {
76
+ "constant": False,
77
+ "inputs": [{"name": "_amount", "type": "uint256"}],
78
+ "name": "burn",
79
+ "outputs": [],
80
+ "payable": False,
81
+ "stateMutability": "nonpayable",
82
+ "type": "function",
83
+ },
84
+ {
85
+ "constant": True,
86
+ "inputs": [],
87
+ "name": "symbol",
88
+ "outputs": [{"name": "", "type": "string"}],
89
+ "payable": False,
90
+ "stateMutability": "view",
91
+ "type": "function",
92
+ },
93
+ {
94
+ "constant": False,
95
+ "inputs": [
96
+ {"name": "_to", "type": "address"},
97
+ {"name": "_value", "type": "uint256"},
98
+ ],
99
+ "name": "transfer",
100
+ "outputs": [{"name": "", "type": "bool"}],
101
+ "payable": False,
102
+ "stateMutability": "nonpayable",
103
+ "type": "function",
104
+ },
105
+ {
106
+ "constant": True,
107
+ "inputs": [
108
+ {"name": "owner", "type": "address"},
109
+ {"name": "spender", "type": "address"},
110
+ ],
111
+ "name": "allowance",
112
+ "outputs": [{"name": "", "type": "uint256"}],
113
+ "payable": False,
114
+ "stateMutability": "view",
115
+ "type": "function",
116
+ },
117
+ ]
@@ -0,0 +1,92 @@
1
+ from .client import ClobClient
2
+ from .order_utils import SignatureTypeV2, Side
3
+ from .clob_types import (
4
+ PriceHistoryInterval,
5
+ ApiCreds,
6
+ # V1/V2 order input types
7
+ OrderArgsV1,
8
+ OrderArgsV2,
9
+ OrderArgs, # alias for OrderArgsV2
10
+ MarketOrderArgsV1,
11
+ MarketOrderArgsV2,
12
+ MarketOrderArgs, # alias for MarketOrderArgsV2
13
+ OrderType,
14
+ TickSize,
15
+ BookParams,
16
+ TradeParams,
17
+ OpenOrderParams,
18
+ DropNotificationParams,
19
+ OrderScoringParams,
20
+ OrdersScoringParams,
21
+ BalanceAllowanceParams,
22
+ AssetType,
23
+ PartialCreateOrderOptions,
24
+ CreateOrderOptions,
25
+ BuilderConfig,
26
+ MarketDetails,
27
+ FeeDetails,
28
+ ClobToken,
29
+ PricesHistoryParams,
30
+ EarningsParams,
31
+ RewardsMarketsParams,
32
+ # Post order types
33
+ PostOrdersV1Args,
34
+ PostOrdersV2Args,
35
+ PostOrdersArgs,
36
+ # Response types
37
+ BanStatus,
38
+ OrderScoring,
39
+ BuilderTradeParams,
40
+ OrderMarketCancelParams,
41
+ OrderPayload,
42
+ BuilderApiKey,
43
+ BuilderApiKeyResponse,
44
+ )
45
+
46
+ __all__ = [
47
+ # Main client
48
+ "ClobClient",
49
+ "SignatureTypeV2",
50
+ "Side",
51
+ "PriceHistoryInterval",
52
+ # Order input types
53
+ "OrderArgsV1",
54
+ "OrderArgsV2",
55
+ "OrderArgs",
56
+ "MarketOrderArgsV1",
57
+ "MarketOrderArgsV2",
58
+ "MarketOrderArgs",
59
+ # Core types
60
+ "ApiCreds",
61
+ "OrderType",
62
+ "TickSize",
63
+ "BookParams",
64
+ "TradeParams",
65
+ "OpenOrderParams",
66
+ "DropNotificationParams",
67
+ "OrderScoringParams",
68
+ "OrdersScoringParams",
69
+ "BalanceAllowanceParams",
70
+ "AssetType",
71
+ "PartialCreateOrderOptions",
72
+ "CreateOrderOptions",
73
+ "BuilderConfig",
74
+ "MarketDetails",
75
+ "FeeDetails",
76
+ "ClobToken",
77
+ "PricesHistoryParams",
78
+ "EarningsParams",
79
+ "RewardsMarketsParams",
80
+ # Post order types
81
+ "PostOrdersV1Args",
82
+ "PostOrdersV2Args",
83
+ "PostOrdersArgs",
84
+ # Response types
85
+ "BanStatus",
86
+ "OrderScoring",
87
+ "BuilderTradeParams",
88
+ "OrderMarketCancelParams",
89
+ "OrderPayload",
90
+ "BuilderApiKey",
91
+ "BuilderApiKeyResponse",
92
+ ]