From dd139452d053496d79816c881dbb59ee4aded81b Mon Sep 17 00:00:00 2001 From: Chen Wei Date: Tue, 2 Jul 2019 16:41:01 +0800 Subject: part of replacing 'ETH' --- ui/app/components/app/dropdowns/network-dropdown.js | 2 +- ui/app/components/app/signature-request.js | 2 +- .../currency-display/currency-display.component.js | 2 +- ui/app/ducks/gas/gas.duck.js | 20 -------------------- ui/app/helpers/constants/common.js | 2 +- ui/app/helpers/utils/confirm-tx.util.js | 8 ++++---- ui/app/helpers/utils/conversions.util.js | 2 +- ui/app/helpers/utils/util.js | 2 +- .../send-asset-row/send-asset-row.component.js | 4 ++-- .../settings/advanced-tab/advanced-tab.component.js | 2 +- .../settings/networks-tab/networks-tab.constants.js | 2 +- ui/app/selectors/selectors.js | 2 +- ui/app/store/actions.js | 6 +++--- 13 files changed, 18 insertions(+), 38 deletions(-) diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js index 8563f0771..78039ce4a 100644 --- a/ui/app/components/app/dropdowns/network-dropdown.js +++ b/ui/app/components/app/dropdowns/network-dropdown.js @@ -334,7 +334,7 @@ NetworkDropdown.prototype.renderCommonRpc = function (rpcListDetail, provider) { return reversedRpcListDetail.map((entry) => { const rpc = entry.rpcUrl - const ticker = entry.ticker || 'ETH' + const ticker = entry.ticker || 'TAN' const nickname = entry.nickname || '' const currentRpcTarget = provider.type === 'rpc' && rpc === provider.rpcTarget diff --git a/ui/app/components/app/signature-request.js b/ui/app/components/app/signature-request.js index fa237f1d1..40be80966 100644 --- a/ui/app/components/app/signature-request.js +++ b/ui/app/components/app/signature-request.js @@ -172,7 +172,7 @@ SignatureRequest.prototype.renderBalance = function () { h('div.request-signature__balance-text', `${this.context.t('balance')}:`), - h('div.request-signature__balance-value', `${balanceInEther} ETH`), + h('div.request-signature__balance-value', `${balanceInEther} TAN`), ]) } diff --git a/ui/app/components/ui/currency-display/currency-display.component.js b/ui/app/components/ui/currency-display/currency-display.component.js index c15668da3..066b6b2ac 100644 --- a/ui/app/components/ui/currency-display/currency-display.component.js +++ b/ui/app/components/ui/currency-display/currency-display.component.js @@ -24,7 +24,7 @@ export default class CurrencyDisplay extends PureComponent { const { className, displayValue, prefix, prefixComponent, style, suffix, hideTitle } = this.props const text = `${prefix || ''}${displayValue}` const title = suffix ? `${text} ${suffix}` : text - + console.log('suffix', suffix) return (
r.json()) -.then(({ result }) => { - console.log(result) - try { - const gasEstimate = parseInt(hexToNumberString(result).slice(0, -9)) - console.log('RES FROM TANGERINE RPC!!!!!', result, gasEstimate) - } catch (e) { - console.log('error', result, e) - } -}) - export function fetchBasicGasEstimates () { return (dispatch, getState) => { const { @@ -278,8 +260,6 @@ export function fetchBasicGasAndTimeEstimates () { fastest: gasEstimate * 2, } - console.log('!!!BASIC ESTIMATE GAS AND TIME: ', basicEstimates) - const timeRetrieved = Date.now() dispatch(setBasicApiEstimatesLastRetrieved(timeRetrieved)) saveLocalStorageData(timeRetrieved, 'BASIC_GAS_AND_TIME_API_ESTIMATES_LAST_RETRIEVED') diff --git a/ui/app/helpers/constants/common.js b/ui/app/helpers/constants/common.js index a0d6e65b3..6641faaae 100644 --- a/ui/app/helpers/constants/common.js +++ b/ui/app/helpers/constants/common.js @@ -1,4 +1,4 @@ -export const ETH = 'ETH' +export const ETH = 'TAN' export const GWEI = 'GWEI' export const WEI = 'WEI' diff --git a/ui/app/helpers/utils/confirm-tx.util.js b/ui/app/helpers/utils/confirm-tx.util.js index 853427b31..0751247c0 100644 --- a/ui/app/helpers/utils/confirm-tx.util.js +++ b/ui/app/helpers/utils/confirm-tx.util.js @@ -2,7 +2,7 @@ import currencyFormatter from 'currency-formatter' import currencies from 'currency-formatter/currencies' import ethUtil from 'ethereumjs-util' import BigNumber from 'bignumber.js' - +import { ETH } from '../constants/common' import { conversionUtil, addCurrencies, @@ -55,7 +55,7 @@ export function addFiat (...args) { export function getValueFromWeiHex ({ value, - fromCurrency = 'ETH', + fromCurrency = ETH, toCurrency, conversionRate, numberOfDecimals, @@ -75,7 +75,7 @@ export function getValueFromWeiHex ({ export function getTransactionFee ({ value, - fromCurrency = 'ETH', + fromCurrency = ETH, toCurrency, conversionRate, numberOfDecimals, @@ -101,7 +101,7 @@ export function formatCurrency (value, currencyCode) { export function convertTokenToFiat ({ value, - fromCurrency = 'ETH', + fromCurrency = ETH, toCurrency, conversionRate, contractExchangeRate, diff --git a/ui/app/helpers/utils/conversions.util.js b/ui/app/helpers/utils/conversions.util.js index 5e1c21ff7..030c57b87 100644 --- a/ui/app/helpers/utils/conversions.util.js +++ b/ui/app/helpers/utils/conversions.util.js @@ -105,7 +105,7 @@ export function decEthToConvertedCurrency (ethTotal, convertedCurrency, conversi return conversionUtil(ethTotal, { fromNumericBase: 'dec', toNumericBase: 'dec', - fromCurrency: 'ETH', + fromCurrency: ETH, toCurrency: convertedCurrency, numberOfDecimals: 2, conversionRate, diff --git a/ui/app/helpers/utils/util.js b/ui/app/helpers/utils/util.js index 94fa9ad42..5f9856965 100644 --- a/ui/app/helpers/utils/util.js +++ b/ui/app/helpers/utils/util.js @@ -137,7 +137,7 @@ function parseBalance (balance) { // Takes wei hex, returns an object with three properties. // Its "formatted" property is what we generally use to render values. -function formatBalance (balance, decimalsToKeep, needsParse = true, ticker = 'ETH') { +function formatBalance (balance, decimalsToKeep, needsParse = true, ticker = 'TAN') { var parsed = needsParse ? parseBalance(balance) : balance.split('.') var beforeDecimal = parsed[0] var afterDecimal = parsed[1] diff --git a/ui/app/pages/send/send-content/send-asset-row/send-asset-row.component.js b/ui/app/pages/send/send-content/send-asset-row/send-asset-row.component.js index de2d9462f..697b728a5 100644 --- a/ui/app/pages/send/send-content/send-asset-row/send-asset-row.component.js +++ b/ui/app/pages/send/send-content/send-asset-row/send-asset-row.component.js @@ -4,7 +4,7 @@ import SendRowWrapper from '../send-row-wrapper' import Identicon from '../../../../components/ui/identicon/identicon.component' import TokenBalance from '../../../../components/ui/token-balance' import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display' -import {PRIMARY} from '../../../../helpers/constants/common' +import {PRIMARY, ETH} from '../../../../helpers/constants/common' export default class SendAssetRow extends Component { static propTypes = { @@ -45,7 +45,7 @@ export default class SendAssetRow extends Component { name: 'User clicks "Assets" dropdown', }, customVariables: { - assetSelected: address ? 'ERC20' : 'ETH', + assetSelected: address ? 'ERC20' : ETH, }, }) this.props.setSelectedToken(address) diff --git a/ui/app/pages/settings/advanced-tab/advanced-tab.component.js b/ui/app/pages/settings/advanced-tab/advanced-tab.component.js index 3d27fe349..7b2afa9f4 100644 --- a/ui/app/pages/settings/advanced-tab/advanced-tab.component.js +++ b/ui/app/pages/settings/advanced-tab/advanced-tab.component.js @@ -138,7 +138,7 @@ export default class AdvancedTab extends PureComponent { ) } - validateRpc (newRpc, chainId, ticker = 'ETH', nickname) { + validateRpc (newRpc, chainId, ticker = 'TAN', nickname) { const { setRpcTarget, displayWarning } = this.props if (validUrl.isWebUri(newRpc)) { this.context.metricsEvent({ diff --git a/ui/app/pages/settings/networks-tab/networks-tab.constants.js b/ui/app/pages/settings/networks-tab/networks-tab.constants.js index 39e864d16..6bcf5c802 100644 --- a/ui/app/pages/settings/networks-tab/networks-tab.constants.js +++ b/ui/app/pages/settings/networks-tab/networks-tab.constants.js @@ -50,7 +50,7 @@ const defaultNetworksData = [ providerType: 'tangerine_testnet', rpcUrl: 'https://testnet-rpc.tangerine-network.io', chainId: '374', - ticker: 'ETH', + ticker: 'TAN', blockExplorerUrl: 'https://testnet.tangerine.garden', }, { diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 56591b7b0..2c45f3890 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -96,7 +96,7 @@ function getAccountType (state) { function getSelectedAsset (state) { const selectedToken = getSelectedToken(state) - return selectedToken && selectedToken.symbol || 'ETH' + return selectedToken && selectedToken.symbol || 'TAN' } function getCurrentNetworkId (state) { diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index d3cc7efca..5f22efce0 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -1982,7 +1982,7 @@ function setPreviousProvider (type) { } } -function updateAndSetCustomRpc (newRpc, chainId, ticker = 'ETH', nickname, rpcPrefs) { +function updateAndSetCustomRpc (newRpc, chainId, ticker = 'TAN', nickname, rpcPrefs) { return (dispatch) => { log.debug(`background.updateAndSetCustomRpc: ${newRpc} ${chainId} ${ticker} ${nickname}`) background.updateAndSetCustomRpc(newRpc, chainId, ticker, nickname || newRpc, rpcPrefs, (err) => { @@ -1998,7 +1998,7 @@ function updateAndSetCustomRpc (newRpc, chainId, ticker = 'ETH', nickname, rpcPr } } -function editRpc (oldRpc, newRpc, chainId, ticker = 'ETH', nickname, rpcPrefs) { +function editRpc (oldRpc, newRpc, chainId, ticker = 'TAN', nickname, rpcPrefs) { return (dispatch) => { log.debug(`background.delRpcTarget: ${oldRpc}`) background.delCustomRpc(oldRpc, (err) => { @@ -2021,7 +2021,7 @@ function editRpc (oldRpc, newRpc, chainId, ticker = 'ETH', nickname, rpcPrefs) { } } -function setRpcTarget (newRpc, chainId, ticker = 'ETH', nickname) { +function setRpcTarget (newRpc, chainId, ticker = 'TAN', nickname) { return (dispatch) => { log.debug(`background.setRpcTarget: ${newRpc} ${chainId} ${ticker} ${nickname}`) background.setCustomRpc(newRpc, chainId, ticker, nickname || newRpc, (err) => { -- cgit v1.2.3