Skip to content

Commit 3f8c713

Browse files
authored
Merge pull request #176 from poanetwork/develop
Merge the develop branch to the master branch
2 parents 3db8dbc + 0e2fd76 commit 3f8c713

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/stores/TxStore.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { action, observable } from "mobx";
22
import { estimateGas } from './utils/web3'
33
import { addPendingTransaction, removePendingTransaction } from './utils/testUtils'
44
import { getUnit } from './utils/bridgeMode'
5+
import yn from '../components/utils/yn'
56

67
class 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) {

src/stores/utils/bridgeMode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export const getUnit = (bridgeMode) => {
5353
unitHome = 'Tokens'
5454
unitForeign = 'Tokens'
5555
} else if (bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) {
56-
unitHome = 'Tokens'
57-
unitForeign = 'Native coins'
56+
unitHome = 'Native coins'
57+
unitForeign = 'Tokens'
5858
} else {
5959
throw new Error(`Unrecognized bridge mode: ${bridgeMode}`)
6060
}

0 commit comments

Comments
 (0)