Merge branch '000-snt-voting-dapp' of https://github.com/status-im/contracts into 000-snt-voting-dapp
This commit is contained in:
commit
e17870ab17
|
@ -92,8 +92,10 @@ const InnerForm = ({
|
||||||
const StyledForm = withStyles(styles)(InnerForm);
|
const StyledForm = withStyles(styles)(InnerForm);
|
||||||
const AddPoll = withFormik({
|
const AddPoll = withFormik({
|
||||||
mapPropsToValues: props => ({ description: ''}),
|
mapPropsToValues: props => ({ description: ''}),
|
||||||
validate(values){
|
validate(values, props){
|
||||||
const errors = {};
|
const errors = {};
|
||||||
|
const { description } = values;
|
||||||
|
if(description.toString().trim() === "") errors.description = true;
|
||||||
return errors;
|
return errors;
|
||||||
},
|
},
|
||||||
async handleSubmit(values, { setSubmitting }) {
|
async handleSubmit(values, { setSubmitting }) {
|
||||||
|
@ -102,17 +104,20 @@ const AddPoll = withFormik({
|
||||||
const { addPoll } = PollManager.methods;
|
const { addPoll } = PollManager.methods;
|
||||||
const currentBlock = await getBlockNumber();
|
const currentBlock = await getBlockNumber();
|
||||||
const endTime = currentBlock + (oneDayinBlocks * 90);
|
const endTime = currentBlock + (oneDayinBlocks * 90);
|
||||||
addPoll(
|
|
||||||
endTime,
|
const toSend = addPoll(endTime, singleChoiceDef(description, ['YES']));
|
||||||
singleChoiceDef(description, ['YES', 'NO'])
|
toSend.estimateGas()
|
||||||
)
|
.then(gasEstimated => {
|
||||||
.send()
|
console.log("addPoll gas estimated: "+gasEstimated);
|
||||||
|
return toSend.send({gas: gasEstimated + 1000});
|
||||||
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('sucess:', res);
|
console.log('sucess:', res);
|
||||||
})
|
})
|
||||||
.catch(res => {
|
.catch(res => {
|
||||||
console.log('fail:', res);
|
console.log('fail:', res);
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
})(StyledForm)
|
})(StyledForm)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue