rename Giving to Funding

This commit is contained in:
Barry Gitarts 2018-11-30 06:02:57 -05:00
parent 7a81eb3f6a
commit 87d3ae59d8
2 changed files with 19 additions and 22 deletions

View File

@ -9,16 +9,14 @@ import web3 from "Embark/web3";
const { addGiver, numberOfPledgeAdmins, getPledgeAdmin } = LiquidPledgingMock.methods; const { addGiver, numberOfPledgeAdmins, getPledgeAdmin } = LiquidPledgingMock.methods;
const hoursToSeconds = hours => hours * 60 * 60; const hoursToSeconds = hours => hours * 60 * 60;
const createGiver = async (name, url, commitTime) => {
}
const Giving = () => ( const AddFunder = () => (
<Formik <Formik
initialValues={{ giverName: '', giverProfile: '', commitTime : '' }} initialValues={{ funderName: '', funderProfile: '', commitTime : '' }}
onSubmit={async (values, { setSubmitting, resetForm }) => { onSubmit={async (values, { setSubmitting, resetForm }) => {
const { giverName, giverProfile, commitTime } = values; const { funderName, funderProfile, commitTime } = values;
const account = await web3.eth.getCoinbase(); const account = await web3.eth.getCoinbase();
const args = [giverName, giverProfile, commitTime, 0]; const args = [funderName, funderProfile, commitTime, 0];
addGiver(...args) addGiver(...args)
.estimateGas({ from: account }) .estimateGas({ from: account })
.then(async gas => { .then(async gas => {
@ -40,26 +38,26 @@ const Giving = () => (
}) => ( }) => (
<form onSubmit={handleSubmit} style={{ display: 'flex', flexDirection: 'column' }}> <form onSubmit={handleSubmit} style={{ display: 'flex', flexDirection: 'column' }}>
<TextField <TextField
id="giverName" id="funderName"
name="giverName" name="funderName"
label="Giver Name" label="Funder Name"
placeholder="Giver Name" placeholder="Funder Name"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={handleChange} onChange={handleChange}
onBlur={handleBlur} onBlur={handleBlur}
value={values.giverName || ''} value={values.funderName || ''}
/> />
<TextField <TextField
id="giverProfile" id="funderProfile"
name="giverProfile" name="funderProfile"
label="Giver Profile URL or IPFS Hash" label="Funder Profile URL or IPFS Hash"
placeholder="Giver Profile URL or IPFS Hash" placeholder="Funder Profile URL or IPFS Hash"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
onChange={handleChange} onChange={handleChange}
onBlur={handleBlur} onBlur={handleBlur}
value={values.giverProfile || ''} value={values.funderProfile || ''}
/> />
<TextField <TextField
id="commitTime" id="commitTime"
@ -68,17 +66,17 @@ const Giving = () => (
placeholder="Commit time in hours" placeholder="Commit time in hours"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
helperText="The length of time in hours the Giver has to veto when the delegates pledge funds to a project" helperText="The length of time in hours the Funder has to veto when the delegates pledge funds to a project"
onChange={handleChange} onChange={handleChange}
onBlur={handleBlur} onBlur={handleBlur}
value={values.commitTime || ''} value={values.commitTime || ''}
/> />
<Button variant="contained" color="primary" type="submit"> <Button variant="contained" color="primary" type="submit">
ADD GIVER ADD FUNDER
</Button> </Button>
</form> </form>
)} )}
</Formik> </Formik>
) )
export default Giving; export default AddFunder;

View File

@ -3,7 +3,7 @@ import EmbarkJS from 'Embark/EmbarkJS';
import LPVault from 'Embark/contracts/LPVault'; import LPVault from 'Embark/contracts/LPVault';
import LiquidPledgingMock from 'Embark/contracts/LiquidPledgingMock'; import LiquidPledgingMock from 'Embark/contracts/LiquidPledgingMock';
import web3 from "Embark/web3"; import web3 from "Embark/web3";
import Giving from './components/Giving'; import AddFunder from './components/AddFunder';
const { getNetworkType } = web3.eth.net; const { getNetworkType } = web3.eth.net;
@ -16,7 +16,6 @@ class App extends React.Component {
componentDidMount(){ componentDidMount(){
EmbarkJS.onReady(async (err) => { EmbarkJS.onReady(async (err) => {
getNetworkType().then(network => { getNetworkType().then(network => {
//TODO add window.ethereum.enable();
const { environment } = EmbarkJS const { environment } = EmbarkJS
this.setState({ network, environment }) this.setState({ network, environment })
}); });
@ -26,7 +25,7 @@ class App extends React.Component {
render() { render() {
return ( return (
<div> <div>
<Giving /> <AddFunder />
</div> </div>
) )
} }