@0xmonaco/types 1.0.48 → 1.0.50-develop.9c1b239
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/margin-accounts/index.d.ts +39 -2
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sweeper/index.d.ts +49 -27
- package/dist/sweeper/index.js +4 -6
- package/dist/trading/orders.d.ts +5 -0
- package/dist/validation/margin-accounts.d.ts +2 -0
- package/dist/validation/margin-accounts.js +4 -0
- package/dist/vault/index.d.ts +7 -1
- package/dist/websocket/base.d.ts +69 -0
- package/dist/websocket/events/account-events.d.ts +8 -5
- package/dist/websocket/events/balance-events.d.ts +1 -1
- package/dist/websocket/events/conditional-order-events.d.ts +12 -9
- package/dist/websocket/events/instrument-events.d.ts +12 -2
- package/dist/websocket/events/market-stats-events.d.ts +6 -1
- package/dist/websocket/events/ohlcv-events.d.ts +8 -3
- package/dist/websocket/events/orderbook-events.d.ts +2 -2
- package/dist/websocket/events/orders-events.d.ts +173 -64
- package/dist/websocket/events/position-events.d.ts +8 -2
- package/dist/websocket/events/trade-events.d.ts +2 -2
- package/dist/websocket/events/twap-order-events.d.ts +24 -6
- package/dist/wire/schema.d.ts +85 -21
- package/package.json +2 -2
|
@@ -131,17 +131,43 @@ export interface TransferCollateralToParentMarginAccountRequest {
|
|
|
131
131
|
asset: string;
|
|
132
132
|
amount: string;
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Fund a pair's isolated risk bucket from the parent margin account's
|
|
136
|
+
* unallocated collateral (no wallet movement; the bucket is created if
|
|
137
|
+
* needed). What the money becomes when the bucket holds an open position is
|
|
138
|
+
* stated by `applyToPositionMargin` — the two intents want opposite fates for
|
|
139
|
+
* the same dollars. Either way the liquidation cushion improves identically.
|
|
140
|
+
*/
|
|
134
141
|
export interface TransferCollateralToIsolatedRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
|
|
135
142
|
marginMode?: "ISOLATED";
|
|
136
143
|
tradingPairId: string;
|
|
137
144
|
strategyKey?: string;
|
|
138
145
|
selectedTradingPairIds?: never;
|
|
146
|
+
/**
|
|
147
|
+
* `true` (and OMITTED — the default is the human "Adjust Margin" gesture):
|
|
148
|
+
* the amount is COMMITTED to the sole open position's stored margin.
|
|
149
|
+
* Effective leverage drops and stays down, initial margin required rises by
|
|
150
|
+
* the amount, free collateral is unchanged — new orders cannot spend it.
|
|
151
|
+
*
|
|
152
|
+
* `false`: plain allocation. Free collateral rises and the next order can
|
|
153
|
+
* spend it. Programmatic funding loops that top a bucket up to a free
|
|
154
|
+
* collateral target MUST pass `false`, or each top-up converts into
|
|
155
|
+
* requirement and the loop never converges.
|
|
156
|
+
*
|
|
157
|
+
* On a flat bucket both values are a plain allocation. The response's
|
|
158
|
+
* `positionMarginCredited` reports what actually happened — a credit can
|
|
159
|
+
* degrade to a plain allocation when the persisted position row is stale
|
|
160
|
+
* (close/reopen race).
|
|
161
|
+
*/
|
|
162
|
+
applyToPositionMargin?: boolean;
|
|
139
163
|
}
|
|
140
164
|
export interface TransferCollateralToCrossRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
|
|
141
165
|
marginMode: "CROSS";
|
|
142
166
|
selectedTradingPairIds: string[];
|
|
143
167
|
tradingPairId?: never;
|
|
144
168
|
strategyKey?: never;
|
|
169
|
+
/** Cross risk is pooled at bucket equity — there is no per-position margin; an explicit `true` is rejected. */
|
|
170
|
+
applyToPositionMargin?: never;
|
|
145
171
|
}
|
|
146
172
|
export type TransferCollateralToRiskBucketRequest = TransferCollateralToIsolatedRiskBucketRequest | TransferCollateralToCrossRiskBucketRequest;
|
|
147
173
|
export interface TransferCollateralFromParentMarginAccountRequest {
|
|
@@ -161,6 +187,16 @@ export interface TransferCollateralResponse {
|
|
|
161
187
|
newEquity: string;
|
|
162
188
|
newTotalCollateralValue: string;
|
|
163
189
|
newWithdrawableCollateral: string;
|
|
190
|
+
/**
|
|
191
|
+
* Whether the transfer was committed to a position's stored margin. Present
|
|
192
|
+
* only when a position-margin credit was in play: `true` — the credit
|
|
193
|
+
* landed; `false` — a credit was requested (or defaulted) but degraded to a
|
|
194
|
+
* plain allocation because the bucket's persisted position row was stale
|
|
195
|
+
* (close/reopen race) — re-issue the Adjust Margin once the new position
|
|
196
|
+
* row lands if the commitment still matters. Absent (never null) on plain
|
|
197
|
+
* allocations, parent deposits, and releases.
|
|
198
|
+
*/
|
|
199
|
+
positionMarginCredited?: boolean;
|
|
164
200
|
}
|
|
165
201
|
export interface GetMarginAccountMovementsParams {
|
|
166
202
|
movementType?: string;
|
|
@@ -237,8 +273,9 @@ export interface MarginAccountsAPI extends BaseAPI {
|
|
|
237
273
|
getMarginAccountSummary(marginAccountId: string, params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
|
|
238
274
|
getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
|
|
239
275
|
/**
|
|
240
|
-
* @deprecated
|
|
241
|
-
*
|
|
276
|
+
* @deprecated Use `transferCollateralToRiskBucket` for bucket funding
|
|
277
|
+
* (which now credits a sole open position's stored margin the same way) and
|
|
278
|
+
* `transferCollateralToParentMarginAccount` for wallet-to-margin deposits.
|
|
242
279
|
*/
|
|
243
280
|
transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
244
281
|
transferCollateralToParentMarginAccount(request: TransferCollateralToParentMarginAccountRequest): Promise<TransferCollateralResponse>;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export interface MonacoSDK {
|
|
|
109
109
|
pitpass: PitpassAPI;
|
|
110
110
|
/** Testnet faucet API */
|
|
111
111
|
faucet: FaucetAPI;
|
|
112
|
-
/**
|
|
112
|
+
/** Deposit-address registration (sweeper) API; requires a session */
|
|
113
113
|
sweeper: SweeperAPI;
|
|
114
114
|
/** Public whitelist (waitlist) submission API */
|
|
115
115
|
whitelist: WhitelistAPI;
|
package/dist/sweeper/index.d.ts
CHANGED
|
@@ -1,43 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sweeper Types
|
|
3
3
|
*
|
|
4
|
-
* Types for the
|
|
4
|
+
* Types for the deposit-address registration endpoint. Wire shapes are
|
|
5
5
|
* snake_case; these are the camelCase ergonomic forms.
|
|
6
6
|
*
|
|
7
|
-
* NOTE: This endpoint is **
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* they already belong to. Abuse is bounded by a per-client rate limit and an
|
|
11
|
-
* active-application check instead of authentication.
|
|
7
|
+
* NOTE: This endpoint is **authenticated**. The credited address is the calling
|
|
8
|
+
* session's own rather than a request field, so a caller can only ever register
|
|
9
|
+
* an address they hold the session key for.
|
|
12
10
|
*/
|
|
11
|
+
import type { DepositTarget } from "@0xmonaco/contracts";
|
|
13
12
|
import type { BaseAPI } from "../api";
|
|
14
13
|
/**
|
|
15
14
|
* What happened to the registration.
|
|
16
15
|
*
|
|
17
|
-
* - `registered` — the
|
|
18
|
-
* - `already_registered` — the
|
|
16
|
+
* - `registered` — the triple was added; its deposit address is now monitored.
|
|
17
|
+
* - `already_registered` — the triple was known before this call; nothing was
|
|
19
18
|
* re-triggered.
|
|
20
19
|
*/
|
|
21
20
|
export type RegisterSweeperStatus = "registered" | "already_registered";
|
|
22
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Body for a deposit-address registration.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately tiny: the application and the credited address both come from
|
|
25
|
+
* the authenticated session (`login` takes the application's client id), so the
|
|
26
|
+
* only thing left to say is which ledger to aim at.
|
|
27
|
+
*/
|
|
23
28
|
export interface RegisterSweeperRequest {
|
|
24
29
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
30
|
+
* Which ledger swept deposits ask to be credited to. Defaults to `"spot"`.
|
|
31
|
+
*
|
|
32
|
+
* `"margin"` asks for the parent margin account's collateral, skipping the
|
|
33
|
+
* separate `transferCollateralToParentMarginAccount` step. The target is part
|
|
34
|
+
* of the address derivation, so the two targets yield two different deposit
|
|
35
|
+
* addresses for the same pair, each carrying its own request. A `"spot"`
|
|
36
|
+
* address is never credited to margin.
|
|
37
|
+
*
|
|
38
|
+
* `"margin"` is a request rather than a guarantee: a deposit the backend
|
|
39
|
+
* cannot route to collateral — an unsupported collateral asset, or a margin
|
|
40
|
+
* account that fails validation — is credited to the spot wallet instead, so
|
|
41
|
+
* funds are never stranded. Read the balance back rather than treating the
|
|
42
|
+
* address as proof of where the credit landed.
|
|
43
|
+
*
|
|
44
|
+
* An unrecognized value is rejected (400) rather than falling back to spot,
|
|
45
|
+
* which would return an address pointed at a ledger the caller did not ask
|
|
46
|
+
* for.
|
|
29
47
|
*/
|
|
30
|
-
|
|
31
|
-
/** Address credited on the rollup, and half of the deposit-address derivation */
|
|
32
|
-
userAddress: string;
|
|
48
|
+
depositTarget?: DepositTarget;
|
|
33
49
|
}
|
|
34
50
|
/** Result of a deposit-address registration. */
|
|
35
51
|
export interface RegisterSweeperResponse {
|
|
36
|
-
/** Whether this call added the
|
|
52
|
+
/** Whether this call added the triple or it was known before */
|
|
37
53
|
status: RegisterSweeperStatus;
|
|
38
54
|
/**
|
|
39
|
-
* The
|
|
40
|
-
* any contract exists there.
|
|
55
|
+
* The deposit address for this (application, user, deposit target) triple.
|
|
56
|
+
* Stable, and valid to publish and fund before any contract exists there.
|
|
41
57
|
*/
|
|
42
58
|
sweeperAddress: string;
|
|
43
59
|
/**
|
|
@@ -48,20 +64,26 @@ export interface RegisterSweeperResponse {
|
|
|
48
64
|
initialSweepCheck: boolean;
|
|
49
65
|
}
|
|
50
66
|
/**
|
|
51
|
-
* Sweeper API interface. The register endpoint
|
|
67
|
+
* Sweeper API interface. The register endpoint requires authentication.
|
|
52
68
|
*/
|
|
53
69
|
export interface SweeperAPI extends BaseAPI {
|
|
54
70
|
/**
|
|
55
|
-
* Registers an (application, user)
|
|
56
|
-
* address is monitored and every ERC20 deposit is
|
|
57
|
-
* automatically.
|
|
71
|
+
* Registers an (application, user, deposit target) triple so its
|
|
72
|
+
* deterministic deposit address is monitored and every ERC20 deposit is
|
|
73
|
+
* swept into the rollup automatically.
|
|
74
|
+
*
|
|
75
|
+
* The application and the credited address both come from the authenticated
|
|
76
|
+
* session, so this only ever registers the caller's own address under their
|
|
77
|
+
* own application. Call it with no arguments for a spot address.
|
|
58
78
|
*
|
|
59
79
|
* Returns immediately with the derived deposit address; the one-time
|
|
60
80
|
* initial balance check runs in the background. Idempotent and safe to
|
|
61
81
|
* retry: re-registering answers `already_registered` with the same address
|
|
62
|
-
* and never re-triggers the initial check.
|
|
63
|
-
*
|
|
64
|
-
*
|
|
82
|
+
* and never re-triggers the initial check.
|
|
83
|
+
*
|
|
84
|
+
* Throws on an unrecognized `depositTarget` (before sending), when the
|
|
85
|
+
* session's application is no longer active (403), and when the endpoint's
|
|
86
|
+
* global admission limit is exceeded (429).
|
|
65
87
|
*/
|
|
66
|
-
register(body
|
|
88
|
+
register(body?: RegisterSweeperRequest): Promise<RegisterSweeperResponse>;
|
|
67
89
|
}
|
package/dist/sweeper/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sweeper Types
|
|
3
3
|
*
|
|
4
|
-
* Types for the
|
|
4
|
+
* Types for the deposit-address registration endpoint. Wire shapes are
|
|
5
5
|
* snake_case; these are the camelCase ergonomic forms.
|
|
6
6
|
*
|
|
7
|
-
* NOTE: This endpoint is **
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* they already belong to. Abuse is bounded by a per-client rate limit and an
|
|
11
|
-
* active-application check instead of authentication.
|
|
7
|
+
* NOTE: This endpoint is **authenticated**. The credited address is the calling
|
|
8
|
+
* session's own rather than a request field, so a caller can only ever register
|
|
9
|
+
* an address they hold the session key for.
|
|
12
10
|
*/
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -168,6 +168,11 @@ export type ConditionalOrderState = "PENDING_PARENT" | "ACTIVE" | "TRIGGERING" |
|
|
|
168
168
|
* - ACTIVE: inside the execution window; child slices are firing
|
|
169
169
|
* - COMPLETED: window ended (fully filled or hard-stopped with a shortfall)
|
|
170
170
|
* - CANCELLED: cancelled by the user before the window ended
|
|
171
|
+
*
|
|
172
|
+
* These are the values the server sends today, not a runtime guarantee:
|
|
173
|
+
* `@0xmonaco/core` parses the `twap_orders` WebSocket frame leniently, so a
|
|
174
|
+
* state added server-side after this version ships is delivered as-is rather
|
|
175
|
+
* than dropping the update (0XM-2628). Match it with a default branch.
|
|
171
176
|
*/
|
|
172
177
|
export type TwapOrderState = "PENDING" | "ACTIVE" | "COMPLETED" | "CANCELLED";
|
|
173
178
|
/**
|
|
@@ -45,6 +45,7 @@ export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
|
|
|
45
45
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
46
46
|
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
47
47
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
48
|
+
applyToPositionMargin: z.ZodOptional<z.ZodBoolean>;
|
|
48
49
|
}, z.core.$strict>, z.ZodObject<{
|
|
49
50
|
asset: z.ZodString;
|
|
50
51
|
amount: z.ZodString;
|
|
@@ -139,6 +140,7 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
139
140
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
140
141
|
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
141
142
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
143
|
+
applyToPositionMargin: z.ZodOptional<z.ZodBoolean>;
|
|
142
144
|
}, z.core.$strict>, z.ZodObject<{
|
|
143
145
|
tradingPairId: z.ZodUUID;
|
|
144
146
|
side: z.ZodEnum<{
|
|
@@ -51,6 +51,10 @@ const SelectedCrossTradingPairIdsSchema = z.array(UUIDSchema).min(1, "selectedTr
|
|
|
51
51
|
const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
|
|
52
52
|
marginMode: z.literal("ISOLATED").optional(),
|
|
53
53
|
selectedTradingPairIds: z.never().optional(),
|
|
54
|
+
// Omitted defaults server-side to true (the Adjust Margin gesture); false
|
|
55
|
+
// is the plain allocation programmatic funding loops need. The CROSS form
|
|
56
|
+
// stays strict-rejected (no per-position margin to commit to).
|
|
57
|
+
applyToPositionMargin: z.boolean().optional(),
|
|
54
58
|
});
|
|
55
59
|
const CrossRiskBucketScopeSchema = z.object({
|
|
56
60
|
marginMode: z.literal("CROSS"),
|
package/dist/vault/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for vault operations including deposits, withdrawals, and balance management.
|
|
5
5
|
*/
|
|
6
|
+
import type { DepositTarget } from "@0xmonaco/contracts";
|
|
6
7
|
import type { Address } from "viem";
|
|
7
8
|
import type { BaseAPI } from "../api/index";
|
|
8
9
|
import type { Balance, TransactionResult, WithdrawalRetryOptions, WithdrawResult } from "./responses";
|
|
@@ -13,8 +14,13 @@ import type { Balance, TransactionResult, WithdrawalRetryOptions, WithdrawResult
|
|
|
13
14
|
* collateral (auto-creating the account if it does not exist yet). A deposit
|
|
14
15
|
* that cannot be routed to margin (unsupported asset, etc.) safely falls back
|
|
15
16
|
* to spot — funds are never lost.
|
|
17
|
+
*
|
|
18
|
+
* Re-exported from `@0xmonaco/contracts` rather than redeclared: the same
|
|
19
|
+
* value selects the on-chain routing hint for a direct deposit and the
|
|
20
|
+
* derivation of a sweeper deposit address, so one definition keeps the two
|
|
21
|
+
* from drifting into separately-maintained unions.
|
|
16
22
|
*/
|
|
17
|
-
export type DepositTarget
|
|
23
|
+
export type { DepositTarget };
|
|
18
24
|
/**
|
|
19
25
|
* Options for a deposit.
|
|
20
26
|
*/
|
package/dist/websocket/base.d.ts
CHANGED
|
@@ -29,6 +29,55 @@ export interface WebSocketResyncInfo {
|
|
|
29
29
|
}
|
|
30
30
|
/** Handler invoked after a reconnect resumes the live stream. */
|
|
31
31
|
export type ResyncHandler = (info: WebSocketResyncInfo) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Machine-readable classification the server puts on every `Error` frame so a
|
|
34
|
+
* client can branch on the failure without string-matching the human message.
|
|
35
|
+
* Mirrors `ws-api`'s `WsErrorCode` enum, whose SCREAMING_SNAKE_CASE wire
|
|
36
|
+
* strings are pinned on the Rust side in `ws-api/src/websocket/protocol.rs`
|
|
37
|
+
* and cross-checked against this union by `@0xmonaco/core`'s
|
|
38
|
+
* `websocket-enum-parity` test.
|
|
39
|
+
*/
|
|
40
|
+
export type WebSocketErrorCode =
|
|
41
|
+
/** A user-specific channel was subscribed before authenticating. */
|
|
42
|
+
"AUTH_REQUIRED"
|
|
43
|
+
/** The `Authenticate` handshake was rejected; the connection is closed after this frame. */
|
|
44
|
+
| "AUTH_FAILED"
|
|
45
|
+
/** The per-user concurrent-connection cap was reached; this connection is closed after the frame. */
|
|
46
|
+
| "CONNECTION_LIMIT"
|
|
47
|
+
/** The per-connection subscription-cardinality cap was reached. */
|
|
48
|
+
| "SUBSCRIPTION_LIMIT"
|
|
49
|
+
/** A subscription request was malformed or failed parameter validation. */
|
|
50
|
+
| "INVALID_SUBSCRIPTION"
|
|
51
|
+
/** An inbound frame could not be parsed, or an unsupported frame type was sent. */
|
|
52
|
+
| "INVALID_MESSAGE"
|
|
53
|
+
/**
|
|
54
|
+
* A previously-authenticated session became invalid after the handshake
|
|
55
|
+
* (revoked, expired, or the account was banned/deactivated). Re-authenticate
|
|
56
|
+
* rather than blindly reconnecting into the same rejection.
|
|
57
|
+
*/
|
|
58
|
+
| "SESSION_INVALID"
|
|
59
|
+
/**
|
|
60
|
+
* The subscribe-time snapshot could not be read. The subscription is still
|
|
61
|
+
* active and live diffs flow, but the baseline is missing — refetch it (e.g.
|
|
62
|
+
* from REST) rather than assuming the stream started from a coherent state.
|
|
63
|
+
*/
|
|
64
|
+
| "SNAPSHOT_UNAVAILABLE";
|
|
65
|
+
/**
|
|
66
|
+
* An `Error` frame the server sent on this connection.
|
|
67
|
+
*
|
|
68
|
+
* `code` is widened past {@link WebSocketErrorCode} on purpose: a code added
|
|
69
|
+
* server-side after this SDK version shipped is delivered as-is rather than
|
|
70
|
+
* dropped, so an older client still sees that something failed and can log it.
|
|
71
|
+
* Narrow with a `switch` on the known values and treat the default as unknown.
|
|
72
|
+
*/
|
|
73
|
+
export interface WebSocketErrorInfo {
|
|
74
|
+
/** Stable classification of the failure. */
|
|
75
|
+
code: WebSocketErrorCode | (string & {});
|
|
76
|
+
/** Human-readable description; for logging and display, never for branching. */
|
|
77
|
+
message: string;
|
|
78
|
+
}
|
|
79
|
+
/** Handler invoked for every `Error` frame the server sends. */
|
|
80
|
+
export type ErrorHandler = (info: WebSocketErrorInfo) => void;
|
|
32
81
|
/**
|
|
33
82
|
* Reconnect/resync knobs and callbacks for the Monaco WebSocket client.
|
|
34
83
|
*
|
|
@@ -62,6 +111,26 @@ export interface MonacoWebSocketConfig {
|
|
|
62
111
|
* the snapshot was in flight are newer than the snapshot rows they duplicate.
|
|
63
112
|
*/
|
|
64
113
|
onResync?: ResyncHandler;
|
|
114
|
+
/**
|
|
115
|
+
* Called for every `Error` frame the server sends on this connection.
|
|
116
|
+
*
|
|
117
|
+
* `Error` frames are connection-scoped, not channel-scoped, so they reach no
|
|
118
|
+
* subscription handler — without this callback a failed subscribe, an
|
|
119
|
+
* invalidated session, or an unreadable subscribe-time snapshot is invisible
|
|
120
|
+
* to the app. Branch on `code`:
|
|
121
|
+
*
|
|
122
|
+
* - `SNAPSHOT_UNAVAILABLE` — live diffs flow but the baseline is missing;
|
|
123
|
+
* refetch it. The subscription itself is fine.
|
|
124
|
+
* - `SESSION_INVALID` — re-authenticate rather than reconnect into the same
|
|
125
|
+
* rejection.
|
|
126
|
+
* - `AUTH_REQUIRED` — a rejected SUBSCRIBE, not an invalidated session: the
|
|
127
|
+
* channel was never registered, and this client still holds your handler,
|
|
128
|
+
* so it treats the channel as subscribed and sends no new `Subscribe`.
|
|
129
|
+
* Re-authenticating alone leaves it dead. Release the last handler for the
|
|
130
|
+
* channel and subscribe again after authenticating (0XM-2644 tracks doing
|
|
131
|
+
* this automatically).
|
|
132
|
+
*/
|
|
133
|
+
onError?: ErrorHandler;
|
|
65
134
|
}
|
|
66
135
|
/**
|
|
67
136
|
* Raw event message interface
|
|
@@ -42,11 +42,14 @@ export interface AccountEventData {
|
|
|
42
42
|
freeCollateral: string;
|
|
43
43
|
/**
|
|
44
44
|
* Account distress ratio: maintenance margin required over equity (higher is
|
|
45
|
-
* closer to liquidation, decimal string).
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
45
|
+
* closer to liquidation, decimal string). The quotient saturates to the
|
|
46
|
+
* max-decimal sentinel (`79228162514264337593543950335`, maximal distress)
|
|
47
|
+
* whenever it cannot be computed or represented: an account still owing a
|
|
48
|
+
* maintenance requirement at zero or negative equity, and equally at
|
|
49
|
+
* near-zero POSITIVE equity where the true ratio exceeds the decimal range.
|
|
50
|
+
* An empty account with no requirement is `0`. Clamp the sentinel before
|
|
51
|
+
* display; treat any value at or above the liquidation threshold as maximal
|
|
52
|
+
* distress rather than distinguishing the sentinel's causes.
|
|
50
53
|
*/
|
|
51
54
|
marginRatio: string;
|
|
52
55
|
/** Maintenance margin required to keep the account solvent (decimal string) */
|
|
@@ -45,7 +45,7 @@ export interface UserBalanceEventData {
|
|
|
45
45
|
/** Total balance in raw format (wei) */
|
|
46
46
|
totalRaw: string;
|
|
47
47
|
/** Reason for the balance update */
|
|
48
|
-
reason: BalanceUpdateReason;
|
|
48
|
+
reason: BalanceUpdateReason | (string & {});
|
|
49
49
|
/** Reference ID for related entity (e.g., order ID, deposit ID) */
|
|
50
50
|
referenceId: string | null;
|
|
51
51
|
/** Timestamp when the balance was updated (ISO 8601) */
|
|
@@ -13,7 +13,10 @@ export type ConditionalOrderEventReason = "created" | "activated" | "cancelled"
|
|
|
13
13
|
* A conditional (TP/SL) order's current state.
|
|
14
14
|
*
|
|
15
15
|
* **The value unions below are the values the server can send today, not a
|
|
16
|
-
* runtime guarantee
|
|
16
|
+
* runtime guarantee** — which is why each of those fields is typed
|
|
17
|
+
* `Union | (string & {})`: autocomplete still offers the known values, but a
|
|
18
|
+
* `switch` over one needs a `default` branch because an unrecognized value
|
|
19
|
+
* really can arrive (0XM-2628). `@0xmonaco/core` parses this frame leniently — an
|
|
17
20
|
* unrecognized `orderType`, `state`, `side`, `positionSide`, `conditionType`,
|
|
18
21
|
* `triggerSource`, `associationType` or `timeInForce` is passed through as-is
|
|
19
22
|
* rather than validated, because throwing inside the WebSocket message handler
|
|
@@ -36,13 +39,13 @@ export interface ConditionalOrderEventData {
|
|
|
36
39
|
marginAccountId: string;
|
|
37
40
|
positionId?: string;
|
|
38
41
|
parentOrderId?: string;
|
|
39
|
-
associationType?: "POSITION" | "PARENT_ORDER";
|
|
42
|
+
associationType?: "POSITION" | "PARENT_ORDER" | (string & {});
|
|
40
43
|
linkedGroupId?: string;
|
|
41
|
-
conditionType: ConditionalOrderConditionType;
|
|
42
|
-
triggerSource: ConditionalOrderTriggerSource;
|
|
44
|
+
conditionType: ConditionalOrderConditionType | (string & {});
|
|
45
|
+
triggerSource: ConditionalOrderTriggerSource | (string & {});
|
|
43
46
|
triggerPrice: string;
|
|
44
|
-
side: OrderSide;
|
|
45
|
-
positionSide: PositionSide;
|
|
47
|
+
side: OrderSide | (string & {});
|
|
48
|
+
positionSide: PositionSide | (string & {});
|
|
46
49
|
/**
|
|
47
50
|
* Order shape the conditional order places when it triggers.
|
|
48
51
|
*
|
|
@@ -58,7 +61,7 @@ export interface ConditionalOrderEventData {
|
|
|
58
61
|
* the value would arrive as e.g. `STOPLOSS` rather than the canonical
|
|
59
62
|
* `STOP_LOSS`. The parser passes such a value through untouched.
|
|
60
63
|
*/
|
|
61
|
-
orderType: OrderType;
|
|
64
|
+
orderType: OrderType | (string & {});
|
|
62
65
|
limitPrice?: string;
|
|
63
66
|
quantity?: string;
|
|
64
67
|
slippageToleranceBps?: number;
|
|
@@ -71,8 +74,8 @@ export interface ConditionalOrderEventData {
|
|
|
71
74
|
* the server maps exhaustively over every variant, so a value written by any
|
|
72
75
|
* other path reaches the wire as-is. Narrow before relying on the subset.
|
|
73
76
|
*/
|
|
74
|
-
timeInForce?: TimeInForce;
|
|
75
|
-
state: ConditionalOrderState;
|
|
77
|
+
timeInForce?: TimeInForce | (string & {});
|
|
78
|
+
state: ConditionalOrderState | (string & {});
|
|
76
79
|
triggeredOrderId?: string;
|
|
77
80
|
triggeredAt?: string;
|
|
78
81
|
activatedAt?: string;
|
|
@@ -36,8 +36,18 @@ export type InstrumentChangeKind = "listing" | "delisting" | "halt" | "unhalt" |
|
|
|
36
36
|
* Full current configuration for a market on the `instrument` channel.
|
|
37
37
|
*/
|
|
38
38
|
export interface InstrumentEventData {
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* What changed for this market.
|
|
41
|
+
*
|
|
42
|
+
* Widened past {@link InstrumentChangeKind} on purpose: `@0xmonaco/core`
|
|
43
|
+
* parses this frame leniently, so a change kind added server-side after this
|
|
44
|
+
* SDK version ships is delivered as-is rather than dropping the frame — and
|
|
45
|
+
* with it the full market config the frame carries, which can hide a market
|
|
46
|
+
* going inactive behind an unfamiliar label (0XM-2628).
|
|
47
|
+
* `InstrumentChangeKind` names the values the server sends today — narrow
|
|
48
|
+
* with a `switch` that keeps a `default` branch.
|
|
49
|
+
*/
|
|
50
|
+
change: InstrumentChangeKind | (string & {});
|
|
41
51
|
/** Trading pair identifier (UUID) */
|
|
42
52
|
tradingPairId: string;
|
|
43
53
|
/** Market symbol, e.g. "BTC/USDC" */
|
|
@@ -85,6 +85,11 @@ export interface MarketStatsEvent {
|
|
|
85
85
|
/**
|
|
86
86
|
* A single market's row in the all-markets summary frame. A lighter shape than
|
|
87
87
|
* {@link MarketStatsData}: enough to render a markets table.
|
|
88
|
+
*
|
|
89
|
+
* `marketStatus` is typed `MarketStatus | (string & {})`: `@0xmonaco/core`
|
|
90
|
+
* parses this frame leniently, so an unrecognized status is passed through
|
|
91
|
+
* rather than throwing and dropping the summary row (0XM-2628). `MarketStatus`
|
|
92
|
+
* names the values the server sends today — match it with a `default` branch.
|
|
88
93
|
*/
|
|
89
94
|
export interface MarketStatsSummary {
|
|
90
95
|
/** Trading pair identifier (UUID) */
|
|
@@ -114,7 +119,7 @@ export interface MarketStatsSummary {
|
|
|
114
119
|
/** Next funding time as a millisecond epoch. Perp-only; omitted for spot. */
|
|
115
120
|
fundingTimestamp?: number;
|
|
116
121
|
/** Tradability label (always present) */
|
|
117
|
-
marketStatus: MarketStatus;
|
|
122
|
+
marketStatus: MarketStatus | (string & {});
|
|
118
123
|
}
|
|
119
124
|
/**
|
|
120
125
|
* All-markets summary event on the `market_stats` channel: one
|
|
@@ -21,15 +21,20 @@ export interface OHLCVEvent {
|
|
|
21
21
|
/** Trading pair ID (UUID) */
|
|
22
22
|
tradingPairId: string;
|
|
23
23
|
/** Candlestick interval */
|
|
24
|
-
interval: Interval;
|
|
24
|
+
interval: Interval | (string & {});
|
|
25
25
|
/** Trading mode */
|
|
26
|
-
tradingMode: TradingMode;
|
|
26
|
+
tradingMode: TradingMode | (string & {});
|
|
27
27
|
/**
|
|
28
28
|
* Price series this candle belongs to. Always a concrete series on the wire
|
|
29
29
|
* (`trade` or `mark`, never the `*` selector); lets a wildcard subscriber
|
|
30
30
|
* tell the two streams apart. Absent only on legacy frames that omit it.
|
|
31
|
+
*
|
|
32
|
+
* Widened past the two known values on purpose: a wildcard subscription
|
|
33
|
+
* matches any suffix, so a series added server-side after this version still
|
|
34
|
+
* arrives here, and telling the streams apart is the entire point of the
|
|
35
|
+
* field. Match it with a `default` branch.
|
|
31
36
|
*/
|
|
32
|
-
priceType?: "trade" | "mark";
|
|
37
|
+
priceType?: "trade" | "mark" | (string & {});
|
|
33
38
|
/** OHLCV candlestick data */
|
|
34
39
|
candlestick: Candlestick;
|
|
35
40
|
}
|
|
@@ -29,7 +29,7 @@ export interface OrderbookLevel {
|
|
|
29
29
|
*/
|
|
30
30
|
export interface PriceChange {
|
|
31
31
|
/** Order side (BUY or SELL) */
|
|
32
|
-
side: OrderSide;
|
|
32
|
+
side: OrderSide | (string & {});
|
|
33
33
|
/** Old price before the change */
|
|
34
34
|
oldPrice?: string;
|
|
35
35
|
/** New price after the change */
|
|
@@ -46,7 +46,7 @@ export interface OrderbookEvent {
|
|
|
46
46
|
/** Trading pair ID (UUID) */
|
|
47
47
|
tradingPairId: string;
|
|
48
48
|
/** Trading mode (SPOT, MARGIN) */
|
|
49
|
-
tradingMode: TradingMode;
|
|
49
|
+
tradingMode: TradingMode | (string & {});
|
|
50
50
|
/** Bid orders (buy orders) - Full depth */
|
|
51
51
|
bids: OrderbookLevel[];
|
|
52
52
|
/** Ask orders (sell orders) - Full depth */
|
|
@@ -18,7 +18,7 @@ export interface OrderEvent {
|
|
|
18
18
|
/** Order ID (UUID) */
|
|
19
19
|
orderId: string;
|
|
20
20
|
/** Event type */
|
|
21
|
-
eventType: OrderEventType;
|
|
21
|
+
eventType: OrderEventType | (string & {});
|
|
22
22
|
/** ISO 8601 timestamp */
|
|
23
23
|
timestamp: string;
|
|
24
24
|
/** Event-specific data */
|
|
@@ -46,11 +46,11 @@ export interface CommonOrderEventData {
|
|
|
46
46
|
*/
|
|
47
47
|
tradingPair: string;
|
|
48
48
|
/** Trading mode (e.g., "SPOT", "MARGIN") */
|
|
49
|
-
tradingMode: TradingMode;
|
|
49
|
+
tradingMode: TradingMode | (string & {});
|
|
50
50
|
/** Order type - present in most events */
|
|
51
|
-
orderType?: OrderType;
|
|
51
|
+
orderType?: OrderType | (string & {});
|
|
52
52
|
/** Order side - present in most events */
|
|
53
|
-
side?: OrderSide;
|
|
53
|
+
side?: OrderSide | (string & {});
|
|
54
54
|
/** Order price - present in most events */
|
|
55
55
|
price?: string;
|
|
56
56
|
/** Order quantity - present in most events */
|
|
@@ -58,7 +58,7 @@ export interface CommonOrderEventData {
|
|
|
58
58
|
/** Order quantity in RAW (integer, base-unit) precision. Wire: `quantity_raw`. */
|
|
59
59
|
quantityRaw?: string;
|
|
60
60
|
/** Time in force - present in most events */
|
|
61
|
-
timeInForce?: TimeInForce;
|
|
61
|
+
timeInForce?: TimeInForce | (string & {});
|
|
62
62
|
/**
|
|
63
63
|
* Client-assigned correlation handle, echoed so an event can be matched to
|
|
64
64
|
* the request that placed the order without a round trip to `getOrder`.
|
|
@@ -79,6 +79,45 @@ export interface CommonOrderEventData {
|
|
|
79
79
|
* silence. Omitted when the order carried none. Wire: `client_order_id`.
|
|
80
80
|
*/
|
|
81
81
|
clientOrderId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* `true` when the order was admitted post-only (maker-only), so a subscriber
|
|
84
|
+
* can confirm the flag was honoured without a round trip to `getOrder`.
|
|
85
|
+
* Carried on the `OrderPlaced` acknowledgement, the taker fill, and the
|
|
86
|
+
* resting order's lifecycle — `OrderPartiallyCancelled` (an in-place
|
|
87
|
+
* reduction, which is how an MM's own `remainingQuantityTarget` replace is
|
|
88
|
+
* announced), `OrderCancelled` and `OrderExpired`.
|
|
89
|
+
*
|
|
90
|
+
* Declared on the shared block, but two variants can never carry it, and
|
|
91
|
+
* this optional field is the only thing that says so: a **maker fill**,
|
|
92
|
+
* which is out of scope because a maker already learned the flag from its
|
|
93
|
+
* own acknowledgement; and **`OrderRejected`**, which only ever describes a
|
|
94
|
+
* MARKET order with no liquidity or an unfilled IOC/FOK — and post-only is
|
|
95
|
+
* refused on both, so no post-only order can reach it.
|
|
96
|
+
*
|
|
97
|
+
* Only ever present as `true`: on a variant that CARRIES the field, an order
|
|
98
|
+
* that is not post-only omits the key rather than sending `postOnly: false`,
|
|
99
|
+
* exactly as the REST read model's `postOnly?: boolean` does, so
|
|
100
|
+
* `event.data.postOnly ?? false` reads the same as REST *for that event*.
|
|
101
|
+
*
|
|
102
|
+
* That equivalence is per-event, and it does NOT hold on a maker fill.
|
|
103
|
+
* A post-only order rests and therefore fills as a maker, and the maker
|
|
104
|
+
* payload never declares the field — so `?? false` there would return
|
|
105
|
+
* `false` for an order REST reports as `true`. Absence on a maker fill
|
|
106
|
+
* carries NO information. Track `postOnly` as order-level state learned from
|
|
107
|
+
* the `OrderPlaced` acknowledgement (or a REST read) and carry it forward;
|
|
108
|
+
* never re-derive it from whichever event arrived last.
|
|
109
|
+
*
|
|
110
|
+
* On a carrying variant, absent is not evidence the flag was dropped — it is
|
|
111
|
+
* the ordinary shape of a non-post-only order, and also what an order placed
|
|
112
|
+
* before the flag was persisted reports.
|
|
113
|
+
*
|
|
114
|
+
* A post-only order that WOULD have crossed the book is rejected before
|
|
115
|
+
* acceptance and emits no event at all (see `clientOrderId`), so in practice
|
|
116
|
+
* the flag reaches a subscriber on a resting order's lifecycle — never on a
|
|
117
|
+
* taker fill, which an admitted post-only order cannot produce.
|
|
118
|
+
* Wire: `post_only`.
|
|
119
|
+
*/
|
|
120
|
+
postOnly?: boolean;
|
|
82
121
|
}
|
|
83
122
|
/**
|
|
84
123
|
* OrderPlaced event - emitted when a new order is placed
|
|
@@ -87,54 +126,94 @@ export interface OrderPlacedEvent extends OrderEvent {
|
|
|
87
126
|
eventType: "OrderPlaced";
|
|
88
127
|
data: CommonOrderEventData & {
|
|
89
128
|
/** Order status */
|
|
90
|
-
status: OrderStatus;
|
|
129
|
+
status: OrderStatus | (string & {});
|
|
91
130
|
};
|
|
92
131
|
}
|
|
93
132
|
/**
|
|
94
133
|
* OrderMatched event - emitted when an order is matched but not necessarily filled
|
|
95
|
-
* This event is only emitted for taker orders
|
|
134
|
+
* This event is only emitted for taker orders.
|
|
135
|
+
*
|
|
136
|
+
* Carries the SAME payload as `OrderFilled`/`OrderPartiallyFilled`: the
|
|
137
|
+
* matching engine builds one `TakerOrderEventData` and picks the event type
|
|
138
|
+
* from the resulting status, so every execution field below is on the wire
|
|
139
|
+
* here too.
|
|
140
|
+
*
|
|
141
|
+
* Because this event carries only that one shape, the fields below follow it
|
|
142
|
+
* exactly rather than being uniformly optional. A match that filled nothing
|
|
143
|
+
* still SENDS the keys — `tradeId`, `executionPrice` and `executedAt` arrive as
|
|
144
|
+
* `null`, not absent. Only `lastFillQuantity` and `lastFillQuantityRaw` are
|
|
145
|
+
* ever omitted, being the pair the server skips when there is no incremental
|
|
146
|
+
* fill.
|
|
96
147
|
*/
|
|
97
148
|
export interface OrderMatchedEvent extends OrderEvent {
|
|
98
149
|
eventType: "OrderMatched";
|
|
99
150
|
data: CommonOrderEventData & {
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
151
|
+
/** Fill role of this order (`taker` on this event). */
|
|
152
|
+
role: OrderRole | (string & {});
|
|
153
|
+
/** Trade ID of the first trade this event covers. `null` when it covers none. */
|
|
154
|
+
tradeId: string | null;
|
|
155
|
+
/** Execution price of the first trade this event covers. `null` when it covers none. */
|
|
156
|
+
executionPrice: string | null;
|
|
157
|
+
/** Cumulative quantity filled on the order at this event. Wire: `filled_quantity`. */
|
|
158
|
+
filledQuantity: string;
|
|
159
|
+
/** `filledQuantity` in RAW (integer, base-unit) precision. Wire: `filled_quantity_raw`. */
|
|
160
|
+
filledQuantityRaw: string;
|
|
161
|
+
/** Incremental quantity filled by THIS event. Omitted when there is no fill. Wire: `last_fill_quantity`. */
|
|
162
|
+
lastFillQuantity?: string;
|
|
163
|
+
/** `lastFillQuantity` in RAW (integer, base-unit) precision. Omitted with it. Wire: `last_fill_quantity_raw`. */
|
|
164
|
+
lastFillQuantityRaw?: string;
|
|
165
|
+
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
166
|
+
remainingQuantityRaw: string;
|
|
167
|
+
/**
|
|
168
|
+
* Monaco fee for the fills this event covers, in normalized decimal QUOTE
|
|
169
|
+
* units (negative = maker rebate). Excludes the application taker fee, so
|
|
170
|
+
* it is smaller than the order echo's `totalTakerFees` for an application
|
|
171
|
+
* that charges one, and equal to it for one that does not. Wire: `fee`.
|
|
172
|
+
*/
|
|
173
|
+
fee: string;
|
|
174
|
+
/**
|
|
175
|
+
* `fee` in RAW quote-unit precision (scaled by 10^quoteDecimals). Always a
|
|
176
|
+
* whole number -- the engine truncates every fee to an integral raw unit
|
|
177
|
+
* when it stores it -- so `fee` is exactly this value divided by
|
|
178
|
+
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
179
|
+
*/
|
|
180
|
+
feeRaw: string;
|
|
181
|
+
/** Execution timestamp of the first trade this event covers (ISO 8601). `null` when it covers none. */
|
|
182
|
+
executedAt: string | null;
|
|
183
|
+
/** Reference price used for slippage calculation. `null` when unset. */
|
|
184
|
+
referencePrice: string | null;
|
|
185
|
+
/** Best price achieved in matching. `null` when unset. */
|
|
186
|
+
bestPrice: string | null;
|
|
187
|
+
/** Worst price achieved in matching. `null` when unset. */
|
|
188
|
+
worstPrice: string | null;
|
|
189
|
+
/** Actual slippage in basis points. `null` when unset. */
|
|
190
|
+
actualSlippageBps: number | null;
|
|
191
|
+
/** Maximum allowed slippage in basis points. `null` when unset. */
|
|
192
|
+
maxSlippageBps: number | null;
|
|
193
|
+
/** Number of trades executed. */
|
|
194
|
+
tradesCount: number;
|
|
195
|
+
/** Remaining quantity to be filled. */
|
|
196
|
+
remainingQuantity: string;
|
|
197
|
+
/** Average fill price across all trades. `null` when there is none. */
|
|
198
|
+
averageFillPrice: string | null;
|
|
199
|
+
/** Order status. */
|
|
200
|
+
status: OrderStatus | (string & {});
|
|
122
201
|
};
|
|
123
202
|
}
|
|
124
203
|
/**
|
|
125
204
|
* OrderPartiallyFilled event - emitted when an order is partially filled
|
|
126
|
-
* Can be emitted for both taker and maker orders with different field sets
|
|
205
|
+
* Can be emitted for both taker and maker orders with different field sets.
|
|
127
206
|
*
|
|
128
|
-
* Taker events
|
|
129
|
-
*
|
|
207
|
+
* Taker events add `trades_count` and the slippage fields; maker events add
|
|
208
|
+
* `trade_id` and `execution_price`. Both roles report the cumulative fill as
|
|
209
|
+
* `filled_quantity` and this event's increment as `last_fill_quantity`, and
|
|
210
|
+
* both carry the fill charge as `fee` (0XM-2389). `total_filled`,
|
|
211
|
+
* `execution_quantity` and `maker_fee` were never emitted on a fill payload
|
|
212
|
+
* and are not declared here.
|
|
130
213
|
*/
|
|
131
214
|
export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
132
215
|
eventType: "OrderPartiallyFilled";
|
|
133
216
|
data: CommonOrderEventData & {
|
|
134
|
-
/** Taker order ID (taker orders only) */
|
|
135
|
-
takerOrderId?: string;
|
|
136
|
-
/** Maker order ID (maker orders only) */
|
|
137
|
-
makerOrderId?: string;
|
|
138
217
|
/** Reference price (taker orders only) */
|
|
139
218
|
referencePrice?: string;
|
|
140
219
|
/** Best price (taker orders only) */
|
|
@@ -147,14 +226,12 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
147
226
|
maxSlippageBps?: number;
|
|
148
227
|
/** Number of trades (taker orders only - not present for maker) */
|
|
149
228
|
tradesCount?: number;
|
|
150
|
-
/** Total filled quantity (taker orders only - not present for maker) */
|
|
151
|
-
totalFilled?: string;
|
|
152
229
|
/** Remaining quantity (present for both taker and maker) */
|
|
153
230
|
remainingQuantity?: string;
|
|
154
231
|
/** Average fill price (taker orders only) */
|
|
155
232
|
averageFillPrice?: string;
|
|
156
233
|
/** Order status (taker orders only) */
|
|
157
|
-
status?: OrderStatus;
|
|
234
|
+
status?: OrderStatus | (string & {});
|
|
158
235
|
/** Trade ID (maker orders only) */
|
|
159
236
|
tradeId?: string;
|
|
160
237
|
/** Execution price (maker orders only) */
|
|
@@ -180,30 +257,43 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
180
257
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
181
258
|
remainingQuantityRaw?: string;
|
|
182
259
|
/**
|
|
183
|
-
*
|
|
184
|
-
* (
|
|
260
|
+
* Monaco fee for the fills this event covers, in normalized decimal QUOTE
|
|
261
|
+
* units (negative = maker rebate). The wire field is `fee`, not `makerFee`;
|
|
262
|
+
* taker and maker carry the same field. A taker event aggregates every
|
|
263
|
+
* trade it covers; a maker event is one trade.
|
|
264
|
+
*
|
|
265
|
+
* Excludes the application taker fee, so it is NOT the order echo's
|
|
266
|
+
* `totalTakerFees` (which is `fee + applicationTakerFee`). It previously
|
|
267
|
+
* held the raw integer value now exposed as `feeRaw`.
|
|
185
268
|
*/
|
|
186
269
|
fee?: string;
|
|
270
|
+
/**
|
|
271
|
+
* `fee` in RAW quote-unit precision (scaled by 10^quoteDecimals). Always a
|
|
272
|
+
* whole number -- the engine truncates every fee to an integral raw unit
|
|
273
|
+
* when it stores it -- so `fee` is exactly this value divided by
|
|
274
|
+
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
275
|
+
*/
|
|
276
|
+
feeRaw?: string;
|
|
187
277
|
/** Trade execution timestamp (maker orders only) */
|
|
188
278
|
executedAt?: string;
|
|
189
279
|
/** Role of the order in the trade (taker or maker) */
|
|
190
|
-
role?: OrderRole;
|
|
280
|
+
role?: OrderRole | (string & {});
|
|
191
281
|
};
|
|
192
282
|
}
|
|
193
283
|
/**
|
|
194
284
|
* OrderFilled event - emitted when an order is completely filled
|
|
195
|
-
* Can be emitted for both taker and maker orders with different field sets
|
|
285
|
+
* Can be emitted for both taker and maker orders with different field sets.
|
|
196
286
|
*
|
|
197
|
-
* Taker events
|
|
198
|
-
*
|
|
287
|
+
* Taker events add `trades_count` and the slippage fields; maker events add
|
|
288
|
+
* `trade_id` and `execution_price`. Both roles report the cumulative fill as
|
|
289
|
+
* `filled_quantity` and this event's increment as `last_fill_quantity`, and
|
|
290
|
+
* both carry the fill charge as `fee` (0XM-2389). `total_filled`,
|
|
291
|
+
* `execution_quantity` and `maker_fee` were never emitted on a fill payload
|
|
292
|
+
* and are not declared here.
|
|
199
293
|
*/
|
|
200
294
|
export interface OrderFilledEvent extends OrderEvent {
|
|
201
295
|
eventType: "OrderFilled";
|
|
202
296
|
data: CommonOrderEventData & {
|
|
203
|
-
/** Taker order ID (taker orders only) */
|
|
204
|
-
takerOrderId?: string;
|
|
205
|
-
/** Maker order ID (maker orders only) */
|
|
206
|
-
makerOrderId?: string;
|
|
207
297
|
/** Reference price (taker orders only) */
|
|
208
298
|
referencePrice?: string;
|
|
209
299
|
/** Best price (taker orders only) */
|
|
@@ -216,14 +306,12 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
216
306
|
maxSlippageBps?: number;
|
|
217
307
|
/** Number of trades (taker orders only - not present for maker) */
|
|
218
308
|
tradesCount?: number;
|
|
219
|
-
/** Total filled quantity (taker orders only - not present for maker) */
|
|
220
|
-
totalFilled?: string;
|
|
221
309
|
/** Remaining quantity (present for both, should be 0 for filled orders) */
|
|
222
310
|
remainingQuantity?: string;
|
|
223
311
|
/** Average fill price (taker orders only) */
|
|
224
312
|
averageFillPrice?: string;
|
|
225
313
|
/** Order status (taker orders only) */
|
|
226
|
-
status?: OrderStatus;
|
|
314
|
+
status?: OrderStatus | (string & {});
|
|
227
315
|
/** Trade ID (maker orders only) */
|
|
228
316
|
tradeId?: string;
|
|
229
317
|
/** Execution price (maker orders only) */
|
|
@@ -249,14 +337,27 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
249
337
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
250
338
|
remainingQuantityRaw?: string;
|
|
251
339
|
/**
|
|
252
|
-
*
|
|
253
|
-
* (
|
|
340
|
+
* Monaco fee for the fills this event covers, in normalized decimal QUOTE
|
|
341
|
+
* units (negative = maker rebate). The wire field is `fee`, not `makerFee`;
|
|
342
|
+
* taker and maker carry the same field. A taker event aggregates every
|
|
343
|
+
* trade it covers; a maker event is one trade.
|
|
344
|
+
*
|
|
345
|
+
* Excludes the application taker fee, so it is NOT the order echo's
|
|
346
|
+
* `totalTakerFees` (which is `fee + applicationTakerFee`). It previously
|
|
347
|
+
* held the raw integer value now exposed as `feeRaw`.
|
|
254
348
|
*/
|
|
255
349
|
fee?: string;
|
|
350
|
+
/**
|
|
351
|
+
* `fee` in RAW quote-unit precision (scaled by 10^quoteDecimals). Always a
|
|
352
|
+
* whole number -- the engine truncates every fee to an integral raw unit
|
|
353
|
+
* when it stores it -- so `fee` is exactly this value divided by
|
|
354
|
+
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
355
|
+
*/
|
|
356
|
+
feeRaw?: string;
|
|
256
357
|
/** Trade execution timestamp (maker orders only) */
|
|
257
358
|
executedAt?: string;
|
|
258
359
|
/** Role of the order in the trade (taker or maker) */
|
|
259
|
-
role?: OrderRole;
|
|
360
|
+
role?: OrderRole | (string & {});
|
|
260
361
|
};
|
|
261
362
|
}
|
|
262
363
|
/**
|
|
@@ -268,7 +369,7 @@ export interface OrderCancelledEvent extends OrderEvent {
|
|
|
268
369
|
/** Reason for cancellation */
|
|
269
370
|
reason?: string;
|
|
270
371
|
/** Stable machine-readable cancellation cause */
|
|
271
|
-
terminalReason?: OrderTerminalReason;
|
|
372
|
+
terminalReason?: OrderTerminalReason | (string & {});
|
|
272
373
|
/**
|
|
273
374
|
* Cumulative order fill at cancellation, mirroring `filledQuantity` on the
|
|
274
375
|
* taker/maker fill events so consumers read one field across every order
|
|
@@ -308,11 +409,15 @@ export interface OrderRejectedEvent extends OrderEvent {
|
|
|
308
409
|
/** Reason for rejection */
|
|
309
410
|
reason: string;
|
|
310
411
|
/** Order status */
|
|
311
|
-
status: OrderStatus;
|
|
412
|
+
status: OrderStatus | (string & {});
|
|
312
413
|
/** Total filled quantity (may-be partially filled) */
|
|
313
414
|
totalFilled: string;
|
|
415
|
+
/** `totalFilled` in RAW (integer, base-unit) precision. Wire: `total_filled_raw`. */
|
|
416
|
+
totalFilledRaw: string;
|
|
314
417
|
/** Remaining quantity that couldn't be filled */
|
|
315
418
|
remainingQuantity: string;
|
|
419
|
+
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
420
|
+
remainingQuantityRaw: string;
|
|
316
421
|
};
|
|
317
422
|
}
|
|
318
423
|
/**
|
|
@@ -321,12 +426,16 @@ export interface OrderRejectedEvent extends OrderEvent {
|
|
|
321
426
|
export interface OrderExpiredEvent extends OrderEvent {
|
|
322
427
|
eventType: "OrderExpired";
|
|
323
428
|
data: CommonOrderEventData & {
|
|
324
|
-
/** Filled quantity before expiration */
|
|
325
|
-
filledQuantity
|
|
326
|
-
/**
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
|
|
429
|
+
/** Filled quantity before expiration. `null` when the order never filled. */
|
|
430
|
+
filledQuantity: string | null;
|
|
431
|
+
/** `filledQuantity` in RAW (integer, base-unit) precision. Wire: `filled_quantity_raw`. */
|
|
432
|
+
filledQuantityRaw: string | null;
|
|
433
|
+
/** Remaining quantity at expiration. `null` when unset. */
|
|
434
|
+
remainingQuantity: string | null;
|
|
435
|
+
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
436
|
+
remainingQuantityRaw: string | null;
|
|
437
|
+
/** Average fill price. `null` when no fills occurred. */
|
|
438
|
+
averageFillPrice: string | null;
|
|
330
439
|
/** Reason for expiration */
|
|
331
440
|
reason: string;
|
|
332
441
|
};
|
|
@@ -342,7 +451,7 @@ export interface OrderPartiallyCancelledEvent extends OrderEvent {
|
|
|
342
451
|
eventType: "OrderPartiallyCancelled";
|
|
343
452
|
data: CommonOrderEventData & {
|
|
344
453
|
/** Order status — non-terminal (the order still rests) */
|
|
345
|
-
status: OrderStatus;
|
|
454
|
+
status: OrderStatus | (string & {});
|
|
346
455
|
/** Cumulative filled quantity, unchanged by the reduction */
|
|
347
456
|
filledQuantity: string;
|
|
348
457
|
/** Cumulative filled quantity in RAW precision. Wire: `filled_quantity_raw`. */
|
|
@@ -23,6 +23,12 @@ export type PositionEventSide = "LONG" | "SHORT";
|
|
|
23
23
|
export type PositionEventStatus = "OPEN" | "LIQUIDATING" | "CLOSED" | "LIQUIDATED" | "EXPIRED";
|
|
24
24
|
/**
|
|
25
25
|
* Position event data containing the current state of a single position.
|
|
26
|
+
*
|
|
27
|
+
* `side` and `status` are typed `Union | (string & {})`: `@0xmonaco/core`
|
|
28
|
+
* parses this frame leniently, so an unrecognized value is passed through
|
|
29
|
+
* rather than throwing inside the WebSocket message handler and dropping a
|
|
30
|
+
* risk-critical update entirely (0XM-2627/0XM-2628). The unions name the values
|
|
31
|
+
* the server sends today — `switch` over them with a `default` branch.
|
|
26
32
|
*/
|
|
27
33
|
export interface PositionEventData {
|
|
28
34
|
/** Position identifier (UUID) */
|
|
@@ -32,9 +38,9 @@ export interface PositionEventData {
|
|
|
32
38
|
/** Trading pair identifier (UUID) */
|
|
33
39
|
tradingPairId: string;
|
|
34
40
|
/** Position side */
|
|
35
|
-
side: PositionEventSide;
|
|
41
|
+
side: PositionEventSide | (string & {});
|
|
36
42
|
/** Position lifecycle status (SCREAMING_SNAKE_CASE on the wire, e.g. "OPEN") */
|
|
37
|
-
status: PositionEventStatus;
|
|
43
|
+
status: PositionEventStatus | (string & {});
|
|
38
44
|
/** Absolute position size (decimal string) */
|
|
39
45
|
size: string;
|
|
40
46
|
/** Average entry price (decimal string) */
|
|
@@ -15,7 +15,7 @@ export interface TradeEventData {
|
|
|
15
15
|
/** Executed quantity */
|
|
16
16
|
quantity: string;
|
|
17
17
|
/** Side of the maker order (BUY or SELL) */
|
|
18
|
-
makerSide: OrderSide;
|
|
18
|
+
makerSide: OrderSide | (string & {});
|
|
19
19
|
/** Timestamp when the trade was executed (ISO 8601) */
|
|
20
20
|
executedAt: string;
|
|
21
21
|
}
|
|
@@ -28,7 +28,7 @@ export interface TradeEvent {
|
|
|
28
28
|
/** Trading pair ID (UUID) */
|
|
29
29
|
tradingPairId: string;
|
|
30
30
|
/** Trading mode (SPOT or MARGIN) */
|
|
31
|
-
tradingMode: TradingMode;
|
|
31
|
+
tradingMode: TradingMode | (string & {});
|
|
32
32
|
/** Trade execution data */
|
|
33
33
|
data: TradeEventData;
|
|
34
34
|
}
|
|
@@ -18,12 +18,20 @@ export type TwapOrderEventReason = "created" | "slice_placed" | "slice_skipped"
|
|
|
18
18
|
* Field names mirror the backend `TwapOrderEventData` payload (snake_case on
|
|
19
19
|
* the wire, camelCased by the client); the SDK parser normalizes explicit
|
|
20
20
|
* `null` values to absent, so nullable wire fields are optional here.
|
|
21
|
+
*
|
|
22
|
+
* **The value unions below are the values the server sends today, not a
|
|
23
|
+
* runtime guarantee**, which is why each is typed `Union | (string & {})`:
|
|
24
|
+
* `@0xmonaco/core` hands this whole payload through with a single cast and
|
|
25
|
+
* validates no value field, so an unrecognized `side`, `tradingMode`,
|
|
26
|
+
* `executionStyle`, `state`, `triggerDirection` or `reason` arrives as-is
|
|
27
|
+
* rather than dropping the update (0XM-2628). Autocomplete still offers the
|
|
28
|
+
* known values; `switch` over one with a `default` branch.
|
|
21
29
|
*/
|
|
22
30
|
export interface TwapOrderEventData {
|
|
23
31
|
twapOrderId: string;
|
|
24
32
|
tradingPairId: string;
|
|
25
|
-
side: OrderSide;
|
|
26
|
-
tradingMode: TradingMode;
|
|
33
|
+
side: OrderSide | (string & {});
|
|
34
|
+
tradingMode: TradingMode | (string & {});
|
|
27
35
|
totalQuantity: string;
|
|
28
36
|
executedQuantity: string;
|
|
29
37
|
executedNotional: string;
|
|
@@ -41,7 +49,7 @@ export interface TwapOrderEventData {
|
|
|
41
49
|
clientTwapId?: string;
|
|
42
50
|
randomize: boolean;
|
|
43
51
|
/** Child execution style: "TAKER" (banded MARKET slices) or "PASSIVE" (post-only children at the touch, taker sweep at each slice deadline) */
|
|
44
|
-
executionStyle: TwapExecutionStyle;
|
|
52
|
+
executionStyle: TwapExecutionStyle | (string & {});
|
|
45
53
|
/** Window start (ISO 8601) */
|
|
46
54
|
startAt: string;
|
|
47
55
|
/** Window end (ISO 8601). Execution stops hard at this time. */
|
|
@@ -55,13 +63,23 @@ export interface TwapOrderEventData {
|
|
|
55
63
|
nextSliceAt?: string;
|
|
56
64
|
slicesPlaced: number;
|
|
57
65
|
slicesSkipped: number;
|
|
58
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Lifecycle state of the parent order.
|
|
68
|
+
*
|
|
69
|
+
* Widened past {@link TwapOrderState} on purpose: `@0xmonaco/core` parses
|
|
70
|
+
* this frame leniently, so a state added server-side after this SDK version
|
|
71
|
+
* ships is delivered as-is rather than dropping the whole update (0XM-2628).
|
|
72
|
+
* `TwapOrderState` names the values the server sends today — narrow with a
|
|
73
|
+
* `switch` that keeps a `default` branch rather than relying on
|
|
74
|
+
* exhaustiveness.
|
|
75
|
+
*/
|
|
76
|
+
state: TwapOrderState | (string & {});
|
|
59
77
|
/** Terminal annotation, e.g. "ended with shortfall 1.5"; absent for non-terminal parents */
|
|
60
78
|
terminalReason?: string;
|
|
61
79
|
/** Conditional configuration + activation stamp (parity with the REST read
|
|
62
80
|
* model). All absent on unconditional parents. */
|
|
63
81
|
triggerPrice?: string;
|
|
64
|
-
triggerDirection?: "ABOVE" | "BELOW";
|
|
82
|
+
triggerDirection?: "ABOVE" | "BELOW" | (string & {});
|
|
65
83
|
conditionalExpiry?: string;
|
|
66
84
|
triggeredAt?: string;
|
|
67
85
|
createdAt: string;
|
|
@@ -69,7 +87,7 @@ export interface TwapOrderEventData {
|
|
|
69
87
|
cancelledAt?: string;
|
|
70
88
|
completedAt?: string;
|
|
71
89
|
/** Mutation that produced this snapshot */
|
|
72
|
-
reason: TwapOrderEventReason;
|
|
90
|
+
reason: TwapOrderEventReason | (string & {});
|
|
73
91
|
}
|
|
74
92
|
export interface TwapOrderEvent {
|
|
75
93
|
eventType: "twap_order_update";
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -869,6 +869,17 @@ export interface paths {
|
|
|
869
869
|
};
|
|
870
870
|
get?: never;
|
|
871
871
|
put?: never;
|
|
872
|
+
/**
|
|
873
|
+
* @deprecated
|
|
874
|
+
* @description DEPRECATED (0XM-2632): this endpoint overloads two unrelated operations —
|
|
875
|
+
* with `trading_pair_id` it allocates into that pair's isolated risk bucket
|
|
876
|
+
* (crediting the sole open position's stored margin), without it it performs
|
|
877
|
+
* a wallet-debiting deposit to the parent margin account. Use
|
|
878
|
+
* `TransferCollateralToRiskBucket` for bucket funding (which now applies the
|
|
879
|
+
* same position-margin credit) and `TransferCollateralToParentMarginAccount`
|
|
880
|
+
* for wallet-to-margin deposits. Kept for backward compatibility; no removal
|
|
881
|
+
* date scheduled.
|
|
882
|
+
*/
|
|
872
883
|
post: operations["transfer_collateral_to_margin_account"];
|
|
873
884
|
delete?: never;
|
|
874
885
|
options?: never;
|
|
@@ -1029,6 +1040,15 @@ export interface paths {
|
|
|
1029
1040
|
};
|
|
1030
1041
|
get?: never;
|
|
1031
1042
|
put?: never;
|
|
1043
|
+
/**
|
|
1044
|
+
* @description Fund a risk bucket from the parent margin account's unallocated
|
|
1045
|
+
* collateral (no wallet movement; the bucket is created if needed). Since
|
|
1046
|
+
* 0XM-2632, funding an ISOLATED bucket that holds an open position also
|
|
1047
|
+
* credits that position's stored margin — the same behavior as the
|
|
1048
|
+
* deprecated `TransferCollateralToMarginAccount` Adjust Margin rail — so
|
|
1049
|
+
* adding collateral to support a position has one behavior on every route.
|
|
1050
|
+
* A flat isolated bucket and the cross bucket stay plain allocations.
|
|
1051
|
+
*/
|
|
1032
1052
|
post: operations["transfer_collateral_to_risk_bucket"];
|
|
1033
1053
|
delete?: never;
|
|
1034
1054
|
options?: never;
|
|
@@ -2072,23 +2092,29 @@ export interface paths {
|
|
|
2072
2092
|
* Register a deposit address for monitoring
|
|
2073
2093
|
* @description Register a deposit address for monitoring.
|
|
2074
2094
|
*
|
|
2075
|
-
* Every (application, user)
|
|
2076
|
-
*
|
|
2077
|
-
* automatically forwards every ERC20 deposit into the
|
|
2078
|
-
*
|
|
2095
|
+
* Every (application, user, deposit target) triple has a deterministic
|
|
2096
|
+
* deposit address. This registers the caller's own address so the sweeper
|
|
2097
|
+
* service watches it and automatically forwards every ERC20 deposit into the
|
|
2098
|
+
* rollup, crediting the caller under the application.
|
|
2099
|
+
*
|
|
2100
|
+
* Authenticated, and the whole identity comes from the session: the
|
|
2101
|
+
* application is the one `login` established the session under, and the
|
|
2102
|
+
* credited address is the session's own. Neither is a request parameter, so a
|
|
2103
|
+
* caller can only ever register their own address under their own
|
|
2104
|
+
* application. The only thing the body carries is which ledger to aim at.
|
|
2079
2105
|
*
|
|
2080
2106
|
* Registration also runs a one-time initial check in the background: any
|
|
2081
2107
|
* balance already sitting on the address is swept without waiting for a new
|
|
2082
2108
|
* transfer. The response returns immediately with the derived address; it
|
|
2083
2109
|
* does not wait for that check.
|
|
2084
2110
|
*
|
|
2085
|
-
* Idempotent and safe to retry: re-registering an existing
|
|
2111
|
+
* Idempotent and safe to retry: re-registering an existing triple returns
|
|
2086
2112
|
* `already_registered` with the same address and never re-triggers the
|
|
2087
2113
|
* initial check.
|
|
2088
2114
|
*
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2091
|
-
*
|
|
2115
|
+
* Globally rate-limited: registration creates durable state, so the endpoint
|
|
2116
|
+
* admits a bounded number per minute across all callers and answers `429`
|
|
2117
|
+
* beyond it.
|
|
2092
2118
|
*/
|
|
2093
2119
|
post: operations["register_deposit_address"];
|
|
2094
2120
|
delete?: never;
|
|
@@ -6512,25 +6538,21 @@ export interface components {
|
|
|
6512
6538
|
};
|
|
6513
6539
|
RegisterRequest: {
|
|
6514
6540
|
/**
|
|
6515
|
-
* @description
|
|
6516
|
-
* @example
|
|
6517
|
-
|
|
6518
|
-
clientId: string;
|
|
6519
|
-
/**
|
|
6520
|
-
* @description Address credited on the rollup, and half of the deposit address derivation
|
|
6521
|
-
* @example 0x742d35Cc6634C0532925a3b8D4060f31E2C3d8B5
|
|
6541
|
+
* @description Which ledger swept deposits are requested to be credited to. `SPOT` (the default when omitted) credits the spot wallet; `MARGIN` asks for the parent margin account's collateral, skipping the separate collateral transfer. The target is part of the address derivation, so `SPOT` and `MARGIN` yield two different deposit addresses for the same pair, and each address carries its own request. `MARGIN` is a routing request rather than a guarantee: a deposit the matching engine cannot route to collateral — an unsupported collateral asset, or a margin account that fails validation — is credited to the spot wallet instead, so funds are never stranded. A `SPOT` address is never credited to margin.
|
|
6542
|
+
* @example MARGIN
|
|
6543
|
+
* @enum {string|null}
|
|
6522
6544
|
*/
|
|
6523
|
-
|
|
6545
|
+
depositTarget?: "SPOT" | "MARGIN" | null;
|
|
6524
6546
|
};
|
|
6525
6547
|
RegisterResponse: {
|
|
6526
6548
|
/**
|
|
6527
|
-
* @description `registered` when the
|
|
6549
|
+
* @description `registered` when the triple was added, `already_registered` when it was known before this call
|
|
6528
6550
|
* @example registered
|
|
6529
6551
|
* @enum {string|null}
|
|
6530
6552
|
*/
|
|
6531
6553
|
status?: "registered" | "already_registered" | null;
|
|
6532
6554
|
/**
|
|
6533
|
-
* @description The
|
|
6555
|
+
* @description The deposit address for this (application, user, deposit target) triple. Stable, and valid to publish and fund before any contract exists there.
|
|
6534
6556
|
* @example 0xcf1eF339798914EF7Ee4984Ed45BD141D63a65C9
|
|
6535
6557
|
*/
|
|
6536
6558
|
sweeperAddress?: string | null;
|
|
@@ -7355,6 +7377,16 @@ export interface components {
|
|
|
7355
7377
|
marginMode?: string | null;
|
|
7356
7378
|
/** @description Present for cross risk-bucket transfers. */
|
|
7357
7379
|
selectedTradingPairIds?: string[] | null;
|
|
7380
|
+
/**
|
|
7381
|
+
* @description Whether the transfer was committed to a position's stored margin.
|
|
7382
|
+
* Present only when a position-margin credit was in play: true — the credit
|
|
7383
|
+
* landed; false — a credit was requested (or defaulted) but degraded to a
|
|
7384
|
+
* plain allocation because the bucket's persisted position row was stale
|
|
7385
|
+
* (close/reopen race) — re-issue the Adjust Margin once the new position
|
|
7386
|
+
* row lands if the commitment still matters. Absent on plain allocations,
|
|
7387
|
+
* parent deposits, and releases.
|
|
7388
|
+
*/
|
|
7389
|
+
positionMarginCredited?: boolean | null;
|
|
7358
7390
|
};
|
|
7359
7391
|
TransferCollateralToParentMarginAccountRequest: {
|
|
7360
7392
|
asset?: string | null;
|
|
@@ -7374,6 +7406,31 @@ export interface components {
|
|
|
7374
7406
|
marginMode?: string | null;
|
|
7375
7407
|
/** @description Trading pair UUIDs selected into the cross risk bucket. Required when marginMode is CROSS. */
|
|
7376
7408
|
selectedTradingPairIds?: string[] | null;
|
|
7409
|
+
/**
|
|
7410
|
+
* @description What the transferred collateral becomes when the ISOLATED bucket holds an
|
|
7411
|
+
* open position. The two intents want opposite fates for the same dollars,
|
|
7412
|
+
* so the caller states theirs:
|
|
7413
|
+
*
|
|
7414
|
+
* - true (and UNSET — the default is the human "Adjust Margin" gesture):
|
|
7415
|
+
* the amount is COMMITTED to the position's stored margin. Effective
|
|
7416
|
+
* leverage drops and stays down, initial margin required rises by the
|
|
7417
|
+
* amount, free collateral is unchanged — new orders cannot spend it.
|
|
7418
|
+
* - false: plain allocation. Free collateral rises and the next order can
|
|
7419
|
+
* spend it. Programmatic funding loops that top a bucket up to a free
|
|
7420
|
+
* collateral target MUST pass false, or each top-up converts into
|
|
7421
|
+
* requirement and the loop never converges.
|
|
7422
|
+
*
|
|
7423
|
+
* Either way the liquidation cushion improves identically (the breach
|
|
7424
|
+
* check is bucket-equity based). On a FLAT isolated bucket there is no
|
|
7425
|
+
* position to commit to and both values are a plain allocation. Explicit
|
|
7426
|
+
* true is rejected for CROSS buckets (cross has no per-position margin);
|
|
7427
|
+
* unset/false is a plain allocation there.
|
|
7428
|
+
*
|
|
7429
|
+
* The response reports what actually happened in `position_margin_credited`
|
|
7430
|
+
* — a credit can degrade to a plain allocation when the persisted position
|
|
7431
|
+
* row is stale (close/reopen race).
|
|
7432
|
+
*/
|
|
7433
|
+
applyToPositionMargin?: boolean | null;
|
|
7377
7434
|
};
|
|
7378
7435
|
TransferRewardsRequest: {
|
|
7379
7436
|
/**
|
|
@@ -12008,14 +12065,21 @@ export interface operations {
|
|
|
12008
12065
|
};
|
|
12009
12066
|
content?: never;
|
|
12010
12067
|
};
|
|
12011
|
-
/** @description
|
|
12012
|
-
|
|
12068
|
+
/** @description Authentication required */
|
|
12069
|
+
401: {
|
|
12070
|
+
headers: {
|
|
12071
|
+
[name: string]: unknown;
|
|
12072
|
+
};
|
|
12073
|
+
content?: never;
|
|
12074
|
+
};
|
|
12075
|
+
/** @description The application for this session is not active */
|
|
12076
|
+
403: {
|
|
12013
12077
|
headers: {
|
|
12014
12078
|
[name: string]: unknown;
|
|
12015
12079
|
};
|
|
12016
12080
|
content?: never;
|
|
12017
12081
|
};
|
|
12018
|
-
/** @description Registration
|
|
12082
|
+
/** @description Registration admission limit exceeded; retry shortly */
|
|
12019
12083
|
429: {
|
|
12020
12084
|
headers: {
|
|
12021
12085
|
[name: string]: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.50-develop.9c1b239",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lint": "biome lint ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@0xmonaco/contracts": "1.0.
|
|
19
|
+
"@0xmonaco/contracts": "1.0.50-develop.9c1b239",
|
|
20
20
|
"zod": "^4.1.12"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|