|
|
@ -1,32 +1,39 @@ |
|
|
|
import { connect } from 'react-redux' |
|
|
|
import { connect } from 'react-redux' |
|
|
|
import { compose } from 'recompose' |
|
|
|
import { compose } from 'recompose' |
|
|
|
import R from 'ramda' |
|
|
|
import ethUtil from 'ethereumjs-util' |
|
|
|
import { multiplyCurrencies } from '../../../conversion-util' |
|
|
|
import { multiplyCurrencies } from '../../../conversion-util' |
|
|
|
import { bnToHex } from '../../../helpers/conversions.util' |
|
|
|
|
|
|
|
import withModalProps from '../../../higher-order-components/with-modal-props' |
|
|
|
import withModalProps from '../../../higher-order-components/with-modal-props' |
|
|
|
import CancelTransaction from './cancel-transaction.component' |
|
|
|
import CancelTransaction from './cancel-transaction.component' |
|
|
|
import { showModal, hideModal, createCancelTransaction } from '../../../actions' |
|
|
|
import { showModal, createCancelTransaction } from '../../../actions' |
|
|
|
|
|
|
|
import { getHexGasTotal } from '../../../helpers/confirm-transaction/util' |
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => { |
|
|
|
const mapStateToProps = (state, ownProps) => { |
|
|
|
const { metamask } = state |
|
|
|
const { metamask } = state |
|
|
|
const { transactionId, originalGasPrice } = ownProps |
|
|
|
const { transactionId, originalGasPrice } = ownProps |
|
|
|
const { selectedAddressTxList } = metamask |
|
|
|
const { selectedAddressTxList } = metamask |
|
|
|
const transaction = R.find(({ id }) => id === transactionId)(selectedAddressTxList) |
|
|
|
const transaction = selectedAddressTxList.find(({ id }) => id === transactionId) |
|
|
|
const transactionStatus = transaction ? transaction.status : '' |
|
|
|
const transactionStatus = transaction ? transaction.status : '' |
|
|
|
|
|
|
|
|
|
|
|
const defaultNewGasPrice = bnToHex(multiplyCurrencies(originalGasPrice, 1.1)) |
|
|
|
const defaultNewGasPrice = ethUtil.addHexPrefix( |
|
|
|
|
|
|
|
multiplyCurrencies(originalGasPrice, 1.1, { |
|
|
|
|
|
|
|
toNumericBase: 'hex', |
|
|
|
|
|
|
|
multiplicandBase: 16, |
|
|
|
|
|
|
|
multiplierBase: 10, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const newGasFee = getHexGasTotal({ gasPrice: defaultNewGasPrice, gasLimit: '0x5208' }) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
transactionId, |
|
|
|
transactionId, |
|
|
|
transactionStatus, |
|
|
|
transactionStatus, |
|
|
|
originalGasPrice, |
|
|
|
originalGasPrice, |
|
|
|
defaultNewGasPrice, |
|
|
|
newGasFee, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => { |
|
|
|
const mapDispatchToProps = dispatch => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
hideModal: () => dispatch(hideModal()), |
|
|
|
|
|
|
|
createCancelTransaction: txId => dispatch(createCancelTransaction(txId)), |
|
|
|
createCancelTransaction: txId => dispatch(createCancelTransaction(txId)), |
|
|
|
showTransactionConfirmedModal: () => dispatch(showModal({ name: 'TRANSACTION_CONFIRMED' })), |
|
|
|
showTransactionConfirmedModal: () => dispatch(showModal({ name: 'TRANSACTION_CONFIRMED' })), |
|
|
|
} |
|
|
|
} |
|
|
|