aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <542863+danfinlay@users.noreply.github.com>2018-04-18 04:36:21 +0800
committerGitHub <noreply@github.com>2018-04-18 04:36:21 +0800
commit6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8 (patch)
tree096c6a8f7e12c5ece8bb64af1466bb2d94b6e5d3 /ui
parentf15b81089e86dc095983faeba4a97209ddd670ce (diff)
parent7b70804aa0d74120098a4bcb2c375d29080e8368 (diff)
downloadtangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.tar
tangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.tar.gz
tangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.tar.bz2
tangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.tar.lz
tangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.tar.xz
tangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.tar.zst
tangerine-wallet-browser-6ee57dcad70057b1f71b9abe53d9d4965cbbe3e8.zip
Merge branch 'master' into i3580-InternationalizeCurrency
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js25
-rw-r--r--ui/app/app.js1
-rw-r--r--ui/app/components/ens-input.js1
-rw-r--r--ui/app/components/modals/modal.js11
-rw-r--r--ui/app/components/pages/home.js1
-rw-r--r--ui/app/components/pages/keychains/restore-vault.js1
-rw-r--r--ui/app/components/pages/unlock.js5
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js8
-rw-r--r--ui/app/components/send/send-v2-container.js1
-rw-r--r--ui/app/components/token-balance.js1
-rw-r--r--ui/app/components/token-cell.js20
-rw-r--r--ui/app/components/token-list.js1
-rw-r--r--ui/app/components/tx-list-item.js18
-rw-r--r--ui/app/conf-tx.js1
-rw-r--r--ui/app/first-time/init-menu.js5
-rw-r--r--ui/app/keychains/hd/restore-vault.js1
-rw-r--r--ui/app/main-container.js1
-rw-r--r--ui/app/reducers/app.js1
-rw-r--r--ui/app/reducers/metamask.js17
-rw-r--r--ui/app/selectors.js19
-rw-r--r--ui/app/send-v2.js11
-rw-r--r--ui/app/unlock.js5
-rw-r--r--ui/index.js3
-rw-r--r--ui/lib/tx-helper.js1
24 files changed, 52 insertions, 107 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 0748a5bea..f5cdd32bc 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -3,6 +3,7 @@ const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url')
const { getTokenAddressFromTokenObject } = require('./util')
const ethUtil = require('ethereumjs-util')
const { fetchLocale } = require('../i18n-helper')
+const log = require('loglevel')
var actions = {
_setBackgroundConnection: _setBackgroundConnection,
@@ -220,8 +221,6 @@ var actions = {
coinBaseSubview: coinBaseSubview,
SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW',
shapeShiftSubview: shapeShiftSubview,
- UPDATE_TOKEN_EXCHANGE_RATE: 'UPDATE_TOKEN_EXCHANGE_RATE',
- updateTokenExchangeRate,
PAIR_UPDATE: 'PAIR_UPDATE',
pairUpdate: pairUpdate,
coinShiftRquest: coinShiftRquest,
@@ -1751,28 +1750,6 @@ function shapeShiftRequest (query, options, cb) {
}
}
-function updateTokenExchangeRate (token = '') {
- const pair = `${token.toLowerCase()}_eth`
-
- return dispatch => {
- if (!token) {
- return
- }
-
- shapeShiftRequest('marketinfo', { pair }, marketinfo => {
- if (!marketinfo.error) {
- dispatch({
- type: actions.UPDATE_TOKEN_EXCHANGE_RATE,
- payload: {
- pair,
- marketinfo,
- },
- })
- }
- })
- }
-}
-
function setFeatureFlag (feature, activated, notificationType) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
diff --git a/ui/app/app.js b/ui/app/app.js
index 75c3febb0..827b4e9ce 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -6,6 +6,7 @@ const { compose } = require('recompose')
const h = require('react-hyperscript')
const actions = require('./actions')
const classnames = require('classnames')
+const log = require('loglevel')
// init
const InitializeScreen = require('../../mascara/src/app/first-time').default
diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js
index feb0a7037..aff4b6ef6 100644
--- a/ui/app/components/ens-input.js
+++ b/ui/app/components/ens-input.js
@@ -11,6 +11,7 @@ const ensRE = /.+\..+$/
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const connect = require('react-redux').connect
const ToAutoComplete = require('./send/to-autocomplete')
+const log = require('loglevel')
EnsInput.contextTypes = {
t: PropTypes.func,
diff --git a/ui/app/components/modals/modal.js b/ui/app/components/modals/modal.js
index 9250cc77e..43dcd20ae 100644
--- a/ui/app/components/modals/modal.js
+++ b/ui/app/components/modals/modal.js
@@ -5,7 +5,8 @@ const connect = require('react-redux').connect
const FadeModal = require('boron').FadeModal
const actions = require('../../actions')
const isMobileView = require('../../../lib/is-mobile-view')
-const isPopupOrNotification = require('../../../../app/scripts/lib/is-popup-or-notification')
+const { getEnvironmentType } = require('../../../../app/scripts/lib/util')
+const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
// Modal Components
const BuyOptions = require('./buy-options-modal')
@@ -162,7 +163,7 @@ const MODALS = {
],
mobileModalStyle: {
width: '95%',
- top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
+ top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '449px',
@@ -179,7 +180,7 @@ const MODALS = {
],
mobileModalStyle: {
width: '95%',
- top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
+ top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '449px',
@@ -196,7 +197,7 @@ const MODALS = {
],
mobileModalStyle: {
width: '95%',
- top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
+ top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '449px',
@@ -208,7 +209,7 @@ const MODALS = {
contents: h(ConfirmResetAccount),
mobileModalStyle: {
width: '95%',
- top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
+ top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '473px',
diff --git a/ui/app/components/pages/home.js b/ui/app/components/pages/home.js
index 7857a2a99..90b8e1d37 100644
--- a/ui/app/components/pages/home.js
+++ b/ui/app/components/pages/home.js
@@ -5,6 +5,7 @@ const { Redirect, withRouter } = require('react-router-dom')
const { compose } = require('recompose')
const h = require('react-hyperscript')
const actions = require('../../actions')
+const log = require('loglevel')
// init
const NewKeyChainScreen = require('../../new-keychain')
diff --git a/ui/app/components/pages/keychains/restore-vault.js b/ui/app/components/pages/keychains/restore-vault.js
index d57894e00..33575bfbb 100644
--- a/ui/app/components/pages/keychains/restore-vault.js
+++ b/ui/app/components/pages/keychains/restore-vault.js
@@ -6,6 +6,7 @@ const connect = require('../../../metamask-connect')
const h = require('react-hyperscript')
const { createNewVaultAndRestore, unMarkPasswordForgotten } = require('../../../actions')
const { DEFAULT_ROUTE } = require('../../../routes')
+const log = require('loglevel')
class RestoreVaultPage extends PersistentForm {
constructor (props) {
diff --git a/ui/app/components/pages/unlock.js b/ui/app/components/pages/unlock.js
index b3320da21..567b72518 100644
--- a/ui/app/components/pages/unlock.js
+++ b/ui/app/components/pages/unlock.js
@@ -11,7 +11,8 @@ const {
setNetworkEndpoints,
setFeatureFlag,
} = require('../../actions')
-const environmentType = require('../../../../app/scripts/lib/environment-type')
+const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
+const { getEnvironmentType } = require('../../../../app/scripts/lib/util')
const getCaretCoordinates = require('textarea-caret')
const EventEmitter = require('events').EventEmitter
const Mascot = require('../mascot')
@@ -131,7 +132,7 @@ class UnlockScreen extends Component {
this.props.markPasswordForgotten()
this.props.history.push(RESTORE_VAULT_ROUTE)
- if (environmentType() === 'popup') {
+ if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP) {
global.platform.openExtensionInBrowser()
}
},
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index 3d59ab3fd..656093b3d 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -50,7 +50,7 @@ module.exports = compose(
function mapStateToProps (state, ownProps) {
- const { token: { symbol }, txData } = ownProps
+ const { token: { address }, txData } = ownProps
const { txParams } = txData || {}
const tokenData = txParams.data && abiDecoder.decodeMethod(txParams.data)
@@ -61,7 +61,7 @@ function mapStateToProps (state, ownProps) {
} = state.metamask
const accounts = state.metamask.accounts
const selectedAddress = getSelectedAddress(state)
- const tokenExchangeRate = getTokenExchangeRate(state, symbol)
+ const tokenExchangeRate = getTokenExchangeRate(state, address)
const { balance } = accounts[selectedAddress]
return {
conversionRate,
@@ -77,12 +77,9 @@ function mapStateToProps (state, ownProps) {
}
function mapDispatchToProps (dispatch, ownProps) {
- const { token: { symbol } } = ownProps
-
return {
backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })),
- updateTokenExchangeRate: () => dispatch(actions.updateTokenExchangeRate(symbol)),
editTransaction: txMeta => {
const { token: { address } } = ownProps
const { txParams = {}, id } = txMeta
@@ -205,7 +202,6 @@ ConfirmSendToken.prototype.componentWillMount = function () {
.balanceOf(selectedAddress)
.then(usersToken => {
})
- this.props.updateTokenExchangeRate()
this.updateComponentSendErrors({})
}
diff --git a/ui/app/components/send/send-v2-container.js b/ui/app/components/send/send-v2-container.js
index aca1a5a0a..adfc91240 100644
--- a/ui/app/components/send/send-v2-container.js
+++ b/ui/app/components/send/send-v2-container.js
@@ -66,7 +66,6 @@ function mapDispatchToProps (dispatch) {
showCustomizeGasModal: () => dispatch(actions.showModal({ name: 'CUSTOMIZE_GAS' })),
estimateGas: params => dispatch(actions.estimateGas(params)),
getGasPrice: () => dispatch(actions.getGasPrice()),
- updateTokenExchangeRate: token => dispatch(actions.updateTokenExchangeRate(token)),
signTokenTx: (tokenAddress, toAddress, amount, txData) => (
dispatch(actions.signTokenTx(tokenAddress, toAddress, amount, txData))
),
diff --git a/ui/app/components/token-balance.js b/ui/app/components/token-balance.js
index 2f71c0687..1900ccec7 100644
--- a/ui/app/components/token-balance.js
+++ b/ui/app/components/token-balance.js
@@ -4,6 +4,7 @@ const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker')
const connect = require('react-redux').connect
const selectors = require('../selectors')
+const log = require('loglevel')
function mapStateToProps (state) {
return {
diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js
index 0332fde88..c84117d84 100644
--- a/ui/app/components/token-cell.js
+++ b/ui/app/components/token-cell.js
@@ -16,7 +16,7 @@ function mapStateToProps (state) {
currentCurrency: state.metamask.currentCurrency,
selectedTokenAddress: state.metamask.selectedTokenAddress,
userAddress: selectors.getSelectedAddress(state),
- tokenExchangeRates: state.metamask.tokenExchangeRates,
+ contractExchangeRates: state.metamask.contractExchangeRates,
conversionRate: state.metamask.conversionRate,
sidebarOpen: state.appState.sidebarOpen,
}
@@ -25,7 +25,6 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
setSelectedToken: address => dispatch(actions.setSelectedToken(address)),
- updateTokenExchangeRate: token => dispatch(actions.updateTokenExchangeRate(token)),
hideSidebar: () => dispatch(actions.hideSidebar()),
}
}
@@ -41,15 +40,6 @@ function TokenCell () {
}
}
-TokenCell.prototype.componentWillMount = function () {
- const {
- updateTokenExchangeRate,
- symbol,
- } = this.props
-
- updateTokenExchangeRate(symbol)
-}
-
TokenCell.prototype.render = function () {
const { tokenMenuOpen } = this.state
const props = this.props
@@ -60,7 +50,7 @@ TokenCell.prototype.render = function () {
network,
setSelectedToken,
selectedTokenAddress,
- tokenExchangeRates,
+ contractExchangeRates,
conversionRate,
hideSidebar,
sidebarOpen,
@@ -68,15 +58,13 @@ TokenCell.prototype.render = function () {
// userAddress,
} = props
- const pair = `${symbol.toLowerCase()}_eth`
-
let currentTokenToFiatRate
let currentTokenInFiat
let formattedFiat = ''
- if (tokenExchangeRates[pair]) {
+ if (contractExchangeRates[address]) {
currentTokenToFiatRate = multiplyCurrencies(
- tokenExchangeRates[pair].rate,
+ contractExchangeRates[address],
conversionRate
)
currentTokenInFiat = conversionUtil(string, {
diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js
index 150a3762d..4189cf801 100644
--- a/ui/app/components/token-list.js
+++ b/ui/app/components/token-list.js
@@ -6,6 +6,7 @@ const TokenTracker = require('eth-token-tracker')
const TokenCell = require('./token-cell.js')
const connect = require('react-redux').connect
const selectors = require('../selectors')
+const log = require('loglevel')
function mapStateToProps (state) {
return {
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js
index 42c008798..403f83ab9 100644
--- a/ui/app/components/tx-list-item.js
+++ b/ui/app/components/tx-list-item.js
@@ -27,7 +27,7 @@ function mapStateToProps (state) {
return {
tokens: state.metamask.tokens,
currentCurrency: getCurrentCurrency(state),
- tokenExchangeRates: state.metamask.tokenExchangeRates,
+ contractExchangeRates: state.metamask.contractExchangeRates,
selectedAddressTxList: state.metamask.selectedAddressTxList,
}
}
@@ -142,31 +142,29 @@ TxListItem.prototype.getTokenInfo = async function () {
({ decimals, symbol } = await tokenInfoGetter(toAddress))
}
- return { decimals, symbol }
+ return { decimals, symbol, address: toAddress }
}
TxListItem.prototype.getSendTokenTotal = async function () {
const {
txParams = {},
conversionRate,
- tokenExchangeRates,
+ contractExchangeRates,
currentCurrency,
} = this.props
const decodedData = txParams.data && abiDecoder.decodeMethod(txParams.data)
const { params = [] } = decodedData || {}
const { value } = params[1] || {}
- const { decimals, symbol } = await this.getTokenInfo()
+ const { decimals, symbol, address } = await this.getTokenInfo()
const total = calcTokenAmount(value, decimals)
- const pair = symbol && `${symbol.toLowerCase()}_eth`
-
let tokenToFiatRate
let totalInFiat
- if (tokenExchangeRates[pair]) {
+ if (contractExchangeRates[address]) {
tokenToFiatRate = multiplyCurrencies(
- tokenExchangeRates[pair].rate,
+ contractExchangeRates[address],
conversionRate
)
@@ -220,7 +218,6 @@ TxListItem.prototype.resubmit = function () {
TxListItem.prototype.render = function () {
const {
transactionStatus,
- transactionAmount,
onClick,
transactionId,
dateString,
@@ -229,7 +226,6 @@ TxListItem.prototype.render = function () {
txParams,
} = this.props
const { total, fiatTotal, isTokenTx } = this.state
- const showFiatTotal = transactionAmount !== '0x0' && fiatTotal
return h(`div${className || ''}`, {
key: transactionId,
@@ -288,7 +284,7 @@ TxListItem.prototype.render = function () {
h('span.tx-list-value', total),
- showFiatTotal && h('span.tx-list-fiat-value', fiatTotal),
+ fiatTotal && h('span.tx-list-fiat-value', fiatTotal),
]),
]),
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index fee7cd36f..b71538e31 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -6,6 +6,7 @@ const { withRouter } = require('react-router-dom')
const { compose } = require('recompose')
const actions = require('./actions')
const txHelper = require('../lib/tx-helper')
+const log = require('loglevel')
const PendingTx = require('./components/pending-tx')
const SignatureRequest = require('./components/signature-request')
diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js
index 692b01c8c..3df040922 100644
--- a/ui/app/first-time/init-menu.js
+++ b/ui/app/first-time/init-menu.js
@@ -8,7 +8,8 @@ const actions = require('../actions')
const Tooltip = require('../components/tooltip')
const getCaretCoordinates = require('textarea-caret')
const { RESTORE_VAULT_ROUTE, DEFAULT_ROUTE } = require('../routes')
-const environmentType = require('../../../app/scripts/lib/environment-type')
+const { getEnvironmentType } = require('../../../app/scripts/lib/util')
+const { ENVIRONMENT_TYPE_POPUP } = require('../../../app/scripts/lib/enums')
const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums
class InitializeMenuScreen extends Component {
@@ -180,7 +181,7 @@ class InitializeMenuScreen extends Component {
showRestoreVault () {
this.props.markPasswordForgotten()
- if (environmentType() === 'popup') {
+ if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP) {
global.platform.openExtensionInBrowser()
}
diff --git a/ui/app/keychains/hd/restore-vault.js b/ui/app/keychains/hd/restore-vault.js
index 38ad14adb..913d20505 100644
--- a/ui/app/keychains/hd/restore-vault.js
+++ b/ui/app/keychains/hd/restore-vault.js
@@ -4,6 +4,7 @@ const PersistentForm = require('../../../lib/persistent-form')
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const actions = require('../../actions')
+const log = require('loglevel')
RestoreVaultScreen.contextTypes = {
t: PropTypes.func,
diff --git a/ui/app/main-container.js b/ui/app/main-container.js
index 6dd4ff151..c305687ea 100644
--- a/ui/app/main-container.js
+++ b/ui/app/main-container.js
@@ -4,6 +4,7 @@ const inherits = require('util').inherits
const AccountAndTransactionDetails = require('./account-and-transaction-details')
const Settings = require('./components/pages/settings')
const UnlockScreen = require('./components/pages/unlock')
+const log = require('loglevel')
module.exports = MainContainer
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 74a0f9299..2b39eb8db 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -1,6 +1,7 @@
const extend = require('xtend')
const actions = require('../actions')
const txHelper = require('../../lib/tx-helper')
+const log = require('loglevel')
module.exports = reduceApp
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 6d0a5bb10..5f965fbe0 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -1,7 +1,8 @@
const extend = require('xtend')
const actions = require('../actions')
const MetamascaraPlatform = require('../../../app/scripts/platforms/window')
-const environmentType = require('../../../app/scripts/lib/environment-type')
+const { getEnvironmentType } = require('../../../app/scripts/lib/util')
+const { ENVIRONMENT_TYPE_POPUP } = require('../../../app/scripts/lib/enums')
const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums
module.exports = reduceMetamask
@@ -15,7 +16,7 @@ function reduceMetamask (state, action) {
isUnlocked: false,
isAccountMenuOpen: false,
isMascara: window.platform instanceof MetamascaraPlatform,
- isPopup: environmentType() === 'popup',
+ isPopup: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP,
rpcTarget: 'https://rawtestrpc.metamask.io/',
identities: {},
unapprovedTxs: {},
@@ -24,6 +25,7 @@ function reduceMetamask (state, action) {
frequentRpcList: [],
addressBook: [],
selectedTokenAddress: null,
+ contractExchangeRates: {},
tokenExchangeRates: {},
tokens: [],
send: {
@@ -176,15 +178,6 @@ function reduceMetamask (state, action) {
conversionDate: action.value.conversionDate,
})
- case actions.UPDATE_TOKEN_EXCHANGE_RATE:
- const { payload: { pair, marketinfo } } = action
- return extend(metamaskState, {
- tokenExchangeRates: {
- ...metamaskState.tokenExchangeRates,
- [pair]: marketinfo,
- },
- })
-
case actions.UPDATE_TOKENS:
return extend(metamaskState, {
tokens: action.newTokens,
@@ -358,7 +351,7 @@ function reduceMetamask (state, action) {
welcomeScreenSeen: true,
})
- case action.SET_CURRENT_LOCALE:
+ case actions.SET_CURRENT_LOCALE:
return extend(metamaskState, {
currentLocale: action.value,
})
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
index 2bdc39004..60cc264da 100644
--- a/ui/app/selectors.js
+++ b/ui/app/selectors.js
@@ -62,22 +62,15 @@ function getSelectedToken (state) {
}
function getSelectedTokenExchangeRate (state) {
- const tokenExchangeRates = state.metamask.tokenExchangeRates
+ const contractExchangeRates = state.metamask.contractExchangeRates
const selectedToken = getSelectedToken(state) || {}
- const { symbol = '' } = selectedToken
-
- const pair = `${symbol.toLowerCase()}_eth`
- const { rate: tokenExchangeRate = 0 } = tokenExchangeRates[pair] || {}
-
- return tokenExchangeRate
+ const { address } = selectedToken
+ return contractExchangeRates[address] || 0
}
-function getTokenExchangeRate (state, tokenSymbol) {
- const pair = `${tokenSymbol.toLowerCase()}_eth`
- const tokenExchangeRates = state.metamask.tokenExchangeRates
- const { rate: tokenExchangeRate = 0 } = tokenExchangeRates[pair] || {}
-
- return tokenExchangeRate
+function getTokenExchangeRate (state, address) {
+ const contractExchangeRates = state.metamask.contractExchangeRates
+ return contractExchangeRates[address] || 0
}
function conversionRateSelector (state) {
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js
index d0c28caa2..30d3d3152 100644
--- a/ui/app/send-v2.js
+++ b/ui/app/send-v2.js
@@ -88,17 +88,6 @@ SendTransactionScreen.prototype.updateSendTokenBalance = function (usersToken) {
}
SendTransactionScreen.prototype.componentWillMount = function () {
- const {
- updateTokenExchangeRate,
- selectedToken = {},
- } = this.props
-
- const { symbol } = selectedToken || {}
-
- if (symbol) {
- updateTokenExchangeRate(symbol)
- }
-
this.updateGas()
}
diff --git a/ui/app/unlock.js b/ui/app/unlock.js
index 84d8b7e7c..1325656af 100644
--- a/ui/app/unlock.js
+++ b/ui/app/unlock.js
@@ -7,7 +7,8 @@ const actions = require('./actions')
const getCaretCoordinates = require('textarea-caret')
const EventEmitter = require('events').EventEmitter
const { OLD_UI_NETWORK_TYPE } = require('../../app/scripts/config').enums
-const environmentType = require('../../app/scripts/lib/environment-type')
+const { getEnvironmentType } = require('../../app/scripts/lib/util')
+const { ENVIRONMENT_TYPE_POPUP } = require('../../app/scripts/lib/enums')
const Mascot = require('./components/mascot')
@@ -77,7 +78,7 @@ UnlockScreen.prototype.render = function () {
h('p.pointer', {
onClick: () => {
this.props.dispatch(actions.markPasswordForgotten())
- if (environmentType() === 'popup') {
+ if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP) {
global.platform.openExtensionInBrowser()
}
},
diff --git a/ui/index.js b/ui/index.js
index 746e28eab..7b6faac76 100644
--- a/ui/index.js
+++ b/ui/index.js
@@ -6,8 +6,7 @@ const configureStore = require('./app/store')
const txHelper = require('./lib/tx-helper')
const { fetchLocale } = require('./i18n-helper')
const { OLD_UI_NETWORK_TYPE, BETA_UI_NETWORK_TYPE } = require('../app/scripts/config').enums
-
-global.log = require('loglevel')
+const log = require('loglevel')
module.exports = launchMetamaskUi
diff --git a/ui/lib/tx-helper.js b/ui/lib/tx-helper.js
index de3f00d2d..0a6f55a63 100644
--- a/ui/lib/tx-helper.js
+++ b/ui/lib/tx-helper.js
@@ -1,4 +1,5 @@
const valuesFor = require('../app/util').valuesFor
+const log = require('loglevel')
module.exports = function (unapprovedTxs, unapprovedMsgs, personalMsgs, typedMessages, network) {
log.debug('tx-helper called with params:')