From 8b30128314ba18dbc85a4ffbab1f81adbc7862a5 Mon Sep 17 00:00:00 2001 From: Dmitriy Pavlov Date: Mon, 10 Jul 2023 18:08:39 +0300 Subject: [PATCH] feat(OP-4112): return executionTypes --- src/constants/executionTypes.ts | 3 +++ src/services/Aggregator/ws/schemas/addressUpdateSchema.ts | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 src/constants/executionTypes.ts diff --git a/src/constants/executionTypes.ts b/src/constants/executionTypes.ts new file mode 100644 index 0000000..bc82566 --- /dev/null +++ b/src/constants/executionTypes.ts @@ -0,0 +1,3 @@ +const executionTypes = ['LIMIT', 'STOP_LIMIT'] as const; + +export default executionTypes; diff --git a/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts b/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts index 98e142e..675cafe 100644 --- a/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts +++ b/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts @@ -1,6 +1,7 @@ import { z } from 'zod'; import { exchanges } from '../../../../constants/index.js'; import orderStatuses from '../../../../constants/orderStatuses.js'; +import executionTypes from '../../../../constants/executionTypes.js'; import subOrderStatuses from '../../../../constants/subOrderStatuses.js'; import MessageType from '../MessageType.js'; import balancesSchema from './balancesSchema.js'; @@ -35,6 +36,7 @@ export const orderUpdateSchema = z.object({ l: z.boolean().optional(), // is liquidation order t: z.number(), // update time C: z.string().optional(), // trigger condition + E: z.enum(executionTypes).optional(), c: subOrderSchema.array(), }) .transform((val) => ({ @@ -46,6 +48,7 @@ export const orderUpdateSchema = z.object({ settledAmount: o.A, status: o.S, liquidated: o.l, + executionType: o.E, triggerCondition: o.C, subOrders: o.c.map((so) => ({ pair: so.P, @@ -77,6 +80,7 @@ export const fullOrderSchema = z.object({ T: z.number(), // creation time / unix timestamp t: z.number(), // update time c: subOrderSchema.array(), + E: z.enum(executionTypes).optional(), C: z.string().optional(), // trigger condition ro: z.boolean().optional(), // is reversed order }).transform((val) => ({ @@ -97,6 +101,7 @@ export const fullOrderSchema = z.object({ pair: o.P, amount: o.a, price: o.p, + executionType: o.E, triggerCondition: o.C, isReversedOrder: o.ro, subOrders: o.c.map((so) => ({