account

package
v0.0.0-...-c9d2d86 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: ISC Imports: 6 Imported by: 0

Documentation

Overview

Copyright (C) 2017, Zipper Team. All rights reserved.

This file is part of zipper

The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.

You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.

Copyright (C) 2017, Zipper Team. All rights reserved.

This file is part of zipper

The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.

You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.

Copyright (C) 2017, Zipper Team. All rights reserved.

This file is part of zipper

The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.

You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.

Copyright (C) 2017, Zipper Team. All rights reserved.

This file is part of zipper

The zipper is free software: you can use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ISC License for more details.

You should have received a copy of the ISC License along with this program. If not, see <https://opensource.org/licenses/isc>.

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)

Deserialize 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 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 ChainCoordinate

type ChainCoordinate []byte

ChainCoordinate represents the coordinate of the blockchain

func HexToChainCoordinate

func HexToChainCoordinate(hex string) ChainCoordinate

HexToChainCoordinate returns chain coordinate via the hex

func NewChainCoordinate

func NewChainCoordinate(c []byte) ChainCoordinate

NewChainCoordinate returns an instance of ChainCoordinate

func (ChainCoordinate) Bytes

func (cc ChainCoordinate) Bytes() []byte

Bytes return []byte

func (ChainCoordinate) MarshalText

func (cc ChainCoordinate) MarshalText() ([]byte, error)

MarshalText returns the hex representation of a.

func (ChainCoordinate) ParentCoorinate

func (cc ChainCoordinate) ParentCoorinate() ChainCoordinate

ParentCoorinate returns parent coorinate

func (ChainCoordinate) String

func (cc ChainCoordinate) String() string

String returns string format of chain coordinate

func (ChainCoordinate) UnmarshalText

func (cc ChainCoordinate) 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