-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(faucet): support both account and module addresses
- allow 20-32 byte addresses to validate both standard accounts and module accounts
- Loading branch information
1 parent
f71cdc3
commit 016eed9
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { isValidAddress } from "./addresses"; | ||
|
||
describe("isValidAddress", () => { | ||
it("accepts account address", () => { | ||
expect(isValidAddress("cosmos1h806c7khnvmjlywdrkdgk2vrayy2mmvf9rxk2r", "cosmos")).toBe(true); | ||
}); | ||
|
||
it("accepts an ics-27 address", () => { | ||
expect(isValidAddress("osmo1d6em9ea5y3dye6em0awqyss7ssp0a7sgjk792x8cx647cfs7a4msk0fr45", "osmo")).toBe( | ||
true, | ||
); | ||
}); | ||
|
||
it("rejects an invalid address", () => { | ||
expect(isValidAddress("cosmos1fail", "cosmos")).toBe(false); | ||
}); | ||
|
||
it("requires a prefix argument", () => { | ||
// @ts-expect-error intentionally omitting an argument | ||
expect(isValidAddress("cosmos1h806c7khnvmjlywdrkdgk2vrayy2mmvf9rxk2r")).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters