> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xmonaco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# V0.5.7

# Monaco Protocol SDK v0.5.7

## Batch Orders, MCP Server & Network Configuration Improvements

This release introduces batch order creation and replacement for high-frequency trading workflows, a fully rebuilt MCP server for AI assistant integrations, removes the manual WebSocket URL configuration requirement, and tightens the `network` parameter to prevent misconfiguration.

***

## New Features

### Batch Create Orders

Submit multiple orders in a single API call with the new `batchCreate()` method.

**Core SDK:**

* **New Method**: `sdk.trading.batchCreate(orders: BatchCreateOrderParams[])` — `POST /api/v1/orders/batch-create`
* **Partial Success**: Each order is processed independently — failures don't block the rest
* **Per-Order Results**: Detailed outcome per order including match result and error details if failed
* **Full Order Support**: Supports both LIMIT and MARKET orders; time-in-force options (GTC, IOC, FOK) apply to LIMIT orders only

**React SDK:**

* **New Hook Method**: `batchCreate()` available in `useTrade()`

**Example: Core SDK**

```typescript theme={null}
import { MonacoSDK } from "@0xmonaco/core";

const pair = await sdk.market.getTradingPairBySymbol("ETH/USDC");

const result = await sdk.trading.batchCreate([
  {
    tradingPairId: pair.id,
    orderType: "LIMIT",
    side: "BUY",
    quantity: "1.0",
    price: "2000.00",
    timeInForce: "GTC",
  },
  {
    tradingPairId: pair.id,
    orderType: "LIMIT",
    side: "BUY",
    quantity: "0.5",
    price: "1950.00",
    timeInForce: "GTC",
  },
]);

console.log(`Created ${result.total_succeeded} of ${result.total_requested} orders`);

result.results.forEach((r) => {
  if (r.success) {
    console.log(`Order ${r.order_id} created`);
  } else {
    console.error(`Failed: ${r.error?.code} — ${r.error?.message}`);
  }
});
```

**Example: React Hook**

```tsx theme={null}
import { useTrade } from "@0xmonaco/react";

function TradingPanel({ pairId }: { pairId: string }) {
  const { batchCreate } = useTrade();

  async function placeBracketOrders() {
    const result = await batchCreate([
      { tradingPairId: pairId, orderType: "LIMIT", side: "BUY", quantity: "1.0", price: "2000.00", timeInForce: "GTC" },
      { tradingPairId: pairId, orderType: "LIMIT", side: "BUY", quantity: "0.5", price: "1950.00", timeInForce: "GTC" },
    ]);
    console.log(`Created ${result.total_succeeded} orders`);
  }
}
```

**New Types:**

* `BatchCreateOrderParams` — Per-order input (tradingPairId, orderType, side, quantity, price?, timeInForce?, slippageTolerance?, expirationDate?, useMasterBalance?)
* `BatchCreateOrdersResponse` — `{ success, total_requested, total_succeeded, total_failed, results }`
* `BatchCreateResult` — `{ order_id, success, match_result?, error? }`
* `BatchError` — `{ code, message }`

***

### Batch Replace Orders

Replace multiple orders atomically in a single API call with the new `batchReplace()` method.

**Core SDK:**

* **New Method**: `sdk.trading.batchReplace(orders: BatchReplaceOrderParams[])` — `POST /api/v1/orders/batch-replace`
* **Atomic Per-Order**: Each replacement cancels the original and creates a new order independently
* **New Order IDs**: Each successful replacement returns a new order ID
* **Flexible Updates**: `price` and `quantity` are both optional — omit either to keep the original value

**React SDK:**

* **New Hook Method**: `batchReplace()` available in `useTrade()`

**Example: Core SDK**

