From 9063fba5314a18e057125efcaaac2441e7d13a74 Mon Sep 17 00:00:00 2001 From: Chen Wei Date: Wed, 3 Jul 2019 14:12:31 +0800 Subject: Revert "part of replacing 'ETH'" This reverts commit dd139452d053496d79816c881dbb59ee4aded81b. --- 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, 38 insertions(+), 18 deletions(-) diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js index 78039ce4a..8563f0771 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 || 'TAN' + const ticker = entry.ticker || 'ETH' 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 40be80966..fa237f1d1 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} TAN`), + h('div.request-signature__balance-value', `${balanceInEther} ETH`), ]) } 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 066b6b2ac..c15668da3 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 { @@ -260,6 +278,8 @@ 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 6641faaae..a0d6e65b3 100644 --- a/ui/app/helpers/constants/common.js +++ b/ui/app/helpers/constants/common.js @@ -1,4 +1,4 @@ -export const ETH = 'TAN' +export const ETH = 'ETH' 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 0751247c0..853427b31 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 030c57b87..5e1c21ff7 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 5f9856965..94fa9ad42 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 = 'TAN') { +function formatBalance (balance, decimalsToKeep, needsParse = true, ticker = 'ETH') { 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 697b728a5..de2d9462f 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, ETH} from '../../../../helpers/constants/common' +import {PRIMARY} 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 7b2afa9f4..3d27fe349 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 = 'TAN', nickname) { + validateRpc (newRpc, chainId, ticker = 'ETH', 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 6bcf5c802..39e864d16 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: 'TAN', + ticker: 'ETH', blockExplorerUrl: 'https://testnet.tangerine.garden', }, { diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 2c45f3890..56591b7b0 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 || 'TAN' + return selectedToken && selectedToken.symbol || 'ETH' } function getCurrentNetworkId (state) { diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index 5f22efce0..d3cc7efca 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 = 'TAN', nickname, rpcPrefs) { +function updateAndSetCustomRpc (newRpc, chainId, ticker = 'ETH', 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 = 'TAN', nickname, rpcPr } } -function editRpc (oldRpc, newRpc, chainId, ticker = 'TAN', nickname, rpcPrefs) { +function editRpc (oldRpc, newRpc, chainId, ticker = 'ETH', nickname, rpcPrefs) { return (dispatch) => { log.debug(`background.delRpcTarget: ${oldRpc}`) background.delCustomRpc(oldRpc, (err) => { @@ -2021,7 +2021,7 @@ function editRpc (oldRpc, newRpc, chainId, ticker = 'TAN', nickname, rpcPrefs) { } } -function setRpcTarget (newRpc, chainId, ticker = 'TAN', nickname) { +function setRpcTarget (newRpc, chainId, ticker = 'ETH', nickname) { return (dispatch) => { log.debug(`background.setRpcTarget: ${newRpc} ${chainId} ${ticker} ${nickname}`) background.setCustomRpc(newRpc, chainId, ticker, nickname || newRpc, (err) => { -- cgit v1.2.3