import React, { Component } from 'react'; import WalletDecrypt, { DISABLE_WALLETS } from 'components/WalletDecrypt'; import { OnlyUnlocked } from 'components/renderCbs'; import { Fields } from './Fields'; import { isUnlocked as isUnlockedSelector } from 'selectors/wallet'; import { getNetworkConfig } from 'selectors/config'; import { configureLiteSend, TConfigureLiteSend } from 'actions/swap'; import { connect } from 'react-redux'; import { AppState } from 'reducers'; import { shouldDisplayLiteSend } from 'selectors/swap'; import { NetworkConfig } from 'types/network'; interface DispatchProps { configureLiteSend: TConfigureLiteSend; } interface StateProps { shouldDisplay: boolean; isUnlocked: boolean; network: NetworkConfig; } type Props = StateProps & DispatchProps; class LiteSendClass extends Component { public componentDidMount() { this.props.configureLiteSend(); } public render() { if (!this.props.shouldDisplay) { return null; } const { network, isUnlocked } = this.props; let renderMe; if (network.chainId !== 1) { renderMe = (
Note: Send is only supported on Ethereum Mainnet.
); } else { renderMe = isUnlocked ? ( } /> ) : ( ); } return {renderMe}; } } export const LiteSend = connect( (state: AppState) => ({ shouldDisplay: shouldDisplayLiteSend(state), isUnlocked: isUnlockedSelector(state), network: getNetworkConfig(state) }), { configureLiteSend } )(LiteSendClass);