Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- func (a Address) Bytes() []byte
- func (a *Address) DecodeScale(d *scale.Decoder) (int, error)
- func (a *Address) EncodeScale(e *scale.Encoder) (int, error)
- func (a Address) Field() log.Field
- func (a Address) Format(s fmt.State, c rune)
- func (a Address) GetHRPNetwork() string
- func (a Address) IsEmpty() bool
- func (a Address) String() string
- type Config
Constants ¶
const ( // AddressLength is the expected length of the address. AddressLength = 24 // AddressReservedSpace define how much bytes from top is reserved in address for future. AddressReservedSpace = 4 )
Variables ¶
var ( // ErrWrongAddressLength is returned when the length of the address is not correct. ErrWrongAddressLength = errors.New("wrong address length") // ErrUnsupportedNetwork is returned when a network is not supported. ErrUnsupportedNetwork = errors.New("unsupported network") // ErrDecodeBech32 is returned when an error occurs during decoding bech32. ErrDecodeBech32 = errors.New("error decode to bech32") // ErrMissingReservedSpace is returned if top bytes of address is not 0. ErrMissingReservedSpace = errors.New("missing reserved space") )
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the address of a spacemesh account with AddressLength length.
func GenerateAddress ¶
GenerateAddress generates an address from a public key.
func StringToAddress ¶
StringToAddress returns a new Address from a given string like `sm1abc...`.
func (*Address) DecodeScale ¶
DecodeScale implements scale codec interface.
func (*Address) EncodeScale ¶
EncodeScale implements scale codec interface.
func (Address) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (Address) GetHRPNetwork ¶
GetHRPNetwork returns the Human-Readable-Part of bech32 addresses for a networkID.
type Config ¶
type Config struct {
NetworkHRP string `mapstructure:"network-hrp"`
}
Config is the configuration of the address package.
func DefaultAddressConfig ¶
func DefaultAddressConfig() *Config
DefaultAddressConfig returns the default configuration of the address package.
func DefaultTestAddressConfig ¶
func DefaultTestAddressConfig() *Config
DefaultTestAddressConfig returns the default test configuration of the address package.
func SetAddressConfig ¶
SetAddressConfig set hrp prefix for pkg configuration.