accounts

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountTypeCommon uint32 = iota
	AccountTypeChain
	AccountTypeHot
	AccountTypeIssue
)

account type

View Source
const AccountVariety = 3

AccountVariety max index of account type

View Source
const (
	AddressLength = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	URL         URL `json:"url"`
	AccountType uint32
	//AhainCoords []uint32
	PublicKey *crypto.PublicKey
	Address   Address
}

Account the definition of common account struct

func (*Account) Deserialize

func (a *Account) Deserialize(accountBytes []byte)

Deserializ restore an account var from an serialized bytes

func (*Account) Serialize

func (a *Account) Serialize() []byte

Serialize returns the serialized res of an account var

type Address

type Address [AddressLength]byte

Address definition

func ChainCoordinateToAddress

func ChainCoordinateToAddress(cc coordinate.ChainCoordinate) Address

ChainCoordinateToAddress return the publicaccount address of the specified chain by chaincoordinate

func HexToAddress

func HexToAddress(hex string) Address

HexToAddress creates address from address string

func NewAddress

func NewAddress(b []byte) Address

NewAddress new a var of Address type

func PublicKeyToAddress

func PublicKeyToAddress(p crypto.PublicKey) Address

PublicKeyToAddress generate address from the public key

func (Address) Bytes

func (self Address) Bytes() []byte

Bytes returns address bytes

func (Address) Equal

func (a Address) Equal(a1 Address) bool

Equal reports whether a1 equal a

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

MarshalText returns the hex representation of a.

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

SetBytes set the Address var's bytes

func (Address) String

func (self Address) String() string

String returns address string

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

type URL

type URL struct {
	Scheme string // Protocol scheme to identify a capable account backend
	Path   string // Path for the backend to identify a unique entity
}

URL definition

func (URL) Cmp

func (u URL) Cmp(url URL) int

Cmp compares x and y and returns:

-1 if x <  y
 0 if x == y
+1 if x >  y

func (URL) MarshalJSON

func (u URL) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (URL) String

func (u URL) String() string

String implements the stringer interface.

func (URL) TerminalString

func (u URL) TerminalString() string

TerminalString implements the log.TerminalStringer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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