@@ -2,6 +2,7 @@ import { action, observable } from "mobx";
22import { estimateGas } from './utils/web3'
33import { addPendingTransaction , removePendingTransaction } from './utils/testUtils'
44import { getUnit } from './utils/bridgeMode'
5+ import yn from '../components/utils/yn'
56
67class TxStore {
78 @observable txsValues = { }
@@ -112,21 +113,21 @@ class TxStore {
112113 this . alertStore . setBlockConfirmations ( 8 )
113114 this . alertStore . setLoadingStepIndex ( 2 )
114115
115- if ( process . env . REACT_APP_FOREIGN_WITHOUT_EVENTS ) {
116- this . foreignStore . addWaitingForConfirmation ( hash )
117- } else {
116+ if ( yn ( process . env . REACT_APP_FOREIGN_WITHOUT_EVENTS ) ) {
118117 this . foreignStore . waitUntilProcessed ( hash ) . then ( ( ) => {
119118 this . alertStore . setLoadingStepIndex ( 3 )
120119 const unitReceived = getUnit ( this . rootStore . bridgeMode ) . unitForeign
121120 setTimeout ( ( ) => {
122121 this . alertStore . pushSuccess (
123- `${ unitReceived } received on ${ this . homeStore . networkName } ` ,
122+ `${ unitReceived } received on ${ this . foreignStore . networkName } ` ,
124123 this . alertStore . FOREIGN_TRANSFER_SUCCESS
125124 )
126125 }
127126 , 2000 )
128127 removePendingTransaction ( )
129128 } )
129+ } else {
130+ this . foreignStore . addWaitingForConfirmation ( hash )
130131 }
131132 } else {
132133 if ( blockConfirmations > 0 ) {
@@ -141,22 +142,21 @@ class TxStore {
141142 this . alertStore . setBlockConfirmations ( 8 )
142143 this . alertStore . setLoadingStepIndex ( 2 )
143144
144- if ( process . env . REACT_APP_FOREIGN_WITHOUT_EVENTS ) {
145- this . homeStore . addWaitingForConfirmation ( hash )
145+ if ( yn ( process . env . REACT_APP_HOME_WITHOUT_EVENTS ) ) {
146+ this . homeStore . waitUntilProcessed ( hash , this . txsValues [ hash ] ) . then ( ( ) => {
147+ this . alertStore . setLoadingStepIndex ( 3 )
148+ const unitReceived = getUnit ( this . rootStore . bridgeMode ) . unitHome
149+ setTimeout ( ( ) => {
150+ this . alertStore . pushSuccess (
151+ `${ unitReceived } received on ${ this . homeStore . networkName } ` ,
152+ this . alertStore . HOME_TRANSFER_SUCCESS
153+ )
154+ }
155+ , 2000 )
156+ removePendingTransaction ( )
157+ } )
146158 } else {
147- this . homeStore . waitUntilProcessed ( hash , this . txsValues [ hash ] )
148- . then ( ( ) => {
149- this . alertStore . setLoadingStepIndex ( 3 )
150- const unitReceived = getUnit ( this . rootStore . bridgeMode ) . unitHome
151- setTimeout ( ( ) => {
152- this . alertStore . pushSuccess (
153- `${ unitReceived } received on ${ this . foreignStore . networkName } ` ,
154- this . alertStore . HOME_TRANSFER_SUCCESS
155- )
156- }
157- , 2000 )
158- removePendingTransaction ( )
159- } )
159+ this . homeStore . addWaitingForConfirmation ( hash )
160160 }
161161 } else {
162162 if ( blockConfirmations > 0 ) {
0 commit comments