aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-08-23 06:03:36 +0800
committerDan Finlay <dan@danfinlay.com>2016-08-23 06:03:36 +0800
commit6e1000f361afcf259beb587d777f3025fcde7667 (patch)
tree758ddcf89896b8c7976347e9e2c97226378e05a6 /app/scripts/lib
parent270dbacbc472dae660fe8b143df9c64b7f8279cf (diff)
parent3756384da6cb7d1566271cb99ec561d3b051a4ac (diff)
downloadtangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.tar
tangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.tar.gz
tangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.tar.bz2
tangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.tar.lz
tangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.tar.xz
tangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.tar.zst
tangerine-wallet-browser-6e1000f361afcf259beb587d777f3025fcde7667.zip
Merge branch 'master' into PopupNotifications
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/config-manager.js35
-rw-r--r--app/scripts/lib/idStore.js1
2 files changed, 36 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)
+}
+
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 3272f2d1a..7ac71e409 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -100,6 +100,7 @@ IdentityStore.prototype.getState = function () {
unconfMsgs: messageManager.unconfirmedMsgs(),
messages: messageManager.getMsgList(),
selectedAddress: configManager.getSelectedAccount(),
+ shapeShiftTxList: configManager.getShapeShiftTxList(),
currentFiat: configManager.getCurrentFiat(),
conversionRate: configManager.getConversionRate(),
conversionDate: configManager.getConversionDate(),