```typescript theme={null}
const result = await sdk.trading.batchReplace([
  { orderId: "order_1", price: "2050.00" },
  { orderId: "order_2", price: "1975.00", quantity: "2.0" },
  { orderId: "order_3", price: "1925.00" },
]);

console.log(`Replaced ${result.total_succeeded} of ${result.total_requested} orders`);

result.results.forEach((r) => {
  if (r.success) {
    console.log(`New order ID: ${r.new_order_id} (replaced ${r.original_order_id})`);
  } else {
    console.error(`Failed: ${r.error?.code} — ${r.error?.message}`);
  }
});
```

**Example: React Hook**

```tsx theme={null}
import { useTrade } from "@0xmonaco/react";

function OrderGrid() {
  const { batchReplace } = useTrade();

  async function repriceAll(orders: { id: string; newPrice: string }[]) {
    const result = await batchReplace(orders.map(({ id, newPrice }) => ({ orderId: id, price: newPrice })));
    console.log(`Replaced ${result.total_succeeded} orders`);
  }
}
```

**New Types:**

* `BatchReplaceOrderParams` — `{ orderId, price?, quantity?, useMasterBalance? }`
* `BatchReplaceOrdersResponse` — `{ success, total_requested, total_succeeded, total_failed, results }`
* `BatchReplaceResult` — `{ original_order_id, success, new_order_id?, updated_fields?, match_result?, error? }`

***

### Movements Filters

Server-side filtering is now available on the user movements endpoint.

**Core SDK — `getPaginatedUserMovements()`:**

* New parameter: `entry_type` — filter by entry type
* New parameter: `transaction_type` — filter by transaction type
* New parameter: `asset_id` — filter by asset UUID
  **New types** (`@0xmonaco/types`):
* `LedgerEntryType` — union of entry type values
* `TransactionType` — union of transaction type values

**MCP server — `get_movements` tool:**

* Now accepts `entry_type`, `transaction_type`, and `asset_id` as optional filter inputs

```typescript theme={null}
// Core SDK
const deposits = await sdk.profile.getPaginatedUserMovements({
  entry_type: "CREDIT",
  transaction_type: "DEPOSIT",
});

const assetMovements = await sdk.profile.getPaginatedUserMovements({
  asset_id: "123e4567-e89b-12d3-a456-426614174000",
});
```

```tsx theme={null}
// React hook
const { movements } = useUserMovements({ transaction_type: "TRADE" });
```

***

### MCP Server

The Monaco MCP server has been rebuilt from the ground up. It exposes Monaco's full API surface as tools that any MCP-compatible AI assistant (Claude, Cursor, Windsurf) can call directly — no SDK code required.

**What's new in v0.5.7:**

* **26 tools across 9 modules**: search, market, orderbook, trades, trading, profile, fees, vault, and faucet
* **Public-only mode**: run with zero configuration to get read-only market data instantly — `MONACO_PRIVATE_KEY` and `MONACO_CLIENT_ID` are optional
* **Auto RPC defaults**: `MONACO_RPC_URL` defaults per network — no manual URL configuration needed
* **Node 16 compatibility**: polyfills for `fetch` and `WebSocket` for environments like Claude Desktop that run older Node versions

For setup instructions and a full list of available tools, see [MCP Server](/sdk/mcp-server).

***

## Breaking Changes

### `useUserMovements` Now Accepts an Options Object

The `useUserMovements` hook signature has changed from a positional `maxMovements` number to an options object.

```tsx theme={null}
// Before (v0.5.6)
const { movements } = useUserMovements(50);

// After (v0.5.7)
const { movements } = useUserMovements({ maxMovements: 50 });
```

All previous options are available under the same names in the options object. The filter params (`entry_type`, `transaction_type`, `asset_id`) are also passed here.

***

### `wsUrl` Removed from `SDKConfig` and `MonacoProvider`

The `wsUrl` configuration option has been removed. The WebSocket URL is now automatically resolved from the `network` parameter — no manual configuration required.

**Core SDK — What Changed:**

