cosmjs
cosmjs copied to clipboard
Unable to validate an address
Hey cosmjs team.
I can not find any method to validate string as a wallet address programmatically. There is this function in faucet https://github.com/cosmos/cosmjs/blob/79396bfaa49831127ccbbbfdbb1185df14230c63/packages/faucet/src/addresses.ts#L3 but it can not be imported.
Can you move this function up the package hierarchy or point me to another method?
The goal is to check that user-provided string is a valid cosmos address.
Thank you in advance.
Hey! Yeah, true story.
I think the only tricky part is the expected data length. There are currently 20 byte and 32 byte addresses. So we had to make 2 or even 3 functions for that.
In the meantime I recommend copying the function to your code.
Ok, clear, thanks for the explanation.