addressutils

package
v0.0.0-...-018c514 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccAddressFromBech32

func AccAddressFromBech32(address, prefix string) (sdk.AccAddress, error)

AccAddressFromBech32 decodes a bech32 encoded address into an sdk.AccAddress, and validates the prefix (hrp). An empty prefix param skips the checking. Returns an error if address is zero-length, invalid or the prefix does not match.

func AddressFromBech32

func AddressFromBech32(address, prefix string) (addr []byte, err error)

AddressFromBech32 decodes a bech32 encoded address into a byte-slice, and validates the prefix (hrp). An empty prefix param skips the checking. Returns an error if address is zero-length, invalid or the prefix does not match.

func EncodeAddressToBech32

func EncodeAddressToBech32(prefix string, address sdk.Address) (string, error)

EncodeAddressToBech32 encodes an sdk.Address interface with the specified prefix. Identical behaviour to bech32.ConvertAndDecode(); added to addressutils for consistency. Error is thrown if encoding fails.

func GenerateAccAddressForTest

func GenerateAccAddressForTest() sdk.AccAddress

GenerateAccAddressForTest generates a random sdk.AccAddress for test purposes.

func GenerateAddressForTestWithPrefix

func GenerateAddressForTestWithPrefix(prefix string) string

GenerateAddressForTestWithPrefix generates a random bech32 address with the specified prefix for test purposes.

func GenerateValAddressForTest

func GenerateValAddressForTest() sdk.ValAddress

GenerateValAddressForTest generates a random sdk.ValAddress for test purposes.

func MustAccAddressFromBech32

func MustAccAddressFromBech32(address, prefix string) sdk.AccAddress

MustAccAddressFromBech32 decodes a bech32 encoded address into an sdk.AccAddress, and validates the prefix (hrp). An empty prefix param skips the checking. Panics if address is zero-length, invalid or the prefix does not match.

func MustEncodeAddressToBech32

func MustEncodeAddressToBech32(prefix string, address sdk.Address) string

EncodeAddressToBech32 encodes an sdk.Address interface with the specified prefix. Identical behaviour to bech32.ConvertAndDecode(); added to addressutils for consistency. Panics if encoding fails.

func MustValAddressFromBech32

func MustValAddressFromBech32(address, prefix string) sdk.ValAddress

MustValAddressFromBech32 decodes a bech32 encoded address into an sdk.ValAddress, and validates the prefix (hrp). An empty prefix param skips the checking. Panics if address is zero-length, invalid or the prefix does not match.

func ValAddressFromBech32

func ValAddressFromBech32(address, prefix string) (sdk.ValAddress, error)

ValAddressFromBech32 decodes a bech32 encoded address into an sdk.ValAddress, and validates the prefix (hrp). An empty prefix param skips the checking. Returns an error if address is zero-length, invalid or the prefix does not match.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL