common

package
v1.7.3-0...-f4d7a22 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashLength    = 32
	AddressLength = 20
)
View Source
const INT_SIZE int = int(unsafe.Sizeof(0))

Variables

View Source
var (
	Big1   = big.NewInt(1)
	Big2   = big.NewInt(2)
	Big3   = big.NewInt(3)
	Big0   = big.NewInt(0)
	Big32  = big.NewInt(32)
	Big256 = big.NewInt(256)
	Big257 = big.NewInt(257)
)

Functions

func AbsolutePath

func AbsolutePath(Datadir string, filename string) string

func Bytes2Hex

func Bytes2Hex(d []byte) string

func Bytes2Uint64

func Bytes2Uint64(b []byte) uint64

func CopyBytes

func CopyBytes(b []byte) (copiedBytes []byte)

func EmptyHash

func EmptyHash(h Hash) bool

func FileExist

func FileExist(filePath string) bool

func FromHex

func FromHex(s string) []byte

func Hex2Bytes

func Hex2Bytes(str string) []byte

func Hex2BytesFixed

func Hex2BytesFixed(str string, flen int) []byte

func IsHexAddress

func IsHexAddress(s string) bool

func LeftPadBytes

func LeftPadBytes(slice []byte, l int) []byte

func LoadJSON

func LoadJSON(file string, val interface{}) error

func MakeName

func MakeName(name, version string) string

func PrintDepricationWarning

func PrintDepricationWarning(str string)

func Report

func Report(extra ...interface{})

func RightPadBytes

func RightPadBytes(slice []byte, l int) []byte

func ToHex

func ToHex(b []byte) string

Types

type Address

type Address [AddressLength]byte

func BigToAddress

func BigToAddress(b *big.Int) Address

func BytesToAddress

func BytesToAddress(b []byte) Address

func HexToAddress

func HexToAddress(s string) Address

func StringToAddress

func StringToAddress(s string) Address

func (Address) Big

func (a Address) Big() *big.Int

func (Address) Bytes

func (a Address) Bytes() []byte

func (Address) Format

func (a Address) Format(s fmt.State, c rune)

func (Address) Hash

func (a Address) Hash() Hash

func (Address) Hex

func (a Address) Hex() string

func (Address) MarshalText

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

func (*Address) Set

func (a *Address) Set(other Address)

func (*Address) SetBytes

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

func (*Address) SetString

func (a *Address) SetString(s string)

func (Address) Str

func (a Address) Str() string

func (Address) String

func (a Address) String() string

func (*Address) UnmarshalJSON

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

func (*Address) UnmarshalText

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

type Hash

type Hash [HashLength]byte

func BigToHash

func BigToHash(b *big.Int) Hash

func BytesToHash

func BytesToHash(b []byte) Hash

func HexToHash

func HexToHash(s string) Hash

func StringToHash

func StringToHash(s string) Hash

func (Hash) Big

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

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Format

func (h Hash) Format(s fmt.State, c rune)

func (Hash) Generate

func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value

func (Hash) Hex

func (h Hash) Hex() string

func (Hash) MarshalText

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

func (*Hash) Set

func (h *Hash) Set(other Hash)

func (*Hash) SetBytes

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

func (*Hash) SetString

func (h *Hash) SetString(s string)

func (Hash) Str

func (h Hash) Str() string

func (Hash) String

func (h Hash) String() string

func (Hash) TerminalString

func (h Hash) TerminalString() string

func (*Hash) UnmarshalJSON

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

func (*Hash) UnmarshalText

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

type PrettyAge

type PrettyAge time.Time

func (PrettyAge) String

func (t PrettyAge) String() string

type PrettyDuration

type PrettyDuration time.Duration

func (PrettyDuration) String

func (d PrettyDuration) String() string

type StorageSize

type StorageSize float64

func (StorageSize) String

func (s StorageSize) String() string

func (StorageSize) TerminalString

func (s StorageSize) TerminalString() string

type UnprefixedAddress

type UnprefixedAddress Address

func (UnprefixedAddress) MarshalText

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

func (*UnprefixedAddress) UnmarshalText

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

type UnprefixedHash

type UnprefixedHash Hash

func (UnprefixedHash) MarshalText

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

func (*UnprefixedHash) UnmarshalText

func (h *UnprefixedHash) UnmarshalText(input []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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