INNER CODE UNIT · TypeScript
get_priority_option
Deezzir/solana-bot · src/bot.ts:60
function get_priority_option(): Option {
return new Option('--pr, --priority <level>', 'specify priority level')
.choices(Object.values(PriorityLevel) as string[])
.default(PriorityLevel.DEFAULT, PriorityLevel.DEFAULT);
}
function get_json_config_option(): Option {
return new Option('-c, --config <path>', 'Path to the JSON config file').argParser((value) => {
if (!existsSync(value)) throw new InvalidOptionArgumentError('Config file does not exist.');
return common.read_json(value);
});
}
function get_from_option(wallet_cnt: number): Option {
return new Option('-f, --from <number>', 'Starting from the provided index').argParser((value) => {
if (!common.validate_int(value, 0, wallet_cnt))
throw new InvalidOptionArgumentError(`Not a valid range(0 - ${wallet_cnt}).`);
return parseInt(value, 10);