|
|
@ -88,7 +88,8 @@ CopayServer.prototype.createWallet = function(opts, cb) { |
|
|
|
var self = this, |
|
|
|
pubKey; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['name', 'm', 'n', 'pubKey'])) return cb(new ClientError('Required argument missing')); |
|
|
|
if (!Utils.checkRequired(opts, ['name', 'm', 'n', 'pubKey'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
if (_.isEmpty(opts.name)) return cb(new ClientError('Invalid wallet name')); |
|
|
|
if (!Wallet.verifyCopayerLimits(opts.m, opts.n)) |
|
|
@ -154,7 +155,8 @@ CopayServer.prototype._verifySignature = function(text, signature, pubKey) { |
|
|
|
CopayServer.prototype.joinWallet = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['walletId', 'name', 'xPubKey', 'xPubKeySignature'])) return cb(new ClientError('Required argument missing')); |
|
|
|
if (!Utils.checkRequired(opts, ['walletId', 'name', 'xPubKey', 'xPubKeySignature'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
if (_.isEmpty(opts.name)) return cb(new ClientError('Invalid copayer name')); |
|
|
|
|
|
|
@ -236,7 +238,8 @@ CopayServer.prototype.getAddresses = function(opts, cb) { |
|
|
|
CopayServer.prototype.verifyMessageSignature = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['message', 'signature'])) return cb(new ClientError('Required argument missing')); |
|
|
|
if (!Utils.checkRequired(opts, ['message', 'signature'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
self.getWallet({}, function(err, wallet) { |
|
|
|
if (err) return cb(err); |
|
|
@ -389,7 +392,8 @@ CopayServer.prototype._selectUtxos = function(txp, utxos) { |
|
|
|
CopayServer.prototype.createTx = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['toAddress', 'amount'])) return cb(new ClientError('Required argument missing')); |
|
|
|
if (!Utils.checkRequired(opts, ['toAddress', 'amount'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
Utils.runLocked(self.walletId, cb, function(cb) { |
|
|
|
self.getWallet({}, function(err, wallet) { |
|
|
@ -536,7 +540,8 @@ CopayServer.prototype._broadcastTx = function(txp, cb) { |
|
|
|
CopayServer.prototype.signTx = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['txProposalId', 'signatures'])) return cb(new ClientError('Required argument missing')); |
|
|
|
if (!Utils.checkRequired(opts, ['txProposalId', 'signatures'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
self.getWallet({}, function(err, wallet) { |
|
|
|
if (err) return cb(err); |
|
|
@ -592,7 +597,8 @@ CopayServer.prototype.signTx = function(opts, cb) { |
|
|
|
CopayServer.prototype.rejectTx = function(opts, cb) { |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (!Utils.checkRequired(opts, ['txProposalId'])) return cb(new ClientError('Required argument missing')); |
|
|
|
if (!Utils.checkRequired(opts, ['txProposalId'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
self.getTx({ |
|
|
|
id: opts.txProposalId |
|
|
|