1import Maybe from 'folktale/maybe';
2import React from 'react';
3import * as need from '../lib/need';
4import { Row, Col, H1, H3, P, Warning, Anchor } from '../components/old/Base';
5import { Button } from '../components/old/Base';
7import { ROUTE_NAMES } from '../lib/routeNames';
8import { useHistory } from '../store/history';
9import { BRIDGE_ERROR, renderTxnError } from '../lib/error';
10import { NETWORK_TYPES } from '../lib/network';
11import { useTxnConfirmations } from '../store/txnConfirmations';
12import { useNetwork } from '../store/network';
13import { useTxnCursor } from '../store/txnCursor';
15class Success extends React.Component {
26 const nextDot = { '.': '..', '..': '...', '...': '.' };
28 const interval = setInterval(() => {
29 this.setState(({ pending }) => ({ pending: nextDot[pending] }));
31 this.setState({ interval: interval });
34 componentWillUnmount() {
35 clearInterval(this.state.interval);
39 const { props, state } = this;
40 const { networkType, hash, txnConfirmations } = props;
41 const { pending } = state;
44 networkType === NETWORK_TYPES.ROPSTEN ||
45 networkType === NETWORK_TYPES.MAINNET;
48 networkType === NETWORK_TYPES.ROPSTEN
49 ? 'ropsten.etherscan.io'
54 ? 'If you’d like to keep track of it, click the Etherscan link below.'
58 esvisible === false ? null : (
60 className={'mb-4 mt-1'}
63 href={`https://${esdomain}/tx/${hash}`}>
64 {'View on Etherscan ↗'}
68 const confirmations = Maybe.fromNullable(txnConfirmations[hash]).getOrElse(
72 const requiredConfirmations = 1;
75 confirmations < requiredConfirmations
77 : `Confirmed! (x${confirmations} confirmations)!`;
82 <H1>{'Your Transaction was Sent'}</H1>
85 {`We sent your transaction to the chain. It can take some time to
86 execute, especially if the network is busy. ${esmessage}`}
89 <H3>{'Transaction Hash'}</H3>
92 <H3>{'Transaction Status'}</H3>
101const Failure = props => (
107 <H3>{'There was an error sending your transaction.'}</H3>
108 {renderTxnError(props.web3, props.message)}
114function SentTransaction(props) {
115 const history = useHistory();
116 const { txnConfirmations } = useTxnConfirmations();
117 const { web3, networkType } = useNetwork();
118 const { txnCursor } = useTxnCursor();
120 const promptKeyfile = history.data && history.data.promptKeyfile;
122 // TODO: remove need's assumption about accepting the props object
123 const w3 = need.web3({ web3 });
125 const result = txnCursor.matchWith({
127 throw BRIDGE_ERROR.MISSING_TXN;
129 Just: res => res.value,
132 const body = result.matchWith({
133 Error: message => <Failure web3={w3} message={message.value} />,
137 networkType={networkType}
138 txnConfirmations={txnConfirmations}
165 onClick={() => history.popAndPush(ROUTE_NAMES.GEN_KEYFILE)}>
166 {'Download Keyfile →'}
182export default SentTransaction;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list