> ## 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.8.19

# Monaco Protocol SDK v0.8.19

This release adds **cross-margin support** to Monaco's risk-bucket margin system. Margin orders can now be placed against a shared **cross** risk bucket that spans several trading pairs, instead of only per-pair **isolated** risk buckets. The SDK surfaces the resolved margin mode and the cross bucket's selected-pair scope across order placement, positions, margin-account reads, collateral transfers, and risk simulation.

## Added

### Cross margin on risk buckets

Risk buckets now come in two modes, surfaced everywhere as `marginMode`:

* **`ISOLATED`** — a per-pair risk bucket keyed by `tradingPairId`. This is the default and existing behavior.
* **`CROSS`** — a shared risk bucket whose collateral backs positions across a set of `selectedTradingPairIds`.

A new `MarginMode` type (`"ISOLATED" | "CROSS"`) is exported for reuse.

**Order placement** — `placeLimitOrder`, `placeMarketOrder`, and `batchCreate` accept an optional `marginMode` (defaults to `ISOLATED`). Passing `"CROSS"` requires `marginAccountId`, routes the order to the active cross risk bucket for the selected `tradingPairId`, and cannot be combined with `riskBucketId`, `riskBucketCollateral`, or `strategyKey`.

**Positions** — `Position` (list and get) now includes an optional `marginMode`, so you can distinguish cross positions from isolated ones.

**Margin-account reads** — `MarginAccountSummary` (list and summary) now includes `selectedTradingPairIds` on cross risk-bucket rows, so a client can restore the cross bucket's selected-pair scope from account reads alone.

**Collateral transfer** — `transferCollateralToRiskBucket` now takes `marginMode`. For `CROSS`, pass `selectedTradingPairIds` and omit `tradingPairId` and `strategyKey`; for `ISOLATED` (default), pass `tradingPairId` as before. The response echoes the resolved `riskBucketId`, `marginMode`, and `selectedTradingPairIds`.

**Risk simulation** — `simulateRiskBucketOrderRisk` accepts the same `marginMode` and `selectedTradingPairIds` inputs, and its response now includes the resolved `riskBucketId`, `marginMode`, and `selectedTradingPairIds`.

**Surfaces**

* REST: `marginMode` on `POST /api/v1/orders` and `POST /api/v1/orders/batch-create`; `marginMode` + `selectedTradingPairIds` on `POST /api/v1/margin/risk-buckets/collateral/transfer-in` and `POST /api/v1/margin/risk-buckets/simulate-order-risk`; `marginMode` on position reads (`GET /api/v1/positions`, `GET /api/v1/positions/{positionId}`); `selectedTradingPairIds` on margin-account list and summary reads
* Core SDK: `sdk.trading.placeLimitOrder` / `placeMarketOrder` / `batchCreate`, `sdk.marginAccounts.transferCollateralToRiskBucket` / `simulateRiskBucketOrderRisk`
* React: the same contracts flow through the `@0xmonaco/react` hooks via the shared core/types surface
* gRPC: `CreateOrderRequest`, `BatchCreateOrderItem`, `Position`, `MarginAccountSummary`, and the risk-bucket transfer and simulation messages gain the new fields

## Upgrade

```bash theme={null}
npm install @0xmonaco/core@0.8.19 @0xmonaco/types@0.8.19 @0xmonaco/react@0.8.19
# or bun
bun add @0xmonaco/core@0.8.19 @0xmonaco/types@0.8.19 @0xmonaco/react@0.8.19
```

This release is additive — `marginMode` defaults to `ISOLATED`, existing request and response shapes are unchanged, and no code changes are required to upgrade.


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