on master help sign in
Send request to email sender prior to submitting transaction
d587c96Fang
src/bridge/views/InvitesSend.js+12−12
@@ -30,7 +30,8 @@ import {
30 signTransaction,
30 signTransaction,
31 sendSignedTransaction,
31 sendSignedTransaction,
32 waitForTransactionConfirm,
32 waitForTransactionConfirm,
33− isTransactionConfirmed
33+ isTransactionConfirmed,
34+ hexify
34} from '../lib/txn'
35} from '../lib/txn'
35import * as tank from '../lib/tank'
36import * as tank from '../lib/tank'
36import Tx from 'ethereumjs-tx'
37import Tx from 'ethereumjs-tx'
@@ -55,8 +56,8 @@ class InvitesSend extends React.Component {
55 this.generateWallet = this.generateWallet.bind(this);
56 this.generateWallet = this.generateWallet.bind(this);
56 this.canGenerate = this.canGenerate.bind(this);
57 this.canGenerate = this.canGenerate.bind(this);
57 this.handleEmailInput = this.handleEmailInput.bind(this);
58 this.handleEmailInput = this.handleEmailInput.bind(this);
58− this.txnConfirmation = this.txnConfirmation.bind(this);
59 this.createUnsignedTxn = this.createUnsignedTxn.bind(this);
59 this.createUnsignedTxn = this.createUnsignedTxn.bind(this);
60+ this.beforeSend = this.beforeSend.bind(this);
60 }
61 }
61
62
62 componentDidMount() {
63 componentDidMount() {
@@ -166,15 +167,13 @@ class InvitesSend extends React.Component {
166 return Just(txn)
167 return Just(txn)
167 }
168 }
168
169
169− //TODO find a better way of making the user wait for submission success
170+ async beforeSend(stx) {
170− // and email sending, so that we can catch failure cases and can
171+ const rawTx = hexify(stx.serialize());
171− // always fall back to retrying or "please send them this"
172+ return await sendMail(
172− txnConfirmation(txHash, confirmations) {
173+ this.state.targetEmail,
173− this.props.setTxnConfirmations(txHash, confirmations);
174− if (confirmations === 1) {
175− sendMail(this.state.targetEmail, this.state.inviteWallet.value.ticket)
174+ this.state.inviteWallet.value.ticket,
176− .then(console.log);
175+ rawTx
177− }
176+ );
178 }
177 }
179
178
180 render() {
179 render() {
@@ -244,8 +243,9 @@ class InvitesSend extends React.Component {
244 walletType={this.props.walletType}
243 walletType={this.props.walletType}
245 walletHdPath={this.props.walletHdPath}
244 walletHdPath={this.props.walletHdPath}
246 networkType={this.props.networkType}
245 networkType={this.props.networkType}
247− setTxnConfirmations={this.txnConfirmation}
246+ beforeSend={this.beforeSend}
248 onSent={this.props.setTxnHashCursor}
247 onSent={this.props.setTxnHashCursor}
248+ setTxnConfirmations={this.props.setTxnConfirmations}
249 popRoute={this.props.popRoute}
249 popRoute={this.props.popRoute}
250 pushRoute={this.props.pushRoute}
250 pushRoute={this.props.pushRoute}
251 // Other
251 // Other