embark/lib/modules/webserver/backend/contracts/components/function-area.js

37 lines
1019 B
JavaScript
Raw Normal View History

2018-08-02 19:17:40 +00:00
import React from 'react';
import FunctionForm from './function-form';
import PropTypes from 'prop-types';
2018-04-16 18:05:57 +00:00
class FunctionArea extends React.Component {
2018-08-02 19:17:40 +00:00
constructor(props) {
super(props);
this.state = {};
}
render() {
const type = this.props.type;
const contract = this.props.contract;
const contractName = this.props.contractName;
2018-04-16 18:05:57 +00:00
2018-08-02 19:17:40 +00:00
return <React.Fragment>
{
this.props.contract.options.jsonInterface
.filter(item => item.type === type)
.map((item, i) => <FunctionForm definition={this.props.definition} key={i} contract={contract}
contractName={contractName} abi={item}
instanceUpdate={this.props.instanceUpdate}/>)
}
</React.Fragment>;
}
2018-04-16 18:05:57 +00:00
}
2018-08-02 19:17:40 +00:00
FunctionArea.propTypes = {
type: PropTypes.string,
contract: PropTypes.object,
contractName: PropTypes.string,
definition: PropTypes.object,
instanceUpdate: PropTypes.func
};
export default FunctionArea;