commit
59e5fc1883
|
@ -24,6 +24,7 @@ TxProposal.create = function(opts) {
|
||||||
x.toAddress = opts.toAddress;
|
x.toAddress = opts.toAddress;
|
||||||
x.amount = opts.amount;
|
x.amount = opts.amount;
|
||||||
x.message = opts.message;
|
x.message = opts.message;
|
||||||
|
x.payProUrl = opts.payProUrl;
|
||||||
x.proposalSignature = opts.proposalSignature;
|
x.proposalSignature = opts.proposalSignature;
|
||||||
x.changeAddress = opts.changeAddress;
|
x.changeAddress = opts.changeAddress;
|
||||||
x.inputs = [];
|
x.inputs = [];
|
||||||
|
@ -48,6 +49,7 @@ TxProposal.fromObj = function(obj) {
|
||||||
x.toAddress = obj.toAddress;
|
x.toAddress = obj.toAddress;
|
||||||
x.amount = obj.amount;
|
x.amount = obj.amount;
|
||||||
x.message = obj.message;
|
x.message = obj.message;
|
||||||
|
x.payProUrl = obj.payProUrl;
|
||||||
x.proposalSignature = obj.proposalSignature;
|
x.proposalSignature = obj.proposalSignature;
|
||||||
x.changeAddress = obj.changeAddress;
|
x.changeAddress = obj.changeAddress;
|
||||||
x.inputs = obj.inputs;
|
x.inputs = obj.inputs;
|
||||||
|
|
|
@ -351,13 +351,13 @@ WalletService.prototype._getBlockExplorer = function(provider, network) {
|
||||||
return this.blockExplorer;
|
return this.blockExplorer;
|
||||||
|
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
default:
|
default:;
|
||||||
case 'insight':
|
case 'insight':
|
||||||
switch (network) {
|
switch (network) {
|
||||||
default:
|
default:
|
||||||
case 'livenet':
|
case 'livenet':
|
||||||
url = 'https://insight.bitpay.com:443';
|
url = 'https://insight.bitpay.com:443';
|
||||||
break;
|
break;
|
||||||
case 'testnet':
|
case 'testnet':
|
||||||
url = 'https://test-insight.bitpay.com:443'
|
url = 'https://test-insight.bitpay.com:443'
|
||||||
break;
|
break;
|
||||||
|
@ -535,14 +535,14 @@ WalletService.prototype._selectTxInputs = function(txp, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new transaction proposal.
|
* Creates a new transaction proposal.
|
||||||
* @param {Object} opts
|
* @param {Object} opts
|
||||||
* @param {string} opts.toAddress - Destination address.
|
* @param {string} opts.toAddress - Destination address.
|
||||||
* @param {number} opts.amount - Amount to transfer in satoshi.
|
* @param {number} opts.amount - Amount to transfer in satoshi.
|
||||||
* @param {string} opts.message - A message to attach to this transaction.
|
* @param {string} opts.message - A message to attach to this transaction.
|
||||||
* @param {string} opts.proposalSignature - S(toAddress|amount|message). Used by other copayers to verify the proposal.
|
* @param {string} opts.proposalSignature - S(toAddress|amount|message|payProUrl). Used by other copayers to verify the proposal.
|
||||||
|
* @param {string} opts.payProUrl - Options: Paypro URL for peers to verify TX
|
||||||
* @returns {TxProposal} Transaction proposal.
|
* @returns {TxProposal} Transaction proposal.
|
||||||
*/
|
*/
|
||||||
WalletService.prototype.createTx = function(opts, cb) {
|
WalletService.prototype.createTx = function(opts, cb) {
|
||||||
|
@ -557,7 +557,7 @@ WalletService.prototype.createTx = function(opts, cb) {
|
||||||
if (!wallet.isComplete()) return cb(new ClientError('Wallet is not complete'));
|
if (!wallet.isComplete()) return cb(new ClientError('Wallet is not complete'));
|
||||||
|
|
||||||
var copayer = wallet.getCopayer(self.copayerId);
|
var copayer = wallet.getCopayer(self.copayerId);
|
||||||
var hash = WalletUtils.getProposalHash(opts.toAddress, opts.amount, opts.message);
|
var hash = WalletUtils.getProposalHash(opts.toAddress, opts.amount, opts.message, opts.payProUrl);
|
||||||
if (!self._verifySignature(hash, opts.proposalSignature, copayer.requestPubKey))
|
if (!self._verifySignature(hash, opts.proposalSignature, copayer.requestPubKey))
|
||||||
return cb(new ClientError('Invalid proposal signature'));
|
return cb(new ClientError('Invalid proposal signature'));
|
||||||
|
|
||||||
|
@ -585,6 +585,7 @@ WalletService.prototype.createTx = function(opts, cb) {
|
||||||
amount: opts.amount,
|
amount: opts.amount,
|
||||||
message: opts.message,
|
message: opts.message,
|
||||||
proposalSignature: opts.proposalSignature,
|
proposalSignature: opts.proposalSignature,
|
||||||
|
payProUrl: opts.payProUrl,
|
||||||
changeAddress: changeAddress,
|
changeAddress: changeAddress,
|
||||||
requiredSignatures: wallet.m,
|
requiredSignatures: wallet.m,
|
||||||
requiredRejections: Math.min(wallet.m, wallet.n - wallet.m + 1),
|
requiredRejections: Math.min(wallet.m, wallet.n - wallet.m + 1),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "bitcore-wallet-service",
|
"name": "bitcore-wallet-service",
|
||||||
"description": "A service for Mutisig HD Bitcoin Wallets",
|
"description": "A service for Mutisig HD Bitcoin Wallets",
|
||||||
"author": "BitPay Inc",
|
"author": "BitPay Inc",
|
||||||
"version": "0.0.14",
|
"version": "0.0.15",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bitcoin",
|
"bitcoin",
|
||||||
"copay",
|
"copay",
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^0.9.0",
|
"async": "^0.9.0",
|
||||||
"bitcore-wallet-utils": "^0.0.6",
|
"bitcore-wallet-utils": "^0.0.7",
|
||||||
"bitcore-explorers": "^0.9.1",
|
"bitcore-explorers": "^0.9.1",
|
||||||
"body-parser": "^1.11.0",
|
"body-parser": "^1.11.0",
|
||||||
"coveralls": "^2.11.2",
|
"coveralls": "^2.11.2",
|
||||||
|
|
Loading…
Reference in New Issue