lbry-desktop/ui/util/form-validation.js

17 lines
427 B
JavaScript
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
import { regexAddress } from 'util/lbryURI';
2018-03-26 23:32:43 +02:00
export default function validateSendTx(address: string) {
const errors = {
address: '',
};
2018-03-26 23:32:43 +02:00
// All we need to check is if the address is valid
// If values are missing, users wont' be able to submit the form
if (!process.env.NO_ADDRESS_VALIDATION && !regexAddress.test(address)) {
errors.address = __('Not a valid LBRY address');
}
2018-03-26 23:32:43 +02:00
return errors;
}