nado-protocol 0.2.3__py3-none-any.whl → 0.2.4__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.
@@ -122,6 +122,7 @@ class NadoExecuteType(StrEnum):
122
122
  """
123
123
 
124
124
  PLACE_ORDER = "place_order"
125
+ PLACE_ORDERS = "place_orders"
125
126
  CANCEL_ORDERS = "cancel_orders"
126
127
  CANCEL_PRODUCT_ORDERS = "cancel_product_orders"
127
128
  CANCEL_AND_PLACE = "cancel_and_place"
@@ -1,4 +1,4 @@
1
- from typing import Optional, Type, Union
1
+ from typing import Optional, Type, Union, Sequence
2
2
  from pydantic import validator
3
3
  from nado_protocol.contracts.types import NadoExecuteType
4
4
  from nado_protocol.engine_client.types.models import ResponseStatus
@@ -44,6 +44,21 @@ class PlaceOrderParams(SignatureParams):
44
44
  spot_leverage: Optional[bool]
45
45
 
46
46
 
47
+ class PlaceOrdersParams(NadoBaseModel):
48
+ """
49
+ Class for defining the parameters needed to place multiple orders in a single request.
50
+
51
+ Attributes:
52
+ orders (list[PlaceOrderParams]): Array of orders to place.
53
+
54
+ stop_on_failure (Optional[bool]): If true, stops processing remaining orders when the first order fails.
55
+ Already successfully placed orders are NOT cancelled. Defaults to false.
56
+ """
57
+
58
+ orders: Sequence[PlaceOrderParams]
59
+ stop_on_failure: Optional[bool]
60
+
61
+
47
62
  class PlaceMarketOrderParams(SignatureParams):
48
63
  """
49
64
  Class for defining the parameters needed to place a market order.
@@ -215,6 +230,7 @@ class LinkSignerParams(BaseParamsSigned):
215
230
 
216
231
  ExecuteParams = Union[
217
232
  PlaceOrderParams,
233
+ PlaceOrdersParams,
218
234
  CancelOrdersParams,
219
235
  CancelProductOrdersParams,
220
236
  WithdrawCollateralParams,
@@ -244,7 +260,7 @@ class PlaceOrderRequest(NadoBaseModel):
244
260
  if v.order.nonce is None:
245
261
  raise ValueError("Missing order `nonce`")
246
262
  if v.signature is None:
247
- raise ValueError("Missing `signature")
263
+ raise ValueError("Missing `signature`")
248
264
  if isinstance(v.order.sender, bytes):
249
265
  v.order.serialize_dict(["sender"], bytes32_to_hex)
250
266
  v.order.serialize_dict(
@@ -253,6 +269,34 @@ class PlaceOrderRequest(NadoBaseModel):
253
269
  return v
254
270
 
255
271
 
272
+ class PlaceOrdersRequest(NadoBaseModel):
273
+ """
274
+ Parameters for a request to place multiple orders.
275
+
276
+ Attributes:
277
+ place_orders (PlaceOrdersParams): The parameters for the orders to be placed.
278
+
279
+ Methods:
280
+ serialize: Validates and serializes the order parameters.
281
+ """
282
+
283
+ place_orders: PlaceOrdersParams
284
+
285
+ @validator("place_orders")
286
+ def serialize(cls, v: PlaceOrdersParams) -> PlaceOrdersParams:
287
+ for order_params in v.orders:
288
+ if order_params.order.nonce is None:
289
+ raise ValueError("Missing order `nonce`")
290
+ if order_params.signature is None:
291
+ raise ValueError("Missing `signature`")
292
+ if isinstance(order_params.order.sender, bytes):
293
+ order_params.order.serialize_dict(["sender"], bytes32_to_hex)
294
+ order_params.order.serialize_dict(
295
+ ["nonce", "priceX18", "amount", "expiration", "appendix"], str
296
+ )
297
+ return v
298
+
299
+
256
300
  class TxRequest(NadoBaseModel):
257
301
  """
258
302
  Parameters for a transaction request.
@@ -511,6 +555,7 @@ class LinkSignerRequest(NadoBaseModel):
511
555
 
512
556
  ExecuteRequest = Union[
513
557
  PlaceOrderRequest,
558
+ PlaceOrdersRequest,
514
559
  CancelOrdersRequest,
515
560
  CancelProductOrdersRequest,
516
561
  CancelAndPlaceRequest,
@@ -530,6 +575,23 @@ class PlaceOrderResponse(NadoBaseModel):
530
575
  digest: str
531
576
 
532
577
 
578
+ class PlaceOrdersItemResponse(NadoBaseModel):
579
+ """
580
+ Data model for a single order in place orders response.
581
+ """
582
+
583
+ digest: Optional[str]
584
+ error: Optional[str]
585
+
586
+
587
+ class PlaceOrdersResponse(NadoBaseModel):
588
+ """
589
+ Data model for place orders response.
590
+ """
591
+
592
+ place_orders: list[PlaceOrdersItemResponse]
593
+
594
+
533
595
  class CancelOrdersResponse(NadoBaseModel):
534
596
  """
535
597
  Data model for cancelled orders response.
@@ -538,7 +600,9 @@ class CancelOrdersResponse(NadoBaseModel):
538
600
  cancelled_orders: list[OrderData]
539
601
 
540
602
 
541
- ExecuteResponseData = Union[PlaceOrderResponse, CancelOrdersResponse]
603
+ ExecuteResponseData = Union[
604
+ PlaceOrderResponse, PlaceOrdersResponse, CancelOrdersResponse
605
+ ]
542
606
 
543
607
 
544
608
  class ExecuteResponse(NadoBaseModel):
@@ -585,6 +649,7 @@ def to_execute_request(params: ExecuteParams) -> ExecuteRequest:
585
649
  """
586
650
  execute_request_mapping = {
587
651
  PlaceOrderParams: (PlaceOrderRequest, NadoExecuteType.PLACE_ORDER.value),
652
+ PlaceOrdersParams: (PlaceOrdersRequest, NadoExecuteType.PLACE_ORDERS.value),
588
653
  CancelOrdersParams: (
589
654
  CancelOrdersRequest,
590
655
  NadoExecuteType.CANCEL_ORDERS.value,
@@ -54,6 +54,7 @@ class IndexerQueryType(StrEnum):
54
54
  TOKEN_MERKLE_PROOFS = "token_merkle_proofs"
55
55
  FOUNDATION_REWARDS_MERKLE_PROOFS = "foundation_rewards_merkle_proofs"
56
56
  INTEREST_AND_FUNDING = "interest_and_funding"
57
+ INK_AIRDROP = "ink_airdrop"
57
58
 
58
59
 
59
60
  class IndexerBaseParams(NadoBaseModel):
@@ -71,10 +72,10 @@ class IndexerBaseParams(NadoBaseModel):
71
72
 
72
73
  class IndexerSubaccountHistoricalOrdersParams(IndexerBaseParams):
73
74
  """
74
- Parameters for querying historical orders by subaccount.
75
+ Parameters for querying historical orders by subaccounts.
75
76
  """
76
77
 
77
- subaccount: str
78
+ subaccounts: Optional[list[str]]
78
79
  product_ids: Optional[list[int]]
79
80
  trigger_types: Optional[list[str]]
80
81
  isolated: Optional[bool]
@@ -93,7 +94,7 @@ class IndexerMatchesParams(IndexerBaseParams):
93
94
  Parameters for querying matches.
94
95
  """
95
96
 
96
- subaccount: Optional[str]
97
+ subaccounts: Optional[list[str]]
97
98
  product_ids: Optional[list[int]]
98
99
  isolated: Optional[bool]
99
100
 
@@ -122,7 +123,7 @@ class IndexerEventsParams(IndexerBaseParams):
122
123
  Parameters for querying events.
123
124
  """
124
125
 
125
- subaccount: Optional[str]
126
+ subaccounts: Optional[list[str]]
126
127
  product_ids: Optional[list[int]]
127
128
  event_types: Optional[list[IndexerEventType]]
128
129
  isolated: Optional[bool]
@@ -304,6 +305,14 @@ class IndexerAccountSnapshotsParams(NadoBaseModel):
304
305
  active: Optional[bool] = None
305
306
 
306
307
 
308
+ class IndexerInkAirdropParams(NadoBaseModel):
309
+ """
310
+ Parameters for querying Ink airdrop allocation.
311
+ """
312
+
313
+ address: str
314
+
315
+
307
316
  IndexerParams = Union[
308
317
  IndexerSubaccountHistoricalOrdersParams,
309
318
  IndexerHistoricalOrdersByDigestParams,
@@ -327,6 +336,7 @@ IndexerParams = Union[
327
336
  IndexerFoundationRewardsMerkleProofsParams,
328
337
  IndexerInterestAndFundingParams,
329
338
  IndexerAccountSnapshotsParams,
339
+ IndexerInkAirdropParams,
330
340
  ]
331
341
 
332
342
 
@@ -508,6 +518,14 @@ class IndexerAccountSnapshotsRequest(NadoBaseModel):
508
518
  account_snapshots: IndexerAccountSnapshotsParams
509
519
 
510
520
 
521
+ class IndexerInkAirdropRequest(NadoBaseModel):
522
+ """
523
+ Request object for querying Ink airdrop allocation.
524
+ """
525
+
526
+ ink_airdrop: IndexerInkAirdropParams
527
+
528
+
511
529
  IndexerRequest = Union[
512
530
  IndexerHistoricalOrdersRequest,
513
531
  IndexerMatchesRequest,
@@ -530,6 +548,7 @@ IndexerRequest = Union[
530
548
  IndexerFoundationRewardsMerkleProofsRequest,
531
549
  IndexerInterestAndFundingRequest,
532
550
  IndexerAccountSnapshotsRequest,
551
+ IndexerInkAirdropRequest,
533
552
  ]
534
553
 
535
554
 
@@ -711,6 +730,14 @@ class IndexerAccountSnapshotsData(NadoBaseModel):
711
730
  snapshots: Dict[str, Dict[str, list[IndexerEvent]]]
712
731
 
713
732
 
733
+ class IndexerInkAirdropData(NadoBaseModel):
734
+ """
735
+ Data object for Ink airdrop allocation.
736
+ """
737
+
738
+ amount: str
739
+
740
+
714
741
  IndexerResponseData = Union[
715
742
  IndexerHistoricalOrdersData,
716
743
  IndexerMatchesData,
@@ -733,6 +760,7 @@ IndexerResponseData = Union[
733
760
  IndexerLiquidationFeedData,
734
761
  IndexerFundingRatesData,
735
762
  IndexerAccountSnapshotsData,
763
+ IndexerInkAirdropData,
736
764
  ]
737
765
 
738
766
 
@@ -844,6 +872,10 @@ def to_indexer_request(params: IndexerParams) -> IndexerRequest:
844
872
  IndexerAccountSnapshotsRequest,
845
873
  IndexerQueryType.ACCOUNT_SNAPSHOTS.value,
846
874
  ),
875
+ IndexerInkAirdropParams: (
876
+ IndexerInkAirdropRequest,
877
+ IndexerQueryType.INK_AIRDROP.value,
878
+ ),
847
879
  }
848
880
 
849
881
  RequestClass, field_name = indexer_request_mapping[type(params)]
@@ -1,10 +1,11 @@
1
- from typing import Union
1
+ from typing import Union, Sequence
2
2
  from pydantic import validator
3
3
  from nado_protocol.contracts.types import NadoExecuteType
4
4
  from nado_protocol.utils.bytes32 import bytes32_to_hex
5
5
  from nado_protocol.utils.model import NadoBaseModel
6
6
  from nado_protocol.engine_client.types.execute import (
7
7
  PlaceOrderParams,
8
+ PlaceOrdersParams,
8
9
  CancelOrdersParams,
9
10
  CancelProductOrdersParams,
10
11
  CancelOrdersRequest,
@@ -17,11 +18,28 @@ class PlaceTriggerOrderParams(PlaceOrderParams):
17
18
  trigger: TriggerCriteria
18
19
 
19
20
 
21
+ class PlaceTriggerOrdersParams(PlaceOrdersParams):
22
+ """
23
+ Class for defining the parameters needed to place multiple trigger orders in a single request.
24
+
25
+ Attributes:
26
+ orders (list[PlaceTriggerOrderParams]): Array of trigger orders to place.
27
+
28
+ stop_on_failure (Optional[bool]): If true, stops processing remaining orders when the first order fails.
29
+ Already successfully placed orders are NOT cancelled. Defaults to false.
30
+ """
31
+
32
+ orders: Sequence[PlaceTriggerOrderParams]
33
+
34
+
20
35
  CancelTriggerOrdersParams = CancelOrdersParams
21
36
  CancelProductTriggerOrdersParams = CancelProductOrdersParams
22
37
 
23
38
  TriggerExecuteParams = Union[
24
- PlaceTriggerOrderParams, CancelTriggerOrdersParams, CancelProductTriggerOrdersParams
39
+ PlaceTriggerOrderParams,
40
+ PlaceTriggerOrdersParams,
41
+ CancelTriggerOrdersParams,
42
+ CancelProductTriggerOrdersParams,
25
43
  ]
26
44
 
27
45
 
@@ -43,7 +61,7 @@ class PlaceTriggerOrderRequest(NadoBaseModel):
43
61
  if v.order.nonce is None:
44
62
  raise ValueError("Missing order `nonce`")
45
63
  if v.signature is None:
46
- raise ValueError("Missing `signature")
64
+ raise ValueError("Missing `signature`")
47
65
  if isinstance(v.order.sender, bytes):
48
66
  v.order.serialize_dict(["sender"], bytes32_to_hex)
49
67
  v.order.serialize_dict(
@@ -52,11 +70,40 @@ class PlaceTriggerOrderRequest(NadoBaseModel):
52
70
  return v
53
71
 
54
72
 
73
+ class PlaceTriggerOrdersRequest(NadoBaseModel):
74
+ """
75
+ Parameters for a request to place multiple trigger orders.
76
+
77
+ Attributes:
78
+ place_orders (PlaceTriggerOrdersParams): The parameters for the trigger orders to be placed.
79
+
80
+ Methods:
81
+ serialize: Validates and serializes the order parameters.
82
+ """
83
+
84
+ place_orders: PlaceTriggerOrdersParams
85
+
86
+ @validator("place_orders")
87
+ def serialize(cls, v: PlaceTriggerOrdersParams) -> PlaceTriggerOrdersParams:
88
+ for order_params in v.orders:
89
+ if order_params.order.nonce is None:
90
+ raise ValueError("Missing order `nonce`")
91
+ if order_params.signature is None:
92
+ raise ValueError("Missing `signature`")
93
+ if isinstance(order_params.order.sender, bytes):
94
+ order_params.order.serialize_dict(["sender"], bytes32_to_hex)
95
+ order_params.order.serialize_dict(
96
+ ["nonce", "priceX18", "amount", "expiration", "appendix"], str
97
+ )
98
+ return v
99
+
100
+
55
101
  CancelTriggerOrdersRequest = CancelOrdersRequest
56
102
  CancelProductTriggerOrdersRequest = CancelProductOrdersRequest
57
103
 
58
104
  TriggerExecuteRequest = Union[
59
105
  PlaceTriggerOrderRequest,
106
+ PlaceTriggerOrdersRequest,
60
107
  CancelTriggerOrdersRequest,
61
108
  CancelProductTriggerOrdersRequest,
62
109
  ]
@@ -77,6 +124,10 @@ def to_trigger_execute_request(params: TriggerExecuteParams) -> TriggerExecuteRe
77
124
  PlaceTriggerOrderRequest,
78
125
  NadoExecuteType.PLACE_ORDER.value,
79
126
  ),
127
+ PlaceTriggerOrdersParams: (
128
+ PlaceTriggerOrdersRequest,
129
+ NadoExecuteType.PLACE_ORDERS.value,
130
+ ),
80
131
  CancelTriggerOrdersParams: (
81
132
  CancelTriggerOrdersRequest,
82
133
  NadoExecuteType.CANCEL_ORDERS.value,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nado-protocol
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Nado Protocol SDK
5
5
  Keywords: nado protocol,nado sdk,nado protocol api
6
6
  Author: Jeury Mejia
@@ -37,12 +37,12 @@ nado_protocol/contracts/eip712/domain.py,sha256=dZ5aKq2Y45-vzZUMQLuUTbFhH9-R-YEg
37
37
  nado_protocol/contracts/eip712/sign.py,sha256=WeipHcWaEP_vnmXpRH7_Ksm9uKDH2E4IkYYRI0_p2cY,2410
38
38
  nado_protocol/contracts/eip712/types.py,sha256=uTfYD9hjoTozsUL2WTc_-2OREijbfv9FDBYuD1UjVHo,5117
39
39
  nado_protocol/contracts/loader.py,sha256=_0W3ImcARs1bTu1lLMpHMrRNuEVYjrRWctvnEbKWoVg,1500
40
- nado_protocol/contracts/types.py,sha256=GXzqSfbbTZQPw4jalEZR1oE_klI0zVZKRwXVzuRSq4M,4192
40
+ nado_protocol/contracts/types.py,sha256=909nB0crmWzM6-q0rWLFoxIvRIM2RKTXqaZwVUPp0Hs,4226
41
41
  nado_protocol/engine_client/__init__.py,sha256=RE_MxQaQVIp0K5EDhR1_uTjLJgEJBx2fLnhepc3cuAg,1137
42
42
  nado_protocol/engine_client/execute.py,sha256=Tmd1yvLTlvFFaSYqwOWTkzSxdE6QllGB8LHgsOim3Tc,15314
43
43
  nado_protocol/engine_client/query.py,sha256=zCBLeBOY1wkRM42EMsluBRtVw2TuaqJHp4UuIdHWh4c,16265
44
44
  nado_protocol/engine_client/types/__init__.py,sha256=pPjKLDJHclcbqROhU8B8OoxUjZkJI9a2qq5fUCVK7j4,2721
45
- nado_protocol/engine_client/types/execute.py,sha256=prlArTgTCGmnw1JozRP3Sa50brfXwTkTKt6v_n3bwv8,18731
45
+ nado_protocol/engine_client/types/execute.py,sha256=ANF_QwtJAqb9zvga1fjOIiSDt_wjUo4sbf8rVkc-sQ0,20709
46
46
  nado_protocol/engine_client/types/models.py,sha256=hf9HD8rct2XZIqPznfydBq7jqKiJ3vcdrL44GCjtnGQ,3873
47
47
  nado_protocol/engine_client/types/query.py,sha256=N6kPuWSUowMeZnUKpxF9NnMKZBKKe-0Q_B9ccFZkjQA,12185
48
48
  nado_protocol/engine_client/types/stream.py,sha256=F_AKqU4pClzUcM6D9Dc79f6RmraahJzj2-hQSXtQ0vQ,159
@@ -50,12 +50,12 @@ nado_protocol/indexer_client/__init__.py,sha256=ea2exePtguCxJsBlisOQPtnFk8hRmFug
50
50
  nado_protocol/indexer_client/query.py,sha256=Tm4IYmU0T_9ayFTce8SMRPi_NN8QgyHDr4rFC3h7hSw,17102
51
51
  nado_protocol/indexer_client/types/__init__.py,sha256=r3-jxMjrFNbA1nMRSGZjsE3qypmyWab6k20_gasdwL4,3548
52
52
  nado_protocol/indexer_client/types/models.py,sha256=vD1YHHeK15hcU5_O4al7001Fi-gTl6EARMuR-Y8stOc,7533
53
- nado_protocol/indexer_client/types/query.py,sha256=JlI2TXjezTSgvaP8zzb3bO9GADzeQkay1CScO954RAw,19857
53
+ nado_protocol/indexer_client/types/query.py,sha256=FCIIUv049AoBtB5VEolwgX51wycCIjyw4Qq__z0TodY,20559
54
54
  nado_protocol/trigger_client/__init__.py,sha256=kD_WJWGOCDwX7GvGF5VGZibWR2uPYRcWpIWht31PYR4,545
55
55
  nado_protocol/trigger_client/execute.py,sha256=VkVla3SF6MX-ZJC_wZG72em41MPAKX-jv1_Lh4ydezU,15089
56
56
  nado_protocol/trigger_client/query.py,sha256=7M7opYEddNo0Wf9VQ7rha-WaoFQVv5F5OI-YLSRWrpk,2705
57
57
  nado_protocol/trigger_client/types/__init__.py,sha256=Rj953ymGSNnVdOpDrwRuXmC_jhuPZU17BaSgBrc9cbk,183
58
- nado_protocol/trigger_client/types/execute.py,sha256=Ij_gCl3ZzhouWF7JxEY_U6hUbe9teOYp1ZfN0PDcOpM,2896
58
+ nado_protocol/trigger_client/types/execute.py,sha256=y1rxiFy3I7V3BHLKL8wQFDCwmf78AKuf8wB_1K8HlbU,4671
59
59
  nado_protocol/trigger_client/types/models.py,sha256=ZVDF3MFWoR39JBaTmSOTl1WnRnw46hjX-WN_a-g6zKk,1638
60
60
  nado_protocol/trigger_client/types/query.py,sha256=O6qhFLL2IREHc_mf-jFMyuVSzH1RuwjM-8noolLmEaQ,5288
61
61
  nado_protocol/utils/__init__.py,sha256=heFEgVHHce8nAqQcmEMR69aZ8aaJAYXukJ2-W_KTFwY,1446
@@ -75,7 +75,7 @@ nado_protocol/utils/order.py,sha256=Q9TlcotvnB395dPhaKpn0EeN1WNTkpYBTUovlirr1_Y,
75
75
  nado_protocol/utils/subaccount.py,sha256=WJ7lgU2RekuzJAZH-hhCTbIBlRsl2oHozBm7OEMRV74,495
76
76
  nado_protocol/utils/time.py,sha256=tEwmrkc5VdzKLlgkJIAq2ce-nhrduJZNtVPydrrnTHs,360
77
77
  nado_protocol/utils/twap.py,sha256=hfBVK0CBa8m4uBArxTnNRoJr3o1rJucyopR_8_9gkOo,6197
78
- nado_protocol-0.2.3.dist-info/METADATA,sha256=TEC9RaYoErFM0JiLMpPxdB5Be5IU1d6NJcQaAyHBwY4,9558
79
- nado_protocol-0.2.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
80
- nado_protocol-0.2.3.dist-info/entry_points.txt,sha256=Df0O9lFc-m0SyOh6_d9FHeG1OT-esxGm-p_z7rTT9h0,340
81
- nado_protocol-0.2.3.dist-info/RECORD,,
78
+ nado_protocol-0.2.4.dist-info/METADATA,sha256=O5j6sC9-pHy9D4NmSG2XBAyg68rvgRgq97OE9YKThmA,9558
79
+ nado_protocol-0.2.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
80
+ nado_protocol-0.2.4.dist-info/entry_points.txt,sha256=Df0O9lFc-m0SyOh6_d9FHeG1OT-esxGm-p_z7rTT9h0,340
81
+ nado_protocol-0.2.4.dist-info/RECORD,,