```typescript theme={null}
// Before (v0.5.6)
const sdk = new MonacoSDK({
  walletClient,
  network: "staging",
  seiRpcUrl: "https://evm-rpc-testnet.sei-apis.com",
  wsUrl: "wss://staging.apimonaco.xyz/ws",  // ← Remove this
});

// After (v0.5.7)
const sdk = new MonacoSDK({
  walletClient,
  network: "staging",
  seiRpcUrl: "https://evm-rpc-testnet.sei-apis.com",
});
```

**React SDK — What Changed:**

```tsx theme={null}
// Before (v0.5.6)
<MonacoProvider
  clientId="your-client-id"
  network="staging"
  seiRpcUrl="https://evm-rpc-testnet.sei-apis.com"
  wsUrl="wss://staging.apimonaco.xyz/ws"  // ← Remove this
>

// After (v0.5.7)
<MonacoProvider
  clientId="your-client-id"
  network="staging"
  seiRpcUrl="https://evm-rpc-testnet.sei-apis.com"
>
```

**Why this change:**

* Eliminates a common source of misconfiguration
* WebSocket and API URLs are always consistent with each other
* Simpler SDK initialization

***

### `Network` Type Now Accepts Only Preset Values

The `network` parameter no longer accepts arbitrary URL strings. Only preset network names are valid. Passing an unsupported value throws `InvalidConfigError`.

**What Changed:**

```typescript theme={null}
// Before (v0.5.6) — custom URL strings were silently accepted
const sdk = new MonacoSDK({
  network: "https://my-custom-api.com",  // ← No longer works
  // ...
});

// After (v0.5.7) — throws InvalidConfigError for unrecognised values
const sdk = new MonacoSDK({
  network: "staging",  // ← Use a preset name
  // ...
});
```

***

## Upgrade Instructions

### Install New Versions

```bash theme={null}
# npm
npm install @0xmonaco/core@0.5.7 @0xmonaco/types@0.5.7 @0xmonaco/react@0.5.7

# Bun
bun add @0xmonaco/core@0.5.7 @0xmonaco/types@0.5.7 @0xmonaco/react@0.5.7
```

### Migration Steps

#### 1. Update `useUserMovements` call sites

```tsx theme={null}
// Before
const { movements } = useUserMovements(50);

// After
const { movements } = useUserMovements({ maxMovements: 50 });
```

#### 2. Remove `wsUrl` from SDK initialization

Find all `MonacoSDK` constructor calls and remove the `wsUrl` property:

```typescript theme={null}
// Before
const sdk = new MonacoSDK({ walletClient, network: "staging", seiRpcUrl: "...", wsUrl: "..." });

// After
const sdk = new MonacoSDK({ walletClient, network: "staging", seiRpcUrl: "..." });
```

#### 3. Remove `wsUrl` from `MonacoProvider`

```tsx theme={null}
// Before
<MonacoProvider clientId="..." network="staging" seiRpcUrl="..." wsUrl="...">

// After
<MonacoProvider clientId="..." network="staging" seiRpcUrl="...">
```

#### 4. Remove `wsUrl` from environment variables

If you had `VITE_MONACO_WS_URL` or similar env vars, they are no longer needed.

#### 5. (Optional) Adopt batch order methods

Take advantage of the new batch APIs for high-frequency workflows:

```typescript theme={null}
// Instead of sequential placements
for (const order of orders) {
  await sdk.trading.placeLimitOrder(order.pairId, order.side, order.quantity, order.price);
}

// Use batch create
await sdk.trading.batchCreate(orders.map(o => ({
  tradingPairId: o.pairId,
  orderType: "LIMIT",
  side: o.side,
  quantity: o.quantity,
  price: o.price,
  timeInForce: "GTC",
})));
```

***

*For complete documentation, see [Order Management](/developers/trade), [useTrade hook](/sdk/react/hooks/use-trade), and [API Reference](/api-reference/orders/batch-create-orders).*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.