A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/components/app/transaction-breakdown/transaction-breakdown.conta...

34 lines
1.1 KiB

import { connect } from 'react-redux';
import { getIsMainnet, getPreferences } from '../../../selectors';
import { getNativeCurrency } from '../../../ducks/metamask/metamask';
import { getHexGasTotal } from '../../../helpers/utils/confirm-tx.util';
import { sumHexes } from '../../../helpers/utils/transactions.util';
import TransactionBreakdown from './transaction-breakdown.component';
const mapStateToProps = (state, ownProps) => {
const { transaction, isTokenApprove } = ownProps;
const {
txParams: { gas, gasPrice, value } = {},
txReceipt: { gasUsed } = {},
} = transaction;
const { showFiatInTestnets } = getPreferences(state);
const isMainnet = getIsMainnet(state);
const gasLimit = typeof gasUsed === 'string' ? gasUsed : gas;
const hexGasTotal =
(gasLimit && gasPrice && getHexGasTotal({ gasLimit, gasPrice })) || '0x0';
const totalInHex = sumHexes(hexGasTotal, value);
return {
nativeCurrency: getNativeCurrency(state),
showFiat: isMainnet || Boolean(showFiatInTestnets),
totalInHex,
gas,
gasPrice,
gasUsed,
isTokenApprove,
};
};
export default connect(mapStateToProps)(TransactionBreakdown);