Last active
December 20, 2021 17:31
-
-
Save jordanlesich/2e5ba8b503b9531daedb9e601a1d4a94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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