forked from bitpay/bitcore-wallet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bitpay#10 from matiu/feat/cli-send2
Feat/cli send2
- Loading branch information
Showing
12 changed files
with
119 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
|
||
var _ = require('lodash'); | ||
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] <txpid>') | ||
.parse(process.argv); | ||
|
||
var args = program.args; | ||
if (!args[0]) | ||
program.help(); | ||
|
||
var txpid = args[0]; | ||
|
||
var cli = new ClientLib({ | ||
filename: program.config | ||
}); | ||
|
||
cli.txProposals({}, function(err, x) { | ||
common.die(err); | ||
|
||
if (program.verbose) | ||
console.log('* Raw Server Response:\n', x); //TODO | ||
|
||
var txps = _.filter(x, function(x) { | ||
return _.endsWith(common.shortID(x.id), txpid); | ||
}); | ||
|
||
if (!txps.length) | ||
common.die('Could not find TX Proposal:' + txpid); | ||
|
||
if (txps.length > 1) | ||
common.die('More that one TX Proposals match:' + txpid + ' : ' + _.map(txps, function(x) { | ||
return x.id; | ||
}).join(' '));; | ||
|
||
var txp = txps[0]; | ||
cli.sign(txp, function(err, x) { | ||
common.die(err); | ||
|
||
if (program.verbose) | ||
console.log('* Raw Server Response:\n', x); //TODO | ||
|
||
console.log('Transaction signed.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters