library

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAddressLength        = errors.New("invalid address length (42)")
	ErrInvalidAddressMissingPrefix = errors.New("missing prefix 0x")
	ErrInvalidAddressBadCharacters = errors.New("contains invalid characters")
	ErrInvalidAddressNull          = errors.New("null address")
	ErrUnknownAddressAlg           = errors.New("unknown crypto algorithm for address")
)
View Source
var (
	ErrInvalidCompositeKey = errors.New("invalid composite key")
)
View Source
var (
	// ErrNilCounter is returned when a nil counter is used.
	ErrNilCounter = errors.New("nil counter")
)

Functions

func BytesToHexString

func BytesToHexString(input []byte) string

func BytesToUint8

func BytesToUint8(input []byte) (uint8, error)

func BytesToUint64

func BytesToUint64(input []byte) (uint64, error)

func Uint64ToString

func Uint64ToString(input uint64) string

Types

type Address

type Address string

Address is the hex string of ethereum account address

const (
	AddressPrefix         = "0x"
	ZeroAddress   Address = "0x0000000000000000000000000000000000000000"
)

func (Address) Bytes

func (addr Address) Bytes() []byte

func (Address) EmptyAddress

func (addr Address) EmptyAddress() bool

func (*Address) FromPublicKey

func (addr *Address) FromPublicKey(pub interface{}) error

func (*Address) FromString

func (addr *Address) FromString(addrStr string)

func (Address) String

func (addr Address) String() string

func (Address) Validate

func (addr Address) Validate() error

type Bool

type Bool string
const (
	True  Bool = "true"
	False Bool = "false"
)

func BytesToBool

func BytesToBool(input []byte) Bool

func (Bool) Bool

func (b Bool) Bool() bool

func (Bool) Bytes

func (b Bool) Bytes() []byte

func (Bool) String

func (b Bool) String() string

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Counter is a data type that represents a counter that can be incremented, decremented, and reset.

func BytesToCounter

func BytesToCounter(input []byte) (*Counter, error)

func NewCounter

func NewCounter(initNumber uint64) *Counter

NewCounter creates a new counter with the specified initial value.

func (*Counter) Bytes

func (counter *Counter) Bytes() []byte

Bytes returns the byte slice representation of the counter.

func (*Counter) Current

func (counter *Counter) Current() uint64

Current returns the current value of the counter.

func (*Counter) Decrement

func (counter *Counter) Decrement(offset uint64) error

Decrement subtracts the specified offset from the counter.

func (*Counter) Increment

func (counter *Counter) Increment(offset uint64) error

Increment adds the specified offset to the counter.

func (*Counter) Reset

func (counter *Counter) Reset()

Reset sets the counter to zero.

func (*Counter) String

func (counter *Counter) String() string

String returns the string representation of the counter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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