common

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInt added in v0.10.0

func AddInt[T constraints.Integer](a, b T) (T, error)

AddInt makes safe sum for arbitrary integer type.

func Decode2CBigInt added in v0.11.0

func Decode2CBigInt(bytes []byte) *big.Int

Decode2CBigInt decodes two's complement representation of BigInt from bytes slice.

func Dup

func Dup(b []byte) []byte

Dup duplicate (copy) bytes.

func Encode2CBigInt added in v0.11.0

func Encode2CBigInt(n *big.Int) []byte

Encode2CBigInt encodes BigInt into a two's complement representation.

func EnsureTimeout added in v0.8.0

func EnsureTimeout(tm tm, expected uint64)

EnsureTimeout ensures that no way when expected can be higher than current, but if somehow its happened...

func FromBase58JSON

func FromBase58JSON(value []byte, size int, name string) ([]byte, error)

func FromBase58JSONUnchecked added in v0.10.0

func FromBase58JSONUnchecked(value []byte, name string) ([]byte, error)

func FromHexJSON added in v0.10.0

func FromHexJSON(value []byte, size int, name string) ([]byte, error)

func FromHexJSONUnchecked added in v0.10.0

func FromHexJSONUnchecked(value []byte, name string) ([]byte, error)

func GetStatePath

func GetStatePath() (string, error)

func MulInt added in v0.11.0

func MulInt[T constraints.Integer](a, b T) (T, error)

MulInt makes safe mul for arbitrary integer type.

func ReplaceInvalidUtf8Chars added in v0.8.0

func ReplaceInvalidUtf8Chars(s string) string

ReplaceInvalidUtf8Chars replaces invalid utf8 characters with '?' to reproduce JVM behaviour.

func SafeIntToUint32 added in v0.11.0

func SafeIntToUint32(v int) uint32

func SubInt added in v0.11.0

func SubInt[T constraints.Integer](a, b T) (T, error)

SubInt makes safe sub for arbitrary integer type.

func ToBase58JSON

func ToBase58JSON(b []byte) []byte

func ToBase64JSON added in v0.6.0

func ToBase64JSON(b []byte) []byte

func ToHexJSON added in v0.10.0

func ToHexJSON(b []byte) []byte

func UnixMillisFromTime added in v0.10.0

func UnixMillisFromTime(t time.Time) int64

func UnixMillisToTime added in v0.10.0

func UnixMillisToTime(ts int64) time.Time

Types

This section is empty.

Jump to

Keyboard shortcuts

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