diff --git a/app/components/PledgesTable.jsx b/app/components/PledgesTable.jsx index c0a143a..358b999 100644 --- a/app/components/PledgesTable.jsx +++ b/app/components/PledgesTable.jsx @@ -16,7 +16,7 @@ const convertToDatetime = (field, fundProfiles) => { const { commitTime, id } = field const profile = fundProfiles[id - 1] //TODO fix - add commitTime from funder and delegates to get actual dateTime - if (Number(commitTime) === 0) return 0 + if (!profile || Number(commitTime) === 0) return 0 const time = Number(commitTime) + Number(profile.commitTime) const date = new Date(time * 1000) return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` diff --git a/app/components/TransferDialog.jsx b/app/components/TransferDialog.jsx index 99962a0..f95c287 100644 --- a/app/components/TransferDialog.jsx +++ b/app/components/TransferDialog.jsx @@ -17,26 +17,27 @@ const { transfer } = LiquidPledgingMock.methods const TransferDialog = ({ row, handleClose, transferPledgeAmounts }) => ( { - const { id } = row - const { idSender, amount, idReceiver } = values - const args = [idSender, id, toWei(amount.toString()), idReceiver] - - const toSend = transfer(...args); - const estimatedGas = await toSend.estimateGas(); - - toSend.send({gas: estimatedGas + 1000}) - .then(res => { - console.log({res}) - const { events: { Transfer: { returnValues } } } = res - transferPledgeAmounts(returnValues) - handleClose() - }) - .catch(e => { - console.log({e}) - }) - .finally(() => { resetForm() }) - }} + onSubmit={async (values, { setSubmitting, resetForm, setStatus }) => { + const { id } = row + const { idSender, amount, idReceiver } = values + const args = [idSender, id, toWei(amount.toString()), idReceiver] + const toSend = transfer(...args); + const estimatedGas = await toSend.estimateGas(); + + toSend.send({gas: estimatedGas + 1000}) + .then(res => { + console.log({res}) + const { events: { Transfer: { returnValues } } } = res + transferPledgeAmounts(returnValues) + }) + .catch(e => { + console.log({e}) + }) + .finally(() => { + handleClose() + resetForm() + }) + }} > {({ values,