fix identation

This commit is contained in:
Iuri Matias 2019-05-22 13:08:12 -04:00
parent e1de258bda
commit 4d33583ba0
1 changed files with 105 additions and 105 deletions

View File

@ -17,10 +17,10 @@ async function main() {
]
}
])
// .then(answers => {
// console.log(JSON.stringify(answers, null, ' '));
// test()
// });
// .then(answers => {
// console.log(JSON.stringify(answers, null, ' '));
// test()
// });
}
async function projects() {
@ -101,132 +101,132 @@ async function project(id) {
async function createProject(defaultAccount) {
return inquirer.prompt([
{
type: 'input',
name: 'name',
message: 'What is the project name?',
filter: String,
{
type: 'input',
name: 'name',
message: 'What is the project name?',
filter: String,
validate: function(value) {
return value.length > 0;
}
},
{
type: 'input',
name: 'url',
message: 'What is the project url?',
},
{
type: 'input',
name: 'url',
message: 'What is the project url?',
default: "status.im",
filter: String
},
{
type: 'input',
name: 'account',
message: 'Address of the project admin?',
filter: String
},
{
type: 'input',
name: 'account',
message: 'Address of the project admin?',
default: defaultAccount,
validate: function(value) {
return value.indexOf("0x") === 0;
}
},
{
type: 'input',
name: 'parentProject',
message: 'What is the parent project?',
},
{
type: 'input',
name: 'parentProject',
message: 'What is the parent project?',
default: 0,
filter: Number
},
{
type: 'input',
name: 'commitTime',
message: 'Time in seconds after which the project owner can access funds',
default: 86400,
filter: Number
},
{
type: 'input',
name: 'plugin',
message: 'Plugin address',
filter: Number
},
{
type: 'input',
name: 'commitTime',
message: 'Time in seconds after which the project owner can access funds',
default: 86400,
filter: Number
},
{
type: 'input',
name: 'plugin',
message: 'Plugin address',
default: "0x0000000000000000000000000000000000000000",
validate: function(value) {
return value.indexOf("0x") === 0;
}
}
validate: function(value) {
return value.indexOf("0x") === 0;
}
}
])
}
async function createFunder() {
return inquirer.prompt([
{
type: 'input',
name: 'name',
message: 'What is the funders name?',
filter: String,
{
type: 'input',
name: 'name',
message: 'What is the funders name?',
filter: String,
validate: function(value) {
return value.length > 0;
}
},
{
type: 'input',
name: 'url',
message: 'What is the funders url?',
},
{
type: 'input',
name: 'url',
message: 'What is the funders url?',
default: "status.im",
filter: String
},
{
type: 'input',
name: 'commitTime',
message: 'commit time',
default: 86400,
filter: Number
},
{
type: 'input',
name: 'plugin',
message: 'Plugin address',
filter: String
},
{
type: 'input',
name: 'commitTime',
message: 'commit time',
default: 86400,
filter: Number
},
{
type: 'input',
name: 'plugin',
message: 'Plugin address',
default: "0x0000000000000000000000000000000000000000",
validate: function(value) {
return value.indexOf("0x") === 0;
}
}
validate: function(value) {
return value.indexOf("0x") === 0;
}
}
])
}
async function mintToken() {
return inquirer.prompt([
{
type: 'input',
name: 'tokenAddress',
message: 'What is the token address?',
filter: String,
{
type: 'input',
name: 'tokenAddress',
message: 'What is the token address?',
filter: String,
validate: function(value) {
return value.indexOf("0x") === 0;
return value.indexOf("0x") === 0;
}
},
{
type: 'input',
name: 'account',
message: 'What account to mint?',
filter: String
},
{
type: 'input',
name: 'amount',
message: 'amount (in ether units)',
default: 2,
filter: Number
}
},
{
type: 'input',
name: 'account',
message: 'What account to mint?',
filter: String
},
{
type: 'input',
name: 'amount',
message: 'amount (in ether units)',
default: 2,
filter: Number
}
])
}
function doAction(actionText, action) {
console.dir(actionText)
const confirmation = inquirer
.prompt([
{
type: 'confirm',
name: 'action',
message: 'Execute?',
}
]).then(() => {
console.dir("executing...");
console.dir(actionText)
const confirmation = inquirer
.prompt([
{
type: 'confirm',
name: 'action',
message: 'Execute?',
}
]).then(() => {
console.dir("executing...");
action()
})
}
@ -242,9 +242,9 @@ async function app() {
if (subAction === 'List Projects') {
} if (subAction === 'Create Project') {
let params = (await createProject("0x0000000000000000000000000000000000000001"))
let text = `await LiquidPledging.methods.addProject(\"${params.name}\", \"${params.url}\", \"${params.account}\", ${params.parentProject}, ${params.commitTime}, \"${params.plugin}\").send({from: web3.eth.defaultAccount, gas: 2000000})`
let text = `await LiquidPledging.methods.addProject(\"${params.name}\", \"${params.url}\", \"${params.account}\", ${params.parentProject}, ${params.commitTime}, \"${params.plugin}\").send({from: web3.eth.defaultAccount, gas: 2000000})`
doAction(text, () => {
let projectReceipt = await LiquidPledging.methods.addProject(params.name, params.url, params.account, params.parentProject, params.commitTime, params.plugin).send({from: web3.eth.defaultAccount, gas: 2000000});
let projectReceipt = await LiquidPledging.methods.addProject(params.name, params.url, params.account, params.parentProject, params.commitTime, params.plugin).send({from: web3.eth.defaultAccount, gas: 2000000});
var projectId = projectReceipt.events.ProjectAdded.returnValues.idProject;
console.log(projectId);
@ -257,9 +257,9 @@ async function app() {
if (subAction === 'List Funders') {
} if (subAction === 'Create Funder') {
let params = (await createProject())
let text = `await LiquidPledging.methods.addGiver(\"${params.name}\", \"${params.url}\", ${params.commitTime}, \"${params.plugin}\").send({from: web3.eth.defaultAccount, gas: 2000000})`
let text = `await LiquidPledging.methods.addGiver(\"${params.name}\", \"${params.url}\", ${params.commitTime}, \"${params.plugin}\").send({from: web3.eth.defaultAccount, gas: 2000000})`
doAction(text, () => {
let funderReceipt = await LiquidPledging.methods.addGiver(params.name, params.url, params.commitTime, params.plugin).send({from: web3.eth.defaultAccount, gas: 2000000})
let funderReceipt = await LiquidPledging.methods.addGiver(params.name, params.url, params.commitTime, params.plugin).send({from: web3.eth.defaultAccount, gas: 2000000})
var funderId = funderReceipt.events.GiverAdded.returnValues.idGiver;
console.log(funderId);
});
@ -271,7 +271,7 @@ async function app() {
let params = (await mintToken())
let text = `await StandardToken.methods.mint(\"${params.account}\", web3.utils.toWei(\"${params.amount}\", \"ether\")).send({gas: 2000000})`
doAction(text, () => {
await StandardToken.methods.mint(params.account, web3.utils.toWei(params.amount, "ether")).send({gas: 2000000})
await StandardToken.methods.mint(params.account, web3.utils.toWei(params.amount, "ether")).send({gas: 2000000})
});
} if (subAction === 'Aprove') {
}
@ -292,6 +292,6 @@ async function app() {
}
//(() => {
app()
app()
//})()