add #getTx

This commit is contained in:
Ivan Socolsky 2015-02-04 15:45:08 -03:00
parent 01ef9e8702
commit f7e60084f2
1 changed files with 17 additions and 0 deletions

View File

@ -433,6 +433,23 @@ CopayServer.prototype.createTx = function(opts, cb) {
}); });
}; };
/**
* Retrieves a tx from storage.
* @param {Object} opts
* @param {string} opts.walletId - The wallet id.
* @param {string} opts.id - The tx id.
* @returns {Object} txProposal
*/
CopayServer.prototype.getTx = function(opts, cb) {
var self = this;
self.storage.fetchTx(opts.walletId, opts.id, function(err, txp) {
if (err) return cb(err);
if (!txp) return cb(new ClientError('Transaction proposal not found'));
return cb(null, txp);
});
};
CopayServer.prototype._broadcastTx = function(rawTx, cb) { CopayServer.prototype._broadcastTx = function(rawTx, cb) {
// TODO: this should attempt to broadcast _all_ accepted and not-yet broadcasted (status=='accepted') txps? // TODO: this should attempt to broadcast _all_ accepted and not-yet broadcasted (status=='accepted') txps?
cb = cb || function() {}; cb = cb || function() {};