diff options
Diffstat (limited to 'app/scripts/lib/config-manager.js')
-rw-r--r-- | app/scripts/lib/config-manager.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index c56f52e48..6f5cb3a4a 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -332,3 +332,38 @@ ConfigManager.prototype.getShouldntShowWarning = function () { var data = this.getData() return ('isEthConfirmed' in data) && data.isEthConfirmed } + +ConfigManager.prototype.getShapeShiftTxList = function () { + var data = this.getData() + var shapeShiftTxList = data.shapeShiftTxList ? data.shapeShiftTxList : [] + shapeShiftTxList.forEach((tx) => { + if (tx.response.status !== 'complete') { + var requestListner = function (request) { + tx.response = JSON.parse(this.responseText) + if (tx.response.status === 'complete') { + tx.time = new Date().getTime() + } + } + + var shapShiftReq = new XMLHttpRequest() + shapShiftReq.addEventListener('load', requestListner) + shapShiftReq.open('GET', `https://shapeshift.io/txStat/${tx.depositAddress}`, true) + shapShiftReq.send() + } + }) + this.setData(data) + return shapeShiftTxList +} + +ConfigManager.prototype.createShapeShiftTx = function (depositAddress, depositType) { + var data = this.getData() + + var shapeShiftTx = {depositAddress, depositType, key: 'shapeshift', time: new Date().getTime(), response: {}} + if (!data.shapeShiftTxList) { + data.shapeShiftTxList = [shapeShiftTx] + } else { + data.shapeShiftTxList.push(shapeShiftTx) + } + this.setData(data) +} + |