diff --git a/client/src/components/Proposals.jsx b/client/src/components/Proposals.jsx
index b6e1092..cf9d301 100644
--- a/client/src/components/Proposals.jsx
+++ b/client/src/components/Proposals.jsx
@@ -30,6 +30,7 @@ function Proposals() {
const [proposals, dispatchProposal] = useList();
const proposalsContract = useRef();
const [showAddProposal, setShowAddProposal] = useState(false);
+ const [durations, setDurations] = useState([]);
const fetchProposal = useCallback(async (proposalIndex) => {
const proposal = await proposalsContract.current.methods.proposals(proposalIndex).call();
@@ -85,16 +86,24 @@ function Proposals() {
};
}, [provider, chainId, proposalsContract, fetchProposals, fetchProposal]);
- const handleShowAddProposal = () => setShowAddProposal(true);
+ const handleShowAddProposal = (duration0, duration1, duration2) => {
+ setDurations([duration0, duration1, duration2]);
+ setShowAddProposal(true);
+ };
const onSubmitProposal = useCallback(async (post) => {
// TODO: Make referenda durations configurable
- await proposalsContract.current.methods.propose(post.hash, 20, 40, 60).send({
+ await proposalsContract.current.methods.propose(
+ post.hash,
+ durations[0],
+ durations[1],
+ durations[2],
+ ).send({
from: account,
gas: 1000000,
value: 10000,
});
- }, [account, proposalsContract]);
+ }, [account, proposalsContract, durations]);
const handleAttest = useCallback(async (proposalIndex) => {
await proposalsContract.current.methods.attest(proposalIndex, reputation).send({
@@ -142,10 +151,29 @@ function Proposals() {
};
return (
<>
-