|
|
@ -1867,12 +1867,13 @@ WalletService.prototype._validateAndSanitizeTxOpts = function(wallet, opts, cb) |
|
|
|
* @param {number} opts.outputs[].amount - Amount to transfer in satoshi. |
|
|
|
* @param {string} opts.outputs[].message - A message to attach to this output. |
|
|
|
* @param {string} opts.message - A message to attach to this transaction. |
|
|
|
* @param {string} opts.feePerKb - Use an alternative fee per KB for this TX. |
|
|
|
* @param {string} opts.sendMax - Optional. Send maximum amount of funds that make sense under the specified fee/feePerKb conditions. (defaults to false). |
|
|
|
* @param {number} opts.feePerKb - Use an alternative fee per KB for this TX. |
|
|
|
* @param {string} opts.changeAddress - Optional. Use this address as the change address for the tx. The address should belong to the wallet. |
|
|
|
* @param {Boolean} opts.sendMax - Optional. Send maximum amount of funds that make sense under the specified fee/feePerKb conditions. (defaults to false). |
|
|
|
* @param {string} opts.payProUrl - Optional. Paypro URL for peers to verify TX |
|
|
|
* @param {string} opts.excludeUnconfirmedUtxos[=false] - Optional. Do not use UTXOs of unconfirmed transactions as inputs |
|
|
|
* @param {string} opts.validateOutputs[=true] - Optional. Perform validation on outputs. |
|
|
|
* @param {string} opts.dryRun[=false] - Optional. Simulate the action but do not change server state. |
|
|
|
* @param {Boolean} opts.excludeUnconfirmedUtxos[=false] - Optional. Do not use UTXOs of unconfirmed transactions as inputs |
|
|
|
* @param {Boolean} opts.validateOutputs[=true] - Optional. Perform validation on outputs. |
|
|
|
* @param {Boolean} opts.dryRun[=false] - Optional. Simulate the action but do not change server state. |
|
|
|
* @param {Array} opts.inputs - Optional. Inputs for this TX |
|
|
|
* @param {number} opts.fee - Optional. Use an fixed fee for this TX (only when opts.inputs is specified) |
|
|
|
* @param {Boolean} opts.noShuffleOutputs - Optional. If set, TX outputs won't be shuffled. Defaults to false |
|
|
@ -1905,9 +1906,19 @@ WalletService.prototype.createTx = function(opts, cb) { |
|
|
|
}); |
|
|
|
}, |
|
|
|
function(next) { |
|
|
|
if (!opts.sendMax) { |
|
|
|
if (opts.sendMax) return next(); |
|
|
|
if (opts.changeAddress) { |
|
|
|
self.storage.fetchAddress(opts.changeAddress, function(err, address) { |
|
|
|
if (err) return next(Errors.INVALID_CHANGE_ADDRESS); |
|
|
|
changeAddress = address; |
|
|
|
return next(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
changeAddress = wallet.createAddress(true); |
|
|
|
return next(); |
|
|
|
} |
|
|
|
}, |
|
|
|
function(next) { |
|
|
|
var txOpts = { |
|
|
|
walletId: self.walletId, |
|
|
|
creatorId: self.copayerId, |
|
|
|