From 31eccee3c26fc455853ee50c29c1cda555128ea9 Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Fri, 2 Sep 2016 13:26:54 -0400 Subject: [PATCH] fix(Trade): expose txHash property, only trigger watch after trade has been updated (#264) --- src/coinify/trade.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/coinify/trade.js b/src/coinify/trade.js index 7f367910f..30ce8b02f 100644 --- a/src/coinify/trade.js +++ b/src/coinify/trade.js @@ -120,6 +120,10 @@ Object.defineProperties(CoinifyTrade.prototype, { return this.outCurrency === 'BTC'; } } + }, + 'txHash': { + configurable: false, + get: function () { return this._txHash || null; } } }); @@ -333,11 +337,13 @@ CoinifyTrade.prototype._monitorAddress = function () { }; var tradeWasPaid = function (amount) { - self._watchAddressResolve && self._watchAddressResolve(amount); - + var resolve = function () { + self._watchAddressResolve && self._watchAddressResolve(amount); + }; self.refresh() .then(CoinifyTrade._getTransactionHash) - .then(saveTrade); + .then(saveTrade) + .then(resolve); }; self._coinify.delegate.monitorAddress(self.receiveAddress, function (amount) {