diff options
Diffstat (limited to 'app')
29 files changed, 68 insertions, 107 deletions
diff --git a/app/_locales/cs/messages.json b/app/_locales/cs/messages.json index a28c4cb4a..187ffd95f 100644 --- a/app/_locales/cs/messages.json +++ b/app/_locales/cs/messages.json @@ -252,10 +252,6 @@ "depositBTC": { "message": "Vložte BTC na níže uvedenou adresu:" }, - "depositCoin": { - "message": "Vložte $1 na níže uvedenou adresu", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "Vložit Eth" }, diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index b76f87772..98a8bf972 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -249,10 +249,6 @@ "depositBTC": { "message": "Zahle dein BTC in die unten stehende Adresse ein:" }, - "depositCoin": { - "message": "Zahle deine $1 in die unten stehende Adresse ein", - "description": "Teilt dem Benutzer mit welchen Token er beim Einzahlen mit Shapeshift ausgewählt hat" - }, "depositEth": { "message": "Eth kaufen" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 774ae4c85..cc087867a 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -466,10 +466,6 @@ "depositBTC": { "message": "Deposit your BTC to the address below:" }, - "depositCoin": { - "message": "Deposit your $1 to the address below", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "Deposit Eth" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 3bdbfa852..06531b1dc 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -264,10 +264,6 @@ "depositBTC": { "message": "Deposita tus BTC a la dirección de abajo:" }, - "depositCoin": { - "message": "Deposita tu $1 a la dirección de abajo", - "description": "Informa al usuario que moneda ha elegido para depositar en shapeshift" - }, "depositEth": { "message": "Depositar Ether" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index d2ba10009..70effb3ea 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -330,10 +330,6 @@ "depositBTC": { "message": "Déposez vos BTC à l'adresse ci-dessous:" }, - "depositCoin": { - "message": "Déposer votre $1 à l'adresse ci-dessous", - "description": "Indique à l'utilisateur quelle monnaie il a choisi de déposer avec Shapeshift" - }, "depositEth": { "message": "Déposer Eth" }, diff --git a/app/_locales/hn/messages.json b/app/_locales/hn/messages.json index 6c27ee1bc..54ddcc02b 100644 --- a/app/_locales/hn/messages.json +++ b/app/_locales/hn/messages.json @@ -240,10 +240,6 @@ "depositBTC": { "message": "नीचे दिए गए पते पर अपना बीटीसी जमा करें:" }, - "depositCoin": { - "message": "नीचे दिए गए पते पर अपना $1 जमा करें", - "description": "उपयोगकर्ता को बताता है कि उन्होंने सिक्का के साथ जमा करने के लिए किस सिक्का का चयन किया है" - }, "depositEth": { "message": "Eth जमाआर्थ" }, diff --git a/app/_locales/ht/messages.json b/app/_locales/ht/messages.json index 4a4c92f3a..720c35889 100644 --- a/app/_locales/ht/messages.json +++ b/app/_locales/ht/messages.json @@ -336,10 +336,6 @@ "depositBTC": { "message": "Depoze BTC ou nan adrès ki anba a:" }, - "depositCoin": { - "message": "Depoze $1 ou nan adrès ki anba a", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "Depo Eth" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index 09ba045b9..c79f22b71 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -463,10 +463,6 @@ "depositBTC": { "message": "Deposita i tuoi BTC all'indirizzo sotto:" }, - "depositCoin": { - "message": "Deposita $1 all'indirizzo sotto", - "description": "Dice all'utente quale moneta ha selezionato per depositare con Shapeshift" - }, "depositEth": { "message": "Deposita Eth" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index fcac67894..49b033997 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -228,10 +228,6 @@ "depositBTC": { "message": "BTCを下記のアドレスへ振込んでください:" }, - "depositCoin": { - "message": "$1を下記のアドレスへ振込んでください", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "ETHを入金" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index bf11640e2..541d9dd5c 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -402,10 +402,6 @@ "depositBTC": { "message": "다음 주소로 BTC를 입금해주세요." }, - "depositCoin": { - "message": "다음 주소로 $1 만큼 입금해주세요.", - "description": "사용자에게 shapeshift에서 어떤 코인을 선택해 입금했는지 알려줍니다" - }, "depositEth": { "message": "이더 입금하기" }, diff --git a/app/_locales/nl/messages.json b/app/_locales/nl/messages.json index 12bde6585..ade7327de 100644 --- a/app/_locales/nl/messages.json +++ b/app/_locales/nl/messages.json @@ -240,10 +240,6 @@ "depositBTC": { "message": "Stort uw BTC op het onderstaande adres:" }, - "depositCoin": { - "message": "Stort uw $1 op het onderstaande adres", - "description": "Laat de gebruiker weten welk muntje ze hebben geselecteerd om te deponeren met shapeshift" - }, "depositEth": { "message": "Aanbetaling Eth" }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index da3cf266d..c8cde27f6 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -201,10 +201,6 @@ "depositBTC": { "message": "I-deposito ang iyong BTC sa address na ito:" }, - "depositCoin": { - "message": "I-deposito ang iyong $1 sa address na ito", - "description": "Sinasabihan ang user kung ano ang coin na kanilang pinili para I-deposito gamit ang shapeshift" - }, "depositEth": { "message": "I-deposito ang Eth" }, diff --git a/app/_locales/pl/messages.json b/app/_locales/pl/messages.json index 026f4b3ec..868ab0cae 100644 --- a/app/_locales/pl/messages.json +++ b/app/_locales/pl/messages.json @@ -249,10 +249,6 @@ "depositBTC": { "message": "Zdeponuj swoje BTC na poniższy adres:" }, - "depositCoin": { - "message": "Zdeponuj $1 na poniższy adres", - "description": "Pokazuje użytkownikowi jakie waluty wybrał do zdeponowania w ShapeShift" - }, "depositEth": { "message": "Zdeponuj Eth" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index e51b1f72e..5724bce88 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -240,10 +240,6 @@ "depositBTC": { "message": "Deposite as suas BTC no endereço abaixo:" }, - "depositCoin": { - "message": "Deposite $1 no endereço abaixo", - "description": "Diz ao usuário que moeda selecionou para depositar com shapeshift" - }, "depositEth": { "message": "Depositar Eth" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index f80efcc56..e56441186 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -252,10 +252,6 @@ "depositBTC": { "message": "Отправьте ваш BTC на адрес ниже:" }, - "depositCoin": { - "message": "Отправьте ваш $1 на адрес ниже", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "Пополнить Eth" }, diff --git a/app/_locales/sk/messages.json b/app/_locales/sk/messages.json index febcc9141..f98de674b 100644 --- a/app/_locales/sk/messages.json +++ b/app/_locales/sk/messages.json @@ -243,10 +243,6 @@ "depositBTC": { "message": "Vložte BTC na níže uvedenou adresu:" }, - "depositCoin": { - "message": "Vložte $1 na níže uvedenou adresu", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "Vložit Eth" }, diff --git a/app/_locales/sl/messages.json b/app/_locales/sl/messages.json index 2f3616dee..d04ba1ee7 100644 --- a/app/_locales/sl/messages.json +++ b/app/_locales/sl/messages.json @@ -408,10 +408,6 @@ "depositBTC": { "message": "Vplačajte vaš BTC na spodnji naslov:" }, - "depositCoin": { - "message": "Vplačajte vaš $1 na spodnji naslov", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "Vplačilo ETH" }, diff --git a/app/_locales/th/messages.json b/app/_locales/th/messages.json index d851d325f..a49cf31ad 100644 --- a/app/_locales/th/messages.json +++ b/app/_locales/th/messages.json @@ -240,10 +240,6 @@ "depositBTC": { "message": "ฝากบิตคอยน์ของคุณไปที่แอดเดรสด้านล่างนี้:" }, - "depositCoin": { - "message": "ฝาก $1 ของคุณไปที่แอดเดรสด้านล่างนี้:", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "การฝากอีเธอร์" }, diff --git a/app/_locales/tml/messages.json b/app/_locales/tml/messages.json index e1ef45138..2f883b26b 100644 --- a/app/_locales/tml/messages.json +++ b/app/_locales/tml/messages.json @@ -252,10 +252,6 @@ "depositBTC": { "message": "கீழே உங்கள் முகவரிக்கு உங்கள் BTC வைப்போம்:" }, - "depositCoin": { - "message": "உங்கள் முகவரிக்கு $ 1 ஐ கீழே உள்ளிடவும்", - "description": "சேபஷிபிட் உடன் வைப்புக்குத் தேர்ந்தெடுக்கப்பட்ட நாணயத்தை பயனரிடம் கூறுகிறார்" - }, "depositEth": { "message": "வைப்புத்தொகை எது " }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index bcf96dece..726024764 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -252,10 +252,6 @@ "depositBTC": { "message": "BTC'inizi aşağıdaki adrese yatırın:" }, - "depositCoin": { - "message": "$1'nızı aşağıdaki adrese yatırın", - "description": "Kullanıcıya hangi jetonu seçtiyse onu yatırmasını shapeshift ile söyler." - }, "depositEth": { "message": "Eth yatır" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 857f78597..aee6474b6 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -201,10 +201,6 @@ "depositBTC": { "message": "Ký gửi BTC đến địa chỉ sau:" }, - "depositCoin": { - "description": "Báo cho người dùng biết đồng tiền nào họ đã chọn để ký gửi với ShapeShift", - "message": "Ký gửi $1 đến địa chỉ sau:" - }, "depositEth": { "message": "Ký gửi Eth" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 0d3727703..d14b99acb 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -261,10 +261,6 @@ "depositBTC": { "message": "将你的 BTC 存入到下面的地址:" }, - "depositCoin": { - "message": "将你的 $1 存入到下面的地址", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "存入 Eth" }, diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json index 4df95f72f..18e30188e 100644 --- a/app/_locales/zh_TW/messages.json +++ b/app/_locales/zh_TW/messages.json @@ -378,10 +378,6 @@ "depositBTC": { "message": "將您的 BTC 存入到下面的位址:" }, - "depositCoin": { - "message": "將您的 $1 存入到下面的位址", - "description": "Tells the user what coin they have selected to deposit with shapeshift" - }, "depositEth": { "message": "存入乙太幣" }, diff --git a/app/images/spinner.gif b/app/images/spinner.gif Binary files differnew file mode 100644 index 000000000..8891f9596 --- /dev/null +++ b/app/images/spinner.gif diff --git a/app/manifest.json b/app/manifest.json index d09407373..8639577bb 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "6.7.1", + "version": "6.7.2", "manifest_version": 2, "author": "https://metamask.io", "description": "__MSG_appDescription__", diff --git a/app/notification.html b/app/notification.html index 042ffa6b8..82bf95ada 100644 --- a/app/notification.html +++ b/app/notification.html @@ -1,16 +1,39 @@ <!doctype html> <html style="height:600px;"> <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="utf-8"> <title>MetaMask Notification</title> <style> body { overflow: hidden; } + + #app-content { + display: flex; + flex-flow: column; + } + + #loading__logo { + width: 10rem; + height: 10rem; + align-self: center; + margin: 10rem 0 0 0; + } + + #loading__spinner { + width: 2rem; + height: 2rem; + align-self: center; + margin-top: 1rem; + } </style> </head> <body class="notification" style="height:600px;"> - <div id="app-content"></div> + <div id="app-content"> + <img id="loading__logo" src="./images/logo/metamask-fox.svg" /> + <img id="loading__spinner" src="./images/spinner.gif" /> + </div> <script src="./libs.js" type="text/javascript" charset="utf-8"></script> <script src="./ui.js" type="text/javascript" charset="utf-8"></script> </body> diff --git a/app/scripts/controllers/network/createLocalhostClient.js b/app/scripts/controllers/network/createLocalhostClient.js index 09b1d3c1c..3a435e5d0 100644 --- a/app/scripts/controllers/network/createLocalhostClient.js +++ b/app/scripts/controllers/network/createLocalhostClient.js @@ -2,9 +2,12 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware') const createFetchMiddleware = require('eth-json-rpc-middleware/fetch') const createBlockRefRewriteMiddleware = require('eth-json-rpc-middleware/block-ref-rewrite') const createBlockTrackerInspectorMiddleware = require('eth-json-rpc-middleware/block-tracker-inspector') +const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware') const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware') const BlockTracker = require('eth-block-tracker') +const inTest = process.env.IN_TEST === 'true' + module.exports = createLocalhostClient function createLocalhostClient () { @@ -13,9 +16,24 @@ function createLocalhostClient () { const blockTracker = new BlockTracker({ provider: blockProvider, pollingInterval: 1000 }) const networkMiddleware = mergeMiddleware([ + createEstimateGasMiddleware(), createBlockRefRewriteMiddleware({ blockTracker }), createBlockTrackerInspectorMiddleware({ blockTracker }), fetchMiddleware, ]) return { networkMiddleware, blockTracker } } + +function delay (time) { + return new Promise(resolve => setTimeout(resolve, time)) +} + + +function createEstimateGasMiddleware () { + return createAsyncMiddleware(async (req, _, next) => { + if (req.method === 'eth_estimateGas' && inTest) { + await delay(2000) + } + return next() + }) +} diff --git a/app/scripts/controllers/transactions/lib/util.js b/app/scripts/controllers/transactions/lib/util.js index 84f7592a0..5a8a0cefe 100644 --- a/app/scripts/controllers/transactions/lib/util.js +++ b/app/scripts/controllers/transactions/lib/util.js @@ -17,8 +17,8 @@ module.exports = { // functions that handle normalizing of that key in txParams const normalizers = { - from: from => addHexPrefix(from).toLowerCase(), - to: to => addHexPrefix(to).toLowerCase(), + from: (from, LowerCase = true) => LowerCase ? addHexPrefix(from).toLowerCase() : addHexPrefix(from), + to: (to, LowerCase = true) => LowerCase ? addHexPrefix(to).toLowerCase() : addHexPrefix(to), nonce: nonce => addHexPrefix(nonce), value: value => addHexPrefix(value), data: data => addHexPrefix(data), @@ -31,11 +31,11 @@ const normalizers = { @param txParams {object} @returns {object} normalized txParams */ -function normalizeTxParams (txParams) { +function normalizeTxParams (txParams, LowerCase) { // apply only keys in the normalizers const normalizedTxParams = {} for (const key in normalizers) { - if (txParams[key]) normalizedTxParams[key] = normalizers[key](txParams[key]) + if (txParams[key]) normalizedTxParams[key] = normalizers[key](txParams[key], LowerCase) } return normalizedTxParams } diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index 1a2cb5dee..2aa28c270 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -1,11 +1,10 @@ const extend = require('xtend') const EventEmitter = require('safe-event-emitter') const ObservableStore = require('obs-store') -const ethUtil = require('ethereumjs-util') const log = require('loglevel') const txStateHistoryHelper = require('./lib/tx-state-history-helper') const createId = require('../../lib/random-id') -const { getFinalStates } = require('./lib/util') +const { getFinalStates, normalizeTxParams } = require('./lib/util') /** TransactionStateManager is responsible for the state of a transaction and storing the transaction @@ -126,6 +125,11 @@ class TransactionStateManager extends EventEmitter { @returns {object} the txMeta */ addTx (txMeta) { + // normalize and validate txParams if present + if (txMeta.txParams) { + txMeta.txParams = this.normalizeAndValidateTxParams(txMeta.txParams) + } + this.once(`${txMeta.id}:signed`, function () { this.removeAllListeners(`${txMeta.id}:rejected`) }) @@ -175,13 +179,9 @@ class TransactionStateManager extends EventEmitter { @param [note] {string} - a note about the update for history */ updateTx (txMeta, note) { - // validate txParams + // normalize and validate txParams if present if (txMeta.txParams) { - if (typeof txMeta.txParams.data === 'undefined') { - delete txMeta.txParams.data - } - - this.validateTxParams(txMeta.txParams) + txMeta.txParams = this.normalizeAndValidateTxParams(txMeta.txParams) } // create txMeta snapshot for history @@ -214,6 +214,19 @@ class TransactionStateManager extends EventEmitter { } /** + * normalize and validate txParams members + * @param txParams {object} - txParams + */ + normalizeAndValidateTxParams (txParams) { + if (typeof txParams.data === 'undefined') { + delete txParams.data + } + txParams = normalizeTxParams(txParams, false) + this.validateTxParams(txParams) + return txParams + } + + /** validates txParams members by type @param txParams {object} - txParams to validate */ @@ -227,7 +240,6 @@ class TransactionStateManager extends EventEmitter { break default: if (typeof value !== 'string') throw new Error(`${key} in txParams is not a string. got: (${value})`) - if (!ethUtil.isHexPrefixed(value)) throw new Error(`${key} in txParams is not hex prefixed. got: (${value})`) break } }) |