Documentation ¶
Index ¶
- Variables
- func ClampInt64ToInt(v int64) int
- func ConvertUnmarshalledInt(x interface{}) (int64, error)
- func DirectoryExists(directoryPath string) bool
- func GetOutboundIP() (net.IP, error)
- func GetTerminationSignalCh() <-chan os.Signal
- func MaxInt(a, b int) int
- func MaxUint64(a, b uint64) uint64
- func MinInt(a, b int) int
- func MinInt64(a, b int64) int64
- func MinUint64(a, b uint64) uint64
- func PadLeftOrTrim(bb []byte, size int) []byte
- func SecureRandInt(max int) int
- func SecureRandInt64(max int64) int64
- func SetupDataDir(dataDir string, paths []string) error
- func Substr(input string, start int, size int) string
- func ToFixedFloat(num float64, precision int) float64
- type JSONNumber
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) MaxGrpcMsgSize = 16 * 1024 * 1024 // 16MB )
Functions ¶
func ClampInt64ToInt ¶ added in v1.2.1
ClampInt64ToInt returns the int64 value clamped to the range of an int
func ConvertUnmarshalledInt ¶
func DirectoryExists ¶
DirectoryExists checks if the directory at the specified path exists
func GetOutboundIP ¶ added in v1.2.4
GetOutboundIP returns the preferred outbound ip of this machine
func GetTerminationSignalCh ¶
GetTerminationSignalCh returns a channel to emit signals by ctrl + c
func PadLeftOrTrim ¶
PadLeftOrTrim left-pads the passed in byte array to the specified size, or trims the array if it exceeds the passed in size
func SecureRandInt ¶ added in v1.2.4
func SecureRandInt64 ¶ added in v1.2.4
func SetupDataDir ¶
SetupDataDir sets up the data directory and the corresponding sub-directories
func ToFixedFloat ¶
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
Click to show internal directories.
Click to hide internal directories.