-
Notifications
You must be signed in to change notification settings - Fork 295
/
cardano-node.types.js
154 lines (132 loc) · 3.52 KB
/
cardano-node.types.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// @flow
export type TlsConfig = {
hostname: string,
port: number,
ca: Uint8Array,
cert: Uint8Array,
key: Uint8Array,
};
export type CardanoNodeImplementations = 'cardano' | 'jormungandr';
export const CardanoNodeImplementationOptions: {
CARDANO: CardanoNodeImplementations,
JORMUNGANDR: CardanoNodeImplementations,
} = {
CARDANO: 'cardano',
JORMUNGANDR: 'jormungandr',
};
export type NetworkNames =
| 'mainnet'
| 'staging'
| 'testnet'
| 'development'
| 'itn_rewards_v1'
| string;
export type PlatformNames = 'win32' | 'linux' | 'darwin' | string;
export const NetworkNameOptions = {
mainnet: 'mainnet',
staging: 'staging',
testnet: 'testnet',
development: 'development',
itn_rewards_v1: 'itn_rewards_v1',
};
export type CardanoNodeState =
| 'starting'
| 'running'
| 'exiting'
| 'stopping'
| 'stopped'
| 'updating'
| 'updated'
| 'crashed'
| 'errored'
| 'unrecoverable';
export const CardanoNodeStates: EnumMap<string, CardanoNodeState> = {
STARTING: 'starting',
RUNNING: 'running',
EXITING: 'exiting',
STOPPING: 'stopping',
STOPPED: 'stopped',
UPDATING: 'updating',
UPDATED: 'updated',
CRASHED: 'crashed',
ERRORED: 'errored',
UNRECOVERABLE: 'unrecoverable',
};
export type CardanoPidOptions =
| 'mainnet-PREVIOUS-CARDANO-PID'
| 'staging-PREVIOUS-CARDANO-PID'
| 'testnet-PREVIOUS-CARDANO-PID'
| 'development-PREVIOUS-CARDANO-PID'
| 'itn_rewards_v1-PREVIOUS-CARDANO-PID'
| string;
export type CardanoNodeStorageKeys = {
PREVIOUS_CARDANO_PID: CardanoPidOptions,
};
export type CardanoNodeProcessNames =
| 'cardano-node'
| 'cardano-node.exe'
| 'jormungandr'
| 'jormungandr.exe';
export type ProcessNames = {
CARDANO_PROCESS_NAME: CardanoNodeProcessNames,
};
export const CardanoProcessNameOptions: {
[CardanoNodeImplementations]: {
win32: CardanoNodeProcessNames,
linux: CardanoNodeProcessNames,
darwin: CardanoNodeProcessNames,
},
} = {
cardano: {
win32: 'cardano-node.exe',
linux: 'cardano-node',
darwin: 'cardano-node',
},
jormungandr: {
win32: 'jormungandr.exe',
linux: 'jormungandr',
darwin: 'jormungandr',
},
};
/**
* Expected fault injection types that can be used to tell
* cardano-node to behave faulty (useful for testing)
*/
export type FaultInjection =
| 'FInjIgnoreShutdown'
| 'FInjIgnoreAPI'
| 'FInjApplyUpdateNoExit'
| 'FInjApplyUpdateWrongExitCode';
export const FaultInjections: {
IgnoreShutdown: FaultInjection,
IgnoreApi: FaultInjection,
ApplyUpdateNoExit: FaultInjection,
ApplyUpdateWrongExitCode: FaultInjection,
} = {
IgnoreShutdown: 'FInjIgnoreShutdown',
IgnoreApi: 'FInjIgnoreAPI',
ApplyUpdateNoExit: 'FInjApplyUpdateNoExit',
ApplyUpdateWrongExitCode: 'FInjApplyUpdateWrongExitCode',
};
export type FaultInjectionIpcResponse = Array<FaultInjection>;
export type FaultInjectionIpcRequest = [FaultInjection, boolean];
export type CardanoStatus = {
isNodeResponding: boolean,
isNodeSyncing: boolean,
isNodeInSync: boolean,
hasBeenConnected: boolean,
cardanoNodePID: number,
cardanoWalletPID: number,
};
// Cardano Mainet network magic
export const MAINNET_MAGIC = [1, null];
// Cardano Byron Testnet network magic
export const TESTNET_MAGIC = [1097911063, 0];
// Cardano Byron Testnet network magic
export const ITN_MAGIC = 1;
// Cardano Mainnet Candidate during the Shelley HF
export const SHELLEY_TESTNET_NETWORK_ID = [1, null];
// Cardano Staging network magic
export const STAGING_MAGIC = 633343913;
// Cardano Selfnode network magic
export const SELFNODE_MAGIC = 459045235;