1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Hide ETH Gas Station stimates on non-main network (#9277)

* Hide gas estimate on non-main network (#9189)

* Update v8.0.9 changelog
This commit is contained in:
Mark Stacey 2020-08-19 17:19:59 -03:00 committed by GitHub
parent a0fb62c04a
commit b9f5f1c2c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 13 deletions

View File

@ -6,6 +6,7 @@
- [#9228](https://github.com/MetaMask/metamask-extension/pull/9228): Move transaction confirmation footer buttons to scrollable area - [#9228](https://github.com/MetaMask/metamask-extension/pull/9228): Move transaction confirmation footer buttons to scrollable area
- [#9256](https://github.com/MetaMask/metamask-extension/pull/9256): Handle non-String web3 property access - [#9256](https://github.com/MetaMask/metamask-extension/pull/9256): Handle non-String web3 property access
- [#9266](https://github.com/MetaMask/metamask-extension/pull/9266): Use @metamask/controllers@2.0.5 - [#9266](https://github.com/MetaMask/metamask-extension/pull/9266): Use @metamask/controllers@2.0.5
- [#9189](https://github.com/MetaMask/metamask-extension/pull/9189): Hide ETH Gas Station estimates on non-main network
## 8.0.8 Fri Aug 14 2020 ## 8.0.8 Fri Aug 14 2020
- [#9211](https://github.com/MetaMask/metamask-extension/pull/9211): Fix Etherscan redirect on notification click - [#9211](https://github.com/MetaMask/metamask-extension/pull/9211): Fix Etherscan redirect on notification click

View File

@ -22,12 +22,16 @@ const ConfirmDetailRow = (props) => {
{ label } { label }
</div> </div>
<div className="confirm-detail-row__details"> <div className="confirm-detail-row__details">
<div {
className={classnames('confirm-detail-row__header-text', headerTextClassName)} headerText && (
onClick={() => onHeaderClick && onHeaderClick()} <div
> className={classnames('confirm-detail-row__header-text', headerTextClassName)}
{ headerText } onClick={() => onHeaderClick && onHeaderClick()}
</div> >
{ headerText }
</div>
)
}
{ {
primaryText primaryText
? ( ? (

View File

@ -97,6 +97,7 @@ export default class ConfirmTransactionBase extends Component {
hideSenderToRecipient: PropTypes.bool, hideSenderToRecipient: PropTypes.bool,
showAccountInHeader: PropTypes.bool, showAccountInHeader: PropTypes.bool,
mostRecentOverviewPage: PropTypes.string.isRequired, mostRecentOverviewPage: PropTypes.string.isRequired,
isMainnet: PropTypes.bool,
} }
state = { state = {
@ -236,12 +237,15 @@ export default class ConfirmTransactionBase extends Component {
hideFiatConversion, hideFiatConversion,
nextNonce, nextNonce,
getNextNonce, getNextNonce,
isMainnet,
} = this.props } = this.props
if (hideDetails) { if (hideDetails) {
return null return null
} }
const notMainnetOrTest = !(isMainnet || process.env.IN_TEST)
return ( return (
detailsComponent || ( detailsComponent || (
<div className="confirm-page-container-content__details"> <div className="confirm-page-container-content__details">
@ -249,12 +253,12 @@ export default class ConfirmTransactionBase extends Component {
<ConfirmDetailRow <ConfirmDetailRow
label="Gas Fee" label="Gas Fee"
value={hexTransactionFee} value={hexTransactionFee}
headerText="Edit" headerText={notMainnetOrTest ? '' : 'Edit'}
headerTextClassName="confirm-detail-row__header-text--edit" headerTextClassName={notMainnetOrTest ? '' : 'confirm-detail-row__header-text--edit'}
onHeaderClick={() => this.handleEditGas()} onHeaderClick={notMainnetOrTest ? null : () => this.handleEditGas()}
secondaryText={hideFiatConversion ? this.context.t('noConversionRateAvailable') : ''} secondaryText={hideFiatConversion ? this.context.t('noConversionRateAvailable') : ''}
/> />
{advancedInlineGasShown {advancedInlineGasShown || notMainnetOrTest
? ( ? (
<AdvancedGasInputs <AdvancedGasInputs
updateCustomGasPrice={(newGasPrice) => updateGasAndCalculate({ ...customGas, gasPrice: newGasPrice })} updateCustomGasPrice={(newGasPrice) => updateGasAndCalculate({ ...customGas, gasPrice: newGasPrice })}

View File

@ -180,6 +180,7 @@ const mapStateToProps = (state, ownProps) => {
transactionCategory, transactionCategory,
nextNonce, nextNonce,
mostRecentOverviewPage: getMostRecentOverviewPage(state), mostRecentOverviewPage: getMostRecentOverviewPage(state),
isMainnet,
} }
} }

View File

@ -26,6 +26,7 @@ export default class SendGasRow extends Component {
gasPrice: PropTypes.string, gasPrice: PropTypes.string,
gasLimit: PropTypes.string, gasLimit: PropTypes.string,
insufficientBalance: PropTypes.bool, insufficientBalance: PropTypes.bool,
isMainnet: PropTypes.bool,
} }
static contextTypes = { static contextTypes = {
@ -35,7 +36,11 @@ export default class SendGasRow extends Component {
renderAdvancedOptionsButton () { renderAdvancedOptionsButton () {
const { metricsEvent } = this.context const { metricsEvent } = this.context
const { showCustomizeGasModal } = this.props const { showCustomizeGasModal, isMainnet } = this.props
// Tests should behave in same way as mainnet, but are using Localhost
if (!isMainnet && !process.env.IN_TEST) {
return null
}
return ( return (
<div <div
className="advanced-gas-options-btn" className="advanced-gas-options-btn"
@ -87,6 +92,7 @@ export default class SendGasRow extends Component {
gasPrice, gasPrice,
gasLimit, gasLimit,
insufficientBalance, insufficientBalance,
isMainnet,
} = this.props } = this.props
const { metricsEvent } = this.context const { metricsEvent } = this.context
@ -140,8 +146,8 @@ export default class SendGasRow extends Component {
{ this.renderAdvancedOptionsButton() } { this.renderAdvancedOptionsButton() }
</div> </div>
) )
// Tests should behave in same way as mainnet, but are using Localhost
if (advancedInlineGasShown) { if (advancedInlineGasShown || (!isMainnet && !process.env.IN_TEST)) {
return advancedGasInputs return advancedGasInputs
} else if (gasButtonGroupShown) { } else if (gasButtonGroupShown) {
return gasPriceButtonGroup return gasPriceButtonGroup

View File

@ -17,6 +17,7 @@ import {
getBasicGasEstimateLoadingStatus, getBasicGasEstimateLoadingStatus,
getRenderableEstimateDataForSmallButtonsFromGWEI, getRenderableEstimateDataForSmallButtonsFromGWEI,
getDefaultActiveButtonIndex, getDefaultActiveButtonIndex,
getIsMainnet,
} from '../../../../selectors' } from '../../../../selectors'
import { import {
isBalanceSufficient, isBalanceSufficient,
@ -74,6 +75,7 @@ function mapStateToProps (state) {
maxModeOn: getSendMaxModeState(state), maxModeOn: getSendMaxModeState(state),
sendToken: getSendToken(state), sendToken: getSendToken(state),
tokenBalance: getTokenBalance(state), tokenBalance: getTokenBalance(state),
isMainnet: getIsMainnet(state),
} }
} }

View File

@ -34,6 +34,7 @@ describe('SendGasRow Component', function () {
}} }}
/> />
), { context: { t: (str) => str + '_t', metricsEvent: () => ({}) } }) ), { context: { t: (str) => str + '_t', metricsEvent: () => ({}) } })
wrapper.setProps({ isMainnet: true })
}) })
afterEach(function () { afterEach(function () {