// @flow import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { donationAddressMap } from 'config/data'; import { isValidBTCAddress, isValidETHAddress } from 'libs/validators'; import translate from 'translations'; export default class ReceivingAddress extends Component { static propTypes = { destinationKind: PropTypes.string.isRequired, destinationAddressSwap: PropTypes.func.isRequired, destinationAddress: PropTypes.string, partTwoCompleteSwap: PropTypes.func, stopLoadBityRates: PropTypes.func }; onChangeDestinationAddress = (event: SyntheticInputEvent) => { const value = event.target.value; this.props.destinationAddressSwap(value); }; onClickPartTwoComplete = () => { this.props.stopLoadBityRates(); this.props.partTwoCompleteSwap(true); }; render() { const { destinationKind, destinationAddress } = this.props; let validAddress; // TODO - find better pattern here once currencies move beyond BTC, ETH, REP if (this.props.destinationKind === 'BTC') { validAddress = isValidBTCAddress(destinationAddress); } else { validAddress = isValidETHAddress(destinationAddress); } return (
); } }