add gas station to Contract functions

This commit is contained in:
Jonathan Rainville 2018-08-28 15:11:16 -04:00 committed by Pascal Precht
parent 8ff13b09f1
commit 636431d338
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
3 changed files with 29 additions and 12 deletions

View File

@ -75,7 +75,7 @@ class GasStation extends Component {
<Card.Header>
<Card.Title>Gas Price Estimator (for Mainnet)</Card.Title>
<Card.Options>
<CopyToClipboard text={currentGasStep.price}
<CopyToClipboard text={currentGasStep.price / 10}
onCopy={() => this.setState({copied: true})}
title="Copy gas price to clipboard">
<span><Stamp color="blue" icon="copy"/></span>

View File

@ -36,7 +36,6 @@ class ContractDeploymentContainer extends Component {
render={({gasStats}) => (
<GasStation gasStats={gasStats}/>
)}/>
</React.Fragment>
);
}
@ -58,6 +57,7 @@ ContractDeploymentContainer.propTypes = {
contractFunctions: PropTypes.arrayOf(PropTypes.object),
postContractDeploy: PropTypes.func,
fetchContractProfile: PropTypes.func,
fetchEthGas: PropTypes.func,
error: PropTypes.string
};

View File

@ -3,18 +3,25 @@ import {connect} from 'react-redux';
import PropTypes from 'prop-types';
import {withRouter} from 'react-router-dom';
import {contractProfile as contractProfileAction, contractFunction as contractFunctionAction} from '../actions';
import {
contractProfile as contractProfileAction,
contractFunction as contractFunctionAction,
ethGas as ethGasAction
} from '../actions';
import ContractFunctions from '../components/ContractFunctions';
import DataWrapper from "../components/DataWrapper";
import {getContractProfile, getContractFunctions} from "../reducers/selectors";
import GasStation from "../components/GasStation";
import {getContractProfile, getContractFunctions, getGasStats} from "../reducers/selectors";
class ContractFunctionsContainer extends Component {
componentDidMount() {
this.props.fetchContractProfile(this.props.match.params.contractName);
this.props.fetchEthGas();
}
render() {
return (
<React.Fragment>
<DataWrapper shouldRender={this.props.contractProfile !== undefined}
{...this.props}
render={({contractProfile, contractFunctions, postContractFunction}) => (
@ -22,6 +29,13 @@ class ContractFunctionsContainer extends Component {
contractFunctions={contractFunctions}
postContractFunction={postContractFunction}/>
)}/>
<DataWrapper shouldRender={this.props.gasStats !== undefined}
{...this.props}
render={({gasStats}) => (
<GasStation gasStats={gasStats}/>
)}/>
</React.Fragment>
);
}
}
@ -30,6 +44,7 @@ function mapStateToProps(state, props) {
return {
contractProfile: getContractProfile(state, props.match.params.contractName),
contractFunctions: getContractFunctions(state, props.match.params.contractName),
gasStats: getGasStats(state),
error: state.errorMessage,
loading: state.loading
};
@ -41,6 +56,7 @@ ContractFunctionsContainer.propTypes = {
contractFunctions: PropTypes.arrayOf(PropTypes.object),
postContractFunction: PropTypes.func,
fetchContractProfile: PropTypes.func,
fetchEthGas: PropTypes.func,
error: PropTypes.string
};
@ -48,6 +64,7 @@ export default withRouter(connect(
mapStateToProps,
{
fetchContractProfile: contractProfileAction.request,
postContractFunction: contractFunctionAction.post
postContractFunction: contractFunctionAction.post,
fetchEthGas: ethGasAction.request
}
)(ContractFunctionsContainer));