@@ -30,7 +30,8 @@ import {
3030 signTransaction,
3131 sendSignedTransaction,
3232 waitForTransactionConfirm,
33− isTransactionConfirmed
33+ isTransactionConfirmed,
34+ hexify
3435} from '../lib/txn'
3536import * as tank from '../lib/tank'
3637import Tx from 'ethereumjs-tx'
@@ -55,8 +56,8 @@ class InvitesSend extends React.Component {
5556 this.generateWallet = this.generateWallet.bind(this);
5657 this.canGenerate = this.canGenerate.bind(this);
5758 this.handleEmailInput = this.handleEmailInput.bind(this);
58− this.txnConfirmation = this.txnConfirmation.bind(this);
5959 this.createUnsignedTxn = this.createUnsignedTxn.bind(this);
60+ this.beforeSend = this.beforeSend.bind(this);
6061 }
6162
6263 componentDidMount() {
@@ -166,15 +167,13 @@ class InvitesSend extends React.Component {
166167 return Just(txn)
167168 }
168169
169− //TODO find a better way of making the user wait for submission success
170− // and email sending, so that we can catch failure cases and can
171− // always fall back to retrying or "please send them this"
172− txnConfirmation(txHash, confirmations) {
173− this.props.setTxnConfirmations(txHash, confirmations);
174− if (confirmations === 1) {
175− sendMail(this.state.targetEmail, this.state.inviteWallet.value.ticket)
176− .then(console.log);
177− }
170+ async beforeSend(stx) {
171+ const rawTx = hexify(stx.serialize());
172+ return await sendMail(
173+ this.state.targetEmail,
174+ this.state.inviteWallet.value.ticket,
175+ rawTx
176+ );
178177 }
179178
180179 render() {
@@ -244,8 +243,9 @@ class InvitesSend extends React.Component {
244243 walletType={this.props.walletType}
245244 walletHdPath={this.props.walletHdPath}
246245 networkType={this.props.networkType}
247− setTxnConfirmations={this.txnConfirmation}
246+ beforeSend={this.beforeSend}
248247 onSent={this.props.setTxnHashCursor}
248+ setTxnConfirmations={this.props.setTxnConfirmations}
249249 popRoute={this.props.popRoute}
250250 pushRoute={this.props.pushRoute}
251251 // Other