Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove empty spaces from ens- or walletAddress input (LF-3268) #121

Merged
merged 7 commits into from
Sep 15, 2023
5 changes: 4 additions & 1 deletion packages/widget/src/components/SendToWallet/SendToWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FormControl, Input } from './SendToWallet.style';

export const SendToWallet: React.FC<BoxProps> = forwardRef((props, ref) => {
const { t } = useTranslation();
const { trigger, getValues, clearErrors } = useFormContext();
const { trigger, getValues, setValue, clearErrors } = useFormContext();
const { account } = useWallet();
const { disabledUI, hiddenUI, requiredUI, toAddress } = useWidgetConfig();
const { showSendToWallet, showSendToWalletDirty, setSendToWallet } =
Expand All @@ -31,6 +31,9 @@ export const SendToWallet: React.FC<BoxProps> = forwardRef((props, ref) => {
rules: {
required:
requiredToAddress && (t('error.title.walletAddressRequired') as string),
onChange: (e) => {
setValue(FormKey.ToAddress, e.target.value.trim());
chybisov marked this conversation as resolved.
Show resolved Hide resolved
},
validate: async (value: string) => {
try {
if (!value) {
Expand Down