Skip to content

Instantly share code, notes, and snippets.

@jordanlesich
Last active December 20, 2021 17:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanlesich/2e5ba8b503b9531daedb9e601a1d4a94 to your computer and use it in GitHub Desktop.
Save jordanlesich/2e5ba8b503b9531daedb9e601a1d4a94 to your computer and use it in GitHub Desktop.
const onSubmit = async values => {
setLoading(true);
const now = (new Date().getTime() / 1000).toFixed();
const hash = createHash();
const details = detailsToJSON({ ...values, hash });
const args = [values.applicant, details];
try {
const poll = createPoll({ action: 'submitProposal', cachePoll })({
daoID: daoid,
chainID: daochain,
hash,
actions: {
onError: (error, txHash) => {
errorToast({
title: 'There was an error.',
});
resolvePoll(txHash);
console.error(`Could not find a matching proposal: ${error}`);
},
onSuccess: txHash => {
successToast({
title: 'GuildKick Proposal Submitted to the Dao!',
});
refreshDao();
resolvePoll(txHash);
createForumTopic({
chainID: daochain,
daoID: daoid,
afterTime: now,
proposalType: 'GuildKick Proposal',
values,
applicant: values.applicant,
daoMetaData,
});
},
},
});
const onTxHash = () => {
setProposalModal(false);
setTxInfoModal(true);
};
await MolochService({
web3: injectedProvider,
daoAddress: daoid,
chainID: daochain,
version: daoOverview.version,
})('submitGuildKickProposal')({
args,
address,
poll,
onTxHash,
});
} catch (err) {
setLoading(false);
console.error('error: ', err);
errorToast({
title: err?.message,
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment