Skip to content

Commit

Permalink
Merge pull request #176 from poanetwork/develop
Browse files Browse the repository at this point in the history
Merge the develop branch to the master branch
  • Loading branch information
akolotov authored Dec 26, 2018
2 parents 3db8dbc + 0e2fd76 commit 3f8c713
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions src/stores/TxStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { action, observable } from "mobx";
import { estimateGas } from './utils/web3'
import { addPendingTransaction, removePendingTransaction } from './utils/testUtils'
import { getUnit } from './utils/bridgeMode'
import yn from '../components/utils/yn'

class TxStore {
@observable txsValues = {}
Expand Down Expand Up @@ -112,21 +113,21 @@ class TxStore {
this.alertStore.setBlockConfirmations(8)
this.alertStore.setLoadingStepIndex(2)

if (process.env.REACT_APP_FOREIGN_WITHOUT_EVENTS) {
this.foreignStore.addWaitingForConfirmation(hash)
} else {
if (yn(process.env.REACT_APP_FOREIGN_WITHOUT_EVENTS)) {
this.foreignStore.waitUntilProcessed(hash).then(() => {
this.alertStore.setLoadingStepIndex(3)
const unitReceived = getUnit(this.rootStore.bridgeMode).unitForeign
setTimeout(() => {
this.alertStore.pushSuccess(
`${unitReceived} received on ${this.homeStore.networkName}`,
`${unitReceived} received on ${this.foreignStore.networkName}`,
this.alertStore.FOREIGN_TRANSFER_SUCCESS
)
}
, 2000)
removePendingTransaction()
})
} else {
this.foreignStore.addWaitingForConfirmation(hash)
}
} else {
if(blockConfirmations > 0) {
Expand All @@ -141,22 +142,21 @@ class TxStore {
this.alertStore.setBlockConfirmations(8)
this.alertStore.setLoadingStepIndex(2)

if (process.env.REACT_APP_FOREIGN_WITHOUT_EVENTS) {
this.homeStore.addWaitingForConfirmation(hash)
if (yn(process.env.REACT_APP_HOME_WITHOUT_EVENTS)) {
this.homeStore.waitUntilProcessed(hash, this.txsValues[hash]).then(() => {
this.alertStore.setLoadingStepIndex(3)
const unitReceived = getUnit(this.rootStore.bridgeMode).unitHome
setTimeout(() => {
this.alertStore.pushSuccess(
`${unitReceived} received on ${this.homeStore.networkName}`,
this.alertStore.HOME_TRANSFER_SUCCESS
)
}
, 2000)
removePendingTransaction()
})
} else {
this.homeStore.waitUntilProcessed(hash, this.txsValues[hash])
.then(() => {
this.alertStore.setLoadingStepIndex(3)
const unitReceived = getUnit(this.rootStore.bridgeMode).unitHome
setTimeout(() => {
this.alertStore.pushSuccess(
`${unitReceived} received on ${this.foreignStore.networkName}`,
this.alertStore.HOME_TRANSFER_SUCCESS
)
}
, 2000)
removePendingTransaction()
})
this.homeStore.addWaitingForConfirmation(hash)
}
} else {
if(blockConfirmations > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/stores/utils/bridgeMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const getUnit = (bridgeMode) => {
unitHome = 'Tokens'
unitForeign = 'Tokens'
} else if (bridgeMode === BRIDGE_MODES.ERC_TO_NATIVE) {
unitHome = 'Tokens'
unitForeign = 'Native coins'
unitHome = 'Native coins'
unitForeign = 'Tokens'
} else {
throw new Error(`Unrecognized bridge mode: ${bridgeMode}`)
}
Expand Down

0 comments on commit 3f8c713

Please sign in to comment.