From 956482be96cb125a19ab73ce633b375fb97f95e9 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 14 Mar 2017 17:05:27 -0700 Subject: [PATCH 1/3] Fix development to use new currency state. --- development/states/account-detail-with-shapeshift-tx.json | 2 +- development/states/account-detail-with-transaction-history.json | 2 +- development/states/account-detail.json | 2 +- development/states/account-list-with-imported.json | 2 +- development/states/accounts-loose.json | 2 +- development/states/accounts.json | 2 +- development/states/compilation-bug.json | 2 +- development/states/conf-tx.json | 2 +- development/states/config.json | 2 +- development/states/first-time.json | 2 +- development/states/import-private-key-warning.json | 2 +- development/states/import-private-key.json | 2 +- development/states/locked.json | 2 +- development/states/lost-accounts.json | 2 +- development/states/new-account.json | 2 +- development/states/notice.json | 2 +- development/states/pending-signature.json | 2 +- development/states/pending-tx-insufficient.json | 2 +- development/states/personal-sign.json | 2 +- development/states/private-network.json | 2 +- development/states/restore-vault.json | 2 +- development/states/send.json | 2 +- development/states/shapeshift.json | 2 +- development/states/terms-and-conditions.json | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/development/states/account-detail-with-shapeshift-tx.json b/development/states/account-detail-with-shapeshift-tx.json index c14062350..97d5e9f06 100644 --- a/development/states/account-detail-with-shapeshift-tx.json +++ b/development/states/account-detail-with-shapeshift-tx.json @@ -1,6 +1,6 @@ { "metamask": { - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.06608791, "conversionDate": 1470421024, "isInitialized": true, diff --git a/development/states/account-detail-with-transaction-history.json b/development/states/account-detail-with-transaction-history.json index 8cb495656..a6bcc2658 100644 --- a/development/states/account-detail-with-transaction-history.json +++ b/development/states/account-detail-with-transaction-history.json @@ -1,6 +1,6 @@ { "metamask": { - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.06608791, "conversionDate": 1470421024, "isInitialized": true, diff --git a/development/states/account-detail.json b/development/states/account-detail.json index 644e3674d..6d11c1deb 100644 --- a/development/states/account-detail.json +++ b/development/states/account-detail.json @@ -1,6 +1,6 @@ { "metamask": { - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.06608791, "conversionDate": 1470421024, "isInitialized": true, diff --git a/development/states/account-list-with-imported.json b/development/states/account-list-with-imported.json index b450b4fb8..41d586db6 100644 --- a/development/states/account-list-with-imported.json +++ b/development/states/account-list-with-imported.json @@ -14,7 +14,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 10.19458075, "conversionDate": 1484696373, "noActiveNotices": true, diff --git a/development/states/accounts-loose.json b/development/states/accounts-loose.json index 542e207d4..df51f0d7e 100644 --- a/development/states/accounts-loose.json +++ b/development/states/accounts-loose.json @@ -30,7 +30,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 0, "conversionDate": "N/A", "noActiveNotices": true, diff --git a/development/states/accounts.json b/development/states/accounts.json index 4eef1145f..c8ff40ed9 100644 --- a/development/states/accounts.json +++ b/development/states/accounts.json @@ -41,7 +41,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.84461814, "conversionDate": 1476226414, "accounts": { diff --git a/development/states/compilation-bug.json b/development/states/compilation-bug.json index b33e59c5c..588d069d4 100644 --- a/development/states/compilation-bug.json +++ b/development/states/compilation-bug.json @@ -41,7 +41,7 @@ "simulationFails": true } }, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 7.69158136, "conversionDate": 1482279663, "noActiveNotices": true, diff --git a/development/states/conf-tx.json b/development/states/conf-tx.json index b44d23ad8..0f1a13751 100644 --- a/development/states/conf-tx.json +++ b/development/states/conf-tx.json @@ -48,7 +48,7 @@ "gasPrice": "4a817c800" } }, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 12.7200827, "conversionDate": 1487363041, "noActiveNotices": true, diff --git a/development/states/config.json b/development/states/config.json index de1df1831..551c0e3fa 100644 --- a/development/states/config.json +++ b/development/states/config.json @@ -1,6 +1,6 @@ { "metamask": { - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.06608791, "conversionDate": 1470421024, "isInitialized": true, diff --git a/development/states/first-time.json b/development/states/first-time.json index 3554ee911..683a61fdf 100644 --- a/development/states/first-time.json +++ b/development/states/first-time.json @@ -6,7 +6,7 @@ "identities": {}, "frequentRpcList": [], "unapprovedTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 12.7527416, "conversionDate": 1487624341, "noActiveNotices": false, diff --git a/development/states/import-private-key-warning.json b/development/states/import-private-key-warning.json index a2d33ed7f..80ebc650d 100644 --- a/development/states/import-private-key-warning.json +++ b/development/states/import-private-key-warning.json @@ -10,7 +10,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 10.1219126, "conversionDate": 1484695442, "noActiveNotices": true, diff --git a/development/states/import-private-key.json b/development/states/import-private-key.json index 73fbd68db..bd455c6d5 100644 --- a/development/states/import-private-key.json +++ b/development/states/import-private-key.json @@ -10,7 +10,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 10.10788584, "conversionDate": 1484694362, "noActiveNotices": true, diff --git a/development/states/locked.json b/development/states/locked.json index 8e6ed7860..866394e86 100644 --- a/development/states/locked.json +++ b/development/states/locked.json @@ -6,7 +6,7 @@ "rpcTarget": "https://rawtestrpc.metamask.io/", "identities": {}, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.4379398, "conversionDate": 1473358355, "accounts": {}, diff --git a/development/states/lost-accounts.json b/development/states/lost-accounts.json index dcba7a764..4f50092b0 100644 --- a/development/states/lost-accounts.json +++ b/development/states/lost-accounts.json @@ -1,6 +1,6 @@ { "metamask": { - "currentFiat": "USD", + "currentCurrency": "USD", "lostAccounts": [ "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", "0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b" diff --git a/development/states/new-account.json b/development/states/new-account.json index a056e14e7..dc2341b0e 100644 --- a/development/states/new-account.json +++ b/development/states/new-account.json @@ -14,7 +14,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 10.92067835, "conversionDate": 1478282884, "network": null, diff --git a/development/states/notice.json b/development/states/notice.json index 1cdcefcfb..efeffab08 100644 --- a/development/states/notice.json +++ b/development/states/notice.json @@ -9,7 +9,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 8.3533002, "conversionDate": 1481671082, "noActiveNotices": false, diff --git a/development/states/pending-signature.json b/development/states/pending-signature.json index 0d49e0229..7deaee8f7 100644 --- a/development/states/pending-signature.json +++ b/development/states/pending-signature.json @@ -22,7 +22,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.02269525, "conversionDate": 1472076963, "accounts": { diff --git a/development/states/pending-tx-insufficient.json b/development/states/pending-tx-insufficient.json index 10ecc826d..18be84089 100644 --- a/development/states/pending-tx-insufficient.json +++ b/development/states/pending-tx-insufficient.json @@ -31,7 +31,7 @@ "maxCost": "de234b52e4a0800" } }, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 12.59854817, "conversionDate": 1487662141, "noActiveNotices": true, diff --git a/development/states/personal-sign.json b/development/states/personal-sign.json index 2fc71f448..8ded6205c 100644 --- a/development/states/personal-sign.json +++ b/development/states/personal-sign.json @@ -18,7 +18,7 @@ } }, "unapprovedTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 13.2126613, "conversionDate": 1487888522, "noActiveNotices": true, diff --git a/development/states/private-network.json b/development/states/private-network.json index 155aa6584..8cdcb4eeb 100644 --- a/development/states/private-network.json +++ b/development/states/private-network.json @@ -16,7 +16,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 9.52855776, "conversionDate": 1479756513, "accounts": { diff --git a/development/states/restore-vault.json b/development/states/restore-vault.json index ad136c78e..0d6c2610d 100644 --- a/development/states/restore-vault.json +++ b/development/states/restore-vault.json @@ -6,7 +6,7 @@ "rpcTarget": "https://rawtestrpc.metamask.io/", "identities": {}, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 0, "conversionDate": "N/A", "accounts": {}, diff --git a/development/states/send.json b/development/states/send.json index 3f52185af..73ac62f65 100644 --- a/development/states/send.json +++ b/development/states/send.json @@ -22,7 +22,7 @@ } }, "unapprovedTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 16.88200327, "conversionDate": 1489013762, "noActiveNotices": true, diff --git a/development/states/shapeshift.json b/development/states/shapeshift.json index bc10143d0..bfd4b7c16 100644 --- a/development/states/shapeshift.json +++ b/development/states/shapeshift.json @@ -22,7 +22,7 @@ } }, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 11.21274318, "conversionDate": 1472159644, "accounts": { diff --git a/development/states/terms-and-conditions.json b/development/states/terms-and-conditions.json index b995e446f..f5ebe8254 100644 --- a/development/states/terms-and-conditions.json +++ b/development/states/terms-and-conditions.json @@ -5,7 +5,7 @@ "rpcTarget": "https://rawtestrpc.metamask.io/", "identities": {}, "unconfTxs": {}, - "currentFiat": "USD", + "currentCurrency": "USD", "conversionRate": 8.18703468, "conversionDate": 1481755832, "network": "3", From 177f2dc948f794f6796d74e3ef2a581048625bb1 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 14 Mar 2017 17:05:47 -0700 Subject: [PATCH 2/3] Fix description of some migrations. --- app/scripts/migrations/010.js | 2 +- app/scripts/migrations/011.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/migrations/010.js b/app/scripts/migrations/010.js index 48a841bc1..c0cc56ae4 100644 --- a/app/scripts/migrations/010.js +++ b/app/scripts/migrations/010.js @@ -2,7 +2,7 @@ const version = 10 /* -This migration breaks out the CurrencyController substate +This migration breaks out the ShapeShiftController substate */ diff --git a/app/scripts/migrations/011.js b/app/scripts/migrations/011.js index bf283ef98..0d5d6d307 100644 --- a/app/scripts/migrations/011.js +++ b/app/scripts/migrations/011.js @@ -2,7 +2,7 @@ const version = 11 /* -This migration breaks out the CurrencyController substate +This migration removes the discaimer state from our app, which was integrated into our notices. */ From 37ffcfcf0e518ed8843022cd079ce09d0b2239ff Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 14 Mar 2017 17:06:16 -0700 Subject: [PATCH 3/3] Rename variables to proper currency state variables. --- app/scripts/metamask-controller.js | 2 +- ui/app/actions.js | 8 ++++---- ui/app/components/fiat-value.js | 4 ++-- ui/app/config.js | 12 ++++++------ ui/app/reducers/metamask.js | 5 +---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 536891dc6..2eaa53200 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -621,7 +621,7 @@ module.exports = class MetamaskController extends EventEmitter { this.currencyController.updateConversionRate() const data = { conversionRate: this.currencyController.getConversionRate(), - currentFiat: this.currencyController.getCurrentCurrency(), + currentCurrency: this.currencyController.getCurrentCurrency(), conversionDate: this.currencyController.getConversionDate(), } cb(null, data) diff --git a/ui/app/actions.js b/ui/app/actions.js index d4fd7553b..0027a5f67 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -71,7 +71,7 @@ var actions = { SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE', SHOW_CONF_MSG_PAGE: 'SHOW_CONF_MSG_PAGE', SET_CURRENT_FIAT: 'SET_CURRENT_FIAT', - setCurrentFiat: setCurrentFiat, + setCurrentCurrency: setCurrentCurrency, // account detail screen SHOW_SEND_PAGE: 'SHOW_SEND_PAGE', showSendPage: showSendPage, @@ -328,10 +328,10 @@ function showInfoPage () { } } -function setCurrentFiat (currencyCode) { +function setCurrentCurrency (currencyCode) { return (dispatch) => { dispatch(this.showLoadingIndication()) - log.debug(`background.setCurrentFiat`) + log.debug(`background.setCurrentCurrency`) background.setCurrentCurrency(currencyCode, (err, data) => { dispatch(this.hideLoadingIndication()) if (err) { @@ -341,7 +341,7 @@ function setCurrentFiat (currencyCode) { dispatch({ type: this.SET_CURRENT_FIAT, value: { - currentFiat: data.currentFiat, + currentCurrency: data.currentCurrency, conversionRate: data.conversionRate, conversionDate: data.conversionDate, }, diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 13ee48245..298809b30 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -9,7 +9,7 @@ module.exports = connect(mapStateToProps)(FiatValue) function mapStateToProps (state) { return { conversionRate: state.metamask.conversionRate, - currentFiat: state.metamask.currentFiat, + currentCurrency: state.metamask.currentCurrency, } } @@ -34,7 +34,7 @@ FiatValue.prototype.render = function () { fiatTooltipNumber = 'Unknown' } - var fiatSuffix = props.currentFiat + var fiatSuffix = props.currentCurrency return fiatDisplay(fiatDisplayNumber, fiatSuffix) } diff --git a/ui/app/config.js b/ui/app/config.js index 00a4cba88..3f0507f48 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -125,19 +125,19 @@ function rpcValidation (newRpc, state) { } function currentConversionInformation (metamaskState, state) { - var currentFiat = metamaskState.currentFiat + var currentCurrency = metamaskState.currentCurrency var conversionDate = metamaskState.conversionDate return h('div', [ h('span', {style: { fontWeight: 'bold', paddingRight: '10px'}}, 'Current Conversion'), h('span', {style: { fontWeight: 'bold', paddingRight: '10px', fontSize: '13px'}}, `Updated ${Date(conversionDate)}`), - h('select#currentFiat', { + h('select#currentCurrency', { onChange (event) { event.preventDefault() - var element = document.getElementById('currentFiat') - var newFiat = element.value - state.dispatch(actions.setCurrentFiat(newFiat)) + var element = document.getElementById('currentCurrency') + var newCurrency = element.value + state.dispatch(actions.setCurrentCurrency(newCurrency)) }, - defaultValue: currentFiat, + defaultValue: currentCurrency, }, currencies.map((currency) => { return h('option', {key: currency.code, value: currency.code}, `${currency.code} - ${currency.name}`) }) diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index a3c07d977..269f8d272 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -13,9 +13,6 @@ function reduceMetamask (state, action) { rpcTarget: 'https://rawtestrpc.metamask.io/', identities: {}, unapprovedTxs: {}, - currentFiat: 'USD', - conversionRate: 0, - conversionDate: 'N/A', noActiveNotices: true, lastUnreadNotice: undefined, frequentRpcList: [], @@ -126,7 +123,7 @@ function reduceMetamask (state, action) { case actions.SET_CURRENT_FIAT: return extend(metamaskState, { - currentFiat: action.value.currentFiat, + currentCurrency: action.value.currentCurrency, conversionRate: action.value.conversionRate, conversionDate: action.value.conversionDate, })