Browse Source

rename clientlib

activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
7de9a95dd0
  1. 4
      app.js
  2. 10
      bit-wallet/bit-send
  3. 33
      bit-wallet/bit-sign
  4. 8
      bit-wallet/bit-status
  5. 2
      lib/clientlib.js
  6. 1
      package.json

4
app.js

@ -39,6 +39,9 @@ app.use(bodyParser.json({
limit: POST_LIMIT
}));
app.use(require('morgan')('dev'));
var port = process.env.COPAY_PORT || 3001;
var router = express.Router();
@ -59,7 +62,6 @@ function returnError(err, res, req) {
}
var m = message || err.toString();
console.log('[app.js.60]'); //TODO
log.error('Error: ' + req.url + ' :' + code + ':' + m);
res.status(code || 500).json({
error: m,

10
bit-wallet/bit-send

@ -19,15 +19,15 @@ if (!args[0] || !args[1] || !args[2])
var amount = args[1];
var message = args[2];
var cli = new ClientLib({
filename: program.config
var cli = new ClientLib({
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);
x.id, x.status, x.requiredSignatures);
if (program.verbose)
console.log('* Raw Server Response:\n', x); //TODO
});
console.log('* Raw Server Response:\n', x); //TODO
});

33
bit-wallet/bit-sign

@ -0,0 +1,33 @@
#!/usr/bin/env node
var program = require('commander');
var ClientLib = require('../lib/clientlib.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 ClientLib({
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
});

8
bit-wallet/bit-status

@ -21,4 +21,12 @@ cli.status(function(err, x) {
if (program.verbose)
console.log('* Raw Server Response:\n', x); //TODO
cli.txProposals(function(err, x) {
console.log('[bit-status.27]', x); //TODO
if (program.verbose)
console.log('* Raw Server Response:\n', x); //TODO
});
});

2
lib/clientlib.js

@ -11,7 +11,7 @@ var fs = require('fs')
var Bitcore = require('bitcore')
var SignUtils = require('./signutils');
var BASE_URL = 'http://localhost:3001/copay/api/';
var BASE_URL = 'http://localhost:3001/copay/api';
function _createProposalOpts(opts, signingKey) {
var msg = opts.toAddress + '|' + opts.amount + '|' + opts.message;

1
package.json

@ -30,6 +30,7 @@
"npmlog": "^0.1.1",
"preconditions": "^1.0.7",
"request": "^2.53.0",
"morgan": "*",
"uuid": "*"
},
"devDependencies": {

Loading…
Cancel
Save