-
Notifications
You must be signed in to change notification settings - Fork 16
/
constants.js
276 lines (248 loc) · 6.95 KB
/
constants.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/**
* @constant {number} MAX_FILE_SIZE
* - Max file size for publish
*/
const MAX_FILE_SIZE = 2621440;
/**
* @constant {number} DID_PREFIX
* - DID prefix for graph database
*/
const DID_PREFIX = 'did:dkg';
const PRIVATE_ASSERTION_PREDICATE = 'https://ontology.origintrail.io/dkg/1.0#privateAssertionID';
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
const BLOCKCHAINS = {
development: {
'hardhat1:31337': {
rpc: 'http://localhost:8545',
hubContract: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
},
'hardhat2:31337': {
rpc: 'http://localhost:9545',
hubContract: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
},
'otp:2043': {
rpc: 'http://parachain-alphanet-02.origin-trail.network:9933',
hubContract: '0x7585a99C5C150a08f5CDeFD16465C6De8D41EbbD',
},
},
devnet: {
'otp:2160': {
rpc: 'https://lofar-tm-rpc.origin-trail.network',
hubContract: '0x833048F6e6BEa78E0AAdedeCd2Dc2231dda443FB',
},
'gnosis:10200': {
rpc: 'https://rpc.chiadochain.net',
hubContract: '0xD2bA102A0b11944d00180eE8136208ccF87bC39A',
gasPriceOracleLink: 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle',
},
'base:84532': {
hubContract: '0x6C861Cb69300C34DfeF674F7C00E734e840C29C0',
rpc: 'https://sepolia.base.org',
},
},
testnet: {
'otp:20430': {
rpc: 'https://lofar-testnet.origin-trail.network',
hubContract: '0xBbfF7Ea6b2Addc1f38A0798329e12C08f03750A6',
},
'gnosis:10200': {
rpc: 'https://rpc.chiadochain.net',
hubContract: '0xC06210312C9217A0EdF67453618F5eB96668679A',
gasPriceOracleLink: 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle',
},
'base:84532': {
hubContract: '0x144eDa5cbf8926327cb2cceef168A121F0E4A299',
rpc: 'https://sepolia.base.org',
},
},
mainnet: {
'otp:2043': {
rpc: 'https://astrosat-parachain-rpc.origin-trail.network',
hubContract: '0x5fA7916c48Fe6D5F1738d12Ad234b78c90B4cAdA',
},
'gnosis:100': {
rpc: 'https://rpc.gnosischain.com/',
hubContract: '0xbEF14fc04F870c2dD65c13Df4faB6ba01A9c746b',
gasPriceOracleLink: 'https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice',
},
'base:8453': {
hubContract: '0xaBfcf2ad1718828E7D3ec20435b0d0b5EAfbDf2c',
rpc: 'https://mainnet.base.org',
},
},
};
const INCENTIVE_TYPE = {
NEUROWEB: 'Neuroweb',
};
const BLOCKCHAINS_RENAME_PAIRS = {
hardhat1: 'hardhat1:31337',
hardhat2: 'hardhat2:31337',
'otp::devnet': 'otp:2160',
'otp::testnet': 'otp:20430',
'otp::mainnet': 'otp:2043',
};
const MAX_BLOCKCHAIN_CALL_RETRIES = 3;
const TRANSACTION_RETRY_ERRORS = [
'transaction was not mined',
'already known',
'replacement transaction underpriced',
];
const WEBSOCKET_PROVIDER_OPTIONS = {
reconnect: {
auto: true,
delay: 1000, // ms
maxAttempts: 3,
},
clientConfig: {
keepalive: true,
keepaliveInterval: 30 * 1000, // ms
},
};
const OPERATIONS = {
PUBLISH: 'publish',
GET: 'get',
UPDATE: 'update',
LOCAL_STORE: 'local-store',
QUERY: 'query',
};
const OPERATION_STATUSES = {
PENDING: 'PENDING',
COMPLETED: 'COMPLETED',
FAILED: 'FAILED',
};
const ASSERTION_STATES = {
LATEST: 'latest',
LATEST_FINALIZED: 'latest_finalized',
};
const CONTENT_TYPES = {
PUBLIC: 'public',
PRIVATE: 'private',
ALL: 'all',
};
const GET_OUTPUT_FORMATS = {
N_QUADS: 'n-quads',
JSON_LD: 'json-ld',
};
const ASSET_STATES = {
LATEST: 'LATEST',
FINALIZED: 'LATEST_FINALIZED',
};
const STORE_TYPES = {
TRIPLE: 'TRIPLE',
PENDING: 'PENDING',
};
const GRAPH_LOCATIONS = {
PUBLIC_KG: 'PUBLIC_KG',
LOCAL_KG: 'LOCAL_KG',
};
const GRAPH_STATES = {
CURRENT: 'CURRENT',
HISTORICAL: 'HISTORICAL',
};
const OT_NODE_TRIPLE_STORE_REPOSITORIES = {
PUBLIC_CURRENT: 'publicCurrent',
PUBLIC_HISTORY: 'publicHistory',
PRIVATE_CURRENT: 'privateCurrent',
PRIVATE_HISTORY: 'privateHistory',
};
const QUERY_TYPES = {
CONSTRUCT: 'CONSTRUCT',
SELECT: 'SELECT',
};
const OPERATIONS_STEP_STATUS = {
INCREASE_ALLOWANCE_COMPLETED: 'INCREASE_ALLOWANCE_COMPLETED',
CREATE_ASSET_COMPLETED: 'CREATE_ASSET_COMPLETED',
NETWORK_PUBLISH_COMPLETED: 'NETWORK_PUBLISH_COMPLETED',
};
const DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY = 0.5;
const DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
development: { 'hardhat1:31337': 2, 'hardhat2:31337': 2, 'otp:2043': 2 },
devnet: {
'otp:2160': 2,
'gnosis:10200': 2,
'base:84532': 2,
},
testnet: {
'otp:20430': 2,
'gnosis:10200': 2,
'base:84532': 2,
},
mainnet: {
'otp:2043': 2,
'gnosis:100': 2,
'base:8453': 2,
},
};
const DEFAULT_NEUROWEB_FINALITY_PARAMETERS = {
WAIT_NEUROWEB_TX_FINALIZATION: false,
TX_FINALITY_POLLING_INTERVAL: 6_000,
TX_FINALITY_MAX_WAIT_TIME: 60_000,
TX_REMINING_POLLING_INTERVAL: 6_000,
TX_REMINING_MAX_WAIT_TIME: 60_000,
};
const DEFAULT_PARAMETERS = {
ENVIRONMENT: 'mainnet',
PORT: 8900,
FREQUENCY: 5,
MAX_NUMBER_OF_RETRIES: 5,
HASH_FUNCTION_ID: 1,
IMMUTABLE: false,
VALIDATE: true,
OUTPUT_FORMAT: GET_OUTPUT_FORMATS.JSON_LD,
STATE: ASSET_STATES.LATEST,
CONTENT_TYPE: CONTENT_TYPES.PUBLIC,
GRAPH_LOCATION: GRAPH_LOCATIONS.LOCAL_KG,
GRAPH_STATE: GRAPH_STATES.CURRENT,
HANDLE_NOT_MINED_ERROR: false,
SIMULATE_TXS: false,
FORCE_REPLACE_TXS: false,
GAS_LIMIT_MULTIPLIER: 1,
};
const DEFAULT_GAS_PRICE = {
GNOSIS: '20',
OTP: '1',
};
const LOW_BID_SUGGESTION = 'low';
const MED_BID_SUGGESTION = 'med';
const HIGH_BID_SUGGESTION = 'high';
const ALL_BID_SUGGESTION = 'all';
const BID_SUGGESTION_RANGE_ENUM = [
LOW_BID_SUGGESTION,
MED_BID_SUGGESTION,
HIGH_BID_SUGGESTION,
ALL_BID_SUGGESTION,
];
module.exports = {
MAX_FILE_SIZE,
DID_PREFIX,
PRIVATE_ASSERTION_PREDICATE,
ZERO_ADDRESS,
BLOCKCHAINS,
BLOCKCHAINS_RENAME_PAIRS,
MAX_BLOCKCHAIN_CALL_RETRIES,
TRANSACTION_RETRY_ERRORS,
WEBSOCKET_PROVIDER_OPTIONS,
OPERATIONS,
OPERATION_STATUSES,
ASSERTION_STATES,
CONTENT_TYPES,
GET_OUTPUT_FORMATS,
INCENTIVE_TYPE,
ASSET_STATES,
STORE_TYPES,
GRAPH_LOCATIONS,
GRAPH_STATES,
OT_NODE_TRIPLE_STORE_REPOSITORIES,
QUERY_TYPES,
OPERATIONS_STEP_STATUS,
DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY,
DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS,
DEFAULT_NEUROWEB_FINALITY_PARAMETERS,
DEFAULT_PARAMETERS,
DEFAULT_GAS_PRICE,
LOW_BID_SUGGESTION,
MED_BID_SUGGESTION,
HIGH_BID_SUGGESTION,
ALL_BID_SUGGESTION,
BID_SUGGESTION_RANGE_ENUM,
};