From 551da6b5e22939588a0fd394f89c3c34ffb74785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 11 Mar 2025 16:28:20 +0100 Subject: [PATCH] hotfix: fix ada handle and payment address validation order --- CHANGELOG.md | 3 ++- govtool/frontend/src/utils/isValidFormat.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fdb78e0d..34361b48a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,13 +14,14 @@ changes. ### Fixed +- hotfix for ada handle and payment address validation order [Issue 3155](https://github.com/IntersectMBO/govtool/issues/3155) + ### Changed ### Removed ## [v2.0.15](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.15) 2025-03-11 - ### Added - Add support for ada handle in drep payment address [Issue 3155](https://github.com/IntersectMBO/govtool/issues/3155) diff --git a/govtool/frontend/src/utils/isValidFormat.ts b/govtool/frontend/src/utils/isValidFormat.ts index 43a6ef003..b203fcee7 100644 --- a/govtool/frontend/src/utils/isValidFormat.ts +++ b/govtool/frontend/src/utils/isValidFormat.ts @@ -49,16 +49,18 @@ export async function isReceivingAddress(address?: string) { return true; } - const receivingAddress = Address.from_bech32(address); - if (receivingAddress) { - return true; - } + // Validation for ada handles needs to go first as + // handles might be shorter then bech32 addresses const isValidAdaHandle = await adaHandleService.isValidAdaHandle(address); if (isValidAdaHandle) { return true; } + const receivingAddress = Address.from_bech32(address); + if (receivingAddress) { + return true; + } return i18n.t("forms.errors.mustBeReceivingAddress"); } catch (e) { return i18n.t("forms.errors.mustBeReceivingAddress");