@orderly.network/ui-order-entry 2.0.0-alpha.1

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.
@@ -0,0 +1,495 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { FocusEvent } from 'react';
4
+ import * as _orderly_network_types from '@orderly.network/types';
5
+ import { OrderSide, OrderType, OrderlyOrder } from '@orderly.network/types';
6
+
7
+ declare enum InputType {
8
+ PRICE = 0,
9
+ TRIGGER_PRICE = 1,
10
+ QUANTITY = 2,
11
+ TOTAL = 3,
12
+ NONE = 4
13
+ }
14
+
15
+ type OrderEntryScriptInputs = {
16
+ symbol: string;
17
+ };
18
+ declare const useOrderEntryScript: (inputs: OrderEntryScriptInputs) => {
19
+ currentQtyPercentage: number;
20
+ side: OrderSide;
21
+ type: OrderType;
22
+ setOrderValue: (key: "symbol" | "type" | "side" | "order_type" | "order_type_ext" | "order_price" | "order_quantity" | "order_amount" | "visible_quantity" | "reduce_only" | "slippage" | "order_tag" | "level" | "post_only_adjust" | "total" | "quantity" | "price" | "algo_type" | "trigger_price_type" | "trigger_price" | "child_orders" | "tp_pnl" | "tp_offset" | "tp_offset_percentage" | "tp_ROI" | "tp_trigger_price" | "sl_pnl" | "sl_offset" | "sl_offset_percentage" | "sl_ROI" | "sl_trigger_price", value: any) => void;
23
+ currentLeverage: number;
24
+ formattedOrder: Required<Pick<_orderly_network_types.OrderlyOrder, "symbol" | "side" | "order_type">> & Partial<Omit<_orderly_network_types.OrderlyOrder, "symbol" | "side" | "order_type">>;
25
+ cancelTP_SL: () => void;
26
+ setMaxQty: () => void;
27
+ symbolInfo: _orderly_network_types.API.SymbolExt;
28
+ onFocus: (type: InputType) => (_: FocusEvent) => void;
29
+ onBlur: (type: InputType) => (_: FocusEvent) => void;
30
+ refs: {
31
+ triggerPriceInputRef: react.MutableRefObject<HTMLInputElement | null>;
32
+ priceInputRef: react.MutableRefObject<HTMLInputElement | null>;
33
+ };
34
+ submit: () => Promise<void>;
35
+ reset: (order?: Partial<_orderly_network_types.OrderlyOrder> | undefined) => void;
36
+ resetErrors: () => void;
37
+ maxQty: number;
38
+ estLiqPrice: number | null;
39
+ estLeverage: number | null;
40
+ helper: {
41
+ validator: () => Promise<{
42
+ symbol?: {
43
+ type: string;
44
+ message: string;
45
+ } | undefined;
46
+ order_type?: {
47
+ type: string;
48
+ message: string;
49
+ } | undefined;
50
+ order_type_ext?: {
51
+ type: string;
52
+ message: string;
53
+ } | undefined;
54
+ order_price?: {
55
+ type: string;
56
+ message: string;
57
+ } | undefined;
58
+ order_quantity?: {
59
+ type: string;
60
+ message: string;
61
+ } | undefined;
62
+ order_amount?: {
63
+ type: string;
64
+ message: string;
65
+ } | undefined;
66
+ visible_quantity?: {
67
+ type: string;
68
+ message: string;
69
+ } | undefined;
70
+ side?: {
71
+ type: string;
72
+ message: string;
73
+ } | undefined;
74
+ reduce_only?: {
75
+ type: string;
76
+ message: string;
77
+ } | undefined;
78
+ slippage?: {
79
+ type: string;
80
+ message: string;
81
+ } | undefined;
82
+ order_tag?: {
83
+ type: string;
84
+ message: string;
85
+ } | undefined;
86
+ level?: {
87
+ type: string;
88
+ message: string;
89
+ } | undefined;
90
+ post_only_adjust?: {
91
+ type: string;
92
+ message: string;
93
+ } | undefined;
94
+ total?: {
95
+ type: string;
96
+ message: string;
97
+ } | undefined;
98
+ quantity?: {
99
+ type: string;
100
+ message: string;
101
+ } | undefined;
102
+ type?: {
103
+ type: string;
104
+ message: string;
105
+ } | undefined;
106
+ price?: {
107
+ type: string;
108
+ message: string;
109
+ } | undefined;
110
+ algo_type?: {
111
+ type: string;
112
+ message: string;
113
+ } | undefined;
114
+ trigger_price_type?: {
115
+ type: string;
116
+ message: string;
117
+ } | undefined;
118
+ trigger_price?: {
119
+ type: string;
120
+ message: string;
121
+ } | undefined;
122
+ child_orders?: {
123
+ type: string;
124
+ message: string;
125
+ } | undefined;
126
+ tp_pnl?: {
127
+ type: string;
128
+ message: string;
129
+ } | undefined;
130
+ tp_offset?: {
131
+ type: string;
132
+ message: string;
133
+ } | undefined;
134
+ tp_offset_percentage?: {
135
+ type: string;
136
+ message: string;
137
+ } | undefined;
138
+ tp_ROI?: {
139
+ type: string;
140
+ message: string;
141
+ } | undefined;
142
+ tp_trigger_price?: {
143
+ type: string;
144
+ message: string;
145
+ } | undefined;
146
+ sl_pnl?: {
147
+ type: string;
148
+ message: string;
149
+ } | undefined;
150
+ sl_offset?: {
151
+ type: string;
152
+ message: string;
153
+ } | undefined;
154
+ sl_offset_percentage?: {
155
+ type: string;
156
+ message: string;
157
+ } | undefined;
158
+ sl_ROI?: {
159
+ type: string;
160
+ message: string;
161
+ } | undefined;
162
+ sl_trigger_price?: {
163
+ type: string;
164
+ message: string;
165
+ } | undefined;
166
+ } | null>;
167
+ validate: () => Promise<{
168
+ symbol?: {
169
+ type: string;
170
+ message: string;
171
+ } | undefined;
172
+ order_type?: {
173
+ type: string;
174
+ message: string;
175
+ } | undefined;
176
+ order_type_ext?: {
177
+ type: string;
178
+ message: string;
179
+ } | undefined;
180
+ order_price?: {
181
+ type: string;
182
+ message: string;
183
+ } | undefined;
184
+ order_quantity?: {
185
+ type: string;
186
+ message: string;
187
+ } | undefined;
188
+ order_amount?: {
189
+ type: string;
190
+ message: string;
191
+ } | undefined;
192
+ visible_quantity?: {
193
+ type: string;
194
+ message: string;
195
+ } | undefined;
196
+ side?: {
197
+ type: string;
198
+ message: string;
199
+ } | undefined;
200
+ reduce_only?: {
201
+ type: string;
202
+ message: string;
203
+ } | undefined;
204
+ slippage?: {
205
+ type: string;
206
+ message: string;
207
+ } | undefined;
208
+ order_tag?: {
209
+ type: string;
210
+ message: string;
211
+ } | undefined;
212
+ level?: {
213
+ type: string;
214
+ message: string;
215
+ } | undefined;
216
+ post_only_adjust?: {
217
+ type: string;
218
+ message: string;
219
+ } | undefined;
220
+ total?: {
221
+ type: string;
222
+ message: string;
223
+ } | undefined;
224
+ quantity?: {
225
+ type: string;
226
+ message: string;
227
+ } | undefined;
228
+ type?: {
229
+ type: string;
230
+ message: string;
231
+ } | undefined;
232
+ price?: {
233
+ type: string;
234
+ message: string;
235
+ } | undefined;
236
+ algo_type?: {
237
+ type: string;
238
+ message: string;
239
+ } | undefined;
240
+ trigger_price_type?: {
241
+ type: string;
242
+ message: string;
243
+ } | undefined;
244
+ trigger_price?: {
245
+ type: string;
246
+ message: string;
247
+ } | undefined;
248
+ child_orders?: {
249
+ type: string;
250
+ message: string;
251
+ } | undefined;
252
+ tp_pnl?: {
253
+ type: string;
254
+ message: string;
255
+ } | undefined;
256
+ tp_offset?: {
257
+ type: string;
258
+ message: string;
259
+ } | undefined;
260
+ tp_offset_percentage?: {
261
+ type: string;
262
+ message: string;
263
+ } | undefined;
264
+ tp_ROI?: {
265
+ type: string;
266
+ message: string;
267
+ } | undefined;
268
+ tp_trigger_price?: {
269
+ type: string;
270
+ message: string;
271
+ } | undefined;
272
+ sl_pnl?: {
273
+ type: string;
274
+ message: string;
275
+ } | undefined;
276
+ sl_offset?: {
277
+ type: string;
278
+ message: string;
279
+ } | undefined;
280
+ sl_offset_percentage?: {
281
+ type: string;
282
+ message: string;
283
+ } | undefined;
284
+ sl_ROI?: {
285
+ type: string;
286
+ message: string;
287
+ } | undefined;
288
+ sl_trigger_price?: {
289
+ type: string;
290
+ message: string;
291
+ } | undefined;
292
+ } | null>;
293
+ };
294
+ freeCollateral: number;
295
+ metaState: {
296
+ dirty: {
297
+ symbol?: boolean | undefined;
298
+ order_type?: boolean | undefined;
299
+ order_type_ext?: boolean | undefined;
300
+ order_price?: boolean | undefined;
301
+ order_quantity?: boolean | undefined;
302
+ order_amount?: boolean | undefined;
303
+ visible_quantity?: boolean | undefined;
304
+ side?: boolean | undefined;
305
+ reduce_only?: boolean | undefined;
306
+ slippage?: boolean | undefined;
307
+ order_tag?: boolean | undefined;
308
+ level?: boolean | undefined;
309
+ post_only_adjust?: boolean | undefined;
310
+ total?: boolean | undefined;
311
+ quantity?: boolean | undefined;
312
+ type?: boolean | undefined;
313
+ price?: boolean | undefined;
314
+ algo_type?: boolean | undefined;
315
+ trigger_price_type?: boolean | undefined;
316
+ trigger_price?: boolean | undefined;
317
+ child_orders?: boolean | undefined;
318
+ tp_pnl?: boolean | undefined;
319
+ tp_offset?: boolean | undefined;
320
+ tp_offset_percentage?: boolean | undefined;
321
+ tp_ROI?: boolean | undefined;
322
+ tp_trigger_price?: boolean | undefined;
323
+ sl_pnl?: boolean | undefined;
324
+ sl_offset?: boolean | undefined;
325
+ sl_offset_percentage?: boolean | undefined;
326
+ sl_ROI?: boolean | undefined;
327
+ sl_trigger_price?: boolean | undefined;
328
+ };
329
+ submitted: boolean;
330
+ validated: boolean;
331
+ errors: {
332
+ symbol?: {
333
+ type: string;
334
+ message: string;
335
+ } | undefined;
336
+ order_type?: {
337
+ type: string;
338
+ message: string;
339
+ } | undefined;
340
+ order_type_ext?: {
341
+ type: string;
342
+ message: string;
343
+ } | undefined;
344
+ order_price?: {
345
+ type: string;
346
+ message: string;
347
+ } | undefined;
348
+ order_quantity?: {
349
+ type: string;
350
+ message: string;
351
+ } | undefined;
352
+ order_amount?: {
353
+ type: string;
354
+ message: string;
355
+ } | undefined;
356
+ visible_quantity?: {
357
+ type: string;
358
+ message: string;
359
+ } | undefined;
360
+ side?: {
361
+ type: string;
362
+ message: string;
363
+ } | undefined;
364
+ reduce_only?: {
365
+ type: string;
366
+ message: string;
367
+ } | undefined;
368
+ slippage?: {
369
+ type: string;
370
+ message: string;
371
+ } | undefined;
372
+ order_tag?: {
373
+ type: string;
374
+ message: string;
375
+ } | undefined;
376
+ level?: {
377
+ type: string;
378
+ message: string;
379
+ } | undefined;
380
+ post_only_adjust?: {
381
+ type: string;
382
+ message: string;
383
+ } | undefined;
384
+ total?: {
385
+ type: string;
386
+ message: string;
387
+ } | undefined;
388
+ quantity?: {
389
+ type: string;
390
+ message: string;
391
+ } | undefined;
392
+ type?: {
393
+ type: string;
394
+ message: string;
395
+ } | undefined;
396
+ price?: {
397
+ type: string;
398
+ message: string;
399
+ } | undefined;
400
+ algo_type?: {
401
+ type: string;
402
+ message: string;
403
+ } | undefined;
404
+ trigger_price_type?: {
405
+ type: string;
406
+ message: string;
407
+ } | undefined;
408
+ trigger_price?: {
409
+ type: string;
410
+ message: string;
411
+ } | undefined;
412
+ child_orders?: {
413
+ type: string;
414
+ message: string;
415
+ } | undefined;
416
+ tp_pnl?: {
417
+ type: string;
418
+ message: string;
419
+ } | undefined;
420
+ tp_offset?: {
421
+ type: string;
422
+ message: string;
423
+ } | undefined;
424
+ tp_offset_percentage?: {
425
+ type: string;
426
+ message: string;
427
+ } | undefined;
428
+ tp_ROI?: {
429
+ type: string;
430
+ message: string;
431
+ } | undefined;
432
+ tp_trigger_price?: {
433
+ type: string;
434
+ message: string;
435
+ } | undefined;
436
+ sl_pnl?: {
437
+ type: string;
438
+ message: string;
439
+ } | undefined;
440
+ sl_offset?: {
441
+ type: string;
442
+ message: string;
443
+ } | undefined;
444
+ sl_offset_percentage?: {
445
+ type: string;
446
+ message: string;
447
+ } | undefined;
448
+ sl_ROI?: {
449
+ type: string;
450
+ message: string;
451
+ } | undefined;
452
+ sl_trigger_price?: {
453
+ type: string;
454
+ message: string;
455
+ } | undefined;
456
+ } | null;
457
+ };
458
+ isMutating: boolean;
459
+ onMarkPriceChange: (markPrice: number) => void;
460
+ };
461
+ type uesOrderEntryScriptReturn = ReturnType<typeof useOrderEntryScript>;
462
+
463
+ declare const OrderEntryWidget: (props: OrderEntryScriptInputs & {
464
+ containerRef?: any;
465
+ }) => react_jsx_runtime.JSX.Element;
466
+
467
+ declare const OrderEntry: (props: uesOrderEntryScriptReturn & {
468
+ containerRef: any;
469
+ }) => react_jsx_runtime.JSX.Element;
470
+
471
+ type Props = {
472
+ order: OrderlyOrder;
473
+ quoteDP: number;
474
+ baseDP: number;
475
+ onConfirm: () => void;
476
+ onCancel: () => void;
477
+ };
478
+ declare const OrderConfirmDialog: {
479
+ (props: Props): react_jsx_runtime.JSX.Element;
480
+ displayName: string;
481
+ };
482
+
483
+ type AdditionalInfoProps = {
484
+ pinned: boolean;
485
+ setPinned: (value: boolean) => void;
486
+ needConfirm: boolean;
487
+ setNeedConfirm: (value: boolean) => void;
488
+ orderTypeExtra?: OrderType;
489
+ onValueChange?: (key: keyof OrderlyOrder, value: any) => void;
490
+ showExtra?: boolean;
491
+ };
492
+
493
+ declare const AdditionalInfoWidget: (props: AdditionalInfoProps) => react_jsx_runtime.JSX.Element;
494
+
495
+ export { AdditionalInfoWidget, OrderConfirmDialog, OrderEntry, OrderEntryWidget };