|
@ -1348,7 +1348,6 @@ WalletService.prototype.createTx = function(opts, cb) { |
|
|
/** |
|
|
/** |
|
|
* Creates a new transaction proposal. |
|
|
* Creates a new transaction proposal. |
|
|
* @param {Object} opts |
|
|
* @param {Object} opts |
|
|
* @param {string} opts.type - Proposal type. |
|
|
|
|
|
* @param {Array} opts.outputs - List of outputs. |
|
|
* @param {Array} opts.outputs - List of outputs. |
|
|
* @param {string} opts.outputs[].toAddress - Destination address. |
|
|
* @param {string} opts.outputs[].toAddress - Destination address. |
|
|
* @param {number} opts.outputs[].amount - Amount to transfer in satoshi. |
|
|
* @param {number} opts.outputs[].amount - Amount to transfer in satoshi. |
|
@ -1426,6 +1425,34 @@ WalletService.prototype.createTx2 = function(opts, cb) { |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Send an already created tx proposal to other copayers in the wallet. |
|
|
|
|
|
* @param {Object} opts |
|
|
|
|
|
* @param {string} opts.txProposalId - The tx id. |
|
|
|
|
|
* @param {string} opts.proposalSignature - S(raw tx). Used by other copayers to verify the proposal. |
|
|
|
|
|
* @param {string} opts.proposalSignaturePubKey - The public key needed to verify the proposal signature. |
|
|
|
|
|
* @param {string} opts.proposalSignaturePubKeySig - A signature of the public key used to validate that the public key belongs to the creator. |
|
|
|
|
|
*/ |
|
|
|
|
|
WalletService.prototype.sendTx = function(opts, cb) { |
|
|
|
|
|
var self = this; |
|
|
|
|
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['txProposalId', 'proposalSignature', 'proposalSignaturePubKey', 'proposalSignaturePubKeySig'])) |
|
|
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
|
|
|
|
self._runLocked(cb, function(cb) { |
|
|
|
|
|
self.storage.fetchTx(self.walletId, opts.txProposalId, function(err, txp) { |
|
|
|
|
|
if (err) return cb(err); |
|
|
|
|
|
if (!txp) return cb(Errors.TX_NOT_FOUND); |
|
|
|
|
|
if (!txp.isTemporary()) return cb(); |
|
|
|
|
|
|
|
|
|
|
|
txp.status = 'pending'; |
|
|
|
|
|
self.storage.storeTx(self.walletId, txp, function(err) { |
|
|
|
|
|
if (err) return cb(err); |
|
|
|
|
|
return cb(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Retrieves a tx from storage. |
|
|
* Retrieves a tx from storage. |
|
|