|
|
@ -8,7 +8,7 @@ import { |
|
|
|
clearConfirmTransaction, |
|
|
|
clearConfirmTransaction, |
|
|
|
updateGasAndCalculate, |
|
|
|
updateGasAndCalculate, |
|
|
|
} from '../../../ducks/confirm-transaction.duck' |
|
|
|
} from '../../../ducks/confirm-transaction.duck' |
|
|
|
import { clearSend, cancelTx, updateAndApproveTx, showModal } from '../../../actions' |
|
|
|
import { clearSend, cancelTx, cancelTxs, updateAndApproveTx, showModal } from '../../../actions' |
|
|
|
import { |
|
|
|
import { |
|
|
|
INSUFFICIENT_FUNDS_ERROR_KEY, |
|
|
|
INSUFFICIENT_FUNDS_ERROR_KEY, |
|
|
|
GAS_LIMIT_TOO_LOW_ERROR_KEY, |
|
|
|
GAS_LIMIT_TOO_LOW_ERROR_KEY, |
|
|
@ -17,7 +17,7 @@ import { getHexGasTotal } from '../../../helpers/confirm-transaction/util' |
|
|
|
import { isBalanceSufficient } from '../../send/send.utils' |
|
|
|
import { isBalanceSufficient } from '../../send/send.utils' |
|
|
|
import { conversionGreaterThan } from '../../../conversion-util' |
|
|
|
import { conversionGreaterThan } from '../../../conversion-util' |
|
|
|
import { MIN_GAS_LIMIT_DEC } from '../../send/send.constants' |
|
|
|
import { MIN_GAS_LIMIT_DEC } from '../../send/send.constants' |
|
|
|
import { addressSlicer } from '../../../util' |
|
|
|
import { addressSlicer, valuesFor } from '../../../util' |
|
|
|
|
|
|
|
|
|
|
|
const casedContractMap = Object.keys(contractMap).reduce((acc, base) => { |
|
|
|
const casedContractMap = Object.keys(contractMap).reduce((acc, base) => { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -53,6 +53,7 @@ const mapStateToProps = (state, props) => { |
|
|
|
selectedAddress, |
|
|
|
selectedAddress, |
|
|
|
selectedAddressTxList, |
|
|
|
selectedAddressTxList, |
|
|
|
assetImages, |
|
|
|
assetImages, |
|
|
|
|
|
|
|
unapprovedTxs, |
|
|
|
} = metamask |
|
|
|
} = metamask |
|
|
|
const assetImage = assetImages[txParamsToAddress] |
|
|
|
const assetImage = assetImages[txParamsToAddress] |
|
|
|
const { balance } = accounts[selectedAddress] |
|
|
|
const { balance } = accounts[selectedAddress] |
|
|
@ -67,6 +68,8 @@ const mapStateToProps = (state, props) => { |
|
|
|
const transaction = R.find(({ id }) => id === transactionId)(selectedAddressTxList) |
|
|
|
const transaction = R.find(({ id }) => id === transactionId)(selectedAddressTxList) |
|
|
|
const transactionStatus = transaction ? transaction.status : '' |
|
|
|
const transactionStatus = transaction ? transaction.status : '' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const unapprovedTxCount = valuesFor(unapprovedTxs).length |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
balance, |
|
|
|
balance, |
|
|
|
fromAddress, |
|
|
|
fromAddress, |
|
|
@ -90,6 +93,8 @@ const mapStateToProps = (state, props) => { |
|
|
|
transactionStatus, |
|
|
|
transactionStatus, |
|
|
|
nonce, |
|
|
|
nonce, |
|
|
|
assetImage, |
|
|
|
assetImage, |
|
|
|
|
|
|
|
unapprovedTxs, |
|
|
|
|
|
|
|
unapprovedTxCount, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -107,6 +112,7 @@ const mapDispatchToProps = dispatch => { |
|
|
|
return dispatch(updateGasAndCalculate({ gasLimit, gasPrice })) |
|
|
|
return dispatch(updateGasAndCalculate({ gasLimit, gasPrice })) |
|
|
|
}, |
|
|
|
}, |
|
|
|
cancelTransaction: ({ id }) => dispatch(cancelTx({ id })), |
|
|
|
cancelTransaction: ({ id }) => dispatch(cancelTx({ id })), |
|
|
|
|
|
|
|
cancelAllTransactions: (txList) => dispatch(cancelTxs(txList)), |
|
|
|
sendTransaction: txData => dispatch(updateAndApproveTx(txData)), |
|
|
|
sendTransaction: txData => dispatch(updateAndApproveTx(txData)), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -156,8 +162,9 @@ const getValidateEditGas = ({ balance, conversionRate, txData }) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => { |
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => { |
|
|
|
const { balance, conversionRate, txData } = stateProps |
|
|
|
const { balance, conversionRate, txData, unapprovedTxs } = stateProps |
|
|
|
const { |
|
|
|
const { |
|
|
|
|
|
|
|
cancelAllTransactions: dispatchCancelAllTransactions, |
|
|
|
showCustomizeGasModal: dispatchShowCustomizeGasModal, |
|
|
|
showCustomizeGasModal: dispatchShowCustomizeGasModal, |
|
|
|
updateGasAndCalculate: dispatchUpdateGasAndCalculate, |
|
|
|
updateGasAndCalculate: dispatchUpdateGasAndCalculate, |
|
|
|
...otherDispatchProps |
|
|
|
...otherDispatchProps |
|
|
@ -174,6 +181,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { |
|
|
|
onSubmit: txData => dispatchUpdateGasAndCalculate(txData), |
|
|
|
onSubmit: txData => dispatchUpdateGasAndCalculate(txData), |
|
|
|
validate: validateEditGas, |
|
|
|
validate: validateEditGas, |
|
|
|
}), |
|
|
|
}), |
|
|
|
|
|
|
|
cancelAllTransactions: () => dispatchCancelAllTransactions(valuesFor(unapprovedTxs)), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|