Add data field to pass up parameters up to reducer.

feature/default_network_editable
Kevin Serrano 8 years ago
parent 491b9cddc5
commit 4a9d5b1c25
  1. 4
      app/scripts/lib/idStore.js
  2. 7
      app/scripts/metamask-controller.js
  3. 6
      ui/app/actions.js
  4. 6
      ui/app/reducers/metamask.js

@ -99,6 +99,8 @@ IdentityStore.prototype.getState = function () {
unconfMsgs: messageManager.unconfirmedMsgs(), unconfMsgs: messageManager.unconfirmedMsgs(),
messages: messageManager.getMsgList(), messages: messageManager.getMsgList(),
selectedAddress: configManager.getSelectedAccount(), selectedAddress: configManager.getSelectedAccount(),
currentFiat: configManager.getCurrentFiat(),
currentConversion: configManager.getConversionRate(),
})) }))
} }
@ -199,7 +201,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone
time: time, time: time,
status: 'unconfirmed', status: 'unconfirmed',
} }
console.log('addUnconfirmedTransaction:', txData) console.log('addUnconfirmedTransaction:', txData)
// keep the onTxDoneCb around for after approval/denial (requires user interaction) // keep the onTxDoneCb around for after approval/denial (requires user interaction)

@ -241,8 +241,13 @@ module.exports = class MetamaskController {
try { try {
this.configManager.setCurrentFiat(fiat) this.configManager.setCurrentFiat(fiat)
this.configManager.setConversionRate() this.configManager.setConversionRate()
const data = {
conversionRate: this.configManager.getConversionRate,
currentFiat: this.configManager.getCurrentFiat,
}
cb(data)
} catch (e) { } catch (e) {
cb(e) cb(null,e)
} }
} }

@ -212,10 +212,14 @@ function revealAccount () {
function setCurrentFiat (fiat) { function setCurrentFiat (fiat) {
return (dispatch) => { return (dispatch) => {
dispatch(this.showLoadingIndication()) dispatch(this.showLoadingIndication())
_accountManager.setCurrentFiat(fiat, (err) => { _accountManager.setCurrentFiat(fiat, (data, err) => {
dispatch(this.hideLoadingIndication()) dispatch(this.hideLoadingIndication())
dispatch({ dispatch({
type: this.SET_CURRENT_FIAT, type: this.SET_CURRENT_FIAT,
value: {
currentFiat: data.currentFiat,
conversionRate: data.conversionRate,
}
}) })
}) })
} }

@ -109,6 +109,12 @@ function reduceMetamask (state, action) {
var identities = extend(metamaskState.identities, id) var identities = extend(metamaskState.identities, id)
return extend(metamaskState, { identities }) return extend(metamaskState, { identities })
case actions.SET_CURRENT_FIAT:
return extend(metaMaskState, {
currentFiat: action.value.currentFiat,
conversionRate: action.value.conversionRate,
})
default: default:
return metamaskState return metamaskState

Loading…
Cancel
Save