From cf48a816199728dd0777c96db67fea170f49d7ca Mon Sep 17 00:00:00 2001 From: 0xPatrick Date: Wed, 26 Jun 2024 13:49:50 -0400 Subject: [PATCH] fixup! fix(faucet): isValidAddress should accept all bech32 addresses --- packages/faucet/src/addresses.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/faucet/src/addresses.ts b/packages/faucet/src/addresses.ts index 825de6bf9e..ff836f3a76 100644 --- a/packages/faucet/src/addresses.ts +++ b/packages/faucet/src/addresses.ts @@ -6,9 +6,10 @@ import { fromBech32 } from "@cosmjs/encoding"; export function isValidAddress(input: string, requiredPrefix: string): boolean { try { const { prefix, data } = fromBech32(input); - return ( - prefix === requiredPrefix && input.length >= 8 && input.length <= 90 && data.length >= 4 // 6 chars = 30 bits (3.75 bytes), rounded to whole byte - ); + if (prefix !== requiredPrefix) { + return false; + } + return data.length >= 20 && data.length <= 32; } catch { return false; }