@0xmonaco/core 1.0.42-develop.791e6f3 → 1.0.43

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.
@@ -157,16 +157,25 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
157
157
  * Canceled orders cannot be recovered.
158
158
  *
159
159
  * @param orderId - The ID of the order to cancel
160
+ * @param options - Optional partial-cancel: `remainingQuantityTarget` reduces
161
+ * the resting order in place to that remaining quantity, KEEPING its queue
162
+ * position — a target ("leave this much resting"), not an amount to
163
+ * remove, so a retried request converges. Must be a positive multiple of
164
+ * the market's quantity step, strictly below the current remaining
165
+ * quantity. Omit for a full cancel.
160
166
  * @returns Promise resolving to CancelOrderResponse with cancellation details
161
167
  * @throws {APIError} When API communication fails
162
168
  *
163
169
  * @example
164
170
  * ```typescript
165
171
  * const result = await tradingAPI.cancelOrder("order_123");
166
- * console.log(`Order canceled: ${result.status}`);
172
+ * // Partial: keep 0.5 resting at the same queue position
173
+ * await tradingAPI.cancelOrder("order_123", { remainingQuantityTarget: "0.5" });
167
174
  * ```
168
175
  */
169
- cancelOrder(orderId: string): Promise<CancelOrderResponse>;
176
+ cancelOrder(orderId: string, options?: {
177
+ remainingQuantityTarget?: string;
178
+ }): Promise<CancelOrderResponse>;
170
179
  cancelConditionalOrder(conditionalOrderId: string): Promise<CancelConditionalOrderResponse>;
171
180
  getConditionalOrder(conditionalOrderId: string): Promise<ConditionalOrder>;
172
181
  listConditionalOrders(params?: ListConditionalOrdersParams): Promise<ListConditionalOrdersResponse>;
@@ -212,20 +212,30 @@ export class TradingAPIImpl extends BaseAPI {
212
212
  * Canceled orders cannot be recovered.
213
213
  *
214
214
  * @param orderId - The ID of the order to cancel
215
+ * @param options - Optional partial-cancel: `remainingQuantityTarget` reduces
216
+ * the resting order in place to that remaining quantity, KEEPING its queue
217
+ * position — a target ("leave this much resting"), not an amount to
218
+ * remove, so a retried request converges. Must be a positive multiple of
219
+ * the market's quantity step, strictly below the current remaining
220
+ * quantity. Omit for a full cancel.
215
221
  * @returns Promise resolving to CancelOrderResponse with cancellation details
216
222
  * @throws {APIError} When API communication fails
217
223
  *
218
224
  * @example
219
225
  * ```typescript
220
226
  * const result = await tradingAPI.cancelOrder("order_123");
221
- * console.log(`Order canceled: ${result.status}`);
227
+ * // Partial: keep 0.5 resting at the same queue position
228
+ * await tradingAPI.cancelOrder("order_123", { remainingQuantityTarget: "0.5" });
222
229
  * ```
223
230
  */
224
- async cancelOrder(orderId) {
231
+ async cancelOrder(orderId, options) {
225
232
  // Validate inputs before making API call
226
- validate(CancelOrderSchema, { orderId });
233
+ validate(CancelOrderSchema, { orderId, remainingQuantityTarget: options?.remainingQuantityTarget });
227
234
  const requestBody = {
228
235
  orderId: orderId,
236
+ ...(options?.remainingQuantityTarget !== undefined && {
237
+ remainingQuantityTarget: options.remainingQuantityTarget,
238
+ }),
229
239
  };
230
240
  return await this.makeAuthenticatedRequest(perpRoutes.orders.cancel(), {
231
241
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
3
- "version": "1.0.42-develop.791e6f3",
3
+ "version": "1.0.43",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,8 +23,8 @@
23
23
  "viem": "^2.45.2"
24
24
  },
25
25
  "dependencies": {
26
- "@0xmonaco/contracts": "1.0.42-develop.791e6f3",
27
- "@0xmonaco/types": "1.0.42-develop.791e6f3",
26
+ "@0xmonaco/contracts": "1.0.43",
27
+ "@0xmonaco/types": "1.0.43",
28
28
  "@noble/curves": "^1.9.1",
29
29
  "@noble/hashes": "^1.8.0",
30
30
  "http-status-codes": "^2.3.0"