11from deltadefi .api import API
22from deltadefi .models .models import OrderSide , OrderType
33from deltadefi .responses import (
4+ BuildCancelAllOrdersTransactionResponse ,
45 BuildCancelOrderTransactionResponse ,
56 BuildPlaceOrderTransactionResponse ,
7+ SubmitCancelAllOrdersTransactionResponse ,
68 SubmitPlaceOrderTransactionResponse ,
79)
810from deltadefi .utils import check_required_parameter , check_required_parameters
@@ -86,14 +88,28 @@ def build_cancel_order_transaction(
8688 url_path = f"/{ order_id } /build"
8789 return self .send_request ("DELETE" , self .group_url_path + url_path , ** kwargs )
8890
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+
89104 def submit_place_order_transaction (
90105 self , order_id : str , signed_tx : str , ** kwargs
91106 ) -> SubmitPlaceOrderTransactionResponse :
92107 """
93108 Submit a place order transaction.
94109
95110 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.
97113
98114 Returns:
99115 A SubmitPlaceOrderTransactionResponse object containing the submitted order transaction.
@@ -109,10 +125,25 @@ def submit_cancel_order_transaction(self, signed_tx: str, **kwargs):
109125 Submit a cancel order transaction.
110126
111127 Args:
112- data: A SubmitCancelOrderTransactionRequest object containing the cancel order details .
128+ signed_tx: The signed transaction hex string for canceling the order .
113129 """
114130 check_required_parameter (signed_tx , "signed_tx" )
115131 payload = {"signed_tx" : signed_tx , ** kwargs }
116132
117133 path_url = "/submit"
118134 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 )
0 commit comments