diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-08-23 02:59:08 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-08-23 02:59:08 +0800 |
commit | 3d451ddf3e59e8d4ac610b7e6a01a59beed4f944 (patch) | |
tree | 93193c3014065d00fc14d2efcdca8a11c63e2e4a /app | |
parent | 8592ffd85582612ae18b5f4e5ed6749401f86f3b (diff) | |
parent | 3756384da6cb7d1566271cb99ec561d3b051a4ac (diff) | |
download | tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.tar tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.tar.gz tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.tar.bz2 tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.tar.lz tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.tar.xz tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.tar.zst tangerine-wallet-browser-3d451ddf3e59e8d4ac610b7e6a01a59beed4f944.zip |
Merge branch 'master' into i390-TransactionLimit
Diffstat (limited to 'app')
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/lib/config-manager.js | 35 | ||||
-rw-r--r-- | app/scripts/lib/idStore.js | 1 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 5 |
4 files changed, 42 insertions, 1 deletions
diff --git a/app/manifest.json b/app/manifest.json index a4953542e..09bc9eb37 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "MetaMask", "short_name": "Metamask", - "version": "2.8.0", + "version": "2.9.0", "manifest_version": 2, "description": "Ethereum Browser Extension", "icons": { diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 2ecdbb0c7..4d270bcdb 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -338,3 +338,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(), diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index d21eb5fc1..218f1f72a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -64,6 +64,8 @@ module.exports = class MetamaskController { recoverSeed: idStore.recoverSeed.bind(idStore), // coinbase buyEth: this.buyEth.bind(this), + // shapeshift + createShapeShiftTx: this.createShapeShiftTx.bind(this), } } @@ -317,6 +319,9 @@ module.exports = class MetamaskController { }) } + createShapeShiftTx (depositAddress, depositType) { + this.configManager.createShapeShiftTx(depositAddress, depositType) + } } function noop () {} |