From 852df543036aac5d0d24d3a31a24818ac4c114bd Mon Sep 17 00:00:00 2001 From: Chen Wei Date: Tue, 2 Jul 2019 15:44:40 +0800 Subject: revert replacing "ETH" with "TAN" --- app/scripts/controllers/network/network.js | 10 +-- app/scripts/controllers/token-rates.js | 2 +- .../components/app/dropdowns/network-dropdown.js | 2 +- .../components/app/modals/deposit-ether-modal.js | 94 +++++++++++----------- .../itcss/components/account-details-dropdown.scss | 2 +- ui/app/ducks/gas/gas.duck.js | 14 ---- ui/app/helpers/constants/common.js | 2 +- ui/app/helpers/utils/confirm-tx.util.js | 6 +- ui/app/helpers/utils/conversions.util.js | 2 +- ui/app/helpers/utils/util.js | 2 +- .../send-asset-row/send-asset-row.component.js | 2 +- .../advanced-tab/advanced-tab.component.js | 2 +- .../networks-tab/networks-tab.constants.js | 2 +- ui/app/store/actions.js | 4 +- 14 files changed, 64 insertions(+), 82 deletions(-) diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js index aec2bf560..01a283347 100644 --- a/app/scripts/controllers/network/network.js +++ b/app/scripts/controllers/network/network.js @@ -44,7 +44,7 @@ const defaultProviderConfig = { } const defaultNetworkConfig = { - ticker: 'TAN', + ticker: 'ETH', } module.exports = class NetworkController extends EventEmitter { @@ -132,7 +132,7 @@ module.exports = class NetworkController extends EventEmitter { }) } - setRpcTarget (rpcTarget, chainId, ticker = 'TAN', nickname = '', rpcPrefs) { + setRpcTarget (rpcTarget, chainId, ticker = 'ETH', nickname = '', rpcPrefs) { const providerConfig = { type: 'rpc', rpcTarget, @@ -144,10 +144,8 @@ module.exports = class NetworkController extends EventEmitter { this.providerConfig = providerConfig } - async setProviderType (type, rpcTarget = '', ticker = 'TAN', nickname = '') { - console.log('1') + async setProviderType (type, rpcTarget = '', ticker = 'ETH', nickname = '') { assert.notEqual(type, 'rpc', `NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget"`) - console.log('2') if (INFURA_PROVIDER_TYPES.includes(type)) { assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST, `NetworkController - Unknown rpc type "${type}"`) @@ -155,7 +153,6 @@ module.exports = class NetworkController extends EventEmitter { assert(TANGERINE_PROVIDER_TYPES.includes(type) || type === LOCALHOST, `NetworkController - Unknown rpc type "${type}"`) } const providerConfig = { type, rpcTarget, ticker, nickname } - console.log('providerConfig', providerConfig) this.providerConfig = providerConfig } @@ -188,7 +185,6 @@ module.exports = class NetworkController extends EventEmitter { const isInfura = INFURA_PROVIDER_TYPES.includes(type) const isTangerine = TANGERINE_PROVIDER_TYPES.includes(type) - console.log('_configureProvider', opts, isTangerine) if (isTangerine) { this._configureTangerineProvider(opts) } else if (isInfura) { diff --git a/app/scripts/controllers/token-rates.js b/app/scripts/controllers/token-rates.js index 70b8f64c7..9b86a9ebf 100644 --- a/app/scripts/controllers/token-rates.js +++ b/app/scripts/controllers/token-rates.js @@ -30,7 +30,7 @@ class TokenRatesController { async updateExchangeRates () { if (!this.isActive) { return } const contractExchangeRates = {} - const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'TAN' + const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'eth' const pairs = this._tokens.map(token => token.address).join(',') const query = `contract_addresses=${pairs}&vs_currencies=${nativeCurrency}` if (this._tokens.length > 0) { 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/modals/deposit-ether-modal.js b/ui/app/components/app/modals/deposit-ether-modal.js index f56069d65..b95b9aa5f 100644 --- a/ui/app/components/app/modals/deposit-ether-modal.js +++ b/ui/app/components/app/modals/deposit-ether-modal.js @@ -180,53 +180,53 @@ DepositEtherModal.prototype.render = function () { hide: !isTestNetwork || buyingWithShapeshift, }), - this.renderRow({ - logo: h('div.deposit-ether-modal__logo', { - style: { - backgroundImage: 'url(\'./images/wyre.svg\')', - height: '40px', - }, - }), - title: WYRE_ROW_TITLE, - text: WYRE_ROW_TEXT, - buttonLabel: this.context.t('continueToWyre'), - onButtonClick: () => toWyre(address), - hide: isTestNetwork || buyingWithShapeshift, - }), - - this.renderRow({ - logo: h('div.deposit-ether-modal__logo', { - style: { - backgroundImage: 'url(\'./images/coinswitch_logo.png\')', - height: '40px', - }, - }), - title: COINSWITCH_ROW_TITLE, - text: COINSWITCH_ROW_TEXT, - buttonLabel: this.context.t('continueToCoinSwitch'), - onButtonClick: () => toCoinSwitch(address), - hide: isTestNetwork || buyingWithShapeshift, - }), - - this.renderRow({ - logo: h('div.deposit-ether-modal__logo', { - style: { - backgroundImage: 'url(\'./images/shapeshift logo.png\')', - }, - }), - title: SHAPESHIFT_ROW_TITLE, - text: SHAPESHIFT_ROW_TEXT, - buttonLabel: this.context.t('shapeshiftBuy'), - onButtonClick: () => this.setState({ buyingWithShapeshift: true }), - hide: isTestNetwork, - hideButton: buyingWithShapeshift, - hideTitle: buyingWithShapeshift, - onBackClick: () => this.setState({ buyingWithShapeshift: false }), - showBackButton: this.state.buyingWithShapeshift, - className: buyingWithShapeshift && 'deposit-ether-modal__buy-row__shapeshift-buy', - }), - - buyingWithShapeshift && h(ShapeshiftForm), + // this.renderRow({ + // logo: h('div.deposit-ether-modal__logo', { + // style: { + // backgroundImage: 'url(\'./images/wyre.svg\')', + // height: '40px', + // }, + // }), + // title: WYRE_ROW_TITLE, + // text: WYRE_ROW_TEXT, + // buttonLabel: this.context.t('continueToWyre'), + // onButtonClick: () => toWyre(address), + // hide: isTestNetwork || buyingWithShapeshift, + // }), + + // this.renderRow({ + // logo: h('div.deposit-ether-modal__logo', { + // style: { + // backgroundImage: 'url(\'./images/coinswitch_logo.png\')', + // height: '40px', + // }, + // }), + // title: COINSWITCH_ROW_TITLE, + // text: COINSWITCH_ROW_TEXT, + // buttonLabel: this.context.t('continueToCoinSwitch'), + // onButtonClick: () => toCoinSwitch(address), + // hide: isTestNetwork || buyingWithShapeshift, + // }), + + // this.renderRow({ + // logo: h('div.deposit-ether-modal__logo', { + // style: { + // backgroundImage: 'url(\'./images/shapeshift logo.png\')', + // }, + // }), + // title: SHAPESHIFT_ROW_TITLE, + // text: SHAPESHIFT_ROW_TEXT, + // buttonLabel: this.context.t('shapeshiftBuy'), + // onButtonClick: () => this.setState({ buyingWithShapeshift: true }), + // hide: isTestNetwork, + // hideButton: buyingWithShapeshift, + // hideTitle: buyingWithShapeshift, + // onBackClick: () => this.setState({ buyingWithShapeshift: false }), + // showBackButton: this.state.buyingWithShapeshift, + // className: buyingWithShapeshift && 'deposit-ether-modal__buy-row__shapeshift-buy', + // }), + + // buyingWithShapeshift && h(ShapeshiftForm), ]), diff --git a/ui/app/css/itcss/components/account-details-dropdown.scss b/ui/app/css/itcss/components/account-details-dropdown.scss index 2a3007f83..94fdcf89f 100644 --- a/ui/app/css/itcss/components/account-details-dropdown.scss +++ b/ui/app/css/itcss/components/account-details-dropdown.scss @@ -1,5 +1,5 @@ .account-details-dropdown { - width: 60%; + width: 80%; position: absolute; top: 120px; right: 15px; diff --git a/ui/app/ducks/gas/gas.duck.js b/ui/app/ducks/gas/gas.duck.js index d0f09ce0d..911d0ece8 100644 --- a/ui/app/ducks/gas/gas.duck.js +++ b/ui/app/ducks/gas/gas.duck.js @@ -226,8 +226,6 @@ export function fetchBasicGasEstimates () { fastest: gasEstimate * 2, } - console.log('!!!BASIC GAS ESTIMATE', basicEstimates) - const timeRetrieved = Date.now() dispatch(setBasicPriceEstimatesLastRetrieved(timeRetrieved)) saveLocalStorageData(timeRetrieved, 'BASIC_PRICE_ESTIMATES_LAST_RETRIEVED') @@ -258,18 +256,6 @@ export function fetchBasicGasAndTimeEstimates () { dispatch(basicGasEstimatesLoadingStarted()) - fetch('https://testnet-rpc.tangerine-network.io', { - 'headers': { - 'Content-Type': 'application/json', - }, - 'body': '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":67}', - 'method': 'POST', - }) - .then(r => r.json()) - .then((res) => { - console.log('RES FROM TANGERINE RPC!!!!!', res) - }) - const promiseToFetch = Date.now() - timeLastRetrieved > 75000 ? fetch('https://testnet-rpc.tangerine-network.io', { 'headers': { 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 92a1f668e..853427b31 100644 --- a/ui/app/helpers/utils/confirm-tx.util.js +++ b/ui/app/helpers/utils/confirm-tx.util.js @@ -55,7 +55,7 @@ export function addFiat (...args) { export function getValueFromWeiHex ({ value, - fromCurrency = 'TAN', + fromCurrency = 'ETH', toCurrency, conversionRate, numberOfDecimals, @@ -75,7 +75,7 @@ export function getValueFromWeiHex ({ export function getTransactionFee ({ value, - fromCurrency = 'TAN', + fromCurrency = 'ETH', toCurrency, conversionRate, numberOfDecimals, @@ -101,7 +101,7 @@ export function formatCurrency (value, currencyCode) { export function convertTokenToFiat ({ value, - fromCurrency = 'TAN', + fromCurrency = 'ETH', toCurrency, conversionRate, contractExchangeRate, diff --git a/ui/app/helpers/utils/conversions.util.js b/ui/app/helpers/utils/conversions.util.js index 44e11d996..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: 'TAN', + 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 0716d1c22..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 @@ -45,7 +45,7 @@ export default class SendAssetRow extends Component { name: 'User clicks "Assets" dropdown', }, customVariables: { - assetSelected: address ? 'ERC20' : 'TAN', + 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/store/actions.js b/ui/app/store/actions.js index fd7423cf1..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) => { -- cgit v1.2.3