deltadefi 0.1.1__py3-none-any.whl → 0.1.3__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 deltadefi might be problematic. Click here for more details.

@@ -1,8 +1,10 @@
1
1
  from deltadefi.api import API
2
2
  from deltadefi.models.models import OrderSide, OrderType
3
3
  from deltadefi.responses import (
4
+ BuildCancelAllOrdersTransactionResponse,
4
5
  BuildCancelOrderTransactionResponse,
5
6
  BuildPlaceOrderTransactionResponse,
7
+ SubmitCancelAllOrdersTransactionResponse,
6
8
  SubmitPlaceOrderTransactionResponse,
7
9
  )
8
10
  from deltadefi.utils import check_required_parameter, check_required_parameters
@@ -86,6 +88,19 @@ class Order(API):
86
88
  url_path = f"/{order_id}/build"
87
89
  return self.send_request("DELETE", self.group_url_path + url_path, **kwargs)
88
90
 
91
+ def build_cancel_all_orders_transaction(
92
+ self, **kwargs
93
+ ) -> BuildCancelAllOrdersTransactionResponse:
94
+ """
95
+ Build a cancel all orders transaction.
96
+
97
+ Returns:
98
+ A BuildCancelAllOrdersTransactionResponse object containing the built cancel all orders transaction.
99
+ """
100
+
101
+ url_path = "/cancel-all/build"
102
+ return self.send_request("DELETE", self.group_url_path + url_path, **kwargs)
103
+
89
104
  def submit_place_order_transaction(
90
105
  self, order_id: str, signed_tx: str, **kwargs
91
106
  ) -> SubmitPlaceOrderTransactionResponse:
@@ -93,7 +108,8 @@ class Order(API):
93
108
  Submit a place order transaction.
94
109
 
95
110
  Args:
96
- data: A SubmitPlaceOrderTransactionRequest object containing the order details.
111
+ order_id: The ID of the order to be placed.
112
+ signed_tx: The signed transaction hex string for placing the order.
97
113
 
98
114
  Returns:
99
115
  A SubmitPlaceOrderTransactionResponse object containing the submitted order transaction.
@@ -109,10 +125,25 @@ class Order(API):
109
125
  Submit a cancel order transaction.
110
126
 
111
127
  Args:
112
- data: A SubmitCancelOrderTransactionRequest object containing the cancel order details.
128
+ signed_tx: The signed transaction hex string for canceling the order.
113
129
  """
114
130
  check_required_parameter(signed_tx, "signed_tx")
115
131
  payload = {"signed_tx": signed_tx, **kwargs}
116
132
 
117
133
  path_url = "/submit"
118
134
  return self.send_request("DELETE", self.group_url_path + path_url, payload)
135
+
136
+ def submit_cancel_all_orders_transaction(
137
+ self, signed_txs: list[str], **kwargs
138
+ ) -> SubmitCancelAllOrdersTransactionResponse:
139
+ """
140
+ Submit a cancel all orders transaction.
141
+
142
+ Args:
143
+ signed_txs: A list of signed transaction hex strings for canceling all orders.
144
+ """
145
+ check_required_parameter(signed_txs, "signed_txs")
146
+ payload = {"signed_txs": signed_txs, **kwargs}
147
+
148
+ path_url = "/cancel-all/submit"
149
+ return self.send_request("DELETE", self.group_url_path + path_url, payload)
@@ -187,10 +187,8 @@ class WebSocketClient:
187
187
  # In a more complex implementation, you'd want to handle multiple concurrent subscriptions
188
188
  if self.subscriptions:
189
189
  first_sub = next(iter(self.subscriptions.values()))
190
- if first_sub.get("type") == "trade":
191
- await self.connect(first_sub["endpoint"])
192
- else:
193
- await self.connect()
190
+ # Always use the stored endpoint for reconnection
191
+ await self.connect(first_sub["endpoint"])
194
192
  else:
195
193
  await self.connect()
196
194
 
@@ -61,3 +61,13 @@ class PostOrderResponse(SubmitPlaceOrderTransactionResponse):
61
61
  @dataclass
62
62
  class BuildCancelOrderTransactionResponse(TypedDict):
63
63
  tx_hex: str
64
+
65
+
66
+ @dataclass
67
+ class BuildCancelAllOrdersTransactionResponse(TypedDict):
68
+ tx_hexes: list[str]
69
+
70
+
71
+ @dataclass
72
+ class SubmitCancelAllOrdersTransactionResponse(TypedDict):
73
+ cancelled_order_ids: list[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deltadefi
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Python SDK for DeltaDeFi protocol.
5
5
  Author-email: HinsonSIDAN <wongkahinhinson@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -8,17 +8,17 @@ deltadefi/clients/__init__.py,sha256=4hyPuk6_bcJGXUElOvkgZ7ARlQ6QwKLp-nFgCXTbFVI
8
8
  deltadefi/clients/accounts.py,sha256=sfdPh8CWsein1UAn8h-Y0JB_zMvr95FZx2QuaL6Tico,8407
9
9
  deltadefi/clients/client.py,sha256=2hLOsxqBc8eu_6ovuYLRoK2popdI1_t3pGcEP8Keu9A,4619
10
10
  deltadefi/clients/markets.py,sha256=--wMUFYkZryZjj8wO-rxxJhHEbM3UmcPpubrHU92Bdk,1985
11
- deltadefi/clients/orders.py,sha256=AX6RZfLZFUonjKDPYc1T4wbxVomQeES1mzfJHSjhI-M,3886
12
- deltadefi/clients/websocket.py,sha256=0454RunoE9eHqmQ0wrywEwxqrie1qEXq2ObxyKXopck,12424
11
+ deltadefi/clients/orders.py,sha256=-VZppN4dJitzRkkNCWy9PWLdwGUpnYBNhugaUZIr1PU,5010
12
+ deltadefi/clients/websocket.py,sha256=o6BEd_KVPmSLpMhAC7j98ACqJuMYPxjcLt57EXzoeqw,12370
13
13
  deltadefi/constants/__init__.py,sha256=7LkrzfLTJsCCUl5IgZYrl-AbY_cf1fftcLklgnBYDTs,40
14
14
  deltadefi/constants/constants.py,sha256=4bkY4kfNcsgoCe1xU8n2We7w-vxZXyzVw5rQvAsx4j8,168
15
15
  deltadefi/models/__init__.py,sha256=oDJj6Y4gXN6C7Oz_t2fq8hej-D0G9OqfXjL4Jaeq8z8,37
16
16
  deltadefi/models/models.py,sha256=kiRpCdzUh3WmyuFOaxlZ1rjsQ2cxLWjVFBCqsHXMtBc,1633
17
17
  deltadefi/responses/__init__.py,sha256=JKSIUQu6qI_XhbAR2mVMCKNvR6x_vFZdyLGOuQTVrVY,64
18
18
  deltadefi/responses/accounts.py,sha256=o-It4vyNsiDeCmHa-XQl77KuCVtJi7qlPdn059fgwcI,1590
19
- deltadefi/responses/responses.py,sha256=Kz5PtDnx_AgKrV7NhZqrSMnS1wPlLbu13J2BKNzN0ME,1012
19
+ deltadefi/responses/responses.py,sha256=BqutIkilVCibcxH_10FwN-dY3p3g9XFDOp9NYPbuLPw,1214
20
20
  deltadefi/utils/__init__.py,sha256=krFwciyC3ArJ1j96b5IOVMqKfiFjnKtgQvYPsw3A-MU,38
21
21
  deltadefi/utils/helpers.py,sha256=S90RpdkKJS-khuwk8B0vhOdTQXuUkutZ0RZLybeF550,1025
22
- deltadefi-0.1.1.dist-info/METADATA,sha256=_Y9ZNj9oM_W99lWEj6HzoBb2uJo3Q6DDWh_sjN0jYGw,3075
23
- deltadefi-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- deltadefi-0.1.1.dist-info/RECORD,,
22
+ deltadefi-0.1.3.dist-info/METADATA,sha256=Z9x_HjX5QSutdHYw5AIvIlTW3LoNMpciyPbAzEHxXY4,3075
23
+ deltadefi-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ deltadefi-0.1.3.dist-info/RECORD,,