commit c6979fa85c445ab75395fd98f61217f5083d98cc
parent efcc2e4417e9bd3d00594157e4618eae250b07a4
Author: Sebastian <sebasjm@gmail.com>
Date: Thu, 20 Mar 2025 12:09:43 -0300
fix #9632
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx
@@ -139,7 +139,8 @@ export function PaytoWireTransferForm({
: validateAmount(parsedAmount, limitWithFee, i18n),
});
- const parsed = !rawPaytoInput ? undefined : parsePaytoUri(rawPaytoInput);
+ const foundPayto = searchPaytoInHumanReadableText(rawPaytoInput);
+ const parsed = !foundPayto ? undefined : parsePaytoUri(foundPayto);
const errorsPayto = undefinedIfEmpty({
rawPaytoInput: !rawPaytoInput
@@ -981,3 +982,14 @@ export function TextField({
</div>
);
}
+
+const PAYTO_START_REGEX = /(?:payto:\/\/[^\s]*)/
+
+function searchPaytoInHumanReadableText(
+ text: string | undefined,
+): string | undefined {
+ if (!text) return undefined;
+ const result = PAYTO_START_REGEX.exec(text)
+ if (!result) return undefined
+ return result[0]
+}