|
|
@ -423,11 +423,28 @@ WalletService.prototype.joinWallet = function(opts, cb) { |
|
|
|
self.storage.storeWalletAndUpdateCopayersLookup(wallet, function(err) { |
|
|
|
if (err) return cb(err); |
|
|
|
|
|
|
|
self._notify('NewCopayer', { |
|
|
|
walletId: opts.walletId, |
|
|
|
copayerId: copayer.id, |
|
|
|
copayerName: copayer.name, |
|
|
|
}, function() { |
|
|
|
|
|
|
|
async.series([ |
|
|
|
|
|
|
|
function(next) { |
|
|
|
self._notify('NewCopayer', { |
|
|
|
walletId: opts.walletId, |
|
|
|
copayerId: copayer.id, |
|
|
|
copayerName: copayer.name, |
|
|
|
}, next); |
|
|
|
}, |
|
|
|
function(next) { |
|
|
|
if (wallet.isComplete() && wallet.isShared()) { |
|
|
|
self._notify('WalletComplete', { |
|
|
|
walletId: opts.walletId, |
|
|
|
}, { |
|
|
|
isGlobal: true |
|
|
|
}, next); |
|
|
|
} else { |
|
|
|
next(); |
|
|
|
} |
|
|
|
}, |
|
|
|
], function() { |
|
|
|
return cb(null, { |
|
|
|
copayerId: copayer.id, |
|
|
|
wallet: wallet |
|
|
@ -934,21 +951,21 @@ WalletService.prototype.signTx = function(opts, cb) { |
|
|
|
self.storage.storeTx(self.walletId, txp, function(err) { |
|
|
|
if (err) return cb(err); |
|
|
|
|
|
|
|
async.parallel([ |
|
|
|
async.series([ |
|
|
|
|
|
|
|
function(done) { |
|
|
|
function(next) { |
|
|
|
self._notify('TxProposalAcceptedBy', { |
|
|
|
txProposalId: opts.txProposalId, |
|
|
|
copayerId: self.copayerId, |
|
|
|
}, done); |
|
|
|
}, next); |
|
|
|
}, |
|
|
|
function(done) { |
|
|
|
function(next) { |
|
|
|
if (txp.isAccepted()) { |
|
|
|
self._notify('TxProposalFinallyAccepted', { |
|
|
|
txProposalId: opts.txProposalId, |
|
|
|
}, done); |
|
|
|
}, next); |
|
|
|
} else { |
|
|
|
done(); |
|
|
|
next(); |
|
|
|
} |
|
|
|
}, |
|
|
|
], function() { |
|
|
@ -1035,21 +1052,21 @@ WalletService.prototype.rejectTx = function(opts, cb) { |
|
|
|
self.storage.storeTx(self.walletId, txp, function(err) { |
|
|
|
if (err) return cb(err); |
|
|
|
|
|
|
|
async.parallel([ |
|
|
|
async.series([ |
|
|
|
|
|
|
|
function(done) { |
|
|
|
function(next) { |
|
|
|
self._notify('TxProposalRejectedBy', { |
|
|
|
txProposalId: opts.txProposalId, |
|
|
|
copayerId: self.copayerId, |
|
|
|
}, done); |
|
|
|
}, next); |
|
|
|
}, |
|
|
|
function(done) { |
|
|
|
function(next) { |
|
|
|
if (txp.status == 'rejected') { |
|
|
|
self._notify('TxProposalFinallyRejected', { |
|
|
|
txProposalId: opts.txProposalId, |
|
|
|
}, done); |
|
|
|
}, next); |
|
|
|
} else { |
|
|
|
done(); |
|
|
|
next(); |
|
|
|
} |
|
|
|
}, |
|
|
|
], function() { |
|
|
|