address

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: GPL-3.0 Imports: 1 Imported by: 13

Documentation

Overview

Package address defines the Address API. All chains must implement this API, so that addresses can be encoded/decoded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address pack.String

An Address is a human-readable representation of a public identity. It can be the address of an external account, contract, or script.

func (Address) Marshal

func (addr Address) Marshal(buf []byte, rem int) ([]byte, int, error)

Marshal the address to binary. You should not call this function directly, unless you are implementing marshalling for a container type.

func (Address) SizeHint

func (addr Address) SizeHint() int

SizeHint returns the number of bytes required to represent the address in binary.

func (*Address) Unmarshal

func (addr *Address) Unmarshal(buf []byte, rem int) ([]byte, int, error)

Unmarshal the address from binary. You should not call this function directly, unless you are implementing unmarshalling for a container type.

type Decoder

type Decoder interface {
	DecodeAddress(Address) (RawAddress, error)
}

The Decoder interfaces is used to convert human-readable addresses into raw addresses.

type EncodeDecoder added in v0.2.1

type EncodeDecoder interface {
	Encoder
	Decoder
}

The EncodeDecoder interfaces combines encoding and decoding functionality into one interface.

type Encoder

type Encoder interface {
	EncodeAddress(RawAddress) (Address, error)
}

The Encoder interface is used to convert raw addresses into human-readable addresses.

type RawAddress

type RawAddress pack.Bytes

RawAddress is an address that has been decoded into its binary form.

func (RawAddress) Marshal

func (addr RawAddress) Marshal(buf []byte, rem int) ([]byte, int, error)

Marshal the address to binary. You should not call this function directly, unless you are implementing marshalling for a container type.

func (RawAddress) SizeHint

func (addr RawAddress) SizeHint() int

SizeHint returns the number of bytes required to represent the address in binary.

func (*RawAddress) Unmarshal

func (addr *RawAddress) Unmarshal(buf []byte, rem int) ([]byte, int, error)

Unmarshal the address from binary. You should not call this function directly, unless you are implementing unmarshalling for a container type.

Jump to

Keyboard shortcuts

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