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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// TODO: Move these schemas to the `json-schemas` package and convert to JSON
// Rename to `OrderWatcherWebSocketRequestSchema`, etc...
export const webSocketUtf8MessageSchema = {
id: '/webSocketUtf8MessageSchema',
properties: {
utf8Data: { type: 'string' },
},
type: 'object',
required: ['utf8Data'],
};
export const webSocketRequestSchema = {
id: '/webSocketRequestSchema',
type: 'object',
definitions: {
signedOrderParam: {
type: 'object',
properties: {
signedOrder: { $ref: '/signedOrderSchema' },
},
required: ['signedOrder'],
},
orderHashParam: {
type: 'object',
properties: {
orderHash: { $ref: '/hexSchema' },
},
required: ['orderHash'],
},
},
oneOf: [
{
type: 'object',
properties: {
id: { type: 'string' },
jsonrpc: { type: 'string' },
method: { enum: ['ADD_ORDER'] },
params: { $ref: '#/definitions/signedOrderParam' },
},
required: ['id', 'jsonrpc', 'method', 'params'],
},
{
type: 'object',
properties: {
id: { type: 'string' },
jsonrpc: { type: 'string' },
method: { enum: ['REMOVE_ORDER'] },
params: { $ref: '#/definitions/orderHashParam' },
},
required: ['id', 'jsonrpc', 'method', 'params'],
},
{
type: 'object',
properties: {
id: { type: 'string' },
jsonrpc: { type: 'string' },
method: { enum: ['GET_STATS'] },
params: {},
},
required: ['id', 'jsonrpc', 'method'],
},
],
};
|