nado-protocol 0.1.0__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.
- nado_protocol/__init__.py +0 -0
- nado_protocol/client/__init__.py +200 -0
- nado_protocol/client/apis/__init__.py +26 -0
- nado_protocol/client/apis/base.py +42 -0
- nado_protocol/client/apis/market/__init__.py +23 -0
- nado_protocol/client/apis/market/execute.py +192 -0
- nado_protocol/client/apis/market/query.py +310 -0
- nado_protocol/client/apis/perp/__init__.py +18 -0
- nado_protocol/client/apis/perp/query.py +30 -0
- nado_protocol/client/apis/rewards/__init__.py +6 -0
- nado_protocol/client/apis/rewards/execute.py +131 -0
- nado_protocol/client/apis/rewards/query.py +12 -0
- nado_protocol/client/apis/spot/__init__.py +23 -0
- nado_protocol/client/apis/spot/base.py +32 -0
- nado_protocol/client/apis/spot/execute.py +117 -0
- nado_protocol/client/apis/spot/query.py +79 -0
- nado_protocol/client/apis/subaccount/__init__.py +24 -0
- nado_protocol/client/apis/subaccount/execute.py +54 -0
- nado_protocol/client/apis/subaccount/query.py +145 -0
- nado_protocol/client/context.py +90 -0
- nado_protocol/contracts/__init__.py +377 -0
- nado_protocol/contracts/abis/Endpoint.json +636 -0
- nado_protocol/contracts/abis/FQuerier.json +1909 -0
- nado_protocol/contracts/abis/IClearinghouse.json +876 -0
- nado_protocol/contracts/abis/IERC20.json +185 -0
- nado_protocol/contracts/abis/IEndpoint.json +250 -0
- nado_protocol/contracts/abis/IFoundationRewardsAirdrop.json +76 -0
- nado_protocol/contracts/abis/IOffchainBook.json +536 -0
- nado_protocol/contracts/abis/IPerpEngine.json +931 -0
- nado_protocol/contracts/abis/IProductEngine.json +352 -0
- nado_protocol/contracts/abis/ISpotEngine.json +813 -0
- nado_protocol/contracts/abis/IStaking.json +288 -0
- nado_protocol/contracts/abis/IVrtxAirdrop.json +138 -0
- nado_protocol/contracts/abis/MockERC20.json +311 -0
- nado_protocol/contracts/deployments/deployment.test.json +18 -0
- nado_protocol/contracts/eip712/__init__.py +16 -0
- nado_protocol/contracts/eip712/domain.py +36 -0
- nado_protocol/contracts/eip712/sign.py +79 -0
- nado_protocol/contracts/eip712/types.py +154 -0
- nado_protocol/contracts/loader.py +55 -0
- nado_protocol/contracts/types.py +141 -0
- nado_protocol/engine_client/__init__.py +35 -0
- nado_protocol/engine_client/execute.py +416 -0
- nado_protocol/engine_client/query.py +481 -0
- nado_protocol/engine_client/types/__init__.py +113 -0
- nado_protocol/engine_client/types/execute.py +680 -0
- nado_protocol/engine_client/types/models.py +247 -0
- nado_protocol/engine_client/types/query.py +516 -0
- nado_protocol/engine_client/types/stream.py +6 -0
- nado_protocol/indexer_client/__init__.py +28 -0
- nado_protocol/indexer_client/query.py +466 -0
- nado_protocol/indexer_client/types/__init__.py +122 -0
- nado_protocol/indexer_client/types/models.py +364 -0
- nado_protocol/indexer_client/types/query.py +819 -0
- nado_protocol/trigger_client/__init__.py +17 -0
- nado_protocol/trigger_client/execute.py +118 -0
- nado_protocol/trigger_client/query.py +61 -0
- nado_protocol/trigger_client/types/__init__.py +7 -0
- nado_protocol/trigger_client/types/execute.py +89 -0
- nado_protocol/trigger_client/types/models.py +44 -0
- nado_protocol/trigger_client/types/query.py +77 -0
- nado_protocol/utils/__init__.py +37 -0
- nado_protocol/utils/backend.py +111 -0
- nado_protocol/utils/bytes32.py +159 -0
- nado_protocol/utils/enum.py +6 -0
- nado_protocol/utils/exceptions.py +58 -0
- nado_protocol/utils/execute.py +403 -0
- nado_protocol/utils/expiration.py +45 -0
- nado_protocol/utils/interest.py +66 -0
- nado_protocol/utils/math.py +67 -0
- nado_protocol/utils/model.py +79 -0
- nado_protocol/utils/nonce.py +33 -0
- nado_protocol/utils/subaccount.py +18 -0
- nado_protocol/utils/time.py +21 -0
- nado_protocol-0.1.0.dist-info/METADATA +157 -0
- nado_protocol-0.1.0.dist-info/RECORD +78 -0
- nado_protocol-0.1.0.dist-info/WHEEL +4 -0
- nado_protocol-0.1.0.dist-info/entry_points.txt +11 -0
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
from nado_protocol.utils.enum import StrEnum
|
|
2
|
+
from typing import Optional, Union
|
|
3
|
+
from pydantic import validator
|
|
4
|
+
from nado_protocol.utils.model import NadoBaseModel
|
|
5
|
+
from nado_protocol.engine_client.types.models import (
|
|
6
|
+
ApplyDeltaTx,
|
|
7
|
+
Asset,
|
|
8
|
+
BurnLpTx,
|
|
9
|
+
EngineStatus,
|
|
10
|
+
IsolatedPosition,
|
|
11
|
+
MarketPair,
|
|
12
|
+
MaxOrderSizeDirection,
|
|
13
|
+
MintLpTx,
|
|
14
|
+
ProductSymbol,
|
|
15
|
+
ResponseStatus,
|
|
16
|
+
SpotApr,
|
|
17
|
+
SpotProduct,
|
|
18
|
+
SubaccountHealth,
|
|
19
|
+
SpotProductBalance,
|
|
20
|
+
PerpProduct,
|
|
21
|
+
SymbolData,
|
|
22
|
+
PerpProductBalance,
|
|
23
|
+
MarketLiquidity,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class EngineQueryType(StrEnum):
|
|
28
|
+
"""
|
|
29
|
+
Enumeration of the different types of engine queries.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
STATUS = "status"
|
|
33
|
+
CONTRACTS = "contracts"
|
|
34
|
+
NONCES = "nonces"
|
|
35
|
+
ORDER = "order"
|
|
36
|
+
SYMBOLS = "symbols"
|
|
37
|
+
ALL_PRODUCTS = "all_products"
|
|
38
|
+
FEE_RATES = "fee_rates"
|
|
39
|
+
HEALTH_GROUPS = "health_groups"
|
|
40
|
+
LINKED_SIGNER = "linked_signer"
|
|
41
|
+
MARKET_LIQUIDITY = "market_liquidity"
|
|
42
|
+
MARKET_PRICE = "market_price"
|
|
43
|
+
MAX_ORDER_SIZE = "max_order_size"
|
|
44
|
+
MAX_WITHDRAWABLE = "max_withdrawable"
|
|
45
|
+
MAX_LP_MINTABLE = "max_lp_mintable"
|
|
46
|
+
SUBACCOUNT_INFO = "subaccount_info"
|
|
47
|
+
SUBACCOUNT_ORDERS = "subaccount_orders"
|
|
48
|
+
ORDERS = "orders"
|
|
49
|
+
ISOLATED_POSITIONS = "isolated_positions"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class QueryStatusParams(NadoBaseModel):
|
|
53
|
+
"""
|
|
54
|
+
Parameters for querying the status of the engine.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
type = EngineQueryType.STATUS.value
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class QueryContractsParams(NadoBaseModel):
|
|
61
|
+
"""
|
|
62
|
+
Parameters for querying the Nado contract addresses.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
type = EngineQueryType.CONTRACTS.value
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class QueryNoncesParams(NadoBaseModel):
|
|
69
|
+
"""
|
|
70
|
+
Parameters for querying the nonces associated with a specific address.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
type = EngineQueryType.NONCES.value
|
|
74
|
+
address: str
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class QueryOrderParams(NadoBaseModel):
|
|
78
|
+
"""
|
|
79
|
+
Parameters for querying a specific order using its product_id and digest.
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
type = EngineQueryType.ORDER.value
|
|
83
|
+
product_id: int
|
|
84
|
+
digest: str
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class QueryIsolatedPositionsParams(NadoBaseModel):
|
|
88
|
+
"""
|
|
89
|
+
Parameters for querying the isolated positions of a specific subaccount.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
type = EngineQueryType.ISOLATED_POSITIONS.value
|
|
93
|
+
subaccount: str
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
QuerySubaccountInfoTx = Union[MintLpTx, BurnLpTx, ApplyDeltaTx]
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class QuerySubaccountInfoParams(NadoBaseModel):
|
|
100
|
+
"""
|
|
101
|
+
Parameters for querying the subaccount summary from engine, including balances.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
type = EngineQueryType.SUBACCOUNT_INFO.value
|
|
105
|
+
subaccount: str
|
|
106
|
+
txs: Optional[list[QuerySubaccountInfoTx]]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class QuerySubaccountOpenOrdersParams(NadoBaseModel):
|
|
110
|
+
"""
|
|
111
|
+
Parameters for querying open orders associated with a subaccount for a specific product.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
type = EngineQueryType.SUBACCOUNT_ORDERS.value
|
|
115
|
+
product_id: int
|
|
116
|
+
sender: str
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class QuerySubaccountMultiProductOpenOrdersParams(NadoBaseModel):
|
|
120
|
+
"""
|
|
121
|
+
Parameters for querying open orders associated with a subaccount for provided products.
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
type = EngineQueryType.ORDERS.value
|
|
125
|
+
product_ids: list[int]
|
|
126
|
+
sender: str
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class QueryMarketLiquidityParams(NadoBaseModel):
|
|
130
|
+
"""
|
|
131
|
+
Parameters for querying the market liquidity for a specific product up to a defined depth.
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
type = EngineQueryType.MARKET_LIQUIDITY.value
|
|
135
|
+
product_id: int
|
|
136
|
+
depth: int
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class QuerySymbolsParams(NadoBaseModel):
|
|
140
|
+
"""
|
|
141
|
+
Parameters for querying symbols and product info
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
type = EngineQueryType.SYMBOLS.value
|
|
145
|
+
product_type: Optional[str]
|
|
146
|
+
product_ids: Optional[list[int]]
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class QueryAllProductsParams(NadoBaseModel):
|
|
150
|
+
"""
|
|
151
|
+
Parameters for querying all products available in the engine.
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
type = EngineQueryType.ALL_PRODUCTS.value
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class QueryMarketPriceParams(NadoBaseModel):
|
|
158
|
+
"""
|
|
159
|
+
Parameters for querying the market price of a specific product.
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
type = EngineQueryType.MARKET_PRICE.value
|
|
163
|
+
product_id: int
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class SpotLeverageSerializerMixin(NadoBaseModel):
|
|
167
|
+
spot_leverage: Optional[bool]
|
|
168
|
+
|
|
169
|
+
@validator("spot_leverage")
|
|
170
|
+
def spot_leverage_to_str(cls, v: Optional[bool]) -> Optional[str]:
|
|
171
|
+
return str(v).lower() if v is not None else v
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class QueryMaxOrderSizeParams(SpotLeverageSerializerMixin):
|
|
175
|
+
"""
|
|
176
|
+
Parameters for querying the maximum order size for a specific product and a given sender.
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
type = EngineQueryType.MAX_ORDER_SIZE.value
|
|
180
|
+
sender: str
|
|
181
|
+
product_id: int
|
|
182
|
+
price_x18: str
|
|
183
|
+
direction: MaxOrderSizeDirection
|
|
184
|
+
|
|
185
|
+
@validator("direction")
|
|
186
|
+
def direction_to_str(cls, v: MaxOrderSizeDirection) -> str:
|
|
187
|
+
return v.value
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class QueryMaxWithdrawableParams(SpotLeverageSerializerMixin):
|
|
191
|
+
"""
|
|
192
|
+
Parameters for querying the maximum withdrawable amount for a specific product and a given sender.
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
type = EngineQueryType.MAX_WITHDRAWABLE.value
|
|
196
|
+
sender: str
|
|
197
|
+
product_id: int
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class QueryMaxLpMintableParams(SpotLeverageSerializerMixin):
|
|
201
|
+
"""
|
|
202
|
+
Parameters for querying the maximum liquidity that can be minted by a specified sender for a specific product.
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
type = EngineQueryType.MAX_LP_MINTABLE.value
|
|
206
|
+
sender: str
|
|
207
|
+
product_id: int
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class QueryFeeRatesParams(NadoBaseModel):
|
|
211
|
+
"""
|
|
212
|
+
Parameters for querying the fee rates associated with a specified sender.
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
type = EngineQueryType.FEE_RATES.value
|
|
216
|
+
sender: str
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class QueryHealthGroupsParams(NadoBaseModel):
|
|
220
|
+
"""
|
|
221
|
+
Parameters for querying the health groups in the engine.
|
|
222
|
+
"""
|
|
223
|
+
|
|
224
|
+
type = EngineQueryType.HEALTH_GROUPS.value
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class QueryLinkedSignerParams(NadoBaseModel):
|
|
228
|
+
"""
|
|
229
|
+
Parameters for querying the signer linked to a specified subaccount.
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
type = EngineQueryType.LINKED_SIGNER.value
|
|
233
|
+
subaccount: str
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
QueryRequest = Union[
|
|
237
|
+
QueryStatusParams,
|
|
238
|
+
QueryContractsParams,
|
|
239
|
+
QueryNoncesParams,
|
|
240
|
+
QueryOrderParams,
|
|
241
|
+
QuerySubaccountInfoParams,
|
|
242
|
+
QuerySubaccountOpenOrdersParams,
|
|
243
|
+
QuerySubaccountMultiProductOpenOrdersParams,
|
|
244
|
+
QueryMarketLiquidityParams,
|
|
245
|
+
QuerySymbolsParams,
|
|
246
|
+
QueryAllProductsParams,
|
|
247
|
+
QueryMarketPriceParams,
|
|
248
|
+
QueryMaxOrderSizeParams,
|
|
249
|
+
QueryMaxWithdrawableParams,
|
|
250
|
+
QueryMaxLpMintableParams,
|
|
251
|
+
QueryFeeRatesParams,
|
|
252
|
+
QueryHealthGroupsParams,
|
|
253
|
+
QueryLinkedSignerParams,
|
|
254
|
+
QueryIsolatedPositionsParams,
|
|
255
|
+
]
|
|
256
|
+
|
|
257
|
+
StatusData = EngineStatus
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class ContractsData(NadoBaseModel):
|
|
261
|
+
"""
|
|
262
|
+
Data model for Nado's contract addresses.
|
|
263
|
+
"""
|
|
264
|
+
|
|
265
|
+
chain_id: str
|
|
266
|
+
endpoint_addr: str
|
|
267
|
+
book_addrs: list[str]
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class NoncesData(NadoBaseModel):
|
|
271
|
+
"""
|
|
272
|
+
Data model for nonce values for transactions and orders.
|
|
273
|
+
"""
|
|
274
|
+
|
|
275
|
+
tx_nonce: str
|
|
276
|
+
order_nonce: str
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class OrderData(NadoBaseModel):
|
|
280
|
+
"""
|
|
281
|
+
Data model for details of an order.
|
|
282
|
+
"""
|
|
283
|
+
|
|
284
|
+
product_id: int
|
|
285
|
+
sender: str
|
|
286
|
+
price_x18: str
|
|
287
|
+
amount: str
|
|
288
|
+
expiration: str
|
|
289
|
+
nonce: str
|
|
290
|
+
unfilled_amount: str
|
|
291
|
+
digest: str
|
|
292
|
+
placed_at: str
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
class SubaccountInfoData(NadoBaseModel):
|
|
296
|
+
"""
|
|
297
|
+
Model for detailed info about a subaccount, including balances.
|
|
298
|
+
"""
|
|
299
|
+
|
|
300
|
+
subaccount: str
|
|
301
|
+
exists: bool
|
|
302
|
+
healths: list[SubaccountHealth]
|
|
303
|
+
health_contributions: list[list[str]]
|
|
304
|
+
spot_count: int
|
|
305
|
+
perp_count: int
|
|
306
|
+
spot_balances: list[SpotProductBalance]
|
|
307
|
+
perp_balances: list[PerpProductBalance]
|
|
308
|
+
spot_products: list[SpotProduct]
|
|
309
|
+
perp_products: list[PerpProduct]
|
|
310
|
+
|
|
311
|
+
def parse_subaccount_balance(
|
|
312
|
+
self, product_id: int
|
|
313
|
+
) -> Union[SpotProductBalance, PerpProductBalance]:
|
|
314
|
+
"""
|
|
315
|
+
Parses the balance of a subaccount for a given product.
|
|
316
|
+
|
|
317
|
+
Args:
|
|
318
|
+
product_id (int): The ID of the product to lookup.
|
|
319
|
+
|
|
320
|
+
Returns:
|
|
321
|
+
Union[SpotProductBalance, PerpProductBalance]: The balance of the product in the subaccount.
|
|
322
|
+
|
|
323
|
+
Raises:
|
|
324
|
+
ValueError: If the product ID provided is not found.
|
|
325
|
+
"""
|
|
326
|
+
for spot_balance in self.spot_balances:
|
|
327
|
+
if spot_balance.product_id == product_id:
|
|
328
|
+
return spot_balance
|
|
329
|
+
|
|
330
|
+
for perp_balance in self.perp_balances:
|
|
331
|
+
if perp_balance.product_id == product_id:
|
|
332
|
+
return perp_balance
|
|
333
|
+
|
|
334
|
+
raise ValueError(f"Invalid product id provided: {product_id}")
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class IsolatedPositionsData(NadoBaseModel):
|
|
338
|
+
"""
|
|
339
|
+
Data model for isolated positions of a subaccount.
|
|
340
|
+
"""
|
|
341
|
+
|
|
342
|
+
isolated_positions: list[IsolatedPosition]
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
class SubaccountOpenOrdersData(NadoBaseModel):
|
|
346
|
+
"""
|
|
347
|
+
Data model encapsulating open orders of a subaccount for a
|
|
348
|
+
specific product.
|
|
349
|
+
"""
|
|
350
|
+
|
|
351
|
+
sender: str
|
|
352
|
+
orders: list[OrderData]
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
class ProductOpenOrdersData(NadoBaseModel):
|
|
356
|
+
"""
|
|
357
|
+
Data model encapsulating open orders for a product.
|
|
358
|
+
"""
|
|
359
|
+
|
|
360
|
+
product_id: int
|
|
361
|
+
orders: list[OrderData]
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class SubaccountMultiProductsOpenOrdersData(NadoBaseModel):
|
|
365
|
+
"""
|
|
366
|
+
Data model encapsulating open orders of a subaccount across multiple products.
|
|
367
|
+
"""
|
|
368
|
+
|
|
369
|
+
sender: str
|
|
370
|
+
product_orders: list[ProductOpenOrdersData]
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class MarketLiquidityData(NadoBaseModel):
|
|
374
|
+
"""
|
|
375
|
+
Data model for market liquidity details.
|
|
376
|
+
"""
|
|
377
|
+
|
|
378
|
+
bids: list[MarketLiquidity]
|
|
379
|
+
asks: list[MarketLiquidity]
|
|
380
|
+
timestamp: str
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
class AllProductsData(NadoBaseModel):
|
|
384
|
+
"""
|
|
385
|
+
Data model for all the products available.
|
|
386
|
+
"""
|
|
387
|
+
|
|
388
|
+
spot_products: list[SpotProduct]
|
|
389
|
+
perp_products: list[PerpProduct]
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
class MarketPriceData(NadoBaseModel):
|
|
393
|
+
"""
|
|
394
|
+
Data model for the bid and ask prices of a specific product.
|
|
395
|
+
"""
|
|
396
|
+
|
|
397
|
+
product_id: int
|
|
398
|
+
bid_x18: str
|
|
399
|
+
ask_x18: str
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class MaxOrderSizeData(NadoBaseModel):
|
|
403
|
+
"""
|
|
404
|
+
Data model for the maximum order size.
|
|
405
|
+
"""
|
|
406
|
+
|
|
407
|
+
max_order_size: str
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
class MaxWithdrawableData(NadoBaseModel):
|
|
411
|
+
"""
|
|
412
|
+
Data model for the maximum withdrawable amount.
|
|
413
|
+
"""
|
|
414
|
+
|
|
415
|
+
max_withdrawable: str
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
class MaxLpMintableData(NadoBaseModel):
|
|
419
|
+
"""
|
|
420
|
+
Data model for the maximum liquidity that can be minted.
|
|
421
|
+
"""
|
|
422
|
+
|
|
423
|
+
max_base_amount: str
|
|
424
|
+
max_quote_amount: str
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
class FeeRatesData(NadoBaseModel):
|
|
428
|
+
"""
|
|
429
|
+
Data model for various fee rates associated with transactions.
|
|
430
|
+
"""
|
|
431
|
+
|
|
432
|
+
taker_fee_rates_x18: list[str]
|
|
433
|
+
maker_fee_rates_x18: list[str]
|
|
434
|
+
liquidation_sequencer_fee: str
|
|
435
|
+
health_check_sequencer_fee: str
|
|
436
|
+
taker_sequencer_fee: str
|
|
437
|
+
withdraw_sequencer_fees: list[str]
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class HealthGroupsData(NadoBaseModel):
|
|
441
|
+
"""
|
|
442
|
+
Data model for health group IDs.
|
|
443
|
+
"""
|
|
444
|
+
|
|
445
|
+
health_groups: list[list[int]]
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class LinkedSignerData(NadoBaseModel):
|
|
449
|
+
"""
|
|
450
|
+
Data model for the signer linked to a subaccount.
|
|
451
|
+
"""
|
|
452
|
+
|
|
453
|
+
linked_signer: str
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
class SymbolsData(NadoBaseModel):
|
|
457
|
+
"""
|
|
458
|
+
Data model for the symbols product info
|
|
459
|
+
"""
|
|
460
|
+
|
|
461
|
+
symbols: dict[str, SymbolData]
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
ProductSymbolsData = list[ProductSymbol]
|
|
465
|
+
|
|
466
|
+
QueryResponseData = Union[
|
|
467
|
+
StatusData,
|
|
468
|
+
ContractsData,
|
|
469
|
+
NoncesData,
|
|
470
|
+
OrderData,
|
|
471
|
+
SubaccountInfoData,
|
|
472
|
+
SubaccountOpenOrdersData,
|
|
473
|
+
SubaccountMultiProductsOpenOrdersData,
|
|
474
|
+
MarketLiquidityData,
|
|
475
|
+
SymbolsData,
|
|
476
|
+
AllProductsData,
|
|
477
|
+
MarketPriceData,
|
|
478
|
+
MaxOrderSizeData,
|
|
479
|
+
MaxWithdrawableData,
|
|
480
|
+
MaxLpMintableData,
|
|
481
|
+
FeeRatesData,
|
|
482
|
+
HealthGroupsData,
|
|
483
|
+
LinkedSignerData,
|
|
484
|
+
ProductSymbolsData,
|
|
485
|
+
IsolatedPositionsData,
|
|
486
|
+
]
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
class QueryResponse(NadoBaseModel):
|
|
490
|
+
"""
|
|
491
|
+
Represents a response to a query request.
|
|
492
|
+
|
|
493
|
+
Attributes:
|
|
494
|
+
status (ResponseStatus): The status of the query response.
|
|
495
|
+
|
|
496
|
+
data (Optional[QueryResponseData]): The data returned from the query, or an error message if the query failed.
|
|
497
|
+
|
|
498
|
+
error (Optional[str]): The error message, if any error occurred during the query.
|
|
499
|
+
|
|
500
|
+
error_code (Optional[int]): The error code, if any error occurred during the query.
|
|
501
|
+
|
|
502
|
+
request_type (Optional[str]): Type of the request.
|
|
503
|
+
"""
|
|
504
|
+
|
|
505
|
+
status: ResponseStatus
|
|
506
|
+
data: Optional[QueryResponseData]
|
|
507
|
+
error: Optional[str]
|
|
508
|
+
error_code: Optional[int]
|
|
509
|
+
request_type: Optional[str]
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
AssetsData = list[Asset]
|
|
513
|
+
|
|
514
|
+
MarketPairsData = list[MarketPair]
|
|
515
|
+
|
|
516
|
+
SpotsAprData = list[SpotApr]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from nado_protocol.indexer_client.query import IndexerQueryClient
|
|
2
|
+
from nado_protocol.indexer_client.types import IndexerClientOpts
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IndexerClient(IndexerQueryClient):
|
|
6
|
+
"""
|
|
7
|
+
Client for interacting with the indexer service.
|
|
8
|
+
|
|
9
|
+
It provides methods for querying data from the indexer service.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
opts (IndexerClientOpts): Client configuration options for connecting and interacting with the indexer service.
|
|
13
|
+
|
|
14
|
+
Methods:
|
|
15
|
+
__init__: Initializes the `IndexerClient` with the provided options.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, opts: IndexerClientOpts):
|
|
19
|
+
"""
|
|
20
|
+
Initializes the IndexerClient with the provided options.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
opts (IndexerClientOpts): Client configuration options for connecting and interacting with the indexer service.
|
|
24
|
+
"""
|
|
25
|
+
super().__init__(opts)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
__all__ = ["IndexerClient", "IndexerClientOpts", "IndexerQueryClient"]
|