diff --git a/development/states/confirm-new-ui.json b/development/states/confirm-new-ui.json index fffee989399f..a5138c05aa1a 100644 --- a/development/states/confirm-new-ui.json +++ b/development/states/confirm-new-ui.json @@ -129,7 +129,10 @@ "maxModeOn": false, "editingTransactionId": null }, - "currentLocale": "en" + "currentLocale": "en", + "preferences": { + "useNativeCurrencyAsPrimaryCurrency": true + } }, "appState": { "menuOpen": false, @@ -175,5 +178,321 @@ "hexGasTotal": "", "nonce": "", "fetchingMethodData": false + }, + "gas": { + "customData": { + "price": null, + "limit": "0x186a0" + }, + "basicEstimates": { + "average": 73, + "avgWait": 10.6, + "blockTime": 13.871657754010695, + "blockNum": 6655504, + "fast": 160, + "fastest": 290, + "fastestWait": 0.5, + "fastWait": 0.6, + "safeLow": 50, + "safeLowWait": 16.1, + "speed": 0.6702462692280712 + }, + "basicEstimateIsLoading": false, + "gasEstimatesLoading": false, + "basicPriceAndTimeEstimates": [], + "priceAndTimeEstimates": [ + { + "expectedTime": "1374.1168296452973076627", + "expectedWait": 99.0593088449, + "gasprice": 4.1 + }, + { + "expectedTime": "1280.88976972896682763716", + "expectedWait": 92.3386225672, + "gasprice": 4.4 + }, + { + "expectedTime": "1245.13314632680319175597", + "expectedWait": 89.7609477113, + "gasprice": 4.8 + }, + { + "expectedTime": "1227.99925007911014385881", + "expectedWait": 88.5257747744, + "gasprice": 4.9 + }, + { + "expectedTime": "965.52572720362993349654", + "expectedWait": 69.6042062402, + "gasprice": 5 + }, + { + "expectedTime": "917.466895447437420776", + "expectedWait": 66.1396721082, + "gasprice": 5.1 + }, + { + "expectedTime": "915.81694044041496090521", + "expectedWait": 66.0207277804, + "gasprice": 5.2 + }, + { + "expectedTime": "902.13145619709089691874", + "expectedWait": 65.034148924, + "gasprice": 5.3 + }, + { + "expectedTime": "890.83591122200105749896", + "expectedWait": 64.2198594443, + "gasprice": 5.4 + }, + { + "expectedTime": "879.10469542971335712248", + "expectedWait": 63.3741627006, + "gasprice": 5.5 + }, + { + "expectedTime": "876.99737395823100420974", + "expectedWait": 63.2222470818, + "gasprice": 5.6 + }, + { + "expectedTime": "865.96781957003849098957", + "expectedWait": 62.4271327138, + "gasprice": 5.7 + }, + { + "expectedTime": "865.44839472121496158482", + "expectedWait": 62.3896876688, + "gasprice": 5.8 + }, + { + "expectedTime": "802.16173170976255602161", + "expectedWait": 57.8273877524, + "gasprice": 6 + }, + { + "expectedTime": "780.79313908053047074843", + "expectedWait": 56.2869379368, + "gasprice": 6.1 + }, + { + "expectedTime": "770.04888359616469549233", + "expectedWait": 55.5123906062, + "gasprice": 6.2 + }, + { + "expectedTime": "745.01007965146736962697", + "expectedWait": 53.7073573226, + "gasprice": 6.3 + }, + { + "expectedTime": "735.19921111598501681816", + "expectedWait": 53.0000973318, + "gasprice": 6.6 + }, + { + "expectedTime": "705.68767153912619368694", + "expectedWait": 50.8726270539, + "gasprice": 6.7 + }, + { + "expectedTime": "705.26438593445239690121", + "expectedWait": 50.8421126329, + "gasprice": 6.9 + }, + { + "expectedTime": "652.51573119854865429742", + "expectedWait": 47.0394918019, + "gasprice": 7 + }, + { + "expectedTime": "635.51471669299464383162", + "expectedWait": 45.813898235, + "gasprice": 7.1 + }, + { + "expectedTime": "634.37181911960854759036", + "expectedWait": 45.7315073922, + "gasprice": 7.2 + }, + { + "expectedTime": "633.23097691113902888918", + "expectedWait": 45.6492647195, + "gasprice": 7.3 + }, + { + "expectedTime": "112.7753456245379663928", + "expectedWait": 8.1299111919, + "gasprice": 7.6 + }, + { + "expectedTime": "102.9665314468898381829", + "expectedWait": 7.4227992986, + "gasprice": 8 + }, + { + "expectedTime": "100.94784507024919649891", + "expectedWait": 7.2772733339, + "gasprice": 8.1 + }, + { + "expectedTime": "100.46445647447807351078", + "expectedWait": 7.2424261221, + "gasprice": 8.8 + }, + { + "expectedTime": "84.91686745986737853339", + "expectedWait": 6.1216091808, + "gasprice": 9 + }, + { + "expectedTime": "80.39566429296684383503", + "expectedWait": 5.7956781892, + "gasprice": 9.1 + }, + { + "expectedTime": "78.24522052614759252715", + "expectedWait": 5.6406539084, + "gasprice": 9.2 + }, + { + "expectedTime": "77.1685119880459882636", + "expectedWait": 5.5630345959, + "gasprice": 9.5 + }, + { + "expectedTime": "72.43649507646737870178", + "expectedWait": 5.2219061601, + "gasprice": 9.8 + }, + { + "expectedTime": "71.48259532351443753818", + "expectedWait": 5.1531400638, + "gasprice": 9.9 + }, + { + "expectedTime": "58.23892805162994573827", + "expectedWait": 4.1984115442, + "gasprice": 10 + }, + { + "expectedTime": "53.13065124862245917617", + "expectedWait": 3.8301587446, + "gasprice": 10.1 + }, + { + "expectedTime": "53.03510209647058751971", + "expectedWait": 3.82327066, + "gasprice": 10.3 + }, + { + "expectedTime": "49.06846157804491912403", + "expectedWait": 3.5373177776, + "gasprice": 11 + }, + { + "expectedTime": "48.30893330101818116637", + "expectedWait": 3.4825638116, + "gasprice": 11.1 + }, + { + "expectedTime": "48.25099734861818116715", + "expectedWait": 3.4783872414, + "gasprice": 11.3 + }, + { + "expectedTime": "47.64416885027272662988", + "expectedWait": 3.4346413165, + "gasprice": 11.9 + }, + { + "expectedTime": "46.76354741392085498401", + "expectedWait": 3.3711578128, + "gasprice": 12.6 + }, + { + "expectedTime": "44.99427448545882292232", + "expectedWait": 3.2436119232, + "gasprice": 13 + }, + { + "expectedTime": "44.61790554199251276697", + "expectedWait": 3.2164796979, + "gasprice": 13.1 + }, + { + "expectedTime": "42.87832690973048070488", + "expectedWait": 3.0910744534, + "gasprice": 14 + }, + { + "expectedTime": "42.21224091308663044649", + "expectedWait": 3.0430566888, + "gasprice": 14.9 + }, + { + "expectedTime": "41.15715335111336842864", + "expectedWait": 2.9669960203, + "gasprice": 15 + }, + { + "expectedTime": "40.9600723880876999821", + "expectedWait": 2.9527885646, + "gasprice": 15.1 + }, + { + "expectedTime": "38.89138450301711177472", + "expectedWait": 2.8036580193, + "gasprice": 15.8 + }, + { + "expectedTime": "37.89655640860213852611", + "expectedWait": 2.7319414219, + "gasprice": 16 + }, + { + "expectedTime": "37.35265517364705831954", + "expectedWait": 2.692731888, + "gasprice": 17.4 + }, + { + "expectedTime": "36.79447683873796741798", + "expectedWait": 2.652493126, + "gasprice": 17.8 + }, + { + "expectedTime": "36.11439350850802090309", + "expectedWait": 2.6034663015, + "gasprice": 19 + }, + { + "expectedTime": "31.32676199432192471101", + "expectedWait": 2.2583286403, + "gasprice": 20 + }, + { + "expectedTime": "30.76792490132192471855", + "expectedWait": 2.2180423888, + "gasprice": 20.1 + }, + { + "expectedTime": "29.94493658520962526441", + "expectedWait": 2.1587136243, + "gasprice": 25 + }, + { + "expectedTime": "29.53287347625561457478", + "expectedWait": 2.1290082267, + "gasprice": 29 + }, + { + "expectedTime": "29.09318627175614934008", + "expectedWait": 2.0973114236, + "gasprice": 47 + } + ], + "priceAndTimeEstimatesLastRetrieved": 1541527901281, + "errors": {} } } diff --git a/development/states/confirm-sig-requests.json b/development/states/confirm-sig-requests.json index 1ffde3938d6e..f261ce67fc74 100644 --- a/development/states/confirm-sig-requests.json +++ b/development/states/confirm-sig-requests.json @@ -203,5 +203,321 @@ "hexGasTotal": "", "nonce": "", "fetchingMethodData": false + }, + "gas": { + "customData": { + "price": null, + "limit": "0x186a0" + }, + "basicEstimates": { + "average": 73, + "avgWait": 10.6, + "blockTime": 13.871657754010695, + "blockNum": 6655504, + "fast": 160, + "fastest": 290, + "fastestWait": 0.5, + "fastWait": 0.6, + "safeLow": 50, + "safeLowWait": 16.1, + "speed": 0.6702462692280712 + }, + "basicEstimateIsLoading": false, + "gasEstimatesLoading": false, + "basicPriceAndTimeEstimates": [], + "priceAndTimeEstimates": [ + { + "expectedTime": "1374.1168296452973076627", + "expectedWait": 99.0593088449, + "gasprice": 4.1 + }, + { + "expectedTime": "1280.88976972896682763716", + "expectedWait": 92.3386225672, + "gasprice": 4.4 + }, + { + "expectedTime": "1245.13314632680319175597", + "expectedWait": 89.7609477113, + "gasprice": 4.8 + }, + { + "expectedTime": "1227.99925007911014385881", + "expectedWait": 88.5257747744, + "gasprice": 4.9 + }, + { + "expectedTime": "965.52572720362993349654", + "expectedWait": 69.6042062402, + "gasprice": 5 + }, + { + "expectedTime": "917.466895447437420776", + "expectedWait": 66.1396721082, + "gasprice": 5.1 + }, + { + "expectedTime": "915.81694044041496090521", + "expectedWait": 66.0207277804, + "gasprice": 5.2 + }, + { + "expectedTime": "902.13145619709089691874", + "expectedWait": 65.034148924, + "gasprice": 5.3 + }, + { + "expectedTime": "890.83591122200105749896", + "expectedWait": 64.2198594443, + "gasprice": 5.4 + }, + { + "expectedTime": "879.10469542971335712248", + "expectedWait": 63.3741627006, + "gasprice": 5.5 + }, + { + "expectedTime": "876.99737395823100420974", + "expectedWait": 63.2222470818, + "gasprice": 5.6 + }, + { + "expectedTime": "865.96781957003849098957", + "expectedWait": 62.4271327138, + "gasprice": 5.7 + }, + { + "expectedTime": "865.44839472121496158482", + "expectedWait": 62.3896876688, + "gasprice": 5.8 + }, + { + "expectedTime": "802.16173170976255602161", + "expectedWait": 57.8273877524, + "gasprice": 6 + }, + { + "expectedTime": "780.79313908053047074843", + "expectedWait": 56.2869379368, + "gasprice": 6.1 + }, + { + "expectedTime": "770.04888359616469549233", + "expectedWait": 55.5123906062, + "gasprice": 6.2 + }, + { + "expectedTime": "745.01007965146736962697", + "expectedWait": 53.7073573226, + "gasprice": 6.3 + }, + { + "expectedTime": "735.19921111598501681816", + "expectedWait": 53.0000973318, + "gasprice": 6.6 + }, + { + "expectedTime": "705.68767153912619368694", + "expectedWait": 50.8726270539, + "gasprice": 6.7 + }, + { + "expectedTime": "705.26438593445239690121", + "expectedWait": 50.8421126329, + "gasprice": 6.9 + }, + { + "expectedTime": "652.51573119854865429742", + "expectedWait": 47.0394918019, + "gasprice": 7 + }, + { + "expectedTime": "635.51471669299464383162", + "expectedWait": 45.813898235, + "gasprice": 7.1 + }, + { + "expectedTime": "634.37181911960854759036", + "expectedWait": 45.7315073922, + "gasprice": 7.2 + }, + { + "expectedTime": "633.23097691113902888918", + "expectedWait": 45.6492647195, + "gasprice": 7.3 + }, + { + "expectedTime": "112.7753456245379663928", + "expectedWait": 8.1299111919, + "gasprice": 7.6 + }, + { + "expectedTime": "102.9665314468898381829", + "expectedWait": 7.4227992986, + "gasprice": 8 + }, + { + "expectedTime": "100.94784507024919649891", + "expectedWait": 7.2772733339, + "gasprice": 8.1 + }, + { + "expectedTime": "100.46445647447807351078", + "expectedWait": 7.2424261221, + "gasprice": 8.8 + }, + { + "expectedTime": "84.91686745986737853339", + "expectedWait": 6.1216091808, + "gasprice": 9 + }, + { + "expectedTime": "80.39566429296684383503", + "expectedWait": 5.7956781892, + "gasprice": 9.1 + }, + { + "expectedTime": "78.24522052614759252715", + "expectedWait": 5.6406539084, + "gasprice": 9.2 + }, + { + "expectedTime": "77.1685119880459882636", + "expectedWait": 5.5630345959, + "gasprice": 9.5 + }, + { + "expectedTime": "72.43649507646737870178", + "expectedWait": 5.2219061601, + "gasprice": 9.8 + }, + { + "expectedTime": "71.48259532351443753818", + "expectedWait": 5.1531400638, + "gasprice": 9.9 + }, + { + "expectedTime": "58.23892805162994573827", + "expectedWait": 4.1984115442, + "gasprice": 10 + }, + { + "expectedTime": "53.13065124862245917617", + "expectedWait": 3.8301587446, + "gasprice": 10.1 + }, + { + "expectedTime": "53.03510209647058751971", + "expectedWait": 3.82327066, + "gasprice": 10.3 + }, + { + "expectedTime": "49.06846157804491912403", + "expectedWait": 3.5373177776, + "gasprice": 11 + }, + { + "expectedTime": "48.30893330101818116637", + "expectedWait": 3.4825638116, + "gasprice": 11.1 + }, + { + "expectedTime": "48.25099734861818116715", + "expectedWait": 3.4783872414, + "gasprice": 11.3 + }, + { + "expectedTime": "47.64416885027272662988", + "expectedWait": 3.4346413165, + "gasprice": 11.9 + }, + { + "expectedTime": "46.76354741392085498401", + "expectedWait": 3.3711578128, + "gasprice": 12.6 + }, + { + "expectedTime": "44.99427448545882292232", + "expectedWait": 3.2436119232, + "gasprice": 13 + }, + { + "expectedTime": "44.61790554199251276697", + "expectedWait": 3.2164796979, + "gasprice": 13.1 + }, + { + "expectedTime": "42.87832690973048070488", + "expectedWait": 3.0910744534, + "gasprice": 14 + }, + { + "expectedTime": "42.21224091308663044649", + "expectedWait": 3.0430566888, + "gasprice": 14.9 + }, + { + "expectedTime": "41.15715335111336842864", + "expectedWait": 2.9669960203, + "gasprice": 15 + }, + { + "expectedTime": "40.9600723880876999821", + "expectedWait": 2.9527885646, + "gasprice": 15.1 + }, + { + "expectedTime": "38.89138450301711177472", + "expectedWait": 2.8036580193, + "gasprice": 15.8 + }, + { + "expectedTime": "37.89655640860213852611", + "expectedWait": 2.7319414219, + "gasprice": 16 + }, + { + "expectedTime": "37.35265517364705831954", + "expectedWait": 2.692731888, + "gasprice": 17.4 + }, + { + "expectedTime": "36.79447683873796741798", + "expectedWait": 2.652493126, + "gasprice": 17.8 + }, + { + "expectedTime": "36.11439350850802090309", + "expectedWait": 2.6034663015, + "gasprice": 19 + }, + { + "expectedTime": "31.32676199432192471101", + "expectedWait": 2.2583286403, + "gasprice": 20 + }, + { + "expectedTime": "30.76792490132192471855", + "expectedWait": 2.2180423888, + "gasprice": 20.1 + }, + { + "expectedTime": "29.94493658520962526441", + "expectedWait": 2.1587136243, + "gasprice": 25 + }, + { + "expectedTime": "29.53287347625561457478", + "expectedWait": 2.1290082267, + "gasprice": 29 + }, + { + "expectedTime": "29.09318627175614934008", + "expectedWait": 2.0973114236, + "gasprice": 47 + } + ], + "priceAndTimeEstimatesLastRetrieved": 1541527901281, + "errors": {} } } diff --git a/development/states/currency-localization.json b/development/states/currency-localization.json index ef28891a390a..43acf7fda235 100644 --- a/development/states/currency-localization.json +++ b/development/states/currency-localization.json @@ -152,5 +152,321 @@ "hexGasTotal": "", "nonce": "", "fetchingMethodData": false + }, + "gas": { + "customData": { + "price": null, + "limit": "0x186a0" + }, + "basicEstimates": { + "average": 73, + "avgWait": 10.6, + "blockTime": 13.871657754010695, + "blockNum": 6655504, + "fast": 160, + "fastest": 290, + "fastestWait": 0.5, + "fastWait": 0.6, + "safeLow": 50, + "safeLowWait": 16.1, + "speed": 0.6702462692280712 + }, + "basicEstimateIsLoading": false, + "gasEstimatesLoading": false, + "basicPriceAndTimeEstimates": [], + "priceAndTimeEstimates": [ + { + "expectedTime": "1374.1168296452973076627", + "expectedWait": 99.0593088449, + "gasprice": 4.1 + }, + { + "expectedTime": "1280.88976972896682763716", + "expectedWait": 92.3386225672, + "gasprice": 4.4 + }, + { + "expectedTime": "1245.13314632680319175597", + "expectedWait": 89.7609477113, + "gasprice": 4.8 + }, + { + "expectedTime": "1227.99925007911014385881", + "expectedWait": 88.5257747744, + "gasprice": 4.9 + }, + { + "expectedTime": "965.52572720362993349654", + "expectedWait": 69.6042062402, + "gasprice": 5 + }, + { + "expectedTime": "917.466895447437420776", + "expectedWait": 66.1396721082, + "gasprice": 5.1 + }, + { + "expectedTime": "915.81694044041496090521", + "expectedWait": 66.0207277804, + "gasprice": 5.2 + }, + { + "expectedTime": "902.13145619709089691874", + "expectedWait": 65.034148924, + "gasprice": 5.3 + }, + { + "expectedTime": "890.83591122200105749896", + "expectedWait": 64.2198594443, + "gasprice": 5.4 + }, + { + "expectedTime": "879.10469542971335712248", + "expectedWait": 63.3741627006, + "gasprice": 5.5 + }, + { + "expectedTime": "876.99737395823100420974", + "expectedWait": 63.2222470818, + "gasprice": 5.6 + }, + { + "expectedTime": "865.96781957003849098957", + "expectedWait": 62.4271327138, + "gasprice": 5.7 + }, + { + "expectedTime": "865.44839472121496158482", + "expectedWait": 62.3896876688, + "gasprice": 5.8 + }, + { + "expectedTime": "802.16173170976255602161", + "expectedWait": 57.8273877524, + "gasprice": 6 + }, + { + "expectedTime": "780.79313908053047074843", + "expectedWait": 56.2869379368, + "gasprice": 6.1 + }, + { + "expectedTime": "770.04888359616469549233", + "expectedWait": 55.5123906062, + "gasprice": 6.2 + }, + { + "expectedTime": "745.01007965146736962697", + "expectedWait": 53.7073573226, + "gasprice": 6.3 + }, + { + "expectedTime": "735.19921111598501681816", + "expectedWait": 53.0000973318, + "gasprice": 6.6 + }, + { + "expectedTime": "705.68767153912619368694", + "expectedWait": 50.8726270539, + "gasprice": 6.7 + }, + { + "expectedTime": "705.26438593445239690121", + "expectedWait": 50.8421126329, + "gasprice": 6.9 + }, + { + "expectedTime": "652.51573119854865429742", + "expectedWait": 47.0394918019, + "gasprice": 7 + }, + { + "expectedTime": "635.51471669299464383162", + "expectedWait": 45.813898235, + "gasprice": 7.1 + }, + { + "expectedTime": "634.37181911960854759036", + "expectedWait": 45.7315073922, + "gasprice": 7.2 + }, + { + "expectedTime": "633.23097691113902888918", + "expectedWait": 45.6492647195, + "gasprice": 7.3 + }, + { + "expectedTime": "112.7753456245379663928", + "expectedWait": 8.1299111919, + "gasprice": 7.6 + }, + { + "expectedTime": "102.9665314468898381829", + "expectedWait": 7.4227992986, + "gasprice": 8 + }, + { + "expectedTime": "100.94784507024919649891", + "expectedWait": 7.2772733339, + "gasprice": 8.1 + }, + { + "expectedTime": "100.46445647447807351078", + "expectedWait": 7.2424261221, + "gasprice": 8.8 + }, + { + "expectedTime": "84.91686745986737853339", + "expectedWait": 6.1216091808, + "gasprice": 9 + }, + { + "expectedTime": "80.39566429296684383503", + "expectedWait": 5.7956781892, + "gasprice": 9.1 + }, + { + "expectedTime": "78.24522052614759252715", + "expectedWait": 5.6406539084, + "gasprice": 9.2 + }, + { + "expectedTime": "77.1685119880459882636", + "expectedWait": 5.5630345959, + "gasprice": 9.5 + }, + { + "expectedTime": "72.43649507646737870178", + "expectedWait": 5.2219061601, + "gasprice": 9.8 + }, + { + "expectedTime": "71.48259532351443753818", + "expectedWait": 5.1531400638, + "gasprice": 9.9 + }, + { + "expectedTime": "58.23892805162994573827", + "expectedWait": 4.1984115442, + "gasprice": 10 + }, + { + "expectedTime": "53.13065124862245917617", + "expectedWait": 3.8301587446, + "gasprice": 10.1 + }, + { + "expectedTime": "53.03510209647058751971", + "expectedWait": 3.82327066, + "gasprice": 10.3 + }, + { + "expectedTime": "49.06846157804491912403", + "expectedWait": 3.5373177776, + "gasprice": 11 + }, + { + "expectedTime": "48.30893330101818116637", + "expectedWait": 3.4825638116, + "gasprice": 11.1 + }, + { + "expectedTime": "48.25099734861818116715", + "expectedWait": 3.4783872414, + "gasprice": 11.3 + }, + { + "expectedTime": "47.64416885027272662988", + "expectedWait": 3.4346413165, + "gasprice": 11.9 + }, + { + "expectedTime": "46.76354741392085498401", + "expectedWait": 3.3711578128, + "gasprice": 12.6 + }, + { + "expectedTime": "44.99427448545882292232", + "expectedWait": 3.2436119232, + "gasprice": 13 + }, + { + "expectedTime": "44.61790554199251276697", + "expectedWait": 3.2164796979, + "gasprice": 13.1 + }, + { + "expectedTime": "42.87832690973048070488", + "expectedWait": 3.0910744534, + "gasprice": 14 + }, + { + "expectedTime": "42.21224091308663044649", + "expectedWait": 3.0430566888, + "gasprice": 14.9 + }, + { + "expectedTime": "41.15715335111336842864", + "expectedWait": 2.9669960203, + "gasprice": 15 + }, + { + "expectedTime": "40.9600723880876999821", + "expectedWait": 2.9527885646, + "gasprice": 15.1 + }, + { + "expectedTime": "38.89138450301711177472", + "expectedWait": 2.8036580193, + "gasprice": 15.8 + }, + { + "expectedTime": "37.89655640860213852611", + "expectedWait": 2.7319414219, + "gasprice": 16 + }, + { + "expectedTime": "37.35265517364705831954", + "expectedWait": 2.692731888, + "gasprice": 17.4 + }, + { + "expectedTime": "36.79447683873796741798", + "expectedWait": 2.652493126, + "gasprice": 17.8 + }, + { + "expectedTime": "36.11439350850802090309", + "expectedWait": 2.6034663015, + "gasprice": 19 + }, + { + "expectedTime": "31.32676199432192471101", + "expectedWait": 2.2583286403, + "gasprice": 20 + }, + { + "expectedTime": "30.76792490132192471855", + "expectedWait": 2.2180423888, + "gasprice": 20.1 + }, + { + "expectedTime": "29.94493658520962526441", + "expectedWait": 2.1587136243, + "gasprice": 25 + }, + { + "expectedTime": "29.53287347625561457478", + "expectedWait": 2.1290082267, + "gasprice": 29 + }, + { + "expectedTime": "29.09318627175614934008", + "expectedWait": 2.0973114236, + "gasprice": 47 + } + ], + "priceAndTimeEstimatesLastRetrieved": 1541527901281, + "errors": {} } } diff --git a/development/states/send-edit.json b/development/states/send-edit.json index 7951b06cfd05..09a380730d1a 100644 --- a/development/states/send-edit.json +++ b/development/states/send-edit.json @@ -107,7 +107,7 @@ ] } ], - "selectedAddress": "0xd85a4b6a394794842887b8284293d69163007bbb", + "selectedAddress": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb", "currentCurrency": "USD", "provider": { "type": "testnet" @@ -130,7 +130,10 @@ "maxModeOn": false, "editingTransactionId": null }, - "currentLocale": "en" + "currentLocale": "en", + "preferences": { + "useNativeCurrencyAsPrimaryCurrency": true + } }, "appState": { "menuOpen": false, diff --git a/development/states/send-new-ui.json b/development/states/send-new-ui.json index fd048596c919..60a4af2286e8 100644 --- a/development/states/send-new-ui.json +++ b/development/states/send-new-ui.json @@ -89,7 +89,7 @@ ] } ], - "selectedAddress": "0xd85a4b6a394794842887b8284293d69163007bbb", + "selectedAddress": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb", "currentCurrency": "USD", "provider": { "type": "testnet" diff --git a/development/states/tx-list-items.json b/development/states/tx-list-items.json index e83179a17daa..a3fcd91843e9 100644 --- a/development/states/tx-list-items.json +++ b/development/states/tx-list-items.json @@ -133,5 +133,321 @@ "fromDropdownOpen": false, "toDropdownOpen": false, "errors": {} + }, + "gas": { + "customData": { + "price": null, + "limit": "0x186a0" + }, + "basicEstimates": { + "average": 73, + "avgWait": 10.6, + "blockTime": 13.871657754010695, + "blockNum": 6655504, + "fast": 160, + "fastest": 290, + "fastestWait": 0.5, + "fastWait": 0.6, + "safeLow": 50, + "safeLowWait": 16.1, + "speed": 0.6702462692280712 + }, + "basicEstimateIsLoading": false, + "gasEstimatesLoading": false, + "basicPriceAndTimeEstimates": [], + "priceAndTimeEstimates": [ + { + "expectedTime": "1374.1168296452973076627", + "expectedWait": 99.0593088449, + "gasprice": 4.1 + }, + { + "expectedTime": "1280.88976972896682763716", + "expectedWait": 92.3386225672, + "gasprice": 4.4 + }, + { + "expectedTime": "1245.13314632680319175597", + "expectedWait": 89.7609477113, + "gasprice": 4.8 + }, + { + "expectedTime": "1227.99925007911014385881", + "expectedWait": 88.5257747744, + "gasprice": 4.9 + }, + { + "expectedTime": "965.52572720362993349654", + "expectedWait": 69.6042062402, + "gasprice": 5 + }, + { + "expectedTime": "917.466895447437420776", + "expectedWait": 66.1396721082, + "gasprice": 5.1 + }, + { + "expectedTime": "915.81694044041496090521", + "expectedWait": 66.0207277804, + "gasprice": 5.2 + }, + { + "expectedTime": "902.13145619709089691874", + "expectedWait": 65.034148924, + "gasprice": 5.3 + }, + { + "expectedTime": "890.83591122200105749896", + "expectedWait": 64.2198594443, + "gasprice": 5.4 + }, + { + "expectedTime": "879.10469542971335712248", + "expectedWait": 63.3741627006, + "gasprice": 5.5 + }, + { + "expectedTime": "876.99737395823100420974", + "expectedWait": 63.2222470818, + "gasprice": 5.6 + }, + { + "expectedTime": "865.96781957003849098957", + "expectedWait": 62.4271327138, + "gasprice": 5.7 + }, + { + "expectedTime": "865.44839472121496158482", + "expectedWait": 62.3896876688, + "gasprice": 5.8 + }, + { + "expectedTime": "802.16173170976255602161", + "expectedWait": 57.8273877524, + "gasprice": 6 + }, + { + "expectedTime": "780.79313908053047074843", + "expectedWait": 56.2869379368, + "gasprice": 6.1 + }, + { + "expectedTime": "770.04888359616469549233", + "expectedWait": 55.5123906062, + "gasprice": 6.2 + }, + { + "expectedTime": "745.01007965146736962697", + "expectedWait": 53.7073573226, + "gasprice": 6.3 + }, + { + "expectedTime": "735.19921111598501681816", + "expectedWait": 53.0000973318, + "gasprice": 6.6 + }, + { + "expectedTime": "705.68767153912619368694", + "expectedWait": 50.8726270539, + "gasprice": 6.7 + }, + { + "expectedTime": "705.26438593445239690121", + "expectedWait": 50.8421126329, + "gasprice": 6.9 + }, + { + "expectedTime": "652.51573119854865429742", + "expectedWait": 47.0394918019, + "gasprice": 7 + }, + { + "expectedTime": "635.51471669299464383162", + "expectedWait": 45.813898235, + "gasprice": 7.1 + }, + { + "expectedTime": "634.37181911960854759036", + "expectedWait": 45.7315073922, + "gasprice": 7.2 + }, + { + "expectedTime": "633.23097691113902888918", + "expectedWait": 45.6492647195, + "gasprice": 7.3 + }, + { + "expectedTime": "112.7753456245379663928", + "expectedWait": 8.1299111919, + "gasprice": 7.6 + }, + { + "expectedTime": "102.9665314468898381829", + "expectedWait": 7.4227992986, + "gasprice": 8 + }, + { + "expectedTime": "100.94784507024919649891", + "expectedWait": 7.2772733339, + "gasprice": 8.1 + }, + { + "expectedTime": "100.46445647447807351078", + "expectedWait": 7.2424261221, + "gasprice": 8.8 + }, + { + "expectedTime": "84.91686745986737853339", + "expectedWait": 6.1216091808, + "gasprice": 9 + }, + { + "expectedTime": "80.39566429296684383503", + "expectedWait": 5.7956781892, + "gasprice": 9.1 + }, + { + "expectedTime": "78.24522052614759252715", + "expectedWait": 5.6406539084, + "gasprice": 9.2 + }, + { + "expectedTime": "77.1685119880459882636", + "expectedWait": 5.5630345959, + "gasprice": 9.5 + }, + { + "expectedTime": "72.43649507646737870178", + "expectedWait": 5.2219061601, + "gasprice": 9.8 + }, + { + "expectedTime": "71.48259532351443753818", + "expectedWait": 5.1531400638, + "gasprice": 9.9 + }, + { + "expectedTime": "58.23892805162994573827", + "expectedWait": 4.1984115442, + "gasprice": 10 + }, + { + "expectedTime": "53.13065124862245917617", + "expectedWait": 3.8301587446, + "gasprice": 10.1 + }, + { + "expectedTime": "53.03510209647058751971", + "expectedWait": 3.82327066, + "gasprice": 10.3 + }, + { + "expectedTime": "49.06846157804491912403", + "expectedWait": 3.5373177776, + "gasprice": 11 + }, + { + "expectedTime": "48.30893330101818116637", + "expectedWait": 3.4825638116, + "gasprice": 11.1 + }, + { + "expectedTime": "48.25099734861818116715", + "expectedWait": 3.4783872414, + "gasprice": 11.3 + }, + { + "expectedTime": "47.64416885027272662988", + "expectedWait": 3.4346413165, + "gasprice": 11.9 + }, + { + "expectedTime": "46.76354741392085498401", + "expectedWait": 3.3711578128, + "gasprice": 12.6 + }, + { + "expectedTime": "44.99427448545882292232", + "expectedWait": 3.2436119232, + "gasprice": 13 + }, + { + "expectedTime": "44.61790554199251276697", + "expectedWait": 3.2164796979, + "gasprice": 13.1 + }, + { + "expectedTime": "42.87832690973048070488", + "expectedWait": 3.0910744534, + "gasprice": 14 + }, + { + "expectedTime": "42.21224091308663044649", + "expectedWait": 3.0430566888, + "gasprice": 14.9 + }, + { + "expectedTime": "41.15715335111336842864", + "expectedWait": 2.9669960203, + "gasprice": 15 + }, + { + "expectedTime": "40.9600723880876999821", + "expectedWait": 2.9527885646, + "gasprice": 15.1 + }, + { + "expectedTime": "38.89138450301711177472", + "expectedWait": 2.8036580193, + "gasprice": 15.8 + }, + { + "expectedTime": "37.89655640860213852611", + "expectedWait": 2.7319414219, + "gasprice": 16 + }, + { + "expectedTime": "37.35265517364705831954", + "expectedWait": 2.692731888, + "gasprice": 17.4 + }, + { + "expectedTime": "36.79447683873796741798", + "expectedWait": 2.652493126, + "gasprice": 17.8 + }, + { + "expectedTime": "36.11439350850802090309", + "expectedWait": 2.6034663015, + "gasprice": 19 + }, + { + "expectedTime": "31.32676199432192471101", + "expectedWait": 2.2583286403, + "gasprice": 20 + }, + { + "expectedTime": "30.76792490132192471855", + "expectedWait": 2.2180423888, + "gasprice": 20.1 + }, + { + "expectedTime": "29.94493658520962526441", + "expectedWait": 2.1587136243, + "gasprice": 25 + }, + { + "expectedTime": "29.53287347625561457478", + "expectedWait": 2.1290082267, + "gasprice": 29 + }, + { + "expectedTime": "29.09318627175614934008", + "expectedWait": 2.0973114236, + "gasprice": 47 + } + ], + "priceAndTimeEstimatesLastRetrieved": 1541527901281, + "errors": {} } } diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js index 1acd85a3528a..145c9ad3b864 100644 --- a/test/integration/lib/send-new-ui.js +++ b/test/integration/lib/send-new-ui.js @@ -54,23 +54,14 @@ async function runSendFlowTest (assert, done) { const sendFromField = await queryAsync($, '.send-v2__form-field') assert.ok(sendFromField[0], 'send screen has a from field') - let sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name') - assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 4', 'send from field shows correct account name') - - const sendFromFieldItem = await queryAsync($, '.account-list-item') - sendFromFieldItem[0].click() - - // this seems to fail if the firefox window is not in focus... - const sendFromDropdownList = await queryAsync($, '.send-v2__from-dropdown__list') - assert.equal(sendFromDropdownList.children().length, 4, 'send from dropdown shows all accounts') - sendFromDropdownList.children()[1].click() - - sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name') - assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 2', 'send from field dropdown changes account name') + const sendFromFieldItemAddress = await queryAsync($, '.account-list-item__account-name') + assert.equal(sendFromFieldItemAddress[0].textContent, 'Send Account 2', 'send from field shows correct account name') const sendToFieldInput = await queryAsync($, '.send-v2__to-autocomplete__input') sendToFieldInput[0].focus() + await timeout(1000) + const sendToDropdownList = await queryAsync($, '.send-v2__from-dropdown__list') assert.equal(sendToDropdownList.children().length, 5, 'send to dropdown shows all accounts and address book accounts') @@ -104,7 +95,7 @@ async function runSendFlowTest (assert, done) { reactTriggerChange(selectState[0]) const confirmFromName = (await queryAsync($, '.sender-to-recipient__name')).first() - assert.equal(confirmFromName[0].textContent, 'Send Account 4', 'confirm screen should show correct from name') + assert.equal(confirmFromName[0].textContent, 'Send Account 2', 'confirm screen should show correct from name') const confirmToName = (await queryAsync($, '.sender-to-recipient__name')).last() assert.equal(confirmToName[0].textContent, 'Send Account 3', 'confirm screen should show correct to name') @@ -118,12 +109,6 @@ async function runSendFlowTest (assert, done) { const confirmScreenBackButton = await queryAsync($, '.confirm-page-container-header__back-button') confirmScreenBackButton[0].click() - const sendFromFieldItemInEdit = await queryAsync($, '.account-list-item') - sendFromFieldItemInEdit[0].click() - - const sendFromDropdownListInEdit = await queryAsync($, '.send-v2__from-dropdown__list') - sendFromDropdownListInEdit.children()[2].click() - const sendToFieldInputInEdit = await queryAsync($, '.send-v2__to-autocomplete__input') sendToFieldInputInEdit[0].focus() sendToFieldInputInEdit.val('0xd85a4b6a394794842887b8284293d69163007bbb') diff --git a/ui/app/actions.js b/ui/app/actions.js index e1bb6dc2ddda..5a4389d67fc2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -202,7 +202,6 @@ var actions = { setGasTotal, setSendTokenBalance, updateSendTokenBalance, - updateSendFrom, updateSendHexData, updateSendTo, updateSendAmount, @@ -1008,13 +1007,6 @@ function setSendTokenBalance (tokenBalance) { } } -function updateSendFrom (from) { - return { - type: actions.UPDATE_SEND_FROM, - value: from, - } -} - function updateSendHexData (value) { return { type: actions.UPDATE_SEND_HEX_DATA, diff --git a/ui/app/components/send/account-list-item/account-list-item.component.js b/ui/app/components/send/account-list-item/account-list-item.component.js index 14bb7471f65d..a61467bb399a 100644 --- a/ui/app/components/send/account-list-item/account-list-item.component.js +++ b/ui/app/components/send/account-list-item/account-list-item.component.js @@ -36,7 +36,7 @@ export default class AccountListItem extends Component { return (
handleClick({ name, address, balance })} + onClick={() => handleClick && handleClick({ name, address, balance })} >
diff --git a/ui/app/components/send/account-list-item/account-list-item.scss b/ui/app/components/send/account-list-item/account-list-item.scss deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/ui/app/components/send/send-content/send-content-README.md b/ui/app/components/send/send-content/send-content-README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/ui/app/components/send/send-content/send-content.component.js b/ui/app/components/send/send-content/send-content.component.js index 1b03ffd2b6be..c780c88f52e1 100644 --- a/ui/app/components/send/send-content/send-content.component.js +++ b/ui/app/components/send/send-content/send-content.component.js @@ -13,7 +13,7 @@ export default class SendContent extends Component { updateGas: PropTypes.func, scanQrCode: PropTypes.func, showHexData: PropTypes.bool, - }; + } updateGas = (updateData) => this.props.updateGas(updateData) diff --git a/ui/app/components/send/send-content/send-content.scss b/ui/app/components/send/send-content/send-content.scss deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown-README.md b/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown-README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.component.js b/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.component.js deleted file mode 100644 index d512f7d0b89d..000000000000 --- a/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.component.js +++ /dev/null @@ -1,46 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' -import AccountListItem from '../../../account-list-item/' -import SendDropdownList from '../../send-dropdown-list/' - -export default class FromDropdown extends Component { - - static propTypes = { - accounts: PropTypes.array, - closeDropdown: PropTypes.func, - dropdownOpen: PropTypes.bool, - onSelect: PropTypes.func, - openDropdown: PropTypes.func, - selectedAccount: PropTypes.object, - } - - static contextTypes = { - t: PropTypes.func, - } - - render () { - const { - accounts, - closeDropdown, - dropdownOpen, - openDropdown, - selectedAccount, - onSelect, - } = this.props - - return
- } - /> - {dropdownOpen && } -
- } - -} diff --git a/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.scss b/ui/app/components/send/send-content/send-from-row/from-dropdown/from-dropdown.scss deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/ui/app/components/send/send-content/send-from-row/from-dropdown/index.js b/ui/app/components/send/send-content/send-from-row/from-dropdown/index.js deleted file mode 100644 index 2314ef4e30d2..000000000000 --- a/ui/app/components/send/send-content/send-from-row/from-dropdown/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './from-dropdown.component' diff --git a/ui/app/components/send/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js b/ui/app/components/send/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js deleted file mode 100644 index 84fcb281e671..000000000000 --- a/ui/app/components/send/send-content/send-from-row/from-dropdown/tests/from-dropdown-component.test.js +++ /dev/null @@ -1,88 +0,0 @@ -import React from 'react' -import assert from 'assert' -import { shallow } from 'enzyme' -import sinon from 'sinon' -import FromDropdown from '../from-dropdown.component.js' - -import AccountListItem from '../../../../account-list-item/account-list-item.container' -import SendDropdownList from '../../../send-dropdown-list/send-dropdown-list.component' - -const propsMethodSpies = { - closeDropdown: sinon.spy(), - openDropdown: sinon.spy(), - onSelect: sinon.spy(), -} - -describe('FromDropdown Component', function () { - let wrapper - - beforeEach(() => { - wrapper = shallow(, { context: { t: str => str + '_t' } }) - }) - - afterEach(() => { - propsMethodSpies.closeDropdown.resetHistory() - propsMethodSpies.openDropdown.resetHistory() - propsMethodSpies.onSelect.resetHistory() - }) - - describe('render', () => { - it('should render a div with a .send-v2__from-dropdown class', () => { - assert.equal(wrapper.find('.send-v2__from-dropdown').length, 1) - }) - - it('should render an AccountListItem as the first child of the .send-v2__from-dropdown div', () => { - assert(wrapper.find('.send-v2__from-dropdown').childAt(0).is(AccountListItem)) - }) - - it('should pass the correct props to AccountListItem', () => { - const { - account, - handleClick, - icon, - } = wrapper.find('.send-v2__from-dropdown').childAt(0).props() - assert.deepEqual(account, { address: 'mockAddress' }) - assert.deepEqual( - icon, - - ) - assert.equal(propsMethodSpies.openDropdown.callCount, 0) - handleClick() - assert.equal(propsMethodSpies.openDropdown.callCount, 1) - }) - - it('should not render a SendDropdownList when dropdownOpen is false', () => { - assert.equal(wrapper.find(SendDropdownList).length, 0) - }) - - it('should render a SendDropdownList when dropdownOpen is true', () => { - wrapper.setProps({ dropdownOpen: true }) - assert(wrapper.find(SendDropdownList).length, 1) - }) - - it('should pass the correct props to the SendDropdownList]', () => { - wrapper.setProps({ dropdownOpen: true }) - const { - accounts, - closeDropdown, - onSelect, - activeAddress, - } = wrapper.find(SendDropdownList).props() - assert.deepEqual(accounts, ['mockAccount']) - assert.equal(activeAddress, 'mockAddress') - assert.equal(propsMethodSpies.closeDropdown.callCount, 0) - closeDropdown() - assert.equal(propsMethodSpies.closeDropdown.callCount, 1) - assert.equal(propsMethodSpies.onSelect.callCount, 0) - onSelect() - assert.equal(propsMethodSpies.onSelect.callCount, 1) - }) - }) -}) diff --git a/ui/app/components/send/send-content/send-from-row/send-from-row-README.md b/ui/app/components/send/send-content/send-from-row/send-from-row-README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/ui/app/components/send/send-content/send-from-row/send-from-row.component.js b/ui/app/components/send/send-content/send-from-row/send-from-row.component.js index b6de9d2221eb..f8aa084d8198 100644 --- a/ui/app/components/send/send-content/send-from-row/send-from-row.component.js +++ b/ui/app/components/send/send-content/send-from-row/send-from-row.component.js @@ -1,64 +1,27 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import SendRowWrapper from '../send-row-wrapper/' -import FromDropdown from './from-dropdown/' +import AccountListItem from '../../account-list-item' export default class SendFromRow extends Component { - static propTypes = { - closeFromDropdown: PropTypes.func, - conversionRate: PropTypes.number, from: PropTypes.object, - fromAccounts: PropTypes.array, - fromDropdownOpen: PropTypes.bool, - openFromDropdown: PropTypes.func, - tokenContract: PropTypes.object, - updateSendFrom: PropTypes.func, - setSendTokenBalance: PropTypes.func, } static contextTypes = { t: PropTypes.func, } - async handleFromChange (newFrom) { - const { - updateSendFrom, - tokenContract, - setSendTokenBalance, - } = this.props - - if (tokenContract) { - const usersToken = await tokenContract.balanceOf(newFrom.address) - setSendTokenBalance(usersToken) - } - - updateSendFrom(newFrom) - } - render () { - const { - closeFromDropdown, - conversionRate, - from, - fromAccounts, - fromDropdownOpen, - openFromDropdown, - } = this.props + const { t } = this.context + const { from } = this.props return ( - - closeFromDropdown()} - conversionRate={conversionRate} - dropdownOpen={fromDropdownOpen} - onSelect={newFrom => this.handleFromChange(newFrom)} - openDropdown={() => openFromDropdown()} - selectedAccount={from} - /> + +
+ +
) } - } diff --git a/ui/app/components/send/send-content/send-from-row/send-from-row.container.js b/ui/app/components/send/send-content/send-from-row/send-from-row.container.js index 7008bbea42e3..fe3ac9aa19f7 100644 --- a/ui/app/components/send/send-content/send-from-row/send-from-row.container.js +++ b/ui/app/components/send/send-content/send-from-row/send-from-row.container.js @@ -1,46 +1,11 @@ import { connect } from 'react-redux' -import { - accountsWithSendEtherInfoSelector, - getConversionRate, - getSelectedTokenContract, - getSendFromObject, -} from '../../send.selectors.js' -import { - getFromDropdownOpen, -} from './send-from-row.selectors.js' -import { calcTokenBalance } from '../../send.utils.js' -import { - updateSendFrom, - setSendTokenBalance, -} from '../../../../actions' -import { - closeFromDropdown, - openFromDropdown, -} from '../../../../ducks/send.duck' +import { getSendFromObject } from '../../send.selectors.js' import SendFromRow from './send-from-row.component' -export default connect(mapStateToProps, mapDispatchToProps)(SendFromRow) - function mapStateToProps (state) { return { - conversionRate: getConversionRate(state), from: getSendFromObject(state), - fromAccounts: accountsWithSendEtherInfoSelector(state), - fromDropdownOpen: getFromDropdownOpen(state), - tokenContract: getSelectedTokenContract(state), } } -function mapDispatchToProps (dispatch) { - return { - closeFromDropdown: () => dispatch(closeFromDropdown()), - openFromDropdown: () => dispatch(openFromDropdown()), - updateSendFrom: newFrom => dispatch(updateSendFrom(newFrom)), - setSendTokenBalance: (usersToken, selectedToken) => { - if (!usersToken) return - - const tokenBalance = calcTokenBalance({ usersToken, selectedToken }) - dispatch(setSendTokenBalance(tokenBalance)) - }, - } -} +export default connect(mapStateToProps)(SendFromRow) diff --git a/ui/app/components/send/send-content/send-from-row/tests/send-from-row-component.test.js b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-component.test.js index 9ba8d1739aae..18811c57e38a 100644 --- a/ui/app/components/send/send-content/send-from-row/tests/send-from-row-component.test.js +++ b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-component.test.js @@ -1,121 +1,31 @@ import React from 'react' import assert from 'assert' import { shallow } from 'enzyme' -import sinon from 'sinon' import SendFromRow from '../send-from-row.component.js' - +import AccountListItem from '../../../account-list-item' import SendRowWrapper from '../../send-row-wrapper/send-row-wrapper.component' -import FromDropdown from '../from-dropdown/from-dropdown.component' - -const propsMethodSpies = { - closeFromDropdown: sinon.spy(), - openFromDropdown: sinon.spy(), - updateSendFrom: sinon.spy(), - setSendTokenBalance: sinon.spy(), -} - -sinon.spy(SendFromRow.prototype, 'handleFromChange') describe('SendFromRow Component', function () { - let wrapper - let instance - - beforeEach(() => { - wrapper = shallow(, { context: { t: str => str + '_t' } }) - instance = wrapper.instance() - }) - - afterEach(() => { - propsMethodSpies.closeFromDropdown.resetHistory() - propsMethodSpies.openFromDropdown.resetHistory() - propsMethodSpies.updateSendFrom.resetHistory() - propsMethodSpies.setSendTokenBalance.resetHistory() - SendFromRow.prototype.handleFromChange.resetHistory() - }) - - describe('handleFromChange', () => { - - it('should call updateSendFrom', () => { - assert.equal(propsMethodSpies.updateSendFrom.callCount, 0) - instance.handleFromChange('mockFrom') - assert.equal(propsMethodSpies.updateSendFrom.callCount, 1) - assert.deepEqual( - propsMethodSpies.updateSendFrom.getCall(0).args, - ['mockFrom'] - ) - }) - - it('should call tokenContract.balanceOf and setSendTokenBalance if tokenContract is defined', async () => { - wrapper.setProps({ - tokenContract: { - balanceOf: () => new Promise((resolve) => resolve('mockUsersToken')), - }, - }) - assert.equal(propsMethodSpies.setSendTokenBalance.callCount, 0) - await instance.handleFromChange('mockFrom') - assert.equal(propsMethodSpies.setSendTokenBalance.callCount, 1) - assert.deepEqual( - propsMethodSpies.setSendTokenBalance.getCall(0).args, - ['mockUsersToken'] - ) - }) - - }) - describe('render', () => { + const wrapper = shallow( + , + { context: { t: str => str + '_t' } } + ) + it('should render a SendRowWrapper component', () => { assert.equal(wrapper.find(SendRowWrapper).length, 1) }) it('should pass the correct props to SendRowWrapper', () => { - const { - label, - } = wrapper.find(SendRowWrapper).props() - + const { label } = wrapper.find(SendRowWrapper).props() assert.equal(label, 'from_t:') }) - it('should render an FromDropdown as a child of the SendRowWrapper', () => { - assert(wrapper.find(SendRowWrapper).childAt(0).is(FromDropdown)) - }) - it('should render the FromDropdown with the correct props', () => { - const { - accounts, - closeDropdown, - conversionRate, - dropdownOpen, - onSelect, - openDropdown, - selectedAccount, - } = wrapper.find(SendRowWrapper).childAt(0).props() - assert.deepEqual(accounts, ['mockAccount']) - assert.equal(dropdownOpen, false) - assert.equal(conversionRate, 15) - assert.deepEqual(selectedAccount, { address: 'mockAddress' }) - assert.equal(propsMethodSpies.closeFromDropdown.callCount, 0) - closeDropdown() - assert.equal(propsMethodSpies.closeFromDropdown.callCount, 1) - assert.equal(propsMethodSpies.openFromDropdown.callCount, 0) - openDropdown() - assert.equal(propsMethodSpies.openFromDropdown.callCount, 1) - assert.equal(SendFromRow.prototype.handleFromChange.callCount, 0) - onSelect('mockNewFrom') - assert.equal(SendFromRow.prototype.handleFromChange.callCount, 1) - assert.deepEqual( - SendFromRow.prototype.handleFromChange.getCall(0).args, - ['mockNewFrom'] - ) + const { account } = wrapper.find(AccountListItem).props() + assert.deepEqual(account, { address: 'mockAddress' }) }) }) }) diff --git a/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js index e080b2fe3a12..fd771ea775fe 100644 --- a/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js +++ b/ui/app/components/send/send-content/send-from-row/tests/send-from-row-container.test.js @@ -1,110 +1,26 @@ import assert from 'assert' import proxyquire from 'proxyquire' -import sinon from 'sinon' let mapStateToProps -let mapDispatchToProps - -const actionSpies = { - updateSendFrom: sinon.spy(), - setSendTokenBalance: sinon.spy(), -} -const duckActionSpies = { - closeFromDropdown: sinon.spy(), - openFromDropdown: sinon.spy(), -} proxyquire('../send-from-row.container.js', { 'react-redux': { - connect: (ms, md) => { + connect: ms => { mapStateToProps = ms - mapDispatchToProps = md return () => ({}) }, }, '../../send.selectors.js': { - accountsWithSendEtherInfoSelector: (s) => `mockFromAccounts:${s}`, - getConversionRate: (s) => `mockConversionRate:${s}`, - getSelectedTokenContract: (s) => `mockTokenContract:${s}`, getSendFromObject: (s) => `mockFrom:${s}`, }, - './send-from-row.selectors.js': { getFromDropdownOpen: (s) => `mockFromDropdownOpen:${s}` }, - '../../send.utils.js': { calcTokenBalance: ({ usersToken, selectedToken }) => usersToken + selectedToken }, - '../../../../actions': actionSpies, - '../../../../ducks/send.duck': duckActionSpies, }) describe('send-from-row container', () => { - describe('mapStateToProps()', () => { - it('should map the correct properties to props', () => { assert.deepEqual(mapStateToProps('mockState'), { - conversionRate: 'mockConversionRate:mockState', from: 'mockFrom:mockState', - fromAccounts: 'mockFromAccounts:mockState', - fromDropdownOpen: 'mockFromDropdownOpen:mockState', - tokenContract: 'mockTokenContract:mockState', - }) - }) - - }) - - describe('mapDispatchToProps()', () => { - let dispatchSpy - let mapDispatchToPropsObject - - beforeEach(() => { - dispatchSpy = sinon.spy() - mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy) - }) - - describe('closeFromDropdown()', () => { - it('should dispatch a closeFromDropdown action', () => { - mapDispatchToPropsObject.closeFromDropdown() - assert(dispatchSpy.calledOnce) - assert(duckActionSpies.closeFromDropdown.calledOnce) - assert.equal( - duckActionSpies.closeFromDropdown.getCall(0).args[0], - undefined - ) }) }) - - describe('openFromDropdown()', () => { - it('should dispatch a openFromDropdown action', () => { - mapDispatchToPropsObject.openFromDropdown() - assert(dispatchSpy.calledOnce) - assert(duckActionSpies.openFromDropdown.calledOnce) - assert.equal( - duckActionSpies.openFromDropdown.getCall(0).args[0], - undefined - ) - }) - }) - - describe('updateSendFrom()', () => { - it('should dispatch an updateSendFrom action', () => { - mapDispatchToPropsObject.updateSendFrom('mockFrom') - assert(dispatchSpy.calledOnce) - assert.equal( - actionSpies.updateSendFrom.getCall(0).args[0], - 'mockFrom' - ) - }) - }) - - describe('setSendTokenBalance()', () => { - it('should dispatch an setSendTokenBalance action', () => { - mapDispatchToPropsObject.setSendTokenBalance('mockUsersToken', 'mockSelectedToken') - assert(dispatchSpy.calledOnce) - assert.equal( - actionSpies.setSendTokenBalance.getCall(0).args[0], - 'mockUsersTokenmockSelectedToken' - ) - }) - }) - }) - }) diff --git a/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.component.js b/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.component.js index b7528a15f144..04f4f8a15d99 100644 --- a/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.component.js +++ b/ui/app/components/send/send-content/send-row-wrapper/send-row-wrapper.component.js @@ -29,12 +29,12 @@ export default class SendRowWrapper extends Component { return (
- {label} - {showError && } - {customLabelContent} + {label} + {showError && } + {customLabelContent}
- {formField} + {formField}
) diff --git a/ui/app/ducks/send.duck.js b/ui/app/ducks/send.duck.js index 758916d48744..4d212bd03199 100644 --- a/ui/app/ducks/send.duck.js +++ b/ui/app/ducks/send.duck.js @@ -62,14 +62,6 @@ export default function reducer ({ send: sendState = initState }, action = {}) { } // Action Creators -export function openFromDropdown () { - return { type: OPEN_FROM_DROPDOWN } -} - -export function closeFromDropdown () { - return { type: CLOSE_FROM_DROPDOWN } -} - export function openToDropdown () { return { type: OPEN_TO_DROPDOWN } } diff --git a/ui/app/ducks/tests/send-duck.test.js b/ui/app/ducks/tests/send-duck.test.js index 196fe226c107..ffd8bfb4b199 100644 --- a/ui/app/ducks/tests/send-duck.test.js +++ b/ui/app/ducks/tests/send-duck.test.js @@ -1,8 +1,6 @@ import assert from 'assert' import SendReducer, { - openFromDropdown, - closeFromDropdown, openToDropdown, closeToDropdown, updateSendErrors, @@ -140,20 +138,6 @@ describe('Send Duck', () => { }) }) - describe('openFromDropdown', () => { - assert.deepEqual( - openFromDropdown(), - { type: OPEN_FROM_DROPDOWN } - ) - }) - - describe('closeFromDropdown', () => { - assert.deepEqual( - closeFromDropdown(), - { type: CLOSE_FROM_DROPDOWN } - ) - }) - describe('openToDropdown', () => { assert.deepEqual( openToDropdown(),