import React from 'react'
import { Row, Col, H1, H3, P, Warning, Anchor } from '../components/Base'
import { Button } from '../components/Base'
import { ROUTE_NAMES } from '../lib/router'
import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
import { NETWORK_NAMES } from '../lib/network'
const Success = (props) => {
const esvisible =
props.networkType === NETWORK_NAMES.ROPSTEN ||
props.networkType === NETWORK_NAMES.MAINNET
const esdomain =
props.networkType === NETWORK_NAMES.ROPSTEN
? "ropsten.etherscan.io"
: "etherscan.io"
const esmessage =
esvisible === true
? "If you’d like to keep track of it, click the Etherscan link below."
: ''
const esanchor =
esvisible === false
?
:
{'View on Etherscan ↗'}
return (
{ 'Your Transaction was Sent' }
{
`We sent your transaction to the chain. It can take some time to
execute, especially if the network is busy. ${esmessage}`
}
{ 'Transaction Hash' }
{ props.hash }
{ esanchor }
)
}
const Failure = (props) =>
{ 'Error!' }
{
'There was an error sending your transaction.'
}
{ renderTxnError(props.web3, props.message) }
const SentTransaction = (props) => {
const { web3, txnHashCursor, networkType, popRoute, pushRoute } = props
const { setPointCursor, pointCursor } = props
const promptKeyfile = props.routeData && props.routeData.promptKeyfile
const w3 = web3.matchWith({
Nothing: _ => { throw BRIDGE_ERROR.MISSING_WEB3 },
Just: res => res.value
})
const result = txnHashCursor.matchWith({
Nothing: _ => { throw BRIDGE_ERROR.MISSING_TXN },
Just: res => res.value
})
const body = result.matchWith({
Error: message => ,
Ok: hash =>
})
const ok =
let keyfile;
if (promptKeyfile) {
keyfile = (
)
}
return (
{ body }
{ ok }
{ keyfile }
)
}
export default SentTransaction