From e06a788e0513947ac000e4899ae9d4dcd9ac75dd Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 12 Mar 2015 11:49:01 -0300 Subject: [PATCH] build tx using BWU --- lib/model/txproposal.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/model/txproposal.js b/lib/model/txproposal.js index 9f3bcc7..bc6dc76 100644 --- a/lib/model/txproposal.js +++ b/lib/model/txproposal.js @@ -2,7 +2,8 @@ var _ = require('lodash'); var Uuid = require('uuid'); -var Bitcore = require('bitcore-wallet-utils').Bitcore; +var WalletUtils = require('bitcore-wallet-utils'); +var Bitcore = WalletUtils.Bitcore; var Address = Bitcore.Address; var TxProposalAction = require('./txproposalaction'); @@ -89,16 +90,7 @@ TxProposal.prototype._getCurrentSignatures = function() { TxProposal.prototype.getBitcoreTx = function() { var self = this; - var t = new Bitcore.Transaction(); - - _.each(this.inputs, function(i) { - t.from(i, i.publicKeys, self.requiredSignatures) - }); - - t.to(this.toAddress, this.amount) - .change(this.changeAddress.address); - - t._updateChangeOutput(); + var t = WalletUtils.buildTx(this); var sigs = this._getCurrentSignatures(); _.each(sigs, function(x) {