-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.js
executable file
·50 lines (41 loc) · 1.03 KB
/
index.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
#! /usr/bin/env node
const chalk = require('chalk');
const clear = require('clear');
const figlet = require('figlet');
const panda = require('pandacash-core');
const pkg = require('./package.json');
const detailedVersion = `Pandacash CLI v${pkg.version}`;
/**
* Interface inspired by ganache-cli
*/
module.exports = {
server: panda.server
};
/**
* If started from command-line tool:
*/
if (!module.parent) {
const yargs = require('yargs');
const initArgs = require("./args")
clear();
console.log(
chalk.yellow(
figlet.textSync('pandacash-cli', { horizontalLayout: 'full' })
)
);
const argv = initArgs(yargs, detailedVersion).argv;
const server = panda.server({
mnemonic: argv.m,
totalAccounts: argv.a,
port: argv.p,
walletPort: argv.w,
debug: argv.debug,
enableLogs: true
});
server.listen({ port: argv.port || 48332, walletPort: argv.walletPort || 48333 }, (err) => {
if (err) {
return console.error(err);
}
process.stdin.resume();
});
}