nash_protocol/graphql/
mod.rs

1//! This module generates types from the Nash GraphQL schema
2
3use graphql_client::*;
4
5// Types for custom scalars are not picked up automatically from
6// the schema. Need to add those manually here, and they will be
7// used inside the generated queries.
8type MarketName = String;
9type CurrencySymbol = String;
10type CurrencyNumber = String;
11type DateTime = String;
12type Base16 = String;
13type PaginationCursor = String;
14type AffiliateDeveloperCode = String;
15
16// But otherwise these macros will generate type constructor code
17// inside a new module, grounded on the associated structs
18
19/// Rust constructor for GetOrderbook query
20#[derive(GraphQLQuery)]
21#[graphql(
22    schema_path = "src/graphql/schema.json",
23    query_path = "src/graphql/queries/orderbook.graphql",
24    response_derives = "Debug"
25)]
26pub struct GetOrderbook;
27
28/// Rust constructor for GetTicker query
29#[derive(GraphQLQuery)]
30#[graphql(
31    schema_path = "src/graphql/schema.json",
32    query_path = "src/graphql/queries/get_ticker.graphql",
33    response_derives = "Debug"
34)]
35pub struct GetTicker;
36
37#[derive(GraphQLQuery)]
38#[graphql(
39    schema_path = "src/graphql/schema.json",
40    query_path = "src/graphql/subscriptions/updated_ticker.graphql",
41    response_derives = "Debug"
42)]
43pub struct UpdatedTicker;
44
45/// Rust constructor for subscription to incoming trades
46#[derive(GraphQLQuery)]
47#[graphql(
48    schema_path = "src/graphql/schema.json",
49    query_path = "src/graphql/subscriptions/trades.graphql",
50    response_derives = "Debug"
51)]
52pub struct SubscribeTrades;
53
54#[derive(GraphQLQuery)]
55#[graphql(
56    schema_path = "src/graphql/schema.json",
57    query_path = "src/graphql/subscriptions/updated_orderbook.graphql",
58    response_derives = "Debug"
59)]
60pub struct UpdatedOrderbook;
61
62#[derive(GraphQLQuery)]
63#[graphql(
64    schema_path = "src/graphql/schema.json",
65    query_path = "src/graphql/subscriptions/new_account_trades.graphql",
66    response_derives = "Debug"
67)]
68pub struct NewAccountTrades;
69
70#[derive(GraphQLQuery)]
71#[graphql(
72    schema_path = "src/graphql/schema.json",
73    query_path = "src/graphql/subscriptions/updated_account_orders.graphql",
74    response_derives = "Debug"
75)]
76pub struct UpdatedAccountOrders;
77
78
79#[derive(GraphQLQuery)]
80#[graphql(
81    schema_path = "src/graphql/schema.json",
82    query_path = "src/graphql/subscriptions/updated_account_balances.graphql",
83    response_derives = "Debug"
84)]
85pub struct UpdatedAccountBalances;
86
87/// Rust type for CancelAllOrders query constructor
88#[derive(GraphQLQuery)]
89#[graphql(
90    schema_path = "src/graphql/schema.json",
91    query_path = "src/graphql/mutations/cancel_all_orders.graphql",
92    response_derives = "Debug"
93)]
94pub struct CancelAllOrders;
95
96/// Rust type for DhFillPool query constructor
97#[derive(GraphQLQuery)]
98#[graphql(
99    schema_path = "src/graphql/schema.json",
100    query_path = "src/graphql/queries/dh_fill.graphql",
101    response_derives = "Debug"
102)]
103pub struct DhFillPool;
104
105/// Rust type for GetAssetsNonces constructor
106#[derive(GraphQLQuery)]
107#[graphql(
108    schema_path = "src/graphql/schema.json",
109    query_path = "src/graphql/queries/assets_nonces.graphql",
110    response_derives = "Debug"
111)]
112pub struct GetAssetsNonces;
113
114/// Rust type for PlaceLimitOrder mutation constructor
115#[derive(GraphQLQuery)]
116#[graphql(
117    schema_path = "src/graphql/schema.json",
118    query_path = "src/graphql/mutations/limit_order.graphql",
119    response_derives = "Debug"
120)]
121pub struct PlaceLimitOrder;
122
123#[derive(GraphQLQuery)]
124#[graphql(
125    schema_path = "src/graphql/schema.json",
126    query_path = "src/graphql/mutations/market_order.graphql",
127    response_derives = "Debug"
128)]
129pub struct PlaceMarketOrder;
130
131#[derive(GraphQLQuery)]
132#[graphql(
133    schema_path = "src/graphql/schema.json",
134    query_path = "src/graphql/mutations/sign_states.graphql",
135    response_derives = "Debug"
136)]
137pub struct SignStates;
138
139#[derive(GraphQLQuery)]
140#[graphql(
141    schema_path = "src/graphql/schema.json",
142    query_path = "src/graphql/queries/list_account_balances.graphql",
143    response_derives = "Debug"
144)]
145pub struct ListAccountBalances;
146
147#[derive(GraphQLQuery)]
148#[graphql(
149    schema_path = "src/graphql/schema.json",
150    query_path = "src/graphql/queries/get_account_order.graphql",
151    response_derives = "Debug"
152)]
153pub struct GetAccountOrder;
154
155#[derive(GraphQLQuery)]
156#[graphql(
157    schema_path = "src/graphql/schema.json",
158    query_path = "src/graphql/mutations/cancel_order.graphql",
159    response_derives = "Debug"
160)]
161pub struct CancelOrder;
162
163#[derive(GraphQLQuery)]
164#[graphql(
165    schema_path = "src/graphql/schema.json",
166    query_path = "src/graphql/queries/list_markets.graphql",
167    response_derives = "Debug"
168)]
169pub struct ListMarkets;
170
171#[derive(GraphQLQuery)]
172#[graphql(
173    schema_path = "src/graphql/schema.json",
174    query_path = "src/graphql/queries/list_account_orders.graphql",
175    response_derives = "Debug"
176)]
177pub struct ListAccountOrders;
178#[derive(GraphQLQuery)]
179#[graphql(
180    schema_path = "src/graphql/schema.json",
181    query_path = "src/graphql/queries/list_account_trades.graphql",
182    response_derives = "Debug"
183)]
184pub struct ListAccountTrades;
185
186#[derive(GraphQLQuery)]
187#[graphql(
188    schema_path = "src/graphql/schema.json",
189    query_path = "src/graphql/queries/list_candles.graphql",
190    response_derives = "Debug"
191)]
192pub struct ListCandles;
193
194#[derive(GraphQLQuery)]
195#[graphql(
196    schema_path = "src/graphql/schema.json",
197    query_path = "src/graphql/queries/list_trades.graphql",
198    response_derives = "Debug"
199)]
200pub struct ListTrades;
201