address

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressTypeIndex       = 0
	AddressTypeLength      = 1
	AddressNetworkIdIndex  = 1
	AddressNetworkIdLength = 1
	AddressContentIndex    = 2
	AddressContentLength   = 20
	AddressChecksumIndex   = 22
	AddressChecksumLength  = 4
	AddressLength          = AddressTypeLength + AddressNetworkIdLength + AddressContentLength + AddressChecksumLength
	PublicKeyLength        = secp256k1.PublicKeyLength

	AddressStringLength = 52
)

Variables

View Source
var (
	ErrInvalidAddress         = errors.New("address: invalid address")
	ErrInvalidAddressFormat   = errors.New("address: invalid address format")
	ErrInvalidAddressType     = errors.New("address: invalid address type")
	ErrInvalidAddressChecksum = errors.New("address: invalid address checksum")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Raw []byte
}

func AddressParse

func AddressParse(s string) (*Address, error)

AddressParse parse address string.

func AddressParseFromBytes

func AddressParseFromBytes(b []byte) (*Address, error)

AddressParseFromBytes parse address from bytes.

func NewAddressFromCommonAddress

func NewAddressFromCommonAddress(addr common.Address) *Address

func NewAddressFromPublicKey

func NewAddressFromPublicKey(pubkey []byte) (*Address, error)

func NewContractAddressFromData

func NewContractAddressFromData() (*Address, error)

func (*Address) Bytes

func (a *Address) Bytes() []byte

Bytes returns address bytes

func (*Address) CommonAddress

func (a *Address) CommonAddress() *common.Address

func (Address) Copy

func (a Address) Copy() *Address

func (*Address) String

func (a *Address) String() string

String returns address string

type AddressType

type AddressType byte
const (
	AddressTypeAccount AddressType = 0x01 + iota
	AddressTypeContract
)

Jump to

Keyboard shortcuts

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