1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/app/pages/confirm-transaction/confirm-transaction.container.js
Dan J Miller 97d268c8ee
Remove use of ethgasstation; use metaswap /gasPrices api for gas price estimates (#9867)
* Remove use of ethgassthat; use metaswap /gasPrices api for gas price estimates

* Remove references to ethgasstation

* Pass base to BigNumber constructor in fetchExternalBasicGasEstimates

* Update ui/app/hooks/useTokenTracker.js

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>

* Delete gas price chart

* Remove price chart css import

* Delete additional fee chart code

* Lint fix

* Delete more code no longer used after ethgasstation removal

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-12-02 19:55:19 -03:30

61 lines
2.0 KiB
JavaScript

import { connect } from 'react-redux'
import { compose } from 'redux'
import { withRouter } from 'react-router-dom'
import {
setTransactionToConfirm,
clearConfirmTransaction,
} from '../../ducks/confirm-transaction/confirm-transaction.duck'
import { isTokenMethodAction } from '../../helpers/utils/transactions.util'
import { fetchBasicGasEstimates } from '../../ducks/gas/gas.duck'
import { getContractMethodData, getTokenParams } from '../../store/actions'
import { unconfirmedTransactionsListSelector } from '../../selectors'
import { getMostRecentOverviewPage } from '../../ducks/history/history'
import ConfirmTransaction from './confirm-transaction.component'
const mapStateToProps = (state, ownProps) => {
const {
metamask: { send, unapprovedTxs },
} = state
const {
match: { params = {} },
} = ownProps
const { id } = params
const unconfirmedTransactions = unconfirmedTransactionsListSelector(state)
const totalUnconfirmed = unconfirmedTransactions.length
const transaction = totalUnconfirmed
? unapprovedTxs[id] || unconfirmedTransactions[0]
: {}
const { id: transactionId, transactionCategory } = transaction
return {
totalUnapprovedCount: totalUnconfirmed,
send,
unapprovedTxs,
id,
mostRecentOverviewPage: getMostRecentOverviewPage(state),
paramsTransactionId: id && String(id),
transactionId: transactionId && String(transactionId),
transaction,
isTokenMethodAction: isTokenMethodAction(transactionCategory),
}
}
const mapDispatchToProps = (dispatch) => {
return {
setTransactionToConfirm: (transactionId) => {
dispatch(setTransactionToConfirm(transactionId))
},
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
fetchBasicGasEstimates: () => dispatch(fetchBasicGasEstimates()),
getContractMethodData: (data) => dispatch(getContractMethodData(data)),
getTokenParams: (tokenAddress) => dispatch(getTokenParams(tokenAddress)),
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(ConfirmTransaction)