primitives

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: CC0-1.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VarDataFromBytes = DataFromBytes[VarLen]
	Data8FromBytes   = DataFromBytes[Len8]
	Data20FromBytes  = DataFromBytes[Len20]
	Data32FromBytes  = DataFromBytes[Len32]
	Data256FromBytes = DataFromBytes[Len256]
)
View Source
var (
	VarDataFromHex = DataFromHex[VarLen]
	Data8FromHex   = DataFromHex[Len8]
	Data20FromHex  = DataFromHex[Len20]
	Data32FromHex  = DataFromHex[Len32]
	Data256FromHex = DataFromHex[Len256]
)

Functions

This section is empty.

Types

type Data

type Data[LD tp.LengthDescriptor] struct {
	tp.Data[LD]
}

func DataFromBytes

func DataFromBytes[LD tp.LengthDescriptor](b []byte) Data[LD]

func DataFromHex

func DataFromHex[LD tp.LengthDescriptor](s string) Data[LD]

func (Data[LD]) Bytes

func (d Data[LD]) Bytes() []byte

func (Data[LD]) Hex

func (d Data[LD]) Hex() string

func (Data[LD]) MarshalJSON

func (d Data[LD]) MarshalJSON() ([]byte, error)

func (*Data[LD]) UnmarshalCBOR

func (d *Data[LD]) UnmarshalCBOR(b []byte) error

func (*Data[LD]) UnmarshalJSON

func (d *Data[LD]) UnmarshalJSON(b []byte) error

func (Data[LD]) WriteHexBytes

func (d Data[LD]) WriteHexBytes(dst []byte) []byte

type Data20

type Data20 = Data[Len20]

type Data256

type Data256 = Data[Len256]

type Data32

type Data32 = Data[Len32]

type Data8

type Data8 = Data[Len8]

type HexUint

type HexUint uint64

Special type for convenient uint64-to-hex conversion Only used in responses, not for db storage

func (HexUint) Hex

func (h HexUint) Hex() string

func (HexUint) MarshalJSON

func (h HexUint) MarshalJSON() ([]byte, error)

func (*HexUint) UnmarshalJSON

func (h *HexUint) UnmarshalJSON(b []byte) error

func (HexUint) WriteHexBytes

func (h HexUint) WriteHexBytes(dst []byte) []byte

type Len20

type Len20 struct{}

func (Len20) GetTinyPackLength

func (Len20) GetTinyPackLength() int

type Len256

type Len256 struct{}

func (Len256) GetTinyPackLength

func (Len256) GetTinyPackLength() int

type Len32

type Len32 struct{}

func (Len32) GetTinyPackLength

func (Len32) GetTinyPackLength() int

type Len8

type Len8 struct{}

func (Len8) GetTinyPackLength

func (Len8) GetTinyPackLength() int

type Quantity

type Quantity struct {
	tp.Data[Len32]
}

func QuantityFromBigInt

func QuantityFromBigInt(v *big.Int) Quantity

func QuantityFromBytes

func QuantityFromBytes(b []byte) Quantity

func QuantityFromHex

func QuantityFromHex(s string) Quantity

func QuantityFromUint64

func QuantityFromUint64(v uint64) Quantity

func (Quantity) BigInt

func (q Quantity) BigInt() *big.Int

func (Quantity) Bytes

func (q Quantity) Bytes() []byte

func (Quantity) Hex

func (q Quantity) Hex() string

func (Quantity) IsUint64

func (q Quantity) IsUint64() bool

func (Quantity) IsZero added in v1.1.0

func (q Quantity) IsZero() bool

func (Quantity) MarshalJSON

func (q Quantity) MarshalJSON() ([]byte, error)

func (Quantity) Uint64

func (q Quantity) Uint64() uint64

func (*Quantity) UnmarshalCBOR

func (q *Quantity) UnmarshalCBOR(b []byte) error

func (*Quantity) UnmarshalJSON

func (q *Quantity) UnmarshalJSON(b []byte) error

func (Quantity) WriteHexBytes

func (d Quantity) WriteHexBytes(dst []byte) []byte

type VarData

type VarData = Data[VarLen]

type VarLen

type VarLen = tinypack.VariadicLength

Jump to

Keyboard shortcuts

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