types

package
v0.0.3-tmp Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: GPL-3.0 Imports: 9 Imported by: 168

Documentation

Index

Constants

View Source
const (
	AddressPrefix = "vite_"
	AddressSize   = 20
)
View Source
const (
	TokenTypeIdPrefix = "tti_"
	TokenTypeIdSize   = 10
)
View Source
const GidSize = 10
View Source
const (
	HashSize = 32
)

Variables

View Source
var (
	PRIVATE_GID  = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
	SNAPSHOT_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
	DELEGATE_GID = Gid{0, 0, 0, 0, 0, 0, 0, 0, 0, 2}
)
View Source
var AccountLimitSnapshotHeight = uint64(60 * 60 * 24)
View Source
var EmptyHeight = uint64(0)
View Source
var (
	ErrJsonNotString = errors.New("not valid string")
)
View Source
var GenesisHeight = uint64(1)
View Source
var ZERO_HASH = Hash{}

Functions

func IsValidHexAddress

func IsValidHexAddress(hexStr string) bool

func IsValidHexTokenTypeId

func IsValidHexTokenTypeId(hexStr string) bool

Types

type Address

type Address [AddressSize]byte

func BytesToAddress

func BytesToAddress(b []byte) (Address, error)

func CreateAddress

func CreateAddress() (Address, ed25519.PrivateKey, error)

func CreateAddressWithDeterministic

func CreateAddressWithDeterministic(d [32]byte) (Address, ed25519.PrivateKey, error)

func CreateContractAddress

func CreateContractAddress(data ...[]byte) Address

func HexToAddress

func HexToAddress(hexStr string) (Address, error)

func PrikeyToAddress

func PrikeyToAddress(key ed25519.PrivateKey) Address

func PubkeyToAddress

func PubkeyToAddress(pubkey []byte) Address

func (Address) Bytes

func (addr Address) Bytes() []byte

func (Address) Hex

func (addr Address) Hex() string

func (Address) MarshalText

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

func (*Address) SetBytes

func (addr *Address) SetBytes(b []byte) error

func (Address) String

func (addr Address) String() string

func (*Address) UnmarshalJSON

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

type GetError

type GetError struct {
	Code int
	Err  error
}

func (GetError) Error

func (getErr GetError) Error() string

type Gid

type Gid [GidSize]byte

func BigToGid

func BigToGid(data *big.Int) (Gid, error)

func BytesToGid

func BytesToGid(b []byte) (Gid, error)

func DataToGid

func DataToGid(data ...[]byte) Gid

func (*Gid) Bytes

func (gid *Gid) Bytes() []byte

func (*Gid) SetBytes

func (gid *Gid) SetBytes(b []byte) error

type Hash

type Hash [HashSize]byte

func BigToHash

func BigToHash(b *big.Int) (Hash, error)

func BytesToHash

func BytesToHash(b []byte) (Hash, error)

func DataHash

func DataHash(data []byte) Hash

func DataListHash

func DataListHash(data ...[]byte) Hash

func HexToHash

func HexToHash(hexstr string) (Hash, error)

func (Hash) Big

func (h Hash) Big() *big.Int

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Hex

func (h Hash) Hex() string

func (Hash) IsZero

func (h Hash) IsZero() bool

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte) error

func (Hash) String

func (h Hash) String() string

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(input []byte) error

type TokenTypeId

type TokenTypeId [TokenTypeIdSize]byte

func BytesToTokenTypeId

func BytesToTokenTypeId(b []byte) (TokenTypeId, error)

func CreateTokenTypeId

func CreateTokenTypeId(data ...[]byte) TokenTypeId

func HexToTokenTypeId

func HexToTokenTypeId(hexStr string) (TokenTypeId, error)

func (TokenTypeId) Bytes

func (tid TokenTypeId) Bytes() []byte

func (TokenTypeId) Hex

func (tid TokenTypeId) Hex() string

func (TokenTypeId) MarshalText

func (tid TokenTypeId) MarshalText() ([]byte, error)

func (*TokenTypeId) SetBytes

func (tid *TokenTypeId) SetBytes(b []byte) error

func (TokenTypeId) String

func (tid TokenTypeId) String() string

func (*TokenTypeId) UnmarshalJSON

func (tid *TokenTypeId) UnmarshalJSON(input []byte) error

Jump to

Keyboard shortcuts

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