Added gas estimation
This commit is contained in:
parent
b96ecd5a20
commit
5e9a0da95c
|
@ -102,17 +102,20 @@ const AddPoll = withFormik({
|
|||
const { addPoll } = PollManager.methods;
|
||||
const currentBlock = await getBlockNumber();
|
||||
const endTime = currentBlock + (oneDayinBlocks * 90);
|
||||
addPoll(
|
||||
endTime,
|
||||
singleChoiceDef(description, ['YES', 'NO'])
|
||||
)
|
||||
.send()
|
||||
|
||||
const toSend = addPoll(endTime, singleChoiceDef(description, ['YES']));
|
||||
toSend.estimateGas()
|
||||
.then(gasEstimated => {
|
||||
console.log("addPoll gas estimated: "+gasEstimated);
|
||||
return toSend.send({gas: gasEstimated + 1000});
|
||||
})
|
||||
.then(res => {
|
||||
console.log('sucess:', res);
|
||||
})
|
||||
.catch(res => {
|
||||
console.log('fail:', res);
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
})(StyledForm)
|
||||
|
||||
|
|
Loading…
Reference in New Issue