From 1ffe9505c8ace5eb92e7b2753deadd630b1070a9 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 10 Aug 2018 13:41:41 -0400 Subject: [PATCH] conflict in contarct container --- embark-ui/src/components/ContractLayout.js | 8 ++++++++ embark-ui/src/components/ContractLogger.js | 6 ++---- embark-ui/src/components/ContractProfile.js | 2 +- embark-ui/src/containers/AppContainer.js | 7 +++++-- embark-ui/src/containers/ContractLoggerContainer.js | 6 ++++-- embark-ui/src/containers/ContractsContainer.js | 13 ++----------- embark-ui/src/reducers/selectors.js | 3 +-- lib/modules/console_listener/index.js | 2 +- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/embark-ui/src/components/ContractLayout.js b/embark-ui/src/components/ContractLayout.js index 5a4dd9bc..d3e6a300 100644 --- a/embark-ui/src/components/ContractLayout.js +++ b/embark-ui/src/components/ContractLayout.js @@ -17,6 +17,14 @@ const ContractLayout = (props) => ( Contract
+ + Back to {props.match.params.contractName} + ( responsive className="card-table table-vcenter text-nowrap" headerItems={[ - {content: "Function name"}, - {content: "Params"}, + {content: "call"}, {content: "Transaction hash"}, {content: "Gas Used"}, {content: "Block number"}, @@ -23,8 +22,7 @@ const ContractLogger = ({contractName, contractLogs}) => ( bodyItems={ contractLogs.map((log) => { return ([ - {content: log.functionName}, - {content: log.paramString}, + {content: `${log.name}.${log.functionName}(${log.paramString})`}, {content: log.transactionHash}, {content: log.gasUsed}, {content: log.blockNumber}, diff --git a/embark-ui/src/components/ContractProfile.js b/embark-ui/src/components/ContractProfile.js index 7e26da53..2b839931 100644 --- a/embark-ui/src/components/ContractProfile.js +++ b/embark-ui/src/components/ContractProfile.js @@ -8,7 +8,7 @@ import { } from "tabler-react"; const ContractProfile = ({contractProfile}) => ( - + diff --git a/embark-ui/src/containers/AppContainer.js b/embark-ui/src/containers/AppContainer.js index a14600cd..47a47d9d 100644 --- a/embark-ui/src/containers/AppContainer.js +++ b/embark-ui/src/containers/AppContainer.js @@ -6,12 +6,13 @@ import React, {Component} from 'react'; import history from '../history'; import Layout from '../components/Layout'; import routes from '../routes'; -import {initBlockHeader, processes as processesAction} from '../actions'; +import {contracts as contractsAction, initBlockHeader, processes as processesAction} from '../actions'; class AppContainer extends Component { componentDidMount() { this.props.initBlockHeader(); this.props.fetchProcesses(); + this.props.fetchContracts(); } render() { @@ -27,6 +28,7 @@ class AppContainer extends Component { AppContainer.propTypes = { initBlockHeader: PropTypes.func, + fetchContracts: PropTypes.func, fetchProcesses: PropTypes.func }; @@ -34,6 +36,7 @@ export default connect( null, { initBlockHeader, - fetchProcesses: processesAction.request + fetchProcesses: processesAction.request, + fetchContracts: contractsAction.request }, )(AppContainer); diff --git a/embark-ui/src/containers/ContractLoggerContainer.js b/embark-ui/src/containers/ContractLoggerContainer.js index 33dd5bb8..1c56b6f2 100644 --- a/embark-ui/src/containers/ContractLoggerContainer.js +++ b/embark-ui/src/containers/ContractLoggerContainer.js @@ -5,7 +5,7 @@ import {withRouter} from 'react-router-dom'; import {contractLogs as contractLogsAction} from '../actions'; import ContractLogger from '../components/ContractLogger'; -// import DataWrapper from "../components/DataWrapper"; +import DataWrapper from "../components/DataWrapper"; import {getContractLogsByContract} from "../reducers/selectors"; class ContractProfileContainer extends Component { @@ -17,7 +17,9 @@ class ContractProfileContainer extends Component { render() { return ( - + ( + + )} /> ); } } diff --git a/embark-ui/src/containers/ContractsContainer.js b/embark-ui/src/containers/ContractsContainer.js index 3ed0350f..dca0f6f8 100644 --- a/embark-ui/src/containers/ContractsContainer.js +++ b/embark-ui/src/containers/ContractsContainer.js @@ -2,16 +2,11 @@ import React, {Component} from 'react'; import {connect} from 'react-redux'; import PropTypes from 'prop-types'; -import {contracts as contractsAction} from '../actions'; import Contracts from '../components/Contracts'; import DataWrapper from "../components/DataWrapper"; import {getContracts} from "../reducers/selectors"; class ContractsContainer extends Component { - componentDidMount() { - this.props.fetchContracts(); - } - render() { return ( 0} {...this.props} render={({contracts}) => ( @@ -26,13 +21,9 @@ function mapStateToProps(state) { } ContractsContainer.propTypes = { - contracts: PropTypes.array, - fetchContracts: PropTypes.func + contracts: PropTypes.array }; export default connect( - mapStateToProps, - { - fetchContracts: contractsAction.request - }, + mapStateToProps )(ContractsContainer); diff --git a/embark-ui/src/reducers/selectors.js b/embark-ui/src/reducers/selectors.js index f39e0277..b957c909 100644 --- a/embark-ui/src/reducers/selectors.js +++ b/embark-ui/src/reducers/selectors.js @@ -47,8 +47,7 @@ export function getProcessLogsByProcess(state, processName) { } export function getContractLogsByContract(state, contractName) { - return state.entities.contractLogs; - // return state.entities.processLogs.filter((processLog => processLog.name === processName)); + return state.entities.contractLogs.filter((contractLog => contractLog.name === contractName)); } export function getContracts(state) { diff --git a/lib/modules/console_listener/index.js b/lib/modules/console_listener/index.js index 971105f9..6e6d3d9c 100644 --- a/lib/modules/console_listener/index.js +++ b/lib/modules/console_listener/index.js @@ -94,7 +94,7 @@ class ConsoleListener { gasUsed = utils.hexToNumber(gasUsed); blockNumber = utils.hexToNumber(blockNumber); - this.logs.push(Object.assign({}, request, {name, functionName, paramString})); + this.logs.push(Object.assign({}, request, {name, functionName, paramString, gasUsed, blockNumber})); this.logger.info(`Blockchain>`.underline + ` ${name}.${functionName}(${paramString})`.bold + ` | ${transactionHash} | gas:${gasUsed} | blk:${blockNumber} | status:${status}`); } else {