main.js 1.02 KB
Newer Older
John Doe's avatar
John Doe committed
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
import inquirer from 'inquirer';
import { serviceController, commandController } from './controllers/services.mjs'

const mainMenu = async () => {

    let answers = await inquirer.prompt([{
        type: "list",
        name: "menu",
        message: `
                                         
        Momiji CLI (PureL1Rollup Sepolia Technical Preview #1)

        Balance: ${await serviceController.balance()}

        \x1b[31m${serviceController.error}\x1b[0m
        
        Select an option:\n`,
        choices: [
            {
                value: 'd',
                name: "\tGENERATE ZKXFT",
                short: "\n\tShifting to zkXFT"
            },
            {
                value: 'w',
                name: "\tREDEEM ZKXFT FOR XFT",
                short: "\n\tShifting back to XFT"
            },
            {
                value: 'exit',
                name: "\tEXIT\n",
            }
        ]
    }])

    serviceController.error = "";
    await commandController[answers.menu]();
    mainMenu();
}

mainMenu();