-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
56 lines (51 loc) · 940 Bytes
/
index.js
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
'use strict'
const FLAGS = {
ORDER: {
IS_HIDDEN: 64,
IS_POS_CLOSE: 512,
IS_POS_REDUCE: 1024,
IS_POST_ONLY: 4096,
IS_OCO: 16384,
AVOID_FUNDING_VIR: 524288,
MOD_TIF_0: 33554432,
EXP_0: 1073741824
},
OFFER: {
IS_HIDDEN: 64
},
ENTRY_TRG_REASON: {
R_UPD_FX: 1048576
},
RELAY: {
DEC_S: 2 ** 3,
TIME_S: 2 ** 5,
FMT_X: 2 ** 9,
FMT_INTERNAL0: 2 ** 10,
TS_ALL: 2 ** 15,
SEQ_ALL: 2 ** 16,
CHECKSUM: 2 ** 17,
EXP: 2 ** 18,
DEBUG: 2 ** 19,
C_DEBUG: 2 ** 20,
DP_TRAVEL_RULE: 2 ** 21,
DP_BFXPAY: 2 ** 22,
APP_OFFICIAL: 2 ** 25,
APP_MOBILE_OFFICIAL: 2 ** 26,
VNEXT_0: 2 ** 29
}
}
function has_flag (t, f, c) {
return (f & FLAGS[t][c]) === FLAGS[t][c]
}
function add_flag (t, f, c) {
return f | FLAGS[t][c]
}
function del_flag (t, f, c) {
return f & ~FLAGS[t][c]
}
module.exports = {
FLAGS,
has_flag,
add_flag,
del_flag
}