@@ -8,70 +8,100 @@ import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
8import { NETWORK_NAMES } from '../lib/network'
8import { NETWORK_NAMES } from '../lib/network'
11−const Success = (props) => {
11+class Success extends React.Component {
13− const { networkType, hash, txnConfirmations } = props
13+ constructor(props) {
15− const esvisible =
16+ this.state = {
16− networkType === NETWORK_NAMES.ROPSTEN ||
17+ pending: '.',
17− networkType === NETWORK_NAMES.MAINNET
18+ interval: null
22+ componentDidMount() {
19− const esdomain =
23+ const nextDot = {'.': '..',
20− networkType === NETWORK_NAMES.ROPSTEN
24+ '..': '...',
21− ? "ropsten.etherscan.io"
25+ '...': '.'}
24− const esmessage =
27+ const interval = setInterval(() => {
25− esvisible === true
28+ this.setState(({ pending }) => ({pending: nextDot[pending]}))
26− ? "If you’d like to keep track of it, click the Etherscan link below."
29+ }, 1000)
27− : ''
30+ this.setState({interval: interval})
29− const esanchor =
33+ componentDidUnmount() {
30− esvisible === false
34+ clearInterval(this.state.interval)
33− className={'mb-4 mt-1'}
36− href={`https://${esdomain}/tx/${hash}`}>
37− {'View on Etherscan ↗'}
40− const confirmations = Maybe.fromNullable(txnConfirmations[hash]).getOrElse(0)
37+ render() {
42− const requiredConfirmations = 1
39+ const { props, state } = this
40+ const { networkType, hash, txnConfirmations } = props
41+ const { pending } = state
44− const status = confirmations < requiredConfirmations ? 'Pending...' : `Confirmed x${confirmations}!`
43+ const esvisible =
44+ networkType === NETWORK_NAMES.ROPSTEN ||
45+ networkType === NETWORK_NAMES.MAINNET
46− return (
47+ const esdomain =
47− <Row>
48+ networkType === NETWORK_NAMES.ROPSTEN
48− <Col>
49+ ? "ropsten.etherscan.io"
49− <H1>{ 'Your Transaction was Sent' }</H1>
50+ : "etherscan.io"
54+ ? "If you’d like to keep track of it, click the Etherscan link below."
61+ className={'mb-4 mt-1'}
64+ href={`https://${esdomain}/tx/${hash}`}>
65+ {'View on Etherscan ↗'}
68+ const confirmations = Maybe.fromNullable(txnConfirmations[hash]).getOrElse(0)
70+ const requiredConfirmations = 1
72+ const status = confirmations < requiredConfirmations ?
73+ `Pending${pending}` : `Confirmed! (x${confirmations} confirmations)!`
78+ <H1>{ 'Your Transaction was Sent' }</H1>
53− `We sent your transaction to the chain. It can take some time to
82+ `We sent your transaction to the chain. It can take some time to
54 execute, especially if the network is busy. ${esmessage}`
83 execute, especially if the network is busy. ${esmessage}`
58− <H3>{ 'Transaction Hash' }</H3>
87+ <H3>{ 'Transaction Hash' }</H3>
63− <H3>{ 'Transaction Status' }</H3>
92+ <H3>{ 'Transaction Status' }</H3>
65− <div>{ status }</div>
94+ <div>{ status }</div>
66− <div>{ esanchor }</div>
95+ <div>{ esanchor }</div>
77const Failure = (props) =>
107const Failure = (props) =>