-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
29 lines (27 loc) · 937 Bytes
/
config.ts
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
import Joi from 'joi';
import { cryptoUtils } from '@coti-io/crypto';
const config_schema = Joi.object({
FULL_NODE: Joi.string().uri().required(),
TRUST_SCORE_NODE: Joi.string().uri().required(),
CURRENCY_SYMBOL: Joi.string().required(),
MNEMONIC: Joi.string()
.custom((value, helpers) => {
const mnemonic_array = value.split(' ');
if (![12, 24].includes(mnemonic_array.length)) {
return helpers.message({ custom: '"MNEMONIC" length must be 12 or 24' });
}
return value;
})
.required(),
AMOUNT: Joi.number().required(),
DESTINATION_ADDRESS: Joi.string()
.custom((value, helpers) => {
if (!cryptoUtils.verifyAddressStructure(value)) {
return helpers.message({ custom: '"DESTINATION_ADDRESS" is not a valid address' });
}
return value;
})
.required(),
SOURCE_INDEX: Joi.number().integer().required(),
}).unknown();
export { config_schema };