2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
|
|
|
/* eslint-disable prefer-default-export */
|
2018-04-18 06:03:01 +02:00
|
|
|
import { regexAddress } from 'lbry-redux';
|
2018-03-26 23:32:43 +02:00
|
|
|
|
|
|
|
type DraftTxValues = {
|
|
|
|
address: string,
|
|
|
|
// amount: number
|
|
|
|
};
|
|
|
|
|
|
|
|
export const validateSendTx = (formValues: DraftTxValues) => {
|
|
|
|
const { address } = formValues;
|
|
|
|
const errors = {};
|
|
|
|
|
|
|
|
// All we need to check is if the address is valid
|
|
|
|
// If values are missing, users wont' be able to submit the form
|
|
|
|
if (address && !regexAddress.test(address)) {
|
|
|
|
errors.address = __('Not a valid LBRY address');
|
|
|
|
}
|
|
|
|
|
|
|
|
return errors;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* eslint-enable prefer-default-export */
|