diff --git a/src/components/forms/validator.js b/src/components/forms/validator.js index 214f4a40..8089f2ee 100644 --- a/src/components/forms/validator.js +++ b/src/components/forms/validator.js @@ -52,12 +52,12 @@ export const uniqueAddress = (addresses: string[]) => (value: string) => export const composeValidators = (...validators: Function[]): FieldValidator => (value: Field) => validators.reduce((error, validator) => error || validator(value), undefined) -export const inLimit = (limit: number, base: number, baseText: string) => (value: string) => { +export const inLimit = (limit: number, base: number, baseText: string, symbol: string = 'ETH') => (value: string) => { const amount = Number(value) const max = limit - base if (amount <= max) { return undefined } - return `Should not exceed ${max} ETH (amount to reach ${baseText})` + return `Should not exceed ${max} ${symbol} (amount to reach ${baseText})` } diff --git a/src/routes/safe/component/SendToken/SendTokenForm/index.jsx b/src/routes/safe/component/SendToken/SendTokenForm/index.jsx index 61c0f09f..9bd0eea6 100644 --- a/src/routes/safe/component/SendToken/SendTokenForm/index.jsx +++ b/src/routes/safe/component/SendToken/SendTokenForm/index.jsx @@ -39,7 +39,7 @@ const SendTokenForm = ({ funds, symbol }: Props) => () => ( name={TKN_VALUE_PARAM} component={TextField} type="text" - validate={composeValidators(required, mustBeFloat, greaterThan(0), inLimit(Number(funds), 0, 'available balance'))} + validate={composeValidators(required, mustBeFloat, greaterThan(0), inLimit(Number(funds), 0, 'available balance', symbol))} placeholder="Amount of tokens*" text="Amount of Tokens" />