INNER CODE UNIT · TypeScript

Option

Deezzir/solana-bot · src/bot.ts:67

    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);
    });
}

function get_to_option(wallet_cnt: number): Option {
    return new Option('-t, --to <number>', 'Ending at the provided index (exclusive)').argParser((value) => {
        if (!common.validate_int(value, 0, wallet_cnt))
            throw new InvalidOptionArgumentError(`Not a valid range(0 - ${wallet_cnt}).`);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…