From 636431d33801718c70be00926f2822ba9168d8bd Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 28 Aug 2018 15:11:16 -0400 Subject: [PATCH] add gas station to Contract functions --- embark-ui/src/components/GasStation.js | 2 +- .../containers/ContractDeploymentContainer.js | 2 +- .../containers/ContractFunctionsContainer.js | 37 ++++++++++++++----- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/embark-ui/src/components/GasStation.js b/embark-ui/src/components/GasStation.js index c7b20807e..b94545d9a 100644 --- a/embark-ui/src/components/GasStation.js +++ b/embark-ui/src/components/GasStation.js @@ -75,7 +75,7 @@ class GasStation extends Component { Gas Price Estimator (for Mainnet) - this.setState({copied: true})} title="Copy gas price to clipboard"> diff --git a/embark-ui/src/containers/ContractDeploymentContainer.js b/embark-ui/src/containers/ContractDeploymentContainer.js index 0af3e19e6..58fae465c 100644 --- a/embark-ui/src/containers/ContractDeploymentContainer.js +++ b/embark-ui/src/containers/ContractDeploymentContainer.js @@ -36,7 +36,6 @@ class ContractDeploymentContainer extends Component { render={({gasStats}) => ( )}/> - ); } @@ -58,6 +57,7 @@ ContractDeploymentContainer.propTypes = { contractFunctions: PropTypes.arrayOf(PropTypes.object), postContractDeploy: PropTypes.func, fetchContractProfile: PropTypes.func, + fetchEthGas: PropTypes.func, error: PropTypes.string }; diff --git a/embark-ui/src/containers/ContractFunctionsContainer.js b/embark-ui/src/containers/ContractFunctionsContainer.js index cf273c995..28221cc24 100644 --- a/embark-ui/src/containers/ContractFunctionsContainer.js +++ b/embark-ui/src/containers/ContractFunctionsContainer.js @@ -3,25 +3,39 @@ 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 ( - ( - - )} /> + + ( + + )}/> + + ( + + )}/> + ); } } @@ -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));