@@ -25,6 +25,7 @@ import {
26const SUBMISSION_STATES = {
26const SUBMISSION_STATES = {
27 PROMPT: 'Send transaction',
27 PROMPT: 'Send transaction',
28+ PREPARING: 'Preparing...',
28 FUNDING: 'Finding transaction funding...',
29 FUNDING: 'Finding transaction funding...',
29 SENDING: 'Sending transaction...'
30 SENDING: 'Sending transaction...'
@@ -183,14 +184,30 @@ class StatelessTransaction extends React.Component {
183 const { props, state } = this;
184 const { props, state } = this;
184 const web3 = props.web3.value;
185 const web3 = props.web3.value;
186− this.setState({ txStatus: SUBMISSION_STATES.FUNDING });
188 const stx = state.stx.matchWith({
187 const stx = state.stx.matchWith({
189 Just: tx => tx.value,
188 Just: tx => tx.value,
190 Nothing: () => {
189 Nothing: () => {
191 throw BRIDGE_ERROR.MISSING_TXN;
190 throw BRIDGE_ERROR.MISSING_TXN;
194+ if (props.beforeSend) {
196+ this.setState({ txStatus: SUBMISSION_STATES.PREPARING });
197+ const res = await props.beforeSend(stx);
198+ if (res === false) throw 'beforeSend disallowed sending';
200+ console.log('beforeSend error', e);
202+ txStatus: SUBMISSION_STATES.PROMPT,
203+ txError: Just('Something went wrong!')
209+ this.setState({ txStatus: SUBMISSION_STATES.FUNDING });
194 const rawTx = hexify(stx.serialize());
211 const rawTx = hexify(stx.serialize());
195 const cost = (state.gasLimit * toWei(state.gasPrice, 'gwei'));
212 const cost = (state.gasLimit * toWei(state.gasPrice, 'gwei'));