common

package
v0.0.0-...-37e6da2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxSafeJSInt represents max value which JS support
	// It is used for smartContract fields
	// Our staking repo is written in JS, as are many other clients
	// If we use higher value JS will not be able to parse it
	MaxSafeJSInt = uint64(math.Pow(2, 53) - 2)
)

Functions

func ConvertUnmarshalledInt

func ConvertUnmarshalledInt(x interface{}) (int64, error)

func DirectoryExists

func DirectoryExists(directoryPath string) bool

DirectoryExists checks if the directory at the specified path exists

func GetTerminationSignalCh

func GetTerminationSignalCh() <-chan os.Signal

GetTerminationSignalCh returns a channel to emit signals by ctrl + c

func Max

func Max(a, b uint64) uint64

Max returns the strictly bigger number

func Min

func Min(a, b uint64) uint64

Min returns the strictly lower number

func PadLeftOrTrim

func PadLeftOrTrim(bb []byte, size int) []byte

PadLeftOrTrim left-pads the passed in byte array to the specified size, or trims the array if it exceeds the passed in size

func SetupDataDir

func SetupDataDir(dataDir string, paths []string) error

SetupDataDir sets up the data directory and the corresponding sub-directories

func ToFixedFloat

func ToFixedFloat(num float64, precision int) float64

Types

type JSONNumber

type JSONNumber struct {
	Value uint64
}

JSONNumber is the number represented in decimal or hex in json

func (*JSONNumber) MarshalJSON

func (d *JSONNumber) MarshalJSON() ([]byte, error)

func (*JSONNumber) UnmarshalJSON

func (d *JSONNumber) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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