@0xmonaco/react 1.0.40 → 1.0.41

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.
@@ -1,6 +1,7 @@
1
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
+ type ReplaceOrderOptions = NonNullable<Parameters<TradingAPI["replaceOrder"]>[1]>;
4
5
  export interface UseTradeReturn {
5
6
  /** Place a limit order */
6
7
  placeLimitOrder: (tradingPairId: string, side: OrderSide, quantity: string, price: string, options?: PlaceLimitOrderOptions) => Promise<CreateOrderResponse>;
@@ -19,12 +20,7 @@ export interface UseTradeReturn {
19
20
  /** Cancel all active orders, optionally filtered by trading pair */
20
21
  batchCancelAll: (tradingPairId?: string) => Promise<BatchCancelOrdersResponse>;
21
22
  /** Replace an existing order */
22
- replaceOrder: (orderId: string, newOrder: {
23
- price?: string;
24
- quantity?: string;
25
- useMasterBalance?: boolean;
26
- postOnly?: boolean;
27
- }) => Promise<ReplaceOrderResponse>;
23
+ replaceOrder: (orderId: string, newOrder: ReplaceOrderOptions) => Promise<ReplaceOrderResponse>;
28
24
  /** Batch create multiple orders */
29
25
  batchCreate: (orders: BatchCreateOrderParams[]) => Promise<BatchCreateOrdersResponse>;
30
26
  /** Batch replace multiple orders */
@@ -68,7 +68,10 @@ export const useTrade = () => {
68
68
  throw new Error("SDK not available");
69
69
  return await sdk.trading.batchCancelAll(tradingPairId);
70
70
  }, [sdk]);
71
- const replaceOrder = useCallback(async (orderId, newOrder) => {
71
+ const replaceOrder = useCallback(
72
+ // Derived from the TradingAPI signature so new replace options (e.g.
73
+ // clientOrderId) flow through without re-listing them here.
74
+ async (orderId, newOrder) => {
72
75
  if (!sdk)
73
76
  throw new Error("SDK not available");
74
77
  if (!orderId?.trim())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/react",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
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": "1.0.40",
24
- "@0xmonaco/types": "1.0.40"
23
+ "@0xmonaco/core": "1.0.41",
24
+ "@0xmonaco/types": "1.0.41"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "^19.1.12",