mirror of
https://github.com/status-im/visual-identity.git
synced 2025-02-13 04:57:03 +00:00
fix premature 50 block no confirm error
add full refresh due to new off by one error
This commit is contained in:
parent
84694d1dd2
commit
c47908a454
@ -1,4 +1,5 @@
|
|||||||
import React, { Fragment, PureComponent } from 'react';
|
import React, { Fragment, PureComponent } from 'react';
|
||||||
|
import { toString } from 'lodash';
|
||||||
import AppBar from '@material-ui/core/AppBar';
|
import AppBar from '@material-ui/core/AppBar';
|
||||||
import Toolbar from '@material-ui/core/Toolbar';
|
import Toolbar from '@material-ui/core/Toolbar';
|
||||||
import Card from '@material-ui/core/Card';
|
import Card from '@material-ui/core/Card';
|
||||||
@ -79,7 +80,7 @@ class Poll extends PureComponent {
|
|||||||
const { value } = this.state;
|
const { value } = this.state;
|
||||||
const { toWei } = web3.utils;
|
const { toWei } = web3.utils;
|
||||||
|
|
||||||
const balance4Voting = toWei(value * value);
|
const balance4Voting = toWei(toString(value * value));
|
||||||
const toSend = balance4Voting == 0 ? unvote(idPoll) : customVote(idPoll, balance4Voting);
|
const toSend = balance4Voting == 0 ? unvote(idPoll) : customVote(idPoll, balance4Voting);
|
||||||
|
|
||||||
toSend.estimateGas()
|
toSend.estimateGas()
|
||||||
|
@ -57,11 +57,14 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updatePoll = async (idPoll) => {
|
updatePoll = async (idPoll) => {
|
||||||
const { poll } = PollManager.methods;
|
const { poll, nPolls } = PollManager.methods;
|
||||||
const { rawPolls } = this.state;
|
const { rawPolls } = this.state;
|
||||||
|
const npolls = await nPolls().call();
|
||||||
|
// This check needs to be done because of a bug in web3
|
||||||
|
if (npolls !== rawPolls.length) return this._getPolls();
|
||||||
const newPolls = [...rawPolls];
|
const newPolls = [...rawPolls];
|
||||||
const updatedPoll = await poll(idPoll).call();
|
const updatedPoll = await poll(idPoll).call();
|
||||||
newPolls[idPoll] = updatedPoll;
|
newPolls[idPoll] = { ...updatedPoll };
|
||||||
this.setState({ rawPolls: newPolls });
|
this.setState({ rawPolls: newPolls });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"buildDir": "dist/",
|
"buildDir": "dist/",
|
||||||
"config": "config/",
|
"config": "config/",
|
||||||
"versions": {
|
"versions": {
|
||||||
"web3": "1.0.0-beta",
|
"web3": "1.0.0-beta.34",
|
||||||
"solc": "0.4.24",
|
"solc": "0.4.24",
|
||||||
"ipfs-api": "17.2.4"
|
"ipfs-api": "17.2.4"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user