|
|
@ -9,6 +9,7 @@ import Box from 'components/base/Box' |
|
|
|
import LabelWithExternalIcon from 'components/base/LabelWithExternalIcon' |
|
|
|
import RecipientAddress from 'components/RecipientAddress' |
|
|
|
import { track } from 'analytics/segment' |
|
|
|
import { createCustomErrorClass } from 'helpers/errors' |
|
|
|
|
|
|
|
type Props<Transaction> = { |
|
|
|
t: T, |
|
|
@ -19,6 +20,8 @@ type Props<Transaction> = { |
|
|
|
autoFocus?: boolean, |
|
|
|
} |
|
|
|
|
|
|
|
const InvalidAddress = createCustomErrorClass('InvalidAddress') |
|
|
|
|
|
|
|
class RecipientField<Transaction> extends Component<Props<Transaction>, { isValid: boolean }> { |
|
|
|
state = { |
|
|
|
isValid: true, |
|
|
@ -79,7 +82,13 @@ class RecipientField<Transaction> extends Component<Props<Transaction>, { isVali |
|
|
|
<RecipientAddress |
|
|
|
autoFocus={autoFocus} |
|
|
|
withQrCode |
|
|
|
error={!value || isValid ? null : `This is not a valid ${account.currency.name} address`} |
|
|
|
error={ |
|
|
|
!value || isValid |
|
|
|
? null |
|
|
|
: new InvalidAddress(null, { |
|
|
|
currencyName: account.currency.name, |
|
|
|
}) |
|
|
|
} |
|
|
|
value={value} |
|
|
|
onChange={this.onChange} |
|
|
|
/> |
|
|
|