Skip to content

utils functions for validating address of a chain and convert address between chains #27

@kombos

Description

@kombos

we require some crucial functions to be made part of the utils library of chain-registry, such as validating an address of a particular chain. This should be a functions to verify if an address is a valid bech32 address for a particular chain, in chain-registry ? this should ideally be under @chain-registry/utils or @chain-registry/assets.. for each asset, we could provide a verifyAddress() function, where we pass the complete address (human readable prefix + control digit + remaining hash value) and it will return a boolean value.
for e.g. verifyAddress("osmosis", "osmo1egdwq4khcmsyd0tk6mpq28r7eawjpe6nzd9kjd") could give return value - true - since it is a valid address.

Also, a function to convert an address represented in one chain to address represented in another chain.. for eg. convertAddress("cosmoshub", "osmosis", "cosmos1egdwq4khcmsyd0tk6mpq28r7eawjpe6n2kkxyl") could give back - "osmo1egdwq4khcmsyd0tk6mpq28r7eawjpe6nzd9kjd"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions