Documentation ¶
Index ¶
- Constants
- func FormatAddress(chainIDAlias string, hrp string, addr []byte) (string, error)
- func FormatBech32(hrp string, payload []byte) (string, error)
- func IntFormat(maxValue int) string
- func ParseAddress(addrStr string) (string, string, []byte, error)
- func ParseBech32(addrStr string) (string, []byte, error)
- type CB58
- func (cb58 CB58) ConvertBytes(b []byte) string
- func (cb58 CB58) ConvertString(str string) ([]byte, error)
- func (cb58 *CB58) Encoding() string
- func (cb58 *CB58) FromString(str string) error
- func (cb58 CB58) MarshalJSON() ([]byte, error)
- func (cb58 CB58) String() string
- func (cb58 *CB58) UnmarshalJSON(b []byte) error
- type CustomStringer
- type DumpBytes
- type Encoding
- type EncodingManager
- type Hex
- type PrefixedStringer
Constants ¶
const ( // HexEncoding specifies a hex plus 4 byte checksum encoding format HexEncoding = "hex" // CB58Encoding specifies the CB58 encoding format CB58Encoding = "cb58" )
Variables ¶
This section is empty.
Functions ¶
func FormatAddress ¶ added in v0.8.0
FormatAddress takes in a chain prefix, HRP, and byte slice to produce a string for an address.
func FormatBech32 ¶ added in v0.8.0
FormatBech32 takes an address's bytes as input and returns a bech32 address
func ParseAddress ¶ added in v0.8.0
ParseAddress takes in an address string and splits returns the corresponding parts. This returns the chain ID alias, bech32 HRP, address bytes, and an error if it occurs.
Types ¶
type CB58 ¶
type CB58 struct{ Bytes []byte }
CB58 formats bytes in checksummed base-58 encoding
func (CB58) ConvertBytes ¶ added in v1.0.3
ConvertBytes ...
func (CB58) ConvertString ¶ added in v1.0.3
ConvertString ...
type CustomStringer ¶
type CustomStringer struct{ Stringer func() string }
CustomStringer ...
func (CustomStringer) String ¶
func (cs CustomStringer) String() string
type Encoding ¶ added in v1.0.3
type Encoding interface { ConvertBytes([]byte) string ConvertString(str string) ([]byte, error) Encoding() string }
Encoding returns a struct used to format bytes for a specific encoding
type EncodingManager ¶ added in v1.0.3
EncodingManager is an interface to provide an Encoding interface
func NewEncodingManager ¶ added in v1.0.3
func NewEncodingManager(defaultEnc string) (EncodingManager, error)
NewEncodingManager returns an EncodingManager with the provided default
type Hex ¶ added in v1.0.3
type Hex struct{ Bytes []byte }
Hex implements the Encoding interface Provides a hex format with 4 byte checksum
func (Hex) ConvertBytes ¶ added in v1.0.3
ConvertBytes ...
func (Hex) ConvertString ¶ added in v1.0.3
ConvertString ...
func (*Hex) UnmarshalJSON ¶ added in v1.0.3
UnmarshalJSON ...