Ivan Socolsky
10 years ago
10 changed files with 314 additions and 22 deletions
@ -0,0 +1,24 @@ |
|||
#!/usr/bin/env node |
|||
|
|||
var program = require('commander'); |
|||
var CliLib = require('../lib/clilib.js'); |
|||
var common = require('./common'); |
|||
|
|||
program |
|||
.version('0.0.1') |
|||
.option('-c,--config [file]', 'Wallet config filename') |
|||
.option('-v,--verbose', 'be verbose') |
|||
.parse(process.argv); |
|||
|
|||
var args = program.args; |
|||
var cli = new CliLib({ |
|||
filename: program.config |
|||
}); |
|||
|
|||
cli.address(function(err, x) { |
|||
common.die(err); |
|||
console.log('* New Address %s ', x.address); |
|||
|
|||
if (program.verbose) |
|||
console.log('* Raw Server Response:\n', x); //TODO |
|||
}); |
@ -0,0 +1,29 @@ |
|||
#!/usr/bin/env node |
|||
|
|||
var _ = require('lodash'); |
|||
var program = require('commander'); |
|||
var CliLib = require('../lib/clilib.js'); |
|||
var common = require('./common'); |
|||
|
|||
program |
|||
.version('0.0.1') |
|||
.option('-c,--config [file]', 'Wallet config filename') |
|||
.option('-v,--verbose', 'be verbose') |
|||
.parse(process.argv); |
|||
|
|||
var args = program.args; |
|||
var cli = new CliLib({ |
|||
filename: program.config |
|||
}); |
|||
|
|||
cli.addresses(function(err, x) { |
|||
common.die(err); |
|||
|
|||
console.log('* Addresses:'); |
|||
_.each(x, function(a){ |
|||
console.log(' ', a.address); |
|||
}); |
|||
|
|||
if (program.verbose) |
|||
console.log('* Raw Server Response:\n', x); //TODO |
|||
}); |
@ -0,0 +1,24 @@ |
|||
#!/usr/bin/env node |
|||
|
|||
var program = require('commander'); |
|||
var CliLib = require('../lib/clilib.js'); |
|||
var common = require('./common'); |
|||
|
|||
program |
|||
.version('0.0.1') |
|||
.option('-c,--config [file]', 'Wallet config filename') |
|||
.option('-v,--verbose', 'be verbose') |
|||
.parse(process.argv); |
|||
|
|||
var args = program.args; |
|||
var cli = new CliLib({ |
|||
filename: program.config |
|||
}); |
|||
|
|||
cli.balance(function(err, x) { |
|||
common.die(err); |
|||
console.log('* Wallet balance', x); |
|||
|
|||
if (program.verbose) |
|||
console.log('* Raw Server Response:\n', x); //TODO |
|||
}); |
@ -0,0 +1,33 @@ |
|||
#!/usr/bin/env node |
|||
|
|||
var program = require('commander'); |
|||
var CliLib = require('../lib/clilib.js'); |
|||
var common = require('./common'); |
|||
|
|||
program |
|||
.version('0.0.1') |
|||
.option('-c,--config [file]', 'Wallet config filename') |
|||
.option('-v,--verbose', 'be verbose') |
|||
.usage('[options] <address> <amount> <message>') |
|||
.parse(process.argv); |
|||
|
|||
var args = program.args; |
|||
if (!args[0] || !args[1] || !args[2]) |
|||
program.help(); |
|||
|
|||
var address = args[0]; |
|||
var amount = args[1]; |
|||
var message = args[2]; |
|||
|
|||
var cli = new CliLib({ |
|||
filename: program.config |
|||
}); |
|||
|
|||
cli.send({toAddress: address, amount: amount, message:message}, function(err, x) { |
|||
common.die(err); |
|||
console.log(' * Tx created: ID %s [%s] RequiredSignatures:', |
|||
x.id, x.status, x.requiredSignatures); |
|||
|
|||
if (program.verbose) |
|||
console.log('* Raw Server Response:\n', x); //TODO |
|||
}); |
Loading…
Reference in new issue