aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher/src/schemas/websocket_schemas.ts
blob: c250d12f12b10b734e084e13d7a1a2c740b56c15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
export const webSocketUtf8MessageSchema = {
    id: '/webSocketUtf8MessageSchema',
    properties: {
        utf8Data: { type: 'string' },
    },
    type: 'object',
    required: ['utf8Data'],
};

export const webSocketRequestSchema = {
    id: '/webSocketRequestSchema',
    properties: {
        action: { enum: ['GET_STATS', 'ADD_ORDER', 'REMOVE_ORDER'] },
        signedOrder: { $ref: '/signedOrderSchema' },
        orderHash: { type: 'string' },
    },
    anyOf: [
        {
            properties: { action: { enum: ['ADD_ORDER'] } },
            required: ['signedOrder'],
        },
        {
            properties: { action: { enum: ['REMOVE_ORDER'] } },
            required: ['orderHash'],
        },
        {
            properties: { action: { enum: ['GET_STATS'] } },
            required: [],
        },
    ],
    type: 'object',
};