Skip to content

Commit cf48a81

Browse files
committed
fixup! fix(faucet): isValidAddress should accept all bech32 addresses
1 parent a65fd8b commit cf48a81

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/faucet/src/addresses.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import { fromBech32 } from "@cosmjs/encoding";
66
export function isValidAddress(input: string, requiredPrefix: string): boolean {
77
try {
88
const { prefix, data } = fromBech32(input);
9-
return (
10-
prefix === requiredPrefix && input.length >= 8 && input.length <= 90 && data.length >= 4 // 6 chars = 30 bits (3.75 bytes), rounded to whole byte
11-
);
9+
if (prefix !== requiredPrefix) {
10+
return false;
11+
}
12+
return data.length >= 20 && data.length <= 32;
1213
} catch {
1314
return false;
1415
}

0 commit comments

Comments
 (0)