bitcore-wallet/bin/wallet-confirm

35 lines
1.1 KiB
JavaScript
Executable File

#!/usr/bin/env node
var _ = require('lodash');
var program = require('commander');
var utils = require('./cli-utils');
program = utils.configureCommander(program);
program
.parse(process.argv);
utils.getClient(program, { mustExist: true }, function (client) {
client.getStatus({}, function(err, x) {
utils.die(err);
if (x.wallet.n == 1) {
console.log('Confirmations only work on shared wallets');
process.exit(1);
}
console.log('\n To be sure that no copayer has joined this wallet more than once, you can asked them for their confirmation number. They can get theirs by running the bit-confirm command.');
console.log('\n * Copayer confirmation IDs:');
var myConfirmationId;
_.each(x.wallet.copayers, function(x) {
var confirmationId = utils.confirmationId(x);
if (x.id != client.credentials.copayerId)
console.log('\t\t* %s : %s', x.name, confirmationId);
else
myConfirmationId = confirmationId;
});
console.log('\t\t---');
console.log('\t\tYour confirmation ID: %s', myConfirmationId);
});
});