uint256

package
v0.1.1-experimental.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UInt256ByteLength = 32

UInt256ByteLength is the length of a uint256 in bytes.

Variables

This section is empty.

Functions

This section is empty.

Types

type LittleEndian

type LittleEndian []byte

LittleEndian represents a uint256 number. It is designed to marshal and unmarshal JSON in little-endian format, while under the hood storing the value as big-endian for compatibility with.

func (*LittleEndian) Big

func (s *LittleEndian) Big() *big.Int

Big converts an LittleEndian to a big.Int.

func (LittleEndian) MarshalJSON

func (s LittleEndian) MarshalJSON() ([]byte, error)

MarshalJSON marshals a LittleEndian to JSON, it flips the endianness before encoding it to hex such that it is marshalled as big-endian.

func (*LittleEndian) UInt256

func (s *LittleEndian) UInt256() *uint256.Int

UInt256 converts an LittleEndian to a uint256.Int.

func (*LittleEndian) UnmarshalJSON

func (s *LittleEndian) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals a LittleEndian from JSON by decoding the hex string and flipping the endianness, such that it is unmarshalled as big-endian.

Jump to

Keyboard shortcuts

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