@0xmonaco/react 0.8.19 → 0.8.21
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.
package/dist/coverage.d.ts
CHANGED
package/dist/coverage.js
CHANGED
|
@@ -8,6 +8,7 @@ export const COVERED = {
|
|
|
8
8
|
batch_create_orders: "useTrade",
|
|
9
9
|
batch_replace_orders: "useTrade",
|
|
10
10
|
cancel_conditional_order: "useTrade",
|
|
11
|
+
get_conditional_order: "useTrade",
|
|
11
12
|
cancel_order: "useTrade",
|
|
12
13
|
close_position: "usePositions",
|
|
13
14
|
batch_close_all_positions: "usePositions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, OrderSide, ReplaceOrderResponse, TradingAPI } from "@0xmonaco/types";
|
|
1
|
+
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, OrderSide, ReplaceOrderResponse, TradingAPI } from "@0xmonaco/types";
|
|
2
2
|
type PlaceLimitOrderOptions = NonNullable<Parameters<TradingAPI["placeLimitOrder"]>[4]>;
|
|
3
3
|
type PlaceMarketOrderOptions = NonNullable<Parameters<TradingAPI["placeMarketOrder"]>[3]>;
|
|
4
4
|
export interface UseTradeReturn {
|
|
@@ -10,6 +10,8 @@ export interface UseTradeReturn {
|
|
|
10
10
|
cancelOrder: (orderId: string) => Promise<CancelOrderResponse>;
|
|
11
11
|
/** Cancel an active conditional TP/SL order */
|
|
12
12
|
cancelConditionalOrder: (conditionalOrderId: string) => Promise<CancelConditionalOrderResponse>;
|
|
13
|
+
/** Get a single conditional TP/SL order by its UUID */
|
|
14
|
+
getConditionalOrder: (conditionalOrderId: string) => Promise<ConditionalOrder>;
|
|
13
15
|
/** List conditional TP/SL orders */
|
|
14
16
|
listConditionalOrders: (params?: ListConditionalOrdersParams) => Promise<ListConditionalOrdersResponse>;
|
|
15
17
|
/** Batch cancel specific orders by their IDs */
|
|
@@ -46,6 +46,13 @@ export const useTrade = () => {
|
|
|
46
46
|
throw new Error("Conditional order ID is required and cannot be empty");
|
|
47
47
|
return await sdk.trading.cancelConditionalOrder(conditionalOrderId);
|
|
48
48
|
}, [sdk]);
|
|
49
|
+
const getConditionalOrder = useCallback(async (conditionalOrderId) => {
|
|
50
|
+
if (!sdk)
|
|
51
|
+
throw new Error("SDK not available");
|
|
52
|
+
if (!conditionalOrderId?.trim())
|
|
53
|
+
throw new Error("Conditional order ID is required and cannot be empty");
|
|
54
|
+
return await sdk.trading.getConditionalOrder(conditionalOrderId);
|
|
55
|
+
}, [sdk]);
|
|
49
56
|
const listConditionalOrders = useCallback(async (params) => {
|
|
50
57
|
if (!sdk)
|
|
51
58
|
throw new Error("SDK not available");
|
|
@@ -113,6 +120,7 @@ export const useTrade = () => {
|
|
|
113
120
|
// Order management
|
|
114
121
|
cancelOrder,
|
|
115
122
|
cancelConditionalOrder,
|
|
123
|
+
getConditionalOrder,
|
|
116
124
|
listConditionalOrders,
|
|
117
125
|
batchCancel,
|
|
118
126
|
batchCancelAll,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"lint": "biome lint ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/core": "0.8.
|
|
24
|
-
"@0xmonaco/types": "0.8.
|
|
23
|
+
"@0xmonaco/core": "0.8.21",
|
|
24
|
+
"@0xmonaco/types": "0.8.21"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^19.1.12",
|