mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 11:01:41 +01:00
64adfe7b11
* prepare for EIP1559 gas fields in speedup/cancel * Update ui/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { compose } from 'redux';
|
|
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props';
|
|
import { showModal, createCancelTransaction } from '../../../../store/actions';
|
|
import CancelTransaction from './cancel-transaction.component';
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
const { metamask } = state;
|
|
const {
|
|
transactionId,
|
|
originalGasPrice,
|
|
newGasFee,
|
|
customGasSettings,
|
|
} = ownProps;
|
|
const { currentNetworkTxList } = metamask;
|
|
const transaction = currentNetworkTxList.find(
|
|
({ id }) => id === transactionId,
|
|
);
|
|
const transactionStatus = transaction ? transaction.status : '';
|
|
|
|
return {
|
|
transactionId,
|
|
transactionStatus,
|
|
originalGasPrice,
|
|
customGasSettings,
|
|
newGasFee,
|
|
};
|
|
};
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
return {
|
|
createCancelTransaction: (txId, customGasSettings) => {
|
|
return dispatch(createCancelTransaction(txId, customGasSettings));
|
|
},
|
|
showTransactionConfirmedModal: () =>
|
|
dispatch(showModal({ name: 'TRANSACTION_CONFIRMED' })),
|
|
};
|
|
};
|
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|
const { transactionId, customGasSettings, ...restStateProps } = stateProps;
|
|
// eslint-disable-next-line no-shadow
|
|
const { createCancelTransaction, ...restDispatchProps } = dispatchProps;
|
|
|
|
return {
|
|
...restStateProps,
|
|
...restDispatchProps,
|
|
...ownProps,
|
|
createCancelTransaction: () =>
|
|
createCancelTransaction(transactionId, customGasSettings),
|
|
};
|
|
};
|
|
|
|
export default compose(
|
|
withModalProps,
|
|
connect(mapStateToProps, mapDispatchToProps, mergeProps),
|
|
)(CancelTransaction);
|