Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- func (addr Address) Bytes() []byte
- func (addr *Address) Decode(r io.Reader) error
- func (addr Address) Encode(w io.Writer) error
- func (addr Address) IsAccountAddress() bool
- func (addr Address) IsTreasuryAddress() bool
- func (addr Address) IsValidatorAddress() bool
- func (addr Address) SerializeSize() int
- func (addr Address) ShortString() string
- func (addr Address) String() string
- func (addr Address) Type() AddressType
- type AddressMismatchError
- type AddressType
- type InvalidAddressTypeError
- type InvalidHRPError
- type InvalidLengthError
- type PrivateKey
- type PublicKey
- type Signature
Constants ¶
const ( SignatureTypeTreasury byte = 0 SignatureTypeBLS byte = 1 )
const (
AddressSize = 21
)
Variables ¶
var ( // AddressHRP is the Human Readable Part (HRP) for address. AddressHRP = "pc" // PublicKeyHRP is the Human Readable Part (HRP) for public key. PublicKeyHRP = "public" // PrivateKeyHRP is the Human Readable Part (HRP) for private key. PrivateKeyHRP = "secret" // XPublicKeyHRP is the Human Readable Part (HRP) for extended public key. XPublicKeyHRP = "xpublic" // XPrivateKeyHRP is the Human Readable Part (HRP) for extended private key. XPrivateKeyHRP = "xsecret" )
var ErrInvalidSignature = errors.New("invalid signature")
ErrInvalidSignature is returned when a signature is invalid.
var TreasuryAddress = Address{0}
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressSize]byte
func AddressFromString ¶
AddressFromString decodes the string encoding of an address and returns the Address if text is a valid encoding for a known address type.
func NewAddress ¶ added in v0.15.0
func NewAddress(typ AddressType, data []byte) Address
NewAddress create a new address based.
func (Address) IsAccountAddress ¶ added in v0.15.0
func (Address) IsTreasuryAddress ¶ added in v0.15.0
func (Address) IsValidatorAddress ¶ added in v0.15.0
func (Address) SerializeSize ¶ added in v0.15.0
SerializeSize returns the number of bytes it would take to serialize the address.
func (Address) ShortString ¶ added in v0.15.0
ShortString returns a short string for the address useful for logger.
func (Address) Type ¶ added in v0.15.0
func (addr Address) Type() AddressType
type AddressMismatchError ¶ added in v0.15.0
AddressMismatchError is returned when the provided address is not derived from the corresponding public key.
func (AddressMismatchError) Error ¶ added in v0.15.0
func (e AddressMismatchError) Error() string
type AddressType ¶ added in v0.15.0
type AddressType byte
const ( AddressTypeTreasury AddressType = 0 AddressTypeValidator AddressType = 1 AddressTypeBLSAccount AddressType = 2 )
type InvalidAddressTypeError ¶ added in v0.15.0
type InvalidAddressTypeError int
InvalidAddressTypeError is returned when the address type is not recognized or supported.
func (InvalidAddressTypeError) Error ¶ added in v0.15.0
func (e InvalidAddressTypeError) Error() string
type InvalidHRPError ¶ added in v0.15.0
type InvalidHRPError string
InvalidHRPError is returned when the provided HRP code does not match the expected value.
func (InvalidHRPError) Error ¶ added in v0.15.0
func (e InvalidHRPError) Error() string
type InvalidLengthError ¶ added in v0.15.0
type InvalidLengthError int
InvalidLengthError is returned when the length of the data does not match the expected length.
func (InvalidLengthError) Error ¶ added in v0.15.0
func (e InvalidLengthError) Error() string