|
@ -332,9 +332,8 @@ CopayServer.prototype._getUtxos = function(cb) { |
|
|
|
|
|
|
|
|
// Get addresses for this wallet
|
|
|
// Get addresses for this wallet
|
|
|
self.storage.fetchAddresses(self.walletId, function(err, addresses) { |
|
|
self.storage.fetchAddresses(self.walletId, function(err, addresses) { |
|
|
console.log('[server.js.334:addresses:]',addresses); //TODO
|
|
|
|
|
|
if (err) return cb(err); |
|
|
if (err) return cb(err); |
|
|
if (addresses.length == 0) |
|
|
if (addresses.length == 0) |
|
|
return cb(null, []); |
|
|
return cb(null, []); |
|
|
|
|
|
|
|
|
var addressStrs = _.pluck(addresses, 'address'); |
|
|
var addressStrs = _.pluck(addresses, 'address'); |
|
@ -389,7 +388,6 @@ CopayServer.prototype.getBalance = function(opts, cb) { |
|
|
var self = this; |
|
|
var self = this; |
|
|
|
|
|
|
|
|
self._getUtxos(function(err, utxos) { |
|
|
self._getUtxos(function(err, utxos) { |
|
|
console.log('[server.js.390:utxos:]',utxos); //TODO
|
|
|
|
|
|
if (err) return cb(err); |
|
|
if (err) return cb(err); |
|
|
|
|
|
|
|
|
var balance = {}; |
|
|
var balance = {}; |
|
@ -445,15 +443,13 @@ CopayServer.prototype._selectUtxos = function(txp, utxos) { |
|
|
CopayServer.prototype.createTx = function(opts, cb) { |
|
|
CopayServer.prototype.createTx = function(opts, cb) { |
|
|
var self = this; |
|
|
var self = this; |
|
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['toAddress', 'amount'])) |
|
|
if (!Utils.checkRequired(opts, ['toAddress', 'amount', 'proposalSignature'])) |
|
|
return cb(new ClientError('Required argument missing')); |
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
|
Utils.runLocked(self.walletId, cb, function(cb) { |
|
|
Utils.runLocked(self.walletId, cb, function(cb) { |
|
|
self.getWallet({}, function(err, wallet) { |
|
|
self.getWallet({}, function(err, wallet) { |
|
|
if (err) return cb(err); |
|
|
if (err) return cb(err); |
|
|
if (!wallet.isComplete()) return cb(new ClientError('Wallet is not complete')); |
|
|
if (!wallet.isComplete()) return cb(new ClientError('Wallet is not complete')); |
|
|
if (wallet.isShared() && !Utils.checkRequired(opts, 'proposalSignature')) |
|
|
|
|
|
return cb(new ClientError('Proposal signature is required for shared wallets')); |
|
|
|
|
|
|
|
|
|
|
|
var copayer = wallet.getCopayer(self.copayerId); |
|
|
var copayer = wallet.getCopayer(self.copayerId); |
|
|
var msg = opts.toAddress + '|' + opts.amount + '|' + opts.message; |
|
|
var msg = opts.toAddress + '|' + opts.amount + '|' + opts.message; |
|
|