opinion-clob-sdk 0.1.19__tar.gz → 0.2.0__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.

Potentially problematic release.


This version of opinion-clob-sdk might be problematic. Click here for more details.

Files changed (59) hide show
  1. {opinion_clob_sdk-0.1.19/opinion_clob_sdk.egg-info → opinion_clob_sdk-0.2.0}/PKG-INFO +13 -8
  2. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/README.md +9 -5
  3. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/__init__.py +3 -3
  4. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/builders/base_builder.py +1 -1
  5. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/builders/order_builder_test.py +1 -1
  6. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_test.py +1 -1
  7. opinion_clob_sdk-0.2.0/config.py +16 -0
  8. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0/opinion_clob_sdk.egg-info}/PKG-INFO +13 -8
  9. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/opinion_clob_sdk.egg-info/SOURCES.txt +43 -0
  10. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/sdk.py +23 -11
  11. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/setup.py +13 -8
  12. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/tests/test_integration.py +1 -1
  13. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/tests/test_sdk.py +29 -29
  14. opinion_clob_sdk-0.1.19/config.py +0 -4
  15. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/MANIFEST.in +0 -0
  16. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/__init__.py +0 -0
  17. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/contract_caller.py +0 -0
  18. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/contracts/__init__.py +0 -0
  19. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/contracts/conditional_tokens.py +0 -0
  20. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/contracts/erc20.py +0 -0
  21. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/exception.py +0 -0
  22. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/__init__.py +0 -0
  23. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/builders/__init__.py +0 -0
  24. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/builders/exception.py +0 -0
  25. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/builders/order_builder.py +0 -0
  26. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/constants.py +0 -0
  27. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/model/__init__.py +0 -0
  28. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/model/order.py +0 -0
  29. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/model/order_type.py +0 -0
  30. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/model/sides.py +0 -0
  31. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/model/signatures.py +0 -0
  32. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/signer.py +0 -0
  33. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/py_order_utils/utils.py +0 -0
  34. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/__init__.py +0 -0
  35. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/constants.py +0 -0
  36. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/eip712/__init__.py +0 -0
  37. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/enums.py +0 -0
  38. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/exceptions.py +0 -0
  39. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/multisend.py +0 -0
  40. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe.py +0 -0
  41. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_contracts/__init__.py +0 -0
  42. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py +0 -0
  43. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_contracts/multisend_v1_3_0.py +0 -0
  44. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_contracts/safe_v1_3_0.py +0 -0
  45. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_contracts/utils.py +0 -0
  46. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_signature.py +0 -0
  47. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/safe_tx.py +0 -0
  48. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/signatures.py +0 -0
  49. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/typing.py +0 -0
  50. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/chain/safe/utils.py +0 -0
  51. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/model.py +0 -0
  52. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/opinion_clob_sdk.egg-info/dependency_links.txt +0 -0
  53. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/opinion_clob_sdk.egg-info/requires.txt +0 -0
  54. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/opinion_clob_sdk.egg-info/top_level.txt +0 -0
  55. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/setup.cfg +0 -0
  56. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/tests/test_model.py +0 -0
  57. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/tests/test_order_calculations.py +0 -0
  58. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/tests/test_precision.py +0 -0
  59. {opinion_clob_sdk-0.1.19 → opinion_clob_sdk-0.2.0}/verify_api_calls.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opinion_clob_sdk
3
- Version: 0.1.19
4
- Summary: Opinion CLOB SDK - Python SDK for Opinion Prediction Market Central Limit Order Book API
3
+ Version: 0.2.0
4
+ Summary: Opinion CLOB SDK (Tech Preview) - Python SDK for Opinion Prediction Market Central Limit Order Book API
5
5
  Home-page: https://opinion.trade
6
6
  Author: Opinion Labs
7
7
  Author-email: support@opinion.trade
8
- Keywords: PredictionMarket,CLOB,Trading,Blockchain,Base,Opinion
9
- Classifier: Development Status :: 4 - Beta
8
+ Keywords: PredictionMarket,CLOB,Trading,Blockchain,BNBChain,BSC,Opinion
9
+ Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
12
  Classifier: License :: OSI Approved :: MIT License
@@ -40,17 +40,22 @@ Dynamic: requires-python
40
40
  Dynamic: summary
41
41
 
42
42
 
43
- # Opinion CLOB SDK
43
+ # Opinion CLOB SDK (Tech Preview)
44
+
45
+ **Technology Preview Release - BNB Chain Support**
44
46
 
45
47
  Python SDK for interacting with Opinion prediction markets via the CLOB (Central Limit Order Book) API.
46
48
 
49
+ > ⚠️ **Tech Preview Notice**: This version includes the migration from Base to BNB Chain.
50
+ > While fully functional and tested, we recommend thorough testing in your environment before production use.
51
+
47
52
  ## Features
48
53
 
49
54
  - Market data queries (markets, orderbooks, prices, candles)
50
55
  - Order management (place, cancel, query orders)
51
56
  - Position and balance tracking
52
57
  - Smart contract interactions (split, merge, redeem)
53
- - Support for Base mainnet (chain ID 8453)
58
+ - Support for BNB Chain mainnet (chain ID 56)
54
59
 
55
60
  ## Installation
56
61
 
@@ -66,8 +71,8 @@ from opinion_clob_sdk import Client
66
71
  client = Client(
67
72
  host='https://api.opinion.trade',
68
73
  apikey='your_api_key',
69
- chain_id=8453, # Base mainnet
70
- rpc_url='your_rpc_url',
74
+ chain_id=56, # BNB Chain mainnet
75
+ rpc_url='https://bsc-dataseed.binance.org',
71
76
  private_key='your_private_key',
72
77
  multi_sig_addr='your_multi_sig_address'
73
78
  )
@@ -1,7 +1,12 @@
1
- # Opinion CLOB SDK
1
+ # Opinion CLOB SDK (Tech Preview)
2
+
3
+ **Technology Preview Release - BNB Chain Support**
2
4
 
3
5
  Python SDK for interacting with Opinion prediction markets via the CLOB (Central Limit Order Book) API.
4
6
 
7
+ > ⚠️ **Tech Preview Notice**: Version 0.2.0 includes the migration from Base to BNB Chain.
8
+ > While fully functional and tested, we recommend thorough testing in your environment before production use.
9
+
5
10
  ## Overview
6
11
 
7
12
  The Opinion CLOB SDK provides a Python interface for:
@@ -10,7 +15,7 @@ The Opinion CLOB SDK provides a Python interface for:
10
15
  - Tracking positions and balances
11
16
  - Interacting with smart contracts (split, merge, redeem)
12
17
 
13
- Supports Base mainnet (chain ID 8453) and Base testnet (chain ID 10143).
18
+ Supports BNB Chain mainnet (chain ID 56).
14
19
 
15
20
  ## Installation
16
21
 
@@ -27,7 +32,7 @@ from opinion_clob_sdk import Client
27
32
  client = Client(
28
33
  host='https://api.opinion.trade',
29
34
  apikey='your_api_key',
30
- chain_id=8453, # Base mainnet
35
+ chain_id=56, # BNB Chain mainnet
31
36
  rpc_url='your_rpc_url',
32
37
  private_key='your_private_key',
33
38
  multi_sig_addr='your_multi_sig_address'
@@ -177,8 +182,7 @@ MULTI_SIG_ADDRESS=your_multi_sig_address
177
182
 
178
183
  ### Chain IDs
179
184
 
180
- - **Base Mainnet**: 8453
181
- - **Base Testnet**: 10143
185
+ - **BNB Chain Mainnet**: 56
182
186
 
183
187
  ## Development
184
188
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from opinion_clob_sdk.sdk import (
4
4
  Client,
5
- CHAIN_ID_BASE_MAINNET,
5
+ CHAIN_ID_BNB_MAINNET,
6
6
  SUPPORTED_CHAIN_IDS
7
7
  )
8
8
  from opinion_clob_sdk.model import TopicStatus, TopicType, TopicStatusFilter
@@ -12,13 +12,13 @@ from opinion_clob_sdk.chain.exception import (
12
12
  InsufficientGasBalance
13
13
  )
14
14
 
15
- __version__ = "0.1.17"
15
+ __version__ = "0.2.0"
16
16
  __all__ = [
17
17
  "Client",
18
18
  "TopicStatus",
19
19
  "TopicType",
20
20
  "TopicStatusFilter",
21
- "CHAIN_ID_BASE_MAINNET",
21
+ "CHAIN_ID_BNB_MAINNET",
22
22
  "SUPPORTED_CHAIN_IDS",
23
23
  "BalanceNotEnough",
24
24
  "NoPositionsToRedeem",
@@ -20,7 +20,7 @@ class BaseBuilder:
20
20
  self, chain_id: int, verifying_contract: str
21
21
  ) -> EIP712Struct:
22
22
  return make_domain(
23
- name="OLAB CTF Exchange",
23
+ name="OPINION CTF Exchange",
24
24
  version="1",
25
25
  chainId=str(chain_id),
26
26
  verifyingContract=verifying_contract,
@@ -11,7 +11,7 @@ import json
11
11
  class TestInterfaces(unittest.TestCase):
12
12
  def test_sign_order(self):
13
13
  exchange_address = "0xF0aebf65490374a477100351291c736c73c11D9F"
14
- chain_id = 8453
14
+ chain_id = 56
15
15
  # Test private key, please do not use the key in production env.
16
16
  signer = Signer("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80")
17
17
  builder = OrderBuilder(exchange_address, chain_id, signer, lambda: 1)
@@ -12,7 +12,7 @@ class TestSafeRx(unittest.TestCase):
12
12
  self.private_key = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
13
13
  self.safe_address = '0x8F58a1ab58e18Bb3f8ACf5E14c046D4F7add824a'
14
14
  self.compatibility_handler_address = '0xf48f2B2d2a534e402487b3ee7C18c33Aec0Fe5e4'
15
- self.rpc_url = 'https://mainnet.base.org'
15
+ self.rpc_url = 'https://bsc-dataseed.binance.org'
16
16
  self.w3 = Web3(HTTPProvider(self.rpc_url))
17
17
 
18
18
  def test_sign_multi_sig_tx(self):
@@ -0,0 +1,16 @@
1
+ # Configuration constants for Opinion CLOB SDK
2
+
3
+ # Supported chain IDs
4
+ SUPPORTED_CHAIN_IDS = [56] # BNB Chain (BSC) mainnet
5
+
6
+ # BNB Chain (BSC) Mainnet Contract Addresses
7
+ BNB_CHAIN_CONDITIONAL_TOKENS_ADDR = "0xAD1a38cEc043e70E83a3eC30443dB285ED10D774"
8
+ BNB_CHAIN_MULTISEND_ADDR = "0x998739BFdAAdde7C933B942a68053933098f9EDa"
9
+
10
+ # Default contract addresses by chain ID
11
+ DEFAULT_CONTRACT_ADDRESSES = {
12
+ 56: { # BNB Chain Mainnet
13
+ "conditional_tokens": BNB_CHAIN_CONDITIONAL_TOKENS_ADDR,
14
+ "multisend": BNB_CHAIN_MULTISEND_ADDR,
15
+ }
16
+ }
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opinion_clob_sdk
3
- Version: 0.1.19
4
- Summary: Opinion CLOB SDK - Python SDK for Opinion Prediction Market Central Limit Order Book API
3
+ Version: 0.2.0
4
+ Summary: Opinion CLOB SDK (Tech Preview) - Python SDK for Opinion Prediction Market Central Limit Order Book API
5
5
  Home-page: https://opinion.trade
6
6
  Author: Opinion Labs
7
7
  Author-email: support@opinion.trade
8
- Keywords: PredictionMarket,CLOB,Trading,Blockchain,Base,Opinion
9
- Classifier: Development Status :: 4 - Beta
8
+ Keywords: PredictionMarket,CLOB,Trading,Blockchain,BNBChain,BSC,Opinion
9
+ Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
12
  Classifier: License :: OSI Approved :: MIT License
@@ -40,17 +40,22 @@ Dynamic: requires-python
40
40
  Dynamic: summary
41
41
 
42
42
 
43
- # Opinion CLOB SDK
43
+ # Opinion CLOB SDK (Tech Preview)
44
+
45
+ **Technology Preview Release - BNB Chain Support**
44
46
 
45
47
  Python SDK for interacting with Opinion prediction markets via the CLOB (Central Limit Order Book) API.
46
48
 
49
+ > ⚠️ **Tech Preview Notice**: This version includes the migration from Base to BNB Chain.
50
+ > While fully functional and tested, we recommend thorough testing in your environment before production use.
51
+
47
52
  ## Features
48
53
 
49
54
  - Market data queries (markets, orderbooks, prices, candles)
50
55
  - Order management (place, cancel, query orders)
51
56
  - Position and balance tracking
52
57
  - Smart contract interactions (split, merge, redeem)
53
- - Support for Base mainnet (chain ID 8453)
58
+ - Support for BNB Chain mainnet (chain ID 56)
54
59
 
55
60
  ## Installation
56
61
 
@@ -66,8 +71,8 @@ from opinion_clob_sdk import Client
66
71
  client = Client(
67
72
  host='https://api.opinion.trade',
68
73
  apikey='your_api_key',
69
- chain_id=8453, # Base mainnet
70
- rpc_url='your_rpc_url',
74
+ chain_id=56, # BNB Chain mainnet
75
+ rpc_url='https://bsc-dataseed.binance.org',
71
76
  private_key='your_private_key',
72
77
  multi_sig_addr='your_multi_sig_address'
73
78
  )
@@ -1,6 +1,11 @@
1
1
  MANIFEST.in
2
2
  README.md
3
+ __init__.py
4
+ config.py
5
+ model.py
6
+ sdk.py
3
7
  setup.py
8
+ verify_api_calls.py
4
9
  ./__init__.py
5
10
  ./config.py
6
11
  ./model.py
@@ -44,6 +49,44 @@ setup.py
44
49
  ./chain/safe/safe_contracts/multisend_v1_3_0.py
45
50
  ./chain/safe/safe_contracts/safe_v1_3_0.py
46
51
  ./chain/safe/safe_contracts/utils.py
52
+ chain/__init__.py
53
+ chain/contract_caller.py
54
+ chain/exception.py
55
+ chain/contracts/__init__.py
56
+ chain/contracts/conditional_tokens.py
57
+ chain/contracts/erc20.py
58
+ chain/py_order_utils/__init__.py
59
+ chain/py_order_utils/constants.py
60
+ chain/py_order_utils/signer.py
61
+ chain/py_order_utils/utils.py
62
+ chain/py_order_utils/builders/__init__.py
63
+ chain/py_order_utils/builders/base_builder.py
64
+ chain/py_order_utils/builders/exception.py
65
+ chain/py_order_utils/builders/order_builder.py
66
+ chain/py_order_utils/builders/order_builder_test.py
67
+ chain/py_order_utils/model/__init__.py
68
+ chain/py_order_utils/model/order.py
69
+ chain/py_order_utils/model/order_type.py
70
+ chain/py_order_utils/model/sides.py
71
+ chain/py_order_utils/model/signatures.py
72
+ chain/safe/__init__.py
73
+ chain/safe/constants.py
74
+ chain/safe/enums.py
75
+ chain/safe/exceptions.py
76
+ chain/safe/multisend.py
77
+ chain/safe/safe.py
78
+ chain/safe/safe_signature.py
79
+ chain/safe/safe_test.py
80
+ chain/safe/safe_tx.py
81
+ chain/safe/signatures.py
82
+ chain/safe/typing.py
83
+ chain/safe/utils.py
84
+ chain/safe/eip712/__init__.py
85
+ chain/safe/safe_contracts/__init__.py
86
+ chain/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py
87
+ chain/safe/safe_contracts/multisend_v1_3_0.py
88
+ chain/safe/safe_contracts/safe_v1_3_0.py
89
+ chain/safe/safe_contracts/utils.py
47
90
  opinion_clob_sdk.egg-info/PKG-INFO
48
91
  opinion_clob_sdk.egg-info/SOURCES.txt
49
92
  opinion_clob_sdk.egg-info/dependency_links.txt
@@ -19,6 +19,7 @@ from .chain.py_order_utils.model.sides import BUY, SELL, OrderSide
19
19
  from .chain.py_order_utils.model.order_type import LIMIT_ORDER, MARKET_ORDER
20
20
  from .model import TopicStatus, TopicStatusFilter, TopicType
21
21
  from .chain.py_order_utils.utils import calculate_order_amounts
22
+ from .config import DEFAULT_CONTRACT_ADDRESSES
22
23
 
23
24
  API_INTERNAL_ERROR_MSG = "Unable to process your request. Please contact technical support."
24
25
  MISSING_MARKET_ID_MSG = "market_id is required."
@@ -26,8 +27,8 @@ MISSING_TOKEN_ID_MSG = "token_id is required."
26
27
  MAX_DECIMALS = 18 # Standard maximum for ERC20 tokens (ETH, DAI, etc.)
27
28
 
28
29
  # Supported blockchain chain IDs
29
- CHAIN_ID_BASE_MAINNET = 8453 # Base mainnet
30
- SUPPORTED_CHAIN_IDS = [CHAIN_ID_BASE_MAINNET]
30
+ CHAIN_ID_BNB_MAINNET = 56 # BNB Chain (BSC) mainnet
31
+ SUPPORTED_CHAIN_IDS = [CHAIN_ID_BNB_MAINNET]
31
32
 
32
33
  class InvalidParamError(Exception):
33
34
  pass
@@ -82,8 +83,8 @@ class Client:
82
83
  rpc_url: str = '',
83
84
  private_key: HexStr = HexStr(''),
84
85
  multi_sig_addr: str = '',
85
- conditional_tokens_addr: ChecksumAddress = ChecksumAddress(''),
86
- multisend_addr: ChecksumAddress = ChecksumAddress(''),
86
+ conditional_tokens_addr: Optional[ChecksumAddress] = None,
87
+ multisend_addr: Optional[ChecksumAddress] = None,
87
88
  enable_trading_check_interval: int = 3600,
88
89
  quote_tokens_cache_ttl: int = 3600,
89
90
  market_cache_ttl: int = 300
@@ -94,12 +95,12 @@ class Client:
94
95
  Args:
95
96
  host: API host URL
96
97
  apikey: API authentication key
97
- chain_id: Blockchain chain ID (8453 for Base mainnet)
98
+ chain_id: Blockchain chain ID (56 for BNB Chain mainnet)
98
99
  rpc_url: RPC endpoint URL
99
100
  private_key: Private key for signing transactions
100
101
  multi_sig_addr: Multi-signature wallet address
101
- conditional_tokens_addr: Conditional tokens contract address
102
- multisend_addr: Multisend contract address
102
+ conditional_tokens_addr: Conditional tokens contract address (optional, uses default if not provided)
103
+ multisend_addr: Multisend contract address (optional, uses default if not provided)
103
104
  enable_trading_check_interval: Time interval (in seconds) to cache enable_trading checks.
104
105
  Default is 3600 (1 hour). Set to 0 to check every time.
105
106
  This significantly improves performance for frequent operations.
@@ -108,6 +109,21 @@ class Client:
108
109
  market_cache_ttl: Time interval (in seconds) to cache market data.
109
110
  Default is 300 (5 minutes). Set to 0 to disable caching.
110
111
  """
112
+ # Validate and set chain_id first
113
+ if chain_id not in SUPPORTED_CHAIN_IDS:
114
+ raise InvalidParamError(f'chain_id must be one of {SUPPORTED_CHAIN_IDS}')
115
+ self.chain_id = chain_id
116
+
117
+ # Use default contract addresses if not provided
118
+ if conditional_tokens_addr is None:
119
+ conditional_tokens_addr = ChecksumAddress(
120
+ DEFAULT_CONTRACT_ADDRESSES[chain_id]["conditional_tokens"]
121
+ )
122
+ if multisend_addr is None:
123
+ multisend_addr = ChecksumAddress(
124
+ DEFAULT_CONTRACT_ADDRESSES[chain_id]["multisend"]
125
+ )
126
+
111
127
  self.conf = Configuration(host=host)
112
128
  self.conf.api_key['ApiKeyAuth'] = apikey
113
129
  self.api_key = apikey
@@ -119,10 +135,6 @@ class Client:
119
135
  self.api_client = ApiClient(self.conf)
120
136
  self.market_api = PredictionMarketApi(self.api_client)
121
137
  self.user_api = UserApi(self.api_client)
122
- # Validate and set chain_id
123
- if chain_id not in SUPPORTED_CHAIN_IDS:
124
- raise InvalidParamError(f'chain_id must be one of {SUPPORTED_CHAIN_IDS}')
125
- self.chain_id = chain_id
126
138
 
127
139
  # Cache configuration
128
140
  self.quote_tokens_cache_ttl = quote_tokens_cache_ttl
@@ -1,24 +1,29 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  NAME = "opinion_clob_sdk"
4
- VERSION = "0.1.19"
4
+ VERSION = "0.2.0"
5
5
 
6
6
  setup(
7
7
  name=NAME,
8
8
  version=VERSION,
9
- description="Opinion CLOB SDK - Python SDK for Opinion Prediction Market Central Limit Order Book API",
9
+ description="Opinion CLOB SDK (Tech Preview) - Python SDK for Opinion Prediction Market Central Limit Order Book API",
10
10
  long_description="""
11
- # Opinion CLOB SDK
11
+ # Opinion CLOB SDK (Tech Preview)
12
+
13
+ **Technology Preview Release - BNB Chain Support**
12
14
 
13
15
  Python SDK for interacting with Opinion prediction markets via the CLOB (Central Limit Order Book) API.
14
16
 
17
+ > ⚠️ **Tech Preview Notice**: This version includes the migration from Base to BNB Chain.
18
+ > While fully functional and tested, we recommend thorough testing in your environment before production use.
19
+
15
20
  ## Features
16
21
 
17
22
  - Market data queries (markets, orderbooks, prices, candles)
18
23
  - Order management (place, cancel, query orders)
19
24
  - Position and balance tracking
20
25
  - Smart contract interactions (split, merge, redeem)
21
- - Support for Base mainnet (chain ID 8453)
26
+ - Support for BNB Chain mainnet (chain ID 56)
22
27
 
23
28
  ## Installation
24
29
 
@@ -34,8 +39,8 @@ from opinion_clob_sdk import Client
34
39
  client = Client(
35
40
  host='https://api.opinion.trade',
36
41
  apikey='your_api_key',
37
- chain_id=8453, # Base mainnet
38
- rpc_url='your_rpc_url',
42
+ chain_id=56, # BNB Chain mainnet
43
+ rpc_url='https://bsc-dataseed.binance.org',
39
44
  private_key='your_private_key',
40
45
  multi_sig_addr='your_multi_sig_address'
41
46
  )
@@ -67,7 +72,7 @@ result = client.place_order(order_data)
67
72
  author="Opinion Labs",
68
73
  author_email="support@opinion.trade",
69
74
  url="https://opinion.trade",
70
- keywords=["PredictionMarket", "CLOB", "Trading", "Blockchain", "Base", "Opinion"],
75
+ keywords=["PredictionMarket", "CLOB", "Trading", "Blockchain", "BNBChain", "BSC", "Opinion"],
71
76
  install_requires=[
72
77
  "urllib3 >= 2.3.0",
73
78
  "six >= 1.17.0",
@@ -95,7 +100,7 @@ result = client.place_order(order_data)
95
100
  include_package_data=True,
96
101
  python_requires=">=3.8",
97
102
  classifiers=[
98
- "Development Status :: 4 - Beta",
103
+ "Development Status :: 5 - Production/Stable",
99
104
  "Intended Audience :: Developers",
100
105
  "Topic :: Software Development :: Libraries :: Python Modules",
101
106
  "License :: OSI Approved :: MIT License",
@@ -33,7 +33,7 @@ def client():
33
33
  return Client(
34
34
  host='https://api.opinion.trade',
35
35
  apikey=api_key,
36
- chain_id=8453, # Base mainnet
36
+ chain_id=56, # BNB Chain mainnet
37
37
  rpc_url=rpc_url,
38
38
  private_key=private_key,
39
39
  multi_sig_addr=multi_sig_addr
@@ -9,16 +9,16 @@ class TestClientInitialization:
9
9
 
10
10
  def test_client_initialization_with_valid_chain_id(self):
11
11
  """Test client initialization with valid chain ID"""
12
- # Test Base mainnet
12
+ # Test BNB Chain mainnet
13
13
  client = Client(
14
14
  host='https://api.opinion.trade',
15
15
  apikey='test_key',
16
- chain_id=8453,
17
- rpc_url='https://mainnet.base.org',
16
+ chain_id=56,
17
+ rpc_url='https://bsc-dataseed.binance.org',
18
18
  private_key='0x' + '0' * 64,
19
19
  multi_sig_addr='0x' + '0' * 40
20
20
  )
21
- assert client.chain_id == 8453
21
+ assert client.chain_id == 56
22
22
 
23
23
  def test_client_initialization_with_invalid_chain_id(self):
24
24
  """Test client initialization with invalid chain ID"""
@@ -27,7 +27,7 @@ class TestClientInitialization:
27
27
  host='https://api.opinion.trade',
28
28
  apikey='test_key',
29
29
  chain_id=1, # Invalid chain ID
30
- rpc_url='https://mainnet.base.org',
30
+ rpc_url='https://bsc-dataseed.binance.org',
31
31
  private_key='0x' + '0' * 64,
32
32
  multi_sig_addr='0x' + '0' * 40
33
33
  )
@@ -44,8 +44,8 @@ class TestMarketQueries:
44
44
  client = Client(
45
45
  host='https://api.opinion.trade',
46
46
  apikey='test_key',
47
- chain_id=8453,
48
- rpc_url='https://mainnet.base.org',
47
+ chain_id=56,
48
+ rpc_url='https://bsc-dataseed.binance.org',
49
49
  private_key='0x' + '0' * 64,
50
50
  multi_sig_addr='0x' + '0' * 40
51
51
  )
@@ -67,8 +67,8 @@ class TestMarketQueries:
67
67
  client = Client(
68
68
  host='https://api.opinion.trade',
69
69
  apikey='test_key',
70
- chain_id=8453,
71
- rpc_url='https://mainnet.base.org',
70
+ chain_id=56,
71
+ rpc_url='https://bsc-dataseed.binance.org',
72
72
  private_key='0x' + '0' * 64,
73
73
  multi_sig_addr='0x' + '0' * 40
74
74
  )
@@ -84,8 +84,8 @@ class TestMarketQueries:
84
84
  client = Client(
85
85
  host='https://api.opinion.trade',
86
86
  apikey='test_key',
87
- chain_id=8453,
88
- rpc_url='https://mainnet.base.org',
87
+ chain_id=56,
88
+ rpc_url='https://bsc-dataseed.binance.org',
89
89
  private_key='0x' + '0' * 64,
90
90
  multi_sig_addr='0x' + '0' * 40
91
91
  )
@@ -101,8 +101,8 @@ class TestMarketQueries:
101
101
  client = Client(
102
102
  host='https://api.opinion.trade',
103
103
  apikey='test_key',
104
- chain_id=8453,
105
- rpc_url='https://mainnet.base.org',
104
+ chain_id=56,
105
+ rpc_url='https://bsc-dataseed.binance.org',
106
106
  private_key='0x' + '0' * 64,
107
107
  multi_sig_addr='0x' + '0' * 40
108
108
  )
@@ -122,8 +122,8 @@ class TestTokenQueries:
122
122
  client = Client(
123
123
  host='https://api.opinion.trade',
124
124
  apikey='test_key',
125
- chain_id=8453,
126
- rpc_url='https://mainnet.base.org',
125
+ chain_id=56,
126
+ rpc_url='https://bsc-dataseed.binance.org',
127
127
  private_key='0x' + '0' * 64,
128
128
  multi_sig_addr='0x' + '0' * 40
129
129
  )
@@ -139,8 +139,8 @@ class TestTokenQueries:
139
139
  client = Client(
140
140
  host='https://api.opinion.trade',
141
141
  apikey='test_key',
142
- chain_id=8453,
143
- rpc_url='https://mainnet.base.org',
142
+ chain_id=56,
143
+ rpc_url='https://bsc-dataseed.binance.org',
144
144
  private_key='0x' + '0' * 64,
145
145
  multi_sig_addr='0x' + '0' * 40
146
146
  )
@@ -163,8 +163,8 @@ class TestTokenQueries:
163
163
  client = Client(
164
164
  host='https://api.opinion.trade',
165
165
  apikey='test_key',
166
- chain_id=8453,
167
- rpc_url='https://mainnet.base.org',
166
+ chain_id=56,
167
+ rpc_url='https://bsc-dataseed.binance.org',
168
168
  private_key='0x' + '0' * 64,
169
169
  multi_sig_addr='0x' + '0' * 40
170
170
  )
@@ -191,8 +191,8 @@ class TestUserQueries:
191
191
  client = Client(
192
192
  host='https://api.opinion.trade',
193
193
  apikey='test_key',
194
- chain_id=8453,
195
- rpc_url='https://mainnet.base.org',
194
+ chain_id=56,
195
+ rpc_url='https://bsc-dataseed.binance.org',
196
196
  private_key='0x' + '0' * 64,
197
197
  multi_sig_addr='0x' + '0' * 40
198
198
  )
@@ -208,8 +208,8 @@ class TestUserQueries:
208
208
  client = Client(
209
209
  host='https://api.opinion.trade',
210
210
  apikey='test_key',
211
- chain_id=8453,
212
- rpc_url='https://mainnet.base.org',
211
+ chain_id=56,
212
+ rpc_url='https://bsc-dataseed.binance.org',
213
213
  private_key='0x' + '0' * 64,
214
214
  multi_sig_addr='0x' + '0' * 40
215
215
  )
@@ -225,8 +225,8 @@ class TestUserQueries:
225
225
  client = Client(
226
226
  host='https://api.opinion.trade',
227
227
  apikey='test_key',
228
- chain_id=8453,
229
- rpc_url='https://mainnet.base.org',
228
+ chain_id=56,
229
+ rpc_url='https://bsc-dataseed.binance.org',
230
230
  private_key='0x' + '0' * 64,
231
231
  multi_sig_addr='0x' + '0' * 40
232
232
  )
@@ -242,8 +242,8 @@ class TestUserQueries:
242
242
  client = Client(
243
243
  host='https://api.opinion.trade',
244
244
  apikey='test_key',
245
- chain_id=8453,
246
- rpc_url='https://mainnet.base.org',
245
+ chain_id=56,
246
+ rpc_url='https://bsc-dataseed.binance.org',
247
247
  private_key='0x' + '0' * 64,
248
248
  multi_sig_addr='0x' + '0' * 40
249
249
  )
@@ -267,8 +267,8 @@ class TestOrderOperations:
267
267
  client = Client(
268
268
  host='https://api.opinion.trade',
269
269
  apikey='test_key',
270
- chain_id=8453,
271
- rpc_url='https://mainnet.base.org',
270
+ chain_id=56,
271
+ rpc_url='https://bsc-dataseed.binance.org',
272
272
  private_key='0x' + '0' * 64,
273
273
  multi_sig_addr='0x' + '0' * 40
274
274
  )
@@ -1,4 +0,0 @@
1
- # Configuration constants for Opinion CLOB SDK
2
-
3
- # Supported chain IDs
4
- SUPPORTED_CHAIN_IDS = [8453, 10143] # Base mainnet and Base testnet