@@ -194,39 +194,46 @@ class InvitesSend extends React.Component {
195 for (let i = 0; i < invites.length; i++) {
195 for (let i = 0; i < invites.length; i++) {
196 const invite = invites[i];
196 const invite = invites[i];
198+ // send transaction, informing the user of failure
199+ const txHash = await sendSignedTransaction(
197− sendSignedTransaction(web3, Just(invite.signedTx), tankWasUsed, ()=>{})
200+ web3, Just(invite.signedTx), tankWasUsed, ()=>{}
199− waitForTransactionConfirm(web3, txHash)
200− .then(async success => {
202− console.log('tx succeeded, sending mail', i);
203− success = await sendMail(
204− invite.recipient, invite.ticket, invite.rawTx
207− this.setEmailStatus(i, EMAIL_STATUS.DONE);
209− console.log('email send failed');
211− 'Invite email failed to send for ' + invite.recipient +
212− '. Please give them this ticket: ' + invite.ticket
214− //TODO but this doesn't catch sender-side failures... we may
215− // just need really good monitoring for that...
216− this.setEmailStatus(i, EMAIL_STATUS.FAIL);
219− console.log('invite tx rejected');
220− this.addError('Invite transaction failed for ' + invite.recipient);
221− this.setEmailStatus(i, EMAIL_STATUS.FAIL);
225− .catch(err => {
201+ ).catch(err => {
226 console.error('invite tx sending failed', err);
202 console.error('invite tx sending failed', err);
227 this.addError('Invite transaction not sent for ' + invite.recipient);
203 this.addError('Invite transaction not sent for ' + invite.recipient);
228 this.setEmailStatus(i, EMAIL_STATUS.FAIL);
204 this.setEmailStatus(i, EMAIL_STATUS.FAIL);
207+ // ask the email sender to send this. we can do this prior to tx confirm,
208+ // because the sender service waits for confirm & success for us.
209+ const mailSuccess = await sendMail(
210+ invite.recipient, invite.ticket, invite.rawTx
212+ //TODO but this doesn't catch sender-side failures... we may
213+ // just need really good monitoring for that...
215+ this.setEmailStatus(i, EMAIL_STATUS.DONE);
217+ console.log('email send failed');
218+ //NOTE this assumes that the transaction succeeds, but we don't know
219+ // that for a fact yet...
221+ 'Invite email failed to send for ' + invite.recipient +
222+ '. Please give them this ticket: ' + invite.ticket
224+ this.setEmailStatus(i, EMAIL_STATUS.FAIL);
227+ // update status on transaction confirm, but don't block on it
228+ waitForTransactionConfirm(web3, txHash)
229+ .then(async success => {
231+ console.log('invite tx rejected');
232+ this.addError('Invite transaction failed for ' + invite.recipient);
233+ this.setEmailStatus(i, EMAIL_STATUS.FAIL);
232 this.setState({ status: STATUS.DONE });
239 this.setState({ status: STATUS.DONE });