Merge pull request #3274 from javierbitpay/fix/paperWallet-getTx

improve transaction method
This commit is contained in:
Matias Alejo Garcia 2015-10-05 15:58:46 -03:00
commit 90967e9652

View file

@ -51,20 +51,17 @@ angular.module('copayApp.controllers').controller('paperWalletController',
fc.decryptBIP38PrivateKey(privateKey, passphrase, null, function(err, privateKey) { fc.decryptBIP38PrivateKey(privateKey, passphrase, null, function(err, privateKey) {
if (err) return cb(err); if (err) return cb(err);
fc.getBalanceFromPrivateKey(privateKey, function(err, utxos) { self.getRawTxFromPrivateKey(privateKey, function(err) {
if (err) return cb(err); if (err) return cb(err);
});
});
} else
self.getRawTxFromPrivateKey(privateKey, function(err) {
if (err) return cb(err);
});
};
addressService.getAddress(fc.credentials.walletId, true, function(err, destinationAddress) { self.getRawTxFromPrivateKey = function(privateKey, cb) {
if (err) return cb(err);
fc.buildTxFromPrivateKey(privateKey, destinationAddress, null, function(err, tx) {
if (err) return cb(err);
return cb(null, tx.serialize(), utxos);
});
});
});
});
} else {
fc.getBalanceFromPrivateKey(privateKey, function(err, utxos) { fc.getBalanceFromPrivateKey(privateKey, function(err, utxos) {
if (err) return cb(err) if (err) return cb(err)
@ -78,7 +75,6 @@ angular.module('copayApp.controllers').controller('paperWalletController',
}); });
}); });
} }
};
self.transaction = function() { self.transaction = function() {
self.error = null; self.error = null;