From eca7d55afbfe6044605f6d67a7ef43098124e264 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Sun, 15 Feb 2015 12:46:38 -0300 Subject: [PATCH] update rm --- bit-wallet/bit-rm | 8 ++++---- cli.js | 30 ------------------------------ lib/client/API.js | 20 ++------------------ 3 files changed, 6 insertions(+), 52 deletions(-) delete mode 100644 cli.js diff --git a/bit-wallet/bit-rm b/bit-wallet/bit-rm index 9a864e8..960821c 100644 --- a/bit-wallet/bit-rm +++ b/bit-wallet/bit-rm @@ -2,7 +2,7 @@ var _ = require('lodash'); var program = require('commander'); -var ClientLib = require('../lib/clientlib.js'); +var Client = require('../lib/client'); var common = require('./common'); program @@ -18,11 +18,11 @@ if (!args[0]) var txpid = args[0]; -var cli = new ClientLib({ +var cli = new Client({ filename: program.config }); -cli.txProposals({}, function(err, x) { +cli.getTxProposals({}, function(err, x) { common.die(err); if (program.verbose) @@ -41,7 +41,7 @@ cli.txProposals({}, function(err, x) { }).join(' '));; var txp = txps[0]; - cli.rm(txp, function(err, x) { + cli.removeTxProposal(txp, function(err, x) { common.die(err); if (program.verbose) diff --git a/cli.js b/cli.js deleted file mode 100644 index 3e1e0b3..0000000 --- a/cli.js +++ /dev/null @@ -1,30 +0,0 @@ -var _ = require('lodash'); -var async = require('async'); -var log = require('npmlog'); -var fs = require('fs'); - -var CliLib = require('./lib/clilib'); - -try { - fs.unlinkSync('copay.dat'); -} catch (e) {} - -var cli = new CliLib({ - filename: 'copay.dat' -}); - -cli.createWallet('my wallet', 'me', 1, 1, 'testnet', function(err, secret) { - if (err) { - console.log(err); - process.exit(); - } - - cli.status(function(err, status) { - if (err) { - console.log(err); - process.exit(); - } - - console.log(status); - }) -}); diff --git a/lib/client/API.js b/lib/client/API.js index 8f1ca41..1bae91c 100644 --- a/lib/client/API.js +++ b/lib/client/API.js @@ -359,29 +359,13 @@ API.prototype.rejectTxProposal = function(txp, reason, cb) { this._doPostRequest(url, args, data, cb); }; -ClientLib.prototype.rm = function(txp, cb) { +ClientLib.prototype.removeTxProposal = function(txp, cb) { var self = this; var data = this._loadAndCheck(); var url = '/v1/txproposals/' + txp.id; - var reqSignature = _signRequest(url, {}, data.signingPrivKey); - request({ - headers: { - 'x-identity': data.copayerId, - 'x-signature': reqSignature, - }, - method: 'delete', - url: _getUrl(url), - json: true, - }, function(err, res, body) { - if (err) return cb(err); - if (res.statusCode != 200) { - _parseError(body); - return cb('Request error'); - } - return cb(null, body); - }); + this._doRequest('delete', url, {}, data, cb); }; module.exports = API;