mirror of
https://github.com/status-im/visual-identity.git
synced 2025-02-12 20:46:35 +00:00
add rlp encoding for new proposal
This commit is contained in:
parent
0f0c7261c4
commit
0d75175db3
@ -5,11 +5,27 @@ import CardContent from '@material-ui/core/CardContent';
|
||||
import PollManager from 'Embark/contracts/PollManager';
|
||||
import TextField from '@material-ui/core/TextField';
|
||||
import Button from '@material-ui/core/Button';
|
||||
import { map } from 'lodash';
|
||||
import rlp from 'rlp';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { withFormik } from 'formik';
|
||||
|
||||
const oneDayinBlocks = 5760;
|
||||
|
||||
const singleChoiceDef = (question, options) => {
|
||||
const d = [
|
||||
new Buffer(question),
|
||||
map(options, function(o) {
|
||||
return new Buffer(o);
|
||||
})
|
||||
];
|
||||
|
||||
const b = rlp.encode(d);
|
||||
const rlpDefinition = '0x' + b.toString('hex');
|
||||
|
||||
return rlpDefinition;
|
||||
}
|
||||
|
||||
const styles = theme => ({
|
||||
button: {
|
||||
margin: theme.spacing.unit,
|
||||
@ -74,7 +90,7 @@ const AddPoll = withFormik({
|
||||
const endTime = currentBlock + (oneDayinBlocks * 90);
|
||||
addPoll(
|
||||
endTime,
|
||||
asciiToHex(description)
|
||||
singleChoiceDef(description, ['YES', 'NO'])
|
||||
)
|
||||
.send()
|
||||
.then(res => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user