Adding topic, to, value and data

This commit is contained in:
Richard Ramos 2018-06-25 17:06:19 -04:00
parent 9f122d36ff
commit 98dcb1f803
2 changed files with 48 additions and 8 deletions

View File

@ -97,6 +97,46 @@ class InnerForm extends PureComponent {
onBlur={handleBlur} onBlur={handleBlur}
value={values.url} value={values.url}
/> />
<FieldGroup
id="topic"
name="topic"
type="text"
label="Topic"
onChange={handleChange}
onBlur={handleBlur}
value={values.topic}
/>
<FieldGroup
id="to"
name="to"
type="text"
label="To"
onChange={handleChange}
onBlur={handleBlur}
value={values.to}
/>
<FieldGroup
id="data"
name="data"
type="text"
label="Data"
onChange={handleChange}
onBlur={handleBlur}
value={values.data}
/>
<FieldGroup
id="value"
name="value"
type="text"
label="Value"
onChange={handleChange}
onBlur={handleBlur}
value={values.value}
/>
<Button type="submit" disabled={!canSubmit || isSubmitting}>{isSubmitting ? 'Submission in progress' : 'Submit'}</Button> <Button type="submit" disabled={!canSubmit || isSubmitting}>{isSubmitting ? 'Submission in progress' : 'Submit'}</Button>
</Form> </Form>
</Fragment> </Fragment>
@ -105,14 +145,14 @@ class InnerForm extends PureComponent {
} }
const ProposalManager = withFormik({ const ProposalManager = withFormik({
mapPropsToValues: props => ({ title: '', description: '', url: '' }), mapPropsToValues: props => ({ title: '', description: '', url: '', data: '0x00', value: '0', topic: '0x00', to: '0x0000000000000000000000000000000000000000' }),
validate(values) {}, validate(values) {},
handleSubmit(values, { setSubmitting}){ handleSubmit(values, { setSubmitting}){
let dataObj = { let dataObj = {
title: values.title, title: values.title,
description: values.description, description: values.description,
url: values.url url: values.url,
}; };
const { toHex } = web3.utils; const { toHex } = web3.utils;
@ -123,10 +163,10 @@ const ProposalManager = withFormik({
const hexHash = toHex(hash); const hexHash = toHex(hash);
//TODO create toggle for address approval //TODO create toggle for address approval
submitProposal( submitProposal(
"0x00", values.topic,
"0x0000000000000000000000000000000000000000", values.to,
0, values.value,
"0x00", values.data,
hexHash hexHash
) )
.send({from: web3.eth.defaultAccount, gasLimit: 1000000}) .send({from: web3.eth.defaultAccount, gasLimit: 1000000})

View File

@ -13,7 +13,6 @@ contract PollManager is Controlled {
event PollCanceled(uint256 pollId); event PollCanceled(uint256 pollId);
event Voted(address voter, uint8[] votes); event Voted(address voter, uint8[] votes);
MiniMeTokenFactory public tokenFactory; MiniMeTokenFactory public tokenFactory;
MiniMeTokenInterface public token; MiniMeTokenInterface public token;
@ -48,6 +47,7 @@ contract PollManager is Controlled {
uint8 _numOptions uint8 _numOptions
) )
public public
onlyController
returns (uint pollId) returns (uint pollId)
{ {
pollId = polls.length++; pollId = polls.length++;