opinion-clob-sdk 0.1.0__py3-none-any.whl → 0.1.1__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.

Potentially problematic release.


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

Files changed (48) hide show
  1. opinion_clob_sdk/__init__.py +26 -0
  2. opinion_clob_sdk/config.py +4 -0
  3. opinion_clob_sdk/model.py +19 -0
  4. opinion_clob_sdk/sdk.py +940 -0
  5. {opinion_clob_sdk-0.1.0.dist-info → opinion_clob_sdk-0.1.1.dist-info}/METADATA +1 -1
  6. opinion_clob_sdk-0.1.1.dist-info/RECORD +46 -0
  7. opinion_clob_sdk-0.1.1.dist-info/top_level.txt +1 -0
  8. opinion_clob_sdk-0.1.0.dist-info/RECORD +0 -42
  9. opinion_clob_sdk-0.1.0.dist-info/top_level.txt +0 -1
  10. {chain → opinion_clob_sdk/chain}/__init__.py +0 -0
  11. {chain → opinion_clob_sdk/chain}/contract_caller.py +0 -0
  12. {chain → opinion_clob_sdk/chain}/contracts/__init__.py +0 -0
  13. {chain → opinion_clob_sdk/chain}/contracts/conditional_tokens.py +0 -0
  14. {chain → opinion_clob_sdk/chain}/contracts/erc20.py +0 -0
  15. {chain → opinion_clob_sdk/chain}/exception.py +0 -0
  16. {chain → opinion_clob_sdk/chain}/py_order_utils/__init__.py +0 -0
  17. {chain → opinion_clob_sdk/chain}/py_order_utils/builders/__init__.py +0 -0
  18. {chain → opinion_clob_sdk/chain}/py_order_utils/builders/base_builder.py +0 -0
  19. {chain → opinion_clob_sdk/chain}/py_order_utils/builders/exception.py +0 -0
  20. {chain → opinion_clob_sdk/chain}/py_order_utils/builders/order_builder.py +0 -0
  21. {chain → opinion_clob_sdk/chain}/py_order_utils/builders/order_builder_test.py +0 -0
  22. {chain → opinion_clob_sdk/chain}/py_order_utils/constants.py +0 -0
  23. {chain → opinion_clob_sdk/chain}/py_order_utils/model/__init__.py +0 -0
  24. {chain → opinion_clob_sdk/chain}/py_order_utils/model/order.py +0 -0
  25. {chain → opinion_clob_sdk/chain}/py_order_utils/model/order_type.py +0 -0
  26. {chain → opinion_clob_sdk/chain}/py_order_utils/model/sides.py +0 -0
  27. {chain → opinion_clob_sdk/chain}/py_order_utils/model/signatures.py +0 -0
  28. {chain → opinion_clob_sdk/chain}/py_order_utils/signer.py +0 -0
  29. {chain → opinion_clob_sdk/chain}/py_order_utils/utils.py +0 -0
  30. {chain → opinion_clob_sdk/chain}/safe/__init__.py +0 -0
  31. {chain → opinion_clob_sdk/chain}/safe/constants.py +0 -0
  32. {chain → opinion_clob_sdk/chain}/safe/eip712/__init__.py +0 -0
  33. {chain → opinion_clob_sdk/chain}/safe/enums.py +0 -0
  34. {chain → opinion_clob_sdk/chain}/safe/exceptions.py +0 -0
  35. {chain → opinion_clob_sdk/chain}/safe/multisend.py +0 -0
  36. {chain → opinion_clob_sdk/chain}/safe/safe.py +0 -0
  37. {chain → opinion_clob_sdk/chain}/safe/safe_contracts/__init__.py +0 -0
  38. {chain → opinion_clob_sdk/chain}/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py +0 -0
  39. {chain → opinion_clob_sdk/chain}/safe/safe_contracts/multisend_v1_3_0.py +0 -0
  40. {chain → opinion_clob_sdk/chain}/safe/safe_contracts/safe_v1_3_0.py +0 -0
  41. {chain → opinion_clob_sdk/chain}/safe/safe_contracts/utils.py +0 -0
  42. {chain → opinion_clob_sdk/chain}/safe/safe_signature.py +0 -0
  43. {chain → opinion_clob_sdk/chain}/safe/safe_test.py +0 -0
  44. {chain → opinion_clob_sdk/chain}/safe/safe_tx.py +0 -0
  45. {chain → opinion_clob_sdk/chain}/safe/signatures.py +0 -0
  46. {chain → opinion_clob_sdk/chain}/safe/typing.py +0 -0
  47. {chain → opinion_clob_sdk/chain}/safe/utils.py +0 -0
  48. {opinion_clob_sdk-0.1.0.dist-info → opinion_clob_sdk-0.1.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,26 @@
1
+ """Opinion CLOB SDK - Python SDK for Opinion Prediction Market CLOB API"""
2
+
3
+ from opinion_clob_sdk.sdk import (
4
+ Client,
5
+ CHAIN_ID_BASE_MAINNET,
6
+ SUPPORTED_CHAIN_IDS
7
+ )
8
+ from opinion_clob_sdk.model import TopicStatus, TopicType, TopicStatusFilter
9
+ from opinion_clob_sdk.chain.exception import (
10
+ BalanceNotEnough,
11
+ NoPositionsToRedeem,
12
+ InsufficientGasBalance
13
+ )
14
+
15
+ __version__ = "0.1.1"
16
+ __all__ = [
17
+ "Client",
18
+ "TopicStatus",
19
+ "TopicType",
20
+ "TopicStatusFilter",
21
+ "CHAIN_ID_BASE_MAINNET",
22
+ "SUPPORTED_CHAIN_IDS",
23
+ "BalanceNotEnough",
24
+ "NoPositionsToRedeem",
25
+ "InsufficientGasBalance"
26
+ ]
@@ -0,0 +1,4 @@
1
+ # Configuration constants for Opinion CLOB SDK
2
+
3
+ # Supported chain IDs
4
+ SUPPORTED_CHAIN_IDS = [8453, 10143] # Base mainnet and Base testnet
@@ -0,0 +1,19 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TopicStatus(Enum):
5
+ CREATED = 1
6
+ ACTIVATED = 2
7
+ RESOLVING = 3
8
+ RESOLVED = 4
9
+ FAILED = 5
10
+ DELETED = 6
11
+
12
+ class TopicType(Enum):
13
+ CATEGORICAL = 1
14
+ BINARY = 0
15
+
16
+ class TopicStatusFilter(Enum):
17
+ ALL = 0
18
+ ACTIVATED = 2
19
+ RESOLVED = 4
@@ -0,0 +1,940 @@
1
+ from typing import List, Optional, Dict, Any, Tuple
2
+ import logging
3
+ import math
4
+ from time import time
5
+ from decimal import Decimal
6
+
7
+ from eth_typing import ChecksumAddress, HexStr
8
+ from opinion_api.api.prediction_market_api import PredictionMarketApi
9
+ from opinion_api.api.user_api import UserApi
10
+ from opinion_api.api_client import ApiClient
11
+ from opinion_api.configuration import Configuration
12
+ from opinion_clob_sdk.chain.safe.utils import fast_to_checksum_address
13
+ from .chain.contract_caller import ContractCaller
14
+ from .chain.py_order_utils.builders.order_builder import OrderBuilder
15
+ from .chain.py_order_utils.model.order import OrderDataInput, OrderData, PlaceOrderDataInput
16
+ from .chain.py_order_utils.constants import ZERO_ADDRESS, ZX
17
+ from .chain.py_order_utils.model.signatures import POLY_GNOSIS_SAFE
18
+ from .chain.py_order_utils.model.sides import BUY, SELL, OrderSide
19
+ from .chain.py_order_utils.model.order_type import LIMIT_ORDER, MARKET_ORDER
20
+ from .model import TopicStatus, TopicStatusFilter, TopicType
21
+ from .chain.py_order_utils.utils import calculate_order_amounts
22
+
23
+ API_INTERNAL_ERROR_MSG = "Unable to process your request. Please contact technical support."
24
+ MISSING_MARKET_ID_MSG = "market_id is required."
25
+ MISSING_TOKEN_ID_MSG = "token_id is required."
26
+ MAX_DECIMALS = 18 # Standard maximum for ERC20 tokens (ETH, DAI, etc.)
27
+
28
+ # Supported blockchain chain IDs
29
+ CHAIN_ID_BASE_MAINNET = 8453 # Base mainnet
30
+ SUPPORTED_CHAIN_IDS = [CHAIN_ID_BASE_MAINNET]
31
+
32
+ class InvalidParamError(Exception):
33
+ pass
34
+
35
+ class OpenApiError(Exception):
36
+ pass
37
+
38
+ def safe_amount_to_wei(amount: float, decimals: int) -> int:
39
+ """
40
+ Safely convert human-readable amount to wei units without precision loss.
41
+
42
+ Args:
43
+ amount: Human-readable amount (e.g., 1.5 for 1.5 tokens)
44
+ decimals: Token decimals (e.g., 6 for USDC, 18 for ETH)
45
+
46
+ Returns:
47
+ Integer amount in wei units
48
+
49
+ Raises:
50
+ InvalidParamError: If amount or decimals are invalid
51
+ """
52
+ if amount <= 0:
53
+ raise InvalidParamError(f"Amount must be positive, got: {amount}")
54
+
55
+ if decimals < 0 or decimals > MAX_DECIMALS:
56
+ raise InvalidParamError(f"Decimals must be between 0 and {MAX_DECIMALS}, got: {decimals}")
57
+
58
+ # Use Decimal for exact calculation
59
+ amount_decimal = Decimal(str(amount))
60
+ multiplier = Decimal(10) ** decimals
61
+
62
+ result_decimal = amount_decimal * multiplier
63
+
64
+ # Convert to int
65
+ result = int(result_decimal)
66
+
67
+ # Validate result fits in uint256
68
+ if result >= 2**256:
69
+ raise InvalidParamError(f"Amount too large for uint256: {result}")
70
+
71
+ if result <= 0:
72
+ raise InvalidParamError(f"Calculated amount is zero or negative: {result}")
73
+
74
+ return result
75
+
76
+ class Client:
77
+ def __init__(
78
+ self,
79
+ host: str = '',
80
+ apikey: str = '',
81
+ chain_id: Optional[int] = None,
82
+ rpc_url: str = '',
83
+ private_key: HexStr = HexStr(''),
84
+ multi_sig_addr: str = '',
85
+ conditional_tokens_addr: ChecksumAddress = ChecksumAddress(''),
86
+ multisend_addr: ChecksumAddress = ChecksumAddress(''),
87
+ enable_trading_check_interval: int = 3600,
88
+ quote_tokens_cache_ttl: int = 3600,
89
+ market_cache_ttl: int = 300
90
+ ) -> None:
91
+ """
92
+ Initialize the Opinion CLOB SDK client.
93
+
94
+ Args:
95
+ host: API host URL
96
+ apikey: API authentication key
97
+ chain_id: Blockchain chain ID (8453 for Base mainnet)
98
+ rpc_url: RPC endpoint URL
99
+ private_key: Private key for signing transactions
100
+ multi_sig_addr: Multi-signature wallet address
101
+ conditional_tokens_addr: Conditional tokens contract address
102
+ multisend_addr: Multisend contract address
103
+ enable_trading_check_interval: Time interval (in seconds) to cache enable_trading checks.
104
+ Default is 3600 (1 hour). Set to 0 to check every time.
105
+ This significantly improves performance for frequent operations.
106
+ quote_tokens_cache_ttl: Time interval (in seconds) to cache quote tokens data.
107
+ Default is 3600 (1 hour). Set to 0 to disable caching.
108
+ market_cache_ttl: Time interval (in seconds) to cache market data.
109
+ Default is 300 (5 minutes). Set to 0 to disable caching.
110
+ """
111
+ self.conf = Configuration(host=host)
112
+ self.conf.api_key['ApiKeyAuth'] = apikey
113
+ multi_sig_addr = fast_to_checksum_address(multi_sig_addr)
114
+ self.contract_caller = ContractCaller(rpc_url=rpc_url, private_key=private_key, multi_sig_addr=multi_sig_addr,
115
+ conditional_tokens_addr=conditional_tokens_addr,
116
+ multisend_addr=multisend_addr,
117
+ enable_trading_check_interval=enable_trading_check_interval)
118
+ self.api_client = ApiClient(self.conf)
119
+ self.market_api = PredictionMarketApi(self.api_client)
120
+ self.user_api = UserApi(self.api_client)
121
+ # Validate and set chain_id
122
+ if chain_id not in SUPPORTED_CHAIN_IDS:
123
+ raise InvalidParamError(f'chain_id must be one of {SUPPORTED_CHAIN_IDS}')
124
+ self.chain_id = chain_id
125
+
126
+ # Cache configuration
127
+ self.quote_tokens_cache_ttl = quote_tokens_cache_ttl
128
+ self.market_cache_ttl = market_cache_ttl
129
+ self._quote_tokens_cache: Optional[Any] = None
130
+ self._quote_tokens_cache_time: float = 0
131
+ self._market_cache: Dict[int, Tuple[Any, float]] = {} # market_id -> (data, timestamp)
132
+
133
+ def _validate_market_response(self, response: Any, operation_name: str = "operation") -> Any:
134
+ """Validate and extract market data from API response"""
135
+ if hasattr(response, 'errno') and response.errno != 0:
136
+ raise OpenApiError(f"Failed to {operation_name}: {response}")
137
+
138
+ if not hasattr(response, 'result') or not hasattr(response.result, 'data'):
139
+ raise OpenApiError(f"Invalid response format for {operation_name}")
140
+
141
+ return response.result.data
142
+
143
+ def _parse_list_response(self, response: Any, operation_name: str = "operation") -> List[Any]:
144
+ """Parse response that contains a list"""
145
+ if hasattr(response, 'errno') and response.errno != 0:
146
+ raise OpenApiError(f"Failed to {operation_name}: {response}")
147
+
148
+ if not hasattr(response, 'result') or not hasattr(response.result, 'list'):
149
+ raise OpenApiError(f"Invalid list response format for {operation_name}")
150
+
151
+ return response.result.list
152
+
153
+ def enable_trading(self) -> Tuple[Any, Any, Any]:
154
+ quote_token_list_response = self.get_quote_tokens()
155
+ quote_token_list = self._parse_list_response(quote_token_list_response, "get quote tokens")
156
+
157
+ supported_quote_tokens: dict = {}
158
+
159
+ # for each quote token, check if the chain_id is the same as the chain_id in the contract_caller
160
+ for quote_token in quote_token_list:
161
+ quote_token_address = fast_to_checksum_address(quote_token.currency_address)
162
+ ctf_exchange_address = fast_to_checksum_address(quote_token.ctfexchange_address)
163
+ supported_quote_tokens[quote_token_address] = ctf_exchange_address
164
+
165
+ logging.info(f'Supported quote tokens: {supported_quote_tokens}')
166
+ if len(supported_quote_tokens) == 0:
167
+ raise OpenApiError('No supported quote tokens found')
168
+ return self.contract_caller.enable_trading(supported_quote_tokens)
169
+
170
+ def split(self, market_id: int, amount: int, check_approval: bool = True) -> Tuple[Any, Any, Any]:
171
+ """Split collateral into outcome tokens for a market.
172
+
173
+ Args:
174
+ market_id: The market ID to split tokens for (required)
175
+ amount: Amount of collateral to split in wei (required)
176
+ check_approval: Whether to check and enable trading approvals first
177
+ """
178
+ if not market_id or market_id <= 0:
179
+ raise InvalidParamError("market_id must be a positive integer")
180
+ if not amount or amount <= 0:
181
+ raise InvalidParamError("amount must be a positive integer")
182
+
183
+ # Enable trading first for all trade operations.
184
+ if check_approval:
185
+ self.enable_trading()
186
+
187
+ topic_detail = self.get_market(market_id)
188
+ market_data = self._validate_market_response(topic_detail, "get market for split")
189
+
190
+ if int(market_data.chain_id) != self.chain_id:
191
+ raise OpenApiError('Cannot split on different chain')
192
+
193
+ status = market_data.status
194
+ if not (status == TopicStatus.ACTIVATED.value or status == TopicStatus.RESOLVED.value or status == TopicStatus.RESOLVING.value):
195
+ raise OpenApiError('Cannot split on non-activated/resolving/resolved market')
196
+ collateral = fast_to_checksum_address(market_data.currency_address)
197
+ condition_id = market_data.condition_id
198
+
199
+ return self.contract_caller.split(collateral_token=collateral, condition_id=bytes.fromhex(condition_id), amount=amount)
200
+
201
+ def merge(self, market_id: int, amount: int, check_approval: bool = True) -> Tuple[Any, Any, Any]:
202
+ """Merge outcome tokens back into collateral for a market.
203
+
204
+ Args:
205
+ market_id: The market ID to merge tokens for (required)
206
+ amount: Amount of outcome tokens to merge in wei (required)
207
+ check_approval: Whether to check and enable trading approvals first
208
+ """
209
+ if not market_id or market_id <= 0:
210
+ raise InvalidParamError("market_id must be a positive integer")
211
+ if not amount or amount <= 0:
212
+ raise InvalidParamError("amount must be a positive integer")
213
+
214
+ # Enable trading first for all trade operations.
215
+ if check_approval:
216
+ self.enable_trading()
217
+
218
+ topic_detail = self.get_market(market_id)
219
+ market_data = self._validate_market_response(topic_detail, "get market for merge")
220
+
221
+ if int(market_data.chain_id) != self.chain_id:
222
+ raise OpenApiError('Cannot merge on different chain')
223
+
224
+ status = market_data.status
225
+ if not (status == TopicStatus.ACTIVATED.value or status == TopicStatus.RESOLVED.value or status == TopicStatus.RESOLVING.value):
226
+ raise OpenApiError('Cannot merge on non-activated/resolving/resolved market')
227
+ collateral = fast_to_checksum_address(market_data.currency_address)
228
+ condition_id = market_data.condition_id
229
+
230
+ return self.contract_caller.merge(collateral_token=collateral, condition_id=bytes.fromhex(condition_id),
231
+ amount=amount)
232
+
233
+ def redeem(self, market_id: int, check_approval: bool = True) -> Tuple[Any, Any, Any]:
234
+ """Redeem winning outcome tokens for collateral after market resolution.
235
+
236
+ Args:
237
+ market_id: The market ID to redeem tokens for (required)
238
+ check_approval: Whether to check and enable trading approvals first
239
+ """
240
+ if not market_id or market_id <= 0:
241
+ raise InvalidParamError("market_id must be a positive integer")
242
+
243
+ # Enable trading first for all trade operations.
244
+ if check_approval:
245
+ self.enable_trading()
246
+
247
+ topic_detail = self.get_market(market_id)
248
+ market_data = self._validate_market_response(topic_detail, "get market for redeem")
249
+
250
+ if int(market_data.chain_id) != self.chain_id:
251
+ raise OpenApiError('Cannot redeem on different chain')
252
+
253
+ status = market_data.status
254
+ if not status == TopicStatus.RESOLVED.value:
255
+ raise OpenApiError('Cannot redeem on non-resolved market')
256
+ collateral = market_data.currency_address
257
+ condition_id = market_data.condition_id
258
+ logging.info(f'Redeem: collateral={collateral}, condition_id={condition_id}')
259
+ return self.contract_caller.redeem(collateral_token=collateral, condition_id=bytes.fromhex(condition_id))
260
+
261
+ def get_quote_tokens(self, use_cache: bool = True) -> Any:
262
+ """Get list of supported quote tokens
263
+
264
+ Args:
265
+ use_cache: Whether to use cached data if available (default True).
266
+ Set to False to force a fresh API call.
267
+ """
268
+ current_time = time()
269
+
270
+ # Check cache if enabled
271
+ if use_cache and self.quote_tokens_cache_ttl > 0:
272
+ if self._quote_tokens_cache is not None:
273
+ cache_age = current_time - self._quote_tokens_cache_time
274
+ if cache_age < self.quote_tokens_cache_ttl:
275
+ logging.debug(f"Using cached quote tokens (age: {cache_age:.1f}s)")
276
+ return self._quote_tokens_cache
277
+
278
+ # Fetch fresh data
279
+ logging.debug("Fetching fresh quote tokens from API")
280
+ result = self.market_api.openapi_quote_token_get(chain_id=self.chain_id)
281
+
282
+ # Update cache
283
+ if self.quote_tokens_cache_ttl > 0:
284
+ self._quote_tokens_cache = result
285
+ self._quote_tokens_cache_time = current_time
286
+
287
+ return result
288
+
289
+ # Deprecated: use get_quote_tokens() instead
290
+ def get_currencies(self) -> Any:
291
+ """Deprecated: Use get_quote_tokens() instead"""
292
+ return self.get_quote_tokens()
293
+
294
+ def get_markets(
295
+ self,
296
+ topic_type: Optional[TopicType] = None,
297
+ page: int = 1,
298
+ limit: int = 20,
299
+ status: Optional[TopicStatusFilter] = None
300
+ ) -> Any:
301
+ """Get markets with pagination support.
302
+
303
+ Args:
304
+ topic_type: Optional filter by topic type
305
+ page: Page number (>= 1)
306
+ limit: Number of items per page (1-20)
307
+ status: Optional filter by status
308
+ """
309
+ if page < 1:
310
+ raise InvalidParamError("page must be >= 1")
311
+ if not 1 <= limit <= 20:
312
+ raise InvalidParamError("limit must be between 1 and 20")
313
+
314
+ result = self.market_api.openapi_market_get(
315
+ topic_type=topic_type.value if topic_type else None,
316
+ page=page,
317
+ limit=limit,
318
+ chain_id=self.chain_id,
319
+ status=status.value if status else None
320
+ )
321
+ return result
322
+
323
+ def get_market(self, market_id, use_cache: bool = True):
324
+ """Get detailed information about a specific market
325
+
326
+ Args:
327
+ market_id: The market ID to query
328
+ use_cache: Whether to use cached data if available (default True).
329
+ Set to False to force a fresh API call.
330
+ """
331
+ try:
332
+ if not market_id:
333
+ raise InvalidParamError(MISSING_MARKET_ID_MSG)
334
+
335
+ current_time = time()
336
+
337
+ # Check cache if enabled
338
+ if use_cache and self.market_cache_ttl > 0:
339
+ if market_id in self._market_cache:
340
+ cached_data, cache_time = self._market_cache[market_id]
341
+ cache_age = current_time - cache_time
342
+ if cache_age < self.market_cache_ttl:
343
+ logging.debug(f"Using cached market {market_id} (age: {cache_age:.1f}s)")
344
+ return cached_data
345
+
346
+ # Fetch fresh data
347
+ logging.debug(f"Fetching fresh market {market_id} from API")
348
+ result = self.market_api.openapi_market_market_id_get(market_id)
349
+
350
+ # Update cache
351
+ if self.market_cache_ttl > 0:
352
+ self._market_cache[market_id] = (result, current_time)
353
+
354
+ return result
355
+ except InvalidParamError as e:
356
+ logging.error(f"Validation error: {e}")
357
+ raise
358
+ except Exception as e:
359
+ logging.error(f"API error: {e}")
360
+ raise OpenApiError(f"Failed to get market: {e}")
361
+
362
+ def get_categorical_market(self, market_id):
363
+ """Get detailed information about a categorical market"""
364
+ try:
365
+ if not market_id:
366
+ raise InvalidParamError(MISSING_MARKET_ID_MSG)
367
+
368
+ result = self.market_api.openapi_market_categorical_market_id_get(market_id)
369
+ return result
370
+ except InvalidParamError as e:
371
+ logging.error(f"Validation error: {e}")
372
+ raise
373
+ except Exception as e:
374
+ logging.error(f"API error: {e}")
375
+ raise OpenApiError(f"Failed to get categorical market: {e}")
376
+
377
+ def get_price_history(self, token_id, interval="1hour", start_time=int(time()), bars=60):
378
+ """Get price history/candlestick data for a token"""
379
+ try:
380
+ if not token_id:
381
+ raise InvalidParamError(MISSING_TOKEN_ID_MSG)
382
+
383
+ if not interval:
384
+ raise InvalidParamError('interval is required')
385
+
386
+ result = self.market_api.openapi_token_price_history_get(
387
+ token_id,
388
+ interval=interval,
389
+ start_time=start_time,
390
+ bars=bars
391
+ )
392
+ return result
393
+ except InvalidParamError as e:
394
+ logging.error(f"Validation error: {e}")
395
+ raise
396
+ except Exception as e:
397
+ logging.error(f"API error: {e}")
398
+ raise OpenApiError(f"Failed to get price history: {e}")
399
+
400
+ def get_orderbook(self, token_id):
401
+ """Get orderbook for a specific token"""
402
+ try:
403
+ if not token_id:
404
+ raise InvalidParamError(MISSING_TOKEN_ID_MSG)
405
+
406
+ result = self.market_api.openapi_token_orderbook_get(token_id)
407
+ return result
408
+ except InvalidParamError as e:
409
+ logging.error(f"Validation error: {e}")
410
+ raise
411
+ except Exception as e:
412
+ logging.error(f"API error: {e}")
413
+ raise OpenApiError(f"Failed to get orderbook: {e}")
414
+
415
+ def get_latest_price(self, token_id):
416
+ """Get latest price for a token"""
417
+ try:
418
+ if not token_id:
419
+ raise InvalidParamError(MISSING_TOKEN_ID_MSG)
420
+
421
+ result = self.market_api.openapi_token_latest_price_get(token_id)
422
+ return result
423
+ except InvalidParamError as e:
424
+ logging.error(f"Validation error: {e}")
425
+ raise
426
+ except Exception as e:
427
+ logging.error(f"API error: {e}")
428
+ raise OpenApiError(f"Failed to get latest price: {e}")
429
+
430
+ def get_fee_rates(self, token_id):
431
+ """Get fee rates for a token"""
432
+ try:
433
+ if not token_id:
434
+ raise InvalidParamError(MISSING_TOKEN_ID_MSG)
435
+
436
+ result = self.market_api.openapi_token_fee_rates_get(token_id)
437
+ return result
438
+ except InvalidParamError as e:
439
+ logging.error(f"Validation error: {e}")
440
+ raise
441
+ except Exception as e:
442
+ logging.error(f"API error: {e}")
443
+ raise OpenApiError(f"Failed to get fee rates: {e}")
444
+
445
+ def _place_order(self, data: OrderDataInput, exchange_addr='', chain_id=0, currency_addr='', currency_decimal=0, check_approval=False):
446
+ if check_approval:
447
+ self.enable_trading()
448
+ try:
449
+ if not exchange_addr:
450
+ raise InvalidParamError('exchange_addr is required')
451
+
452
+ # Validate currency_decimal to prevent overflow
453
+ if currency_decimal < 0:
454
+ raise InvalidParamError(f'currency_decimal must be non-negative, got: {currency_decimal}')
455
+ if currency_decimal > MAX_DECIMALS:
456
+ raise InvalidParamError(f'currency_decimal too large (max {MAX_DECIMALS}): {currency_decimal}')
457
+
458
+ chain_id = self.chain_id
459
+
460
+ builder = OrderBuilder(exchange_addr, chain_id, self.contract_caller.signer)
461
+ takerAmount = 0
462
+
463
+ if data.orderType == MARKET_ORDER:
464
+ takerAmount = 0
465
+ data.price = "0"
466
+ # Use safe conversion to avoid precision loss
467
+ recalculated_maker_amount = safe_amount_to_wei(data.makerAmount, currency_decimal)
468
+ if data.orderType == LIMIT_ORDER:
469
+ # Use safe conversion to avoid precision loss
470
+ maker_amount_wei = safe_amount_to_wei(data.makerAmount, currency_decimal)
471
+ recalculated_maker_amount, takerAmount = calculate_order_amounts(
472
+ price=float(data.price),
473
+ maker_amount=maker_amount_wei,
474
+ side=data.side,
475
+ decimals=currency_decimal
476
+ )
477
+
478
+ order_data = OrderData(
479
+ maker=self.contract_caller.multi_sig_addr,
480
+ taker=ZERO_ADDRESS,
481
+ tokenId=data.tokenId,
482
+ makerAmount=recalculated_maker_amount,
483
+ takerAmount=takerAmount,
484
+ feeRateBps='0',
485
+ side=data.side,
486
+ signatureType=POLY_GNOSIS_SAFE,
487
+ signer=self.contract_caller.signer.address()
488
+ )
489
+ signerOrder = builder.build_signed_order(order_data)
490
+
491
+ order_dict = signerOrder.order.dict()
492
+
493
+ # Create V2AddOrderReq object for opinion_api
494
+ from opinion_api.models.v2_add_order_req import V2AddOrderReq
495
+
496
+ v2_add_order_req = V2AddOrderReq(
497
+ salt=str(order_dict['salt']),
498
+ topic_id=data.marketId,
499
+ maker=order_dict['maker'],
500
+ signer=order_dict['signer'],
501
+ taker=order_dict['taker'],
502
+ token_id=str(order_dict['tokenId']),
503
+ maker_amount=str(order_dict['makerAmount']),
504
+ taker_amount=str(order_dict['takerAmount']),
505
+ expiration=str(order_dict['expiration']),
506
+ nonce=str(order_dict['nonce']),
507
+ fee_rate_bps=str(order_dict['feeRateBps']),
508
+ side=str(order_dict['side']),
509
+ signature_type=str(order_dict['signatureType']),
510
+ signature=signerOrder.signature,
511
+ sign=signerOrder.signature,
512
+ contract_address="",
513
+ currency_address=currency_addr,
514
+ price=data.price,
515
+ trading_method=int(data.orderType),
516
+ timestamp=int(time()),
517
+ safe_rate='0',
518
+ order_exp_time='0'
519
+ )
520
+
521
+ result = self.market_api.openapi_order_post(v2_add_order_req=v2_add_order_req)
522
+ return result
523
+ except InvalidParamError as e:
524
+ logging.error(f"Validation error: {e}")
525
+ raise
526
+ except Exception as e:
527
+ logging.error(f"API error: {e}")
528
+ raise OpenApiError(f"Failed to place order: {e}")
529
+
530
+ def place_order(self, data: PlaceOrderDataInput, check_approval=False):
531
+ """Place an order on the market"""
532
+ quote_token_list_response = self.get_quote_tokens()
533
+ quote_token_list = self._parse_list_response(quote_token_list_response, "get quote tokens")
534
+
535
+ market_response = self.get_market(data.marketId)
536
+ market = self._validate_market_response(market_response, "get market for place order")
537
+
538
+ if int(market.chain_id) != self.chain_id:
539
+ raise OpenApiError('Cannot place order on different chain')
540
+
541
+ quote_token_addr = market.currency_address
542
+
543
+ # find quote token from quote_token_list by currency_address
544
+ quote_token = next((item for item in quote_token_list if str.lower(item.currency_address) == str.lower(quote_token_addr)), None)
545
+ if not quote_token:
546
+ raise OpenApiError('Quote token not found for this market')
547
+
548
+ exchange_addr = quote_token.ctfexchange_address
549
+ chain_id = quote_token.chain_id
550
+
551
+ makerAmount = 0
552
+ minimal_maker_amount = 1
553
+
554
+ # reject if market buy and makerAmountInBaseToken is provided
555
+ if(data.side == OrderSide.BUY and data.orderType == MARKET_ORDER and data.makerAmountInBaseToken):
556
+ raise InvalidParamError('makerAmountInBaseToken is not allowed for market buy')
557
+
558
+ # reject if market sell and makerAmountInQuoteToken is provided
559
+ if(data.side == OrderSide.SELL and data.orderType == MARKET_ORDER and data.makerAmountInQuoteToken):
560
+ raise InvalidParamError('makerAmountInQuoteToken is not allowed for market sell')
561
+
562
+ # Validate price for limit orders (prevent division by zero)
563
+ if data.orderType == LIMIT_ORDER:
564
+ try:
565
+ price_decimal = Decimal(str(data.price))
566
+ if price_decimal <= 0:
567
+ raise InvalidParamError(f'Price must be positive for limit orders, got: {data.price}')
568
+ except (ValueError, TypeError, InvalidParamError):
569
+ raise
570
+ except Exception as e:
571
+ raise InvalidParamError(f'Invalid price format: {data.price}') from e
572
+
573
+ # need amount to be in quote token
574
+ if(data.side == OrderSide.BUY):
575
+ # e.g. yes/no
576
+ if(data.makerAmountInBaseToken):
577
+ # Use Decimal for precise calculation to avoid floating point errors
578
+ base_amount = Decimal(str(data.makerAmountInBaseToken))
579
+ price_decimal = Decimal(str(data.price))
580
+ makerAmount = float(base_amount * price_decimal)
581
+ # makerAmountInBaseToken should be at least 1 otherwise throw error
582
+ if(float(data.makerAmountInBaseToken) < minimal_maker_amount):
583
+ raise InvalidParamError("makerAmountInBaseToken must be at least 1")
584
+ # e.g. usdc
585
+ elif(data.makerAmountInQuoteToken):
586
+ makerAmount = float(data.makerAmountInQuoteToken)
587
+ # makerAmountInQuoteToken should be at least 1 otherwise throw error
588
+ if(float(data.makerAmountInQuoteToken) < minimal_maker_amount):
589
+ raise InvalidParamError("makerAmountInQuoteToken must be at least 1")
590
+ else:
591
+ raise InvalidParamError("Either makerAmountInBaseToken or makerAmountInQuoteToken must be provided for BUY orders")
592
+
593
+ elif(data.side == OrderSide.SELL):
594
+ # e.g. yes/no
595
+ if(data.makerAmountInBaseToken):
596
+ makerAmount = float(data.makerAmountInBaseToken)
597
+ # makerAmountInBaseToken should be at least 1 otherwise throw error
598
+ if(float(data.makerAmountInBaseToken) < minimal_maker_amount):
599
+ raise InvalidParamError("makerAmountInBaseToken must be at least 1")
600
+ # e.g. usdc
601
+ elif(data.makerAmountInQuoteToken):
602
+ # Use Decimal for precise division to avoid floating point errors
603
+ quote_amount = Decimal(str(data.makerAmountInQuoteToken))
604
+ price_decimal = Decimal(str(data.price))
605
+ if price_decimal == 0:
606
+ raise InvalidParamError("Price cannot be zero for SELL orders with makerAmountInQuoteToken")
607
+ makerAmount = float(quote_amount / price_decimal)
608
+ # makerAmountInQuoteToken should be at least 1 otherwise throw error
609
+ if(float(data.makerAmountInQuoteToken) < minimal_maker_amount):
610
+ raise InvalidParamError("makerAmountInQuoteToken must be at least 1")
611
+ else:
612
+ raise InvalidParamError("Either makerAmountInBaseToken or makerAmountInQuoteToken must be provided for SELL orders")
613
+
614
+ # Final validation: ensure makerAmount was properly calculated
615
+ if makerAmount <= 0:
616
+ raise InvalidParamError(f"Calculated makerAmount must be positive, got: {makerAmount}")
617
+
618
+
619
+ input = OrderDataInput(
620
+ marketId=data.marketId,
621
+ tokenId=data.tokenId,
622
+ makerAmount=makerAmount,
623
+ price=data.price,
624
+ orderType=data.orderType,
625
+ side=data.side
626
+ )
627
+
628
+ return self._place_order(input, exchange_addr, chain_id, quote_token_addr, int(quote_token.decimal), check_approval)
629
+
630
+ def cancel_order(self, order_id):
631
+ """
632
+ Cancel an existing order.
633
+
634
+ Args:
635
+ order_id: Order ID to cancel (str)
636
+
637
+ Returns:
638
+ API response for order cancellation
639
+ """
640
+ if not order_id or not isinstance(order_id, str):
641
+ raise InvalidParamError('order_id must be a non-empty string')
642
+
643
+ from opinion_api.models.openapi_cancel_order_request_open_api import OpenapiCancelOrderRequestOpenAPI
644
+
645
+ # Internally use trans_no for API compatibility
646
+ request_body = OpenapiCancelOrderRequestOpenAPI(trans_no=order_id)
647
+ result = self.market_api.openapi_order_cancel_post(openapi_cancel_order_request_open_api=request_body)
648
+ return result
649
+
650
+ def place_orders_batch(self, orders: List[PlaceOrderDataInput], check_approval: bool = False) -> List[Any]:
651
+ """
652
+ Place multiple orders in batch to reduce API calls.
653
+
654
+ Args:
655
+ orders: List of PlaceOrderDataInput objects
656
+ check_approval: Whether to check and enable trading approvals first (done once for all orders)
657
+
658
+ Returns:
659
+ List of order placement results
660
+
661
+ Raises:
662
+ InvalidParamError: If orders list is empty or invalid
663
+ """
664
+ if not orders or not isinstance(orders, list):
665
+ raise InvalidParamError('orders must be a non-empty list')
666
+
667
+ if len(orders) == 0:
668
+ raise InvalidParamError('orders list cannot be empty')
669
+
670
+ # Enable trading once for all orders if needed
671
+ if check_approval:
672
+ self.enable_trading()
673
+
674
+ results = []
675
+ errors = []
676
+
677
+ for i, order in enumerate(orders):
678
+ try:
679
+ # Place each order without checking approval again
680
+ result = self.place_order(order, check_approval=False)
681
+ results.append({
682
+ 'index': i,
683
+ 'success': True,
684
+ 'result': result,
685
+ 'order': order
686
+ })
687
+ except Exception as e:
688
+ logging.error(f"Failed to place order at index {i}: {e}")
689
+ errors.append({
690
+ 'index': i,
691
+ 'success': False,
692
+ 'error': str(e),
693
+ 'order': order
694
+ })
695
+ results.append({
696
+ 'index': i,
697
+ 'success': False,
698
+ 'error': str(e),
699
+ 'order': order
700
+ })
701
+
702
+ if errors:
703
+ logging.warning(f"Batch order placement completed with {len(errors)} errors out of {len(orders)} orders")
704
+
705
+ return results
706
+
707
+ def cancel_orders_batch(self, order_ids: List[str]) -> List[Any]:
708
+ """
709
+ Cancel multiple orders in batch.
710
+
711
+ Args:
712
+ order_ids: List of order IDs to cancel
713
+
714
+ Returns:
715
+ List of cancellation results
716
+
717
+ Raises:
718
+ InvalidParamError: If order_ids list is empty or invalid
719
+ """
720
+ if not order_ids or not isinstance(order_ids, list):
721
+ raise InvalidParamError('order_ids must be a non-empty list')
722
+
723
+ if len(order_ids) == 0:
724
+ raise InvalidParamError('order_ids list cannot be empty')
725
+
726
+ results = []
727
+ errors = []
728
+
729
+ for i, order_id in enumerate(order_ids):
730
+ try:
731
+ result = self.cancel_order(order_id)
732
+ results.append({
733
+ 'index': i,
734
+ 'success': True,
735
+ 'result': result,
736
+ 'order_id': order_id
737
+ })
738
+ except Exception as e:
739
+ logging.error(f"Failed to cancel order {order_id}: {e}")
740
+ errors.append({
741
+ 'index': i,
742
+ 'success': False,
743
+ 'error': str(e),
744
+ 'order_id': order_id
745
+ })
746
+ results.append({
747
+ 'index': i,
748
+ 'success': False,
749
+ 'error': str(e),
750
+ 'order_id': order_id
751
+ })
752
+
753
+ if errors:
754
+ logging.warning(f"Batch order cancellation completed with {len(errors)} errors out of {len(order_ids)} orders")
755
+
756
+ return results
757
+
758
+ def cancel_all_orders(self, market_id: Optional[int] = None, side: Optional[OrderSide] = None) -> dict:
759
+ """
760
+ Cancel all open orders, optionally filtered by market and/or side.
761
+
762
+ Args:
763
+ market_id: Optional filter - only cancel orders for this market
764
+ side: Optional filter - only cancel BUY or SELL orders
765
+
766
+ Returns:
767
+ Dictionary with cancellation summary: {
768
+ 'total_orders': int,
769
+ 'cancelled': int,
770
+ 'failed': int,
771
+ 'results': List[dict]
772
+ }
773
+ """
774
+ # Get all open orders
775
+ all_orders = self.get_my_orders(
776
+ market_id=market_id if market_id else 0,
777
+ status='open',
778
+ limit=100, # Get up to 100 orders per page
779
+ page=1
780
+ )
781
+
782
+ # Parse response to get order list
783
+ orders_list = self._parse_list_response(all_orders, "get open orders for cancellation")
784
+
785
+ if not orders_list or len(orders_list) == 0:
786
+ logging.info("No open orders to cancel")
787
+ return {
788
+ 'total_orders': 0,
789
+ 'cancelled': 0,
790
+ 'failed': 0,
791
+ 'results': []
792
+ }
793
+
794
+ # Filter by side if specified
795
+ if side:
796
+ orders_list = [order for order in orders_list if int(order.side) == int(side.value)]
797
+
798
+ # Extract order IDs (internally stored as trans_no)
799
+ order_ids = [order.trans_no for order in orders_list if hasattr(order, 'trans_no')]
800
+
801
+ if not order_ids:
802
+ logging.info("No orders match the filter criteria")
803
+ return {
804
+ 'total_orders': 0,
805
+ 'cancelled': 0,
806
+ 'failed': 0,
807
+ 'results': []
808
+ }
809
+
810
+ # Cancel all orders in batch
811
+ results = self.cancel_orders_batch(order_ids)
812
+
813
+ # Count successes and failures
814
+ cancelled = sum(1 for r in results if r.get('success'))
815
+ failed = sum(1 for r in results if not r.get('success'))
816
+
817
+ logging.info(f"Cancelled {cancelled} orders, {failed} failed out of {len(order_ids)} total")
818
+
819
+ return {
820
+ 'total_orders': len(order_ids),
821
+ 'cancelled': cancelled,
822
+ 'failed': failed,
823
+ 'results': results
824
+ }
825
+
826
+ def get_my_orders(self, market_id=0, status="", limit=10, page=1):
827
+ """Get user's orders with optional filters"""
828
+ try:
829
+ if not isinstance(market_id, int):
830
+ raise InvalidParamError('market_id must be an integer')
831
+
832
+ result = self.market_api.openapi_order_get(
833
+ topic_id=market_id if market_id > 0 else None,
834
+ status=status if status else None,
835
+ limit=limit,
836
+ page=page,
837
+ chain_id=self.chain_id
838
+ )
839
+ return result
840
+ except InvalidParamError as e:
841
+ logging.error(f"Validation error: {e}")
842
+ raise
843
+ except Exception as e:
844
+ logging.error(f"API error: {e}")
845
+ raise OpenApiError(f"Failed to get orders: {e}")
846
+
847
+ def get_order_by_id(self, order_id):
848
+ """Get detailed information about a specific order"""
849
+ try:
850
+ if not order_id or not isinstance(order_id, str):
851
+ raise InvalidParamError('order_id must be a non-empty string')
852
+
853
+ result = self.market_api.openapi_order_order_id_get(order_id)
854
+ return result
855
+ except InvalidParamError as e:
856
+ logging.error(f"Validation error: {e}")
857
+ raise
858
+ except Exception as e:
859
+ logging.error(f"API error: {e}")
860
+ raise OpenApiError(f"Failed to get order by id: {e}")
861
+
862
+ def get_my_positions(
863
+ self,
864
+ market_id: int = 0,
865
+ page: int = 1,
866
+ limit: int = 10
867
+ ) -> Any:
868
+ """Get user's positions with optional filters
869
+
870
+ Args:
871
+ market_id: Optional filter by market ID (0 for all markets)
872
+ page: Page number (default 1)
873
+ limit: Number of items per page (default 10)
874
+ """
875
+ try:
876
+ if not isinstance(market_id, int):
877
+ raise InvalidParamError('market_id must be an integer')
878
+
879
+ if not isinstance(page, int):
880
+ raise InvalidParamError('page must be an integer')
881
+
882
+ if not isinstance(limit, int):
883
+ raise InvalidParamError('limit must be an integer')
884
+
885
+ result = self.market_api.openapi_positions_get(
886
+ topic_id=market_id if market_id > 0 else None,
887
+ page=page,
888
+ limit=limit,
889
+ chain_id=self.chain_id
890
+ )
891
+ return result
892
+ except InvalidParamError as e:
893
+ logging.error(f"Validation error: {e}")
894
+ raise
895
+ except Exception as e:
896
+ logging.error(f"API error: {e}")
897
+ raise OpenApiError(f"Failed to get positions: {e}")
898
+
899
+ def get_my_balances(self, wallet_address=None):
900
+ """Get user's balances"""
901
+ try:
902
+ if not wallet_address:
903
+ wallet_address = self.contract_caller.signer.address()
904
+
905
+ result = self.market_api.openapi_user_balance_get(
906
+ wallet_address,
907
+ chain_id=self.chain_id
908
+ )
909
+ return result
910
+ except Exception as e:
911
+ logging.error(f"API error: {e}")
912
+ raise OpenApiError(f"Failed to get balances: {e}")
913
+
914
+ def get_my_trades(self, market_id=0, limit=10):
915
+ """Get user's trade history"""
916
+ try:
917
+ if not isinstance(market_id, int):
918
+ raise InvalidParamError('market_id must be an integer')
919
+
920
+ result = self.market_api.openapi_trade_get(
921
+ topic_id=market_id if market_id > 0 else None,
922
+ limit=limit,
923
+ chain_id=self.chain_id
924
+ )
925
+ return result
926
+ except InvalidParamError as e:
927
+ logging.error(f"Validation error: {e}")
928
+ raise
929
+ except Exception as e:
930
+ logging.error(f"API error: {e}")
931
+ raise OpenApiError(f"Failed to get trades: {e}")
932
+
933
+ def get_user_auth(self):
934
+ """Get authenticated user information"""
935
+ try:
936
+ result = self.user_api.openapi_user_auth_get()
937
+ return result
938
+ except Exception as e:
939
+ logging.error(f"API error: {e}")
940
+ raise OpenApiError(f"Failed to get user auth: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opinion_clob_sdk
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Opinion CLOB SDK - Python SDK for Opinion Prediction Market Central Limit Order Book API
5
5
  Home-page: https://opinion.trade
6
6
  Author: Opinion Labs
@@ -0,0 +1,46 @@
1
+ opinion_clob_sdk/__init__.py,sha256=pO3CyAVW1cgAYql8jJSrxlziN0hNxkAsCdVVOFZ09pc,624
2
+ opinion_clob_sdk/config.py,sha256=JoQvyK5IAnPiwwB8YZsmUtdEr-5hW2YG6iz1pOnLvDk,139
3
+ opinion_clob_sdk/model.py,sha256=UBrdsg3FtSV1xl3pihkXwv_frI2w2z68VI0cpv2LQh0,287
4
+ opinion_clob_sdk/sdk.py,sha256=R9tBg6tddOGCOHuW2MBGMXcDR1zbjncFgVO5zdc5e2U,38629
5
+ opinion_clob_sdk/chain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ opinion_clob_sdk/chain/contract_caller.py,sha256=AKCD1ZvLTbJX_YWFJecRtZ4Pi7L3_20Q7YOSGfAolEY,17148
7
+ opinion_clob_sdk/chain/exception.py,sha256=6SSx4T_WZL8BxzRbfGSDp6eGD4zJ5ACeBB58DlrpmoA,234
8
+ opinion_clob_sdk/chain/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ opinion_clob_sdk/chain/contracts/conditional_tokens.py,sha256=P_MpetUKMNnT_hchZ0A9q7-g_ZKjkOr-BLldPXB4J7o,13998
10
+ opinion_clob_sdk/chain/contracts/erc20.py,sha256=C56GdZeMxcgdJTmMQKSfA8xHzDdNT71SaNf6xhJIVMY,2843
11
+ opinion_clob_sdk/chain/py_order_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ opinion_clob_sdk/chain/py_order_utils/constants.py,sha256=afsZ0OahGbCzNPE2rXKU1k8gQymkh4ODLKh4KPklvnA,70
13
+ opinion_clob_sdk/chain/py_order_utils/signer.py,sha256=NAMHcMREbRUgrz1-28sqpPoMD8LkRJSyUn7-FLUkYsM,447
14
+ opinion_clob_sdk/chain/py_order_utils/utils.py,sha256=-sf0Vq16bJ8eAc-p63r0TLqtbQkKWEQ6ccSAoQy1r7M,3837
15
+ opinion_clob_sdk/chain/py_order_utils/builders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ opinion_clob_sdk/chain/py_order_utils/builders/base_builder.py,sha256=lw925Mz6MerqCyXNgonhNP-495gZPm_me4HtlhyhVHM,1272
17
+ opinion_clob_sdk/chain/py_order_utils/builders/exception.py,sha256=525fSH8Q241VjxdllBkWi3DiW_-6I1AmG-iHwZBTp4E,47
18
+ opinion_clob_sdk/chain/py_order_utils/builders/order_builder.py,sha256=NybKbNhRd1jceSjtp6lL9x1DjDzJ4ClhsAK2zS58P4c,2968
19
+ opinion_clob_sdk/chain/py_order_utils/builders/order_builder_test.py,sha256=0xPLO9rEDsw_s3UQiooquEarvFe8KneafiaY6PgkLIo,1773
20
+ opinion_clob_sdk/chain/py_order_utils/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ opinion_clob_sdk/chain/py_order_utils/model/order.py,sha256=fI2NhqX_cdUmZivliki4rHXJCxQQY5ykjh8a58FFfPE,5852
22
+ opinion_clob_sdk/chain/py_order_utils/model/order_type.py,sha256=kYXJ0Ikk3Qnr00yCIfrtJibFve8DUjNSJ_xiLw7IphY,185
23
+ opinion_clob_sdk/chain/py_order_utils/model/sides.py,sha256=FZVZnutyLmgiNCVoz-1fjxxFzhH3z24xy5BY6pkIfs8,177
24
+ opinion_clob_sdk/chain/py_order_utils/model/signatures.py,sha256=lKoqi7gVay9NjCv_2QTdelP4EFy61Ez0UeY1ytOmooM,224
25
+ opinion_clob_sdk/chain/safe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ opinion_clob_sdk/chain/safe/constants.py,sha256=H4UKUXJxR9pvwRHU4WM1p6wZ6yGjApOpWfEMYj-W_iE,572
27
+ opinion_clob_sdk/chain/safe/enums.py,sha256=aP9-PfC97ZYtX0dKOYKAyxITVrCDMIAY2_mHMdU8IJM,90
28
+ opinion_clob_sdk/chain/safe/exceptions.py,sha256=kp0jfnP93JyEkEgwPERL6MZ9D8ozbioURcKjMwSLjgE,1498
29
+ opinion_clob_sdk/chain/safe/multisend.py,sha256=l-lWlb7jSzmNCyFbpAr-d8SYEKM4QRm_h0tF53T3CzE,12659
30
+ opinion_clob_sdk/chain/safe/safe.py,sha256=OO-010or-qCCwCSTSh4qKGmoSwEsL2IYECW8IYmSmKQ,5216
31
+ opinion_clob_sdk/chain/safe/safe_signature.py,sha256=W1Xn73DSzE3PZ6ITyikhdWhosY3wdey-scX0Jci037I,12559
32
+ opinion_clob_sdk/chain/safe/safe_test.py,sha256=pbCYOLa_6cQbC0KOA7t41ItunauhHfgN7uneENfMXPk,1384
33
+ opinion_clob_sdk/chain/safe/safe_tx.py,sha256=QxKzv0EA7uwjakFMDVoDLrzYlZANpEhblPBQ7ZcF9zE,17211
34
+ opinion_clob_sdk/chain/safe/signatures.py,sha256=8l6t6R21E9Mj4_USagIp1GiUlJmAp0Cqq9VpB7Zk960,1978
35
+ opinion_clob_sdk/chain/safe/typing.py,sha256=wytgXXRbpyccM_HxpQLeDzfo40Ch_K-Z_ivORb-eNZo,419
36
+ opinion_clob_sdk/chain/safe/utils.py,sha256=1u4yKwMCvfOlg9NsWbsM2WszQoO1wd6D2Z2aGAb1jjo,6469
37
+ opinion_clob_sdk/chain/safe/eip712/__init__.py,sha256=ge0S6t2RtFc_mLFr4D93l6WLS2EONKgkuPGkcP_nDJ4,5915
38
+ opinion_clob_sdk/chain/safe/safe_contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ opinion_clob_sdk/chain/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py,sha256=_aENMzhiQgKSzXxn-TnVFWE84lIgDv1Iiw-VdIC1IMw,5968
40
+ opinion_clob_sdk/chain/safe/safe_contracts/multisend_v1_3_0.py,sha256=8oGhNkS2k2Cy5pG6YNt_BKytS3AEtPeXv4rkyXv_p0M,380
41
+ opinion_clob_sdk/chain/safe/safe_contracts/safe_v1_3_0.py,sha256=YCUWTpf_pR44iUUkDl42f3n2YXSVGlTBcvMtReN7rlM,21922
42
+ opinion_clob_sdk/chain/safe/safe_contracts/utils.py,sha256=xnW8JSq8tVMfvZ4lhT-L96P3Usjs2zrZ5jzrNZvFHjc,631
43
+ opinion_clob_sdk-0.1.1.dist-info/METADATA,sha256=uy_V3eK53xA5Yfb-1-rGOWMcpA_d-lAKahNnVoiFuCE,2776
44
+ opinion_clob_sdk-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
+ opinion_clob_sdk-0.1.1.dist-info/top_level.txt,sha256=4gH76GRX1WZSc3b146FfxE6BAxggJD8y3NMEHUOSPA0,17
46
+ opinion_clob_sdk-0.1.1.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ opinion_clob_sdk
@@ -1,42 +0,0 @@
1
- chain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- chain/contract_caller.py,sha256=AKCD1ZvLTbJX_YWFJecRtZ4Pi7L3_20Q7YOSGfAolEY,17148
3
- chain/exception.py,sha256=6SSx4T_WZL8BxzRbfGSDp6eGD4zJ5ACeBB58DlrpmoA,234
4
- chain/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- chain/contracts/conditional_tokens.py,sha256=P_MpetUKMNnT_hchZ0A9q7-g_ZKjkOr-BLldPXB4J7o,13998
6
- chain/contracts/erc20.py,sha256=C56GdZeMxcgdJTmMQKSfA8xHzDdNT71SaNf6xhJIVMY,2843
7
- chain/py_order_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- chain/py_order_utils/constants.py,sha256=afsZ0OahGbCzNPE2rXKU1k8gQymkh4ODLKh4KPklvnA,70
9
- chain/py_order_utils/signer.py,sha256=NAMHcMREbRUgrz1-28sqpPoMD8LkRJSyUn7-FLUkYsM,447
10
- chain/py_order_utils/utils.py,sha256=-sf0Vq16bJ8eAc-p63r0TLqtbQkKWEQ6ccSAoQy1r7M,3837
11
- chain/py_order_utils/builders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- chain/py_order_utils/builders/base_builder.py,sha256=lw925Mz6MerqCyXNgonhNP-495gZPm_me4HtlhyhVHM,1272
13
- chain/py_order_utils/builders/exception.py,sha256=525fSH8Q241VjxdllBkWi3DiW_-6I1AmG-iHwZBTp4E,47
14
- chain/py_order_utils/builders/order_builder.py,sha256=NybKbNhRd1jceSjtp6lL9x1DjDzJ4ClhsAK2zS58P4c,2968
15
- chain/py_order_utils/builders/order_builder_test.py,sha256=0xPLO9rEDsw_s3UQiooquEarvFe8KneafiaY6PgkLIo,1773
16
- chain/py_order_utils/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- chain/py_order_utils/model/order.py,sha256=fI2NhqX_cdUmZivliki4rHXJCxQQY5ykjh8a58FFfPE,5852
18
- chain/py_order_utils/model/order_type.py,sha256=kYXJ0Ikk3Qnr00yCIfrtJibFve8DUjNSJ_xiLw7IphY,185
19
- chain/py_order_utils/model/sides.py,sha256=FZVZnutyLmgiNCVoz-1fjxxFzhH3z24xy5BY6pkIfs8,177
20
- chain/py_order_utils/model/signatures.py,sha256=lKoqi7gVay9NjCv_2QTdelP4EFy61Ez0UeY1ytOmooM,224
21
- chain/safe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- chain/safe/constants.py,sha256=H4UKUXJxR9pvwRHU4WM1p6wZ6yGjApOpWfEMYj-W_iE,572
23
- chain/safe/enums.py,sha256=aP9-PfC97ZYtX0dKOYKAyxITVrCDMIAY2_mHMdU8IJM,90
24
- chain/safe/exceptions.py,sha256=kp0jfnP93JyEkEgwPERL6MZ9D8ozbioURcKjMwSLjgE,1498
25
- chain/safe/multisend.py,sha256=l-lWlb7jSzmNCyFbpAr-d8SYEKM4QRm_h0tF53T3CzE,12659
26
- chain/safe/safe.py,sha256=OO-010or-qCCwCSTSh4qKGmoSwEsL2IYECW8IYmSmKQ,5216
27
- chain/safe/safe_signature.py,sha256=W1Xn73DSzE3PZ6ITyikhdWhosY3wdey-scX0Jci037I,12559
28
- chain/safe/safe_test.py,sha256=pbCYOLa_6cQbC0KOA7t41ItunauhHfgN7uneENfMXPk,1384
29
- chain/safe/safe_tx.py,sha256=QxKzv0EA7uwjakFMDVoDLrzYlZANpEhblPBQ7ZcF9zE,17211
30
- chain/safe/signatures.py,sha256=8l6t6R21E9Mj4_USagIp1GiUlJmAp0Cqq9VpB7Zk960,1978
31
- chain/safe/typing.py,sha256=wytgXXRbpyccM_HxpQLeDzfo40Ch_K-Z_ivORb-eNZo,419
32
- chain/safe/utils.py,sha256=1u4yKwMCvfOlg9NsWbsM2WszQoO1wd6D2Z2aGAb1jjo,6469
33
- chain/safe/eip712/__init__.py,sha256=ge0S6t2RtFc_mLFr4D93l6WLS2EONKgkuPGkcP_nDJ4,5915
34
- chain/safe/safe_contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- chain/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py,sha256=_aENMzhiQgKSzXxn-TnVFWE84lIgDv1Iiw-VdIC1IMw,5968
36
- chain/safe/safe_contracts/multisend_v1_3_0.py,sha256=8oGhNkS2k2Cy5pG6YNt_BKytS3AEtPeXv4rkyXv_p0M,380
37
- chain/safe/safe_contracts/safe_v1_3_0.py,sha256=YCUWTpf_pR44iUUkDl42f3n2YXSVGlTBcvMtReN7rlM,21922
38
- chain/safe/safe_contracts/utils.py,sha256=xnW8JSq8tVMfvZ4lhT-L96P3Usjs2zrZ5jzrNZvFHjc,631
39
- opinion_clob_sdk-0.1.0.dist-info/METADATA,sha256=PaYXOI7kFUuxqyrPEZ320lR-A0xCCYcRqQyIDOow-nw,2776
40
- opinion_clob_sdk-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
- opinion_clob_sdk-0.1.0.dist-info/top_level.txt,sha256=O2U8tt1VAqoTZR-urcArMMWdyf_x0FZEcZ1-vur6gus,6
42
- opinion_clob_sdk-0.1.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- chain
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