types

package
v0.0.0-...-7833c67 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressLength = 20
	// IncarnationLength length of uint64 for contract incarnations
	IncarnationLength = 2
	// Address32Length is the expected length of the Starknet address (in bytes)
	Address32Length = 32
)
View Source
const (
	HashLength = 32
)
View Source
const PublicKeyLength = 48
View Source
const SignatureLength = 96

Variables

This section is empty.

Functions

func Bytes2Hex

func Bytes2Hex(d []byte) string

Bytes2Hex returns the hexadecimal encoding of d.

func CopyBytes

func CopyBytes(b []byte) (copiedBytes []byte)

CopyBytes returns an exact copy of the provided bytes.

func FromHex1

func FromHex1(s string) []byte

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".

func FromHex2Bytes

func FromHex2Bytes(s string) []byte

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".

func Hex2Bytes

func Hex2Bytes(str string) []byte

Hex2Bytes returns the bytes represented by the hexadecimal string str.

func Int256Min

func Int256Min(a, b *uint256.Int) *uint256.Int

func IsHexAddress

func IsHexAddress(s string) bool

IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.

func KeyCmp

func KeyCmp(key1, key2 []byte) (int, bool)

func LeftPadBytes

func LeftPadBytes(slice []byte, l int) []byte

LeftPadBytes zero-pads slice to the left up to length l.

func ReturnHasherToPool

func ReturnHasherToPool(h *Hasher)

func RightPadBytes

func RightPadBytes(slice []byte, l int) []byte

RightPadBytes zero-pads slice to the right up to length l.

func TrimLeftZeroes

func TrimLeftZeroes(s []byte) []byte

TrimLeftZeroes returns a subslice of s without leading zeroes

func TrimRightZeroes

func TrimRightZeroes(s []byte) []byte

TrimRightZeroes returns a subslice of s without trailing zeroes

Types

type Address

type Address [AddressLength]byte

func BytesToAddress

func BytesToAddress(b []byte) Address

BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.

func HexToAddress

func HexToAddress(s string) Address

HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.

func HexToString

func HexToString(hexs string) (Address, error)

func PrivateToAddress

func PrivateToAddress(key crypto.PrivKey) Address

func PublicToAddress

func PublicToAddress(key crypto.PubKey) Address

func (Address) Bytes

func (a Address) Bytes() []byte

Bytes gets the string representation of the underlying address.

func (*Address) DecodeBytes

func (a *Address) DecodeBytes(b []byte) bool

func (*Address) DecodeString

func (a *Address) DecodeString(s string) bool

func (Address) Equal

func (a Address) Equal(other Address) bool

func (Address) Hash

func (a Address) Hash() Hash

Hash converts an address to a hash by left-padding it with zeros.

func (Address) Hex

func (a Address) Hex() string

Hex returns an EIP55-compliant hex string representation of the address.

func (*Address) IsNull

func (a *Address) IsNull() bool

func (Address) Marshal

func (a Address) Marshal() ([]byte, error)

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

MarshalText returns the hex representation of a.

func (*Address) MarshalTo

func (a *Address) MarshalTo(data []byte) (n int, err error)

func (*Address) Scan

func (a *Address) Scan(src interface{}) error

Scan implements Scanner for database/sql.

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte) *Address

SetBytes sets the address to the value of b. If b is larger than len(a), b will be cropped from the left.

func (Address) Size

func (a Address) Size() int

func (Address) String

func (a Address) String() string

String implements fmt.Stringer.

func (*Address) Unmarshal

func (a *Address) Unmarshal(data []byte) error

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a hash in hex syntax.

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

func (Address) Value

func (a Address) Value() (driver.Value, error)

Value implements valuer for database/sql.

type Addresses

type Addresses []Address

Addresses is a slice of common.Address, implementing sort.Interface

func (Addresses) Len

func (addrs Addresses) Len() int

func (Addresses) Less

func (addrs Addresses) Less(i, j int) bool

func (Addresses) Swap

func (addrs Addresses) Swap(i, j int)

type Bloom

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

func NewBloom

func NewBloom(size uint64) (*Bloom, error)

func (*Bloom) Add

func (b *Bloom) Add(key []byte) error

func (*Bloom) Contain

func (b *Bloom) Contain(key []byte) bool

Contain - true maybe in the set - false must not in the set

func (*Bloom) Marshal

func (b *Bloom) Marshal() ([]byte, error)

func (*Bloom) UnMarshalBloom

func (b *Bloom) UnMarshalBloom(data []byte) error

type Hash

type Hash [HashLength]byte

func BigToHash

func BigToHash(b *big.Int) Hash

BigToHash sets byte representation of b to hash. If b is larger than len(h), b will be cropped from the left.

func BytesHash

func BytesHash(b []byte) Hash

func BytesToHash

func BytesToHash(b []byte) Hash

func HashData

func HashData(data []byte) (Hash, error)

func HashDifference

func HashDifference(a, b []Hash) []Hash

HashDifference returns a new set which is the difference between a and b.

func HexToHash

func HexToHash(s string) Hash

HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.

func StringToHash

func StringToHash(s string) Hash

func (Hash) Big

func (h Hash) Big() *big.Int

Big converts a hash to a big integer.

func (Hash) Bytes

func (h Hash) Bytes() []byte

Bytes gets the byte representation of the underlying hash.

func (Hash) Equal

func (h Hash) Equal(other Hash) bool

func (Hash) Format

func (h Hash) Format(s fmt.State, c rune)

Format implements fmt.Formatter. Hash supports the %v, %s, %v, %x, %X and %d format verbs.

func (Hash) Generate

func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value

Generate implements testing/quick.Generator.

func (Hash) Hex

func (h Hash) Hex() string

Hex converts a hash to a hex string.

func (Hash) HexBytes

func (h Hash) HexBytes() []byte

func (Hash) Marshal

func (h Hash) Marshal() ([]byte, error)

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

MarshalText returns the hex representation of h.

func (*Hash) MarshalTo

func (h *Hash) MarshalTo(data []byte) (n int, err error)

func (*Hash) Scan

func (h *Hash) Scan(src interface{}) error

Scan implements Scanner for database/sql.

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte) error

SetBytes sets the hash to the value of b.

func (*Hash) SetString

func (h *Hash) SetString(s string) error

func (*Hash) Size

func (h *Hash) Size() int

func (Hash) String

func (h Hash) String() string

func (Hash) TerminalString

func (h Hash) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Hash) Unmarshal

func (h *Hash) Unmarshal(data []byte) error

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a hash in hex syntax.

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

func (Hash) Value

func (h Hash) Value() (driver.Value, error)

Value implements valuer for database/sql.

type Hasher

type Hasher struct {
	Sha keccakState
}

func NewHasher

func NewHasher() *Hasher

type Hashes

type Hashes []Hash

Hashes is a slice of common.Hash, implementing sort.Interface

func (Hashes) Len

func (hashes Hashes) Len() int

func (Hashes) Less

func (hashes Hashes) Less(i, j int) bool

func (Hashes) Swap

func (hashes Hashes) Swap(i, j int)

type PublicKey

type PublicKey [PublicKeyLength]byte

func (PublicKey) Bytes

func (h PublicKey) Bytes() []byte

func (PublicKey) Format

func (h PublicKey) Format(s fmt.State, c rune)

Format implements fmt.Formatter. supports the %v, %s, %q, %x, %X and %d format verbs.

func (PublicKey) Hex

func (h PublicKey) Hex() string

func (PublicKey) Marshal

func (h PublicKey) Marshal() ([]byte, error)

func (PublicKey) MarshalText

func (a PublicKey) MarshalText() ([]byte, error)

MarshalText returns the hex representation of a.

func (*PublicKey) SetBytes

func (h *PublicKey) SetBytes(b []byte) error

func (PublicKey) Size

func (h PublicKey) Size() int

func (PublicKey) String

func (h PublicKey) String() string

func (*PublicKey) Unmarshal

func (h *PublicKey) Unmarshal(data []byte) error

func (*PublicKey) UnmarshalJSON

func (a *PublicKey) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a hash in hex syntax.

func (*PublicKey) UnmarshalText

func (a *PublicKey) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

type Signature

type Signature [SignatureLength]byte

func (Signature) Bytes

func (h Signature) Bytes() []byte

func (Signature) Format

func (h Signature) Format(s fmt.State, c rune)

Hash supports the %v, %s, %q, %x, %X and %d format verbs.

func (Signature) Hex

func (h Signature) Hex() string

func (Signature) Marshal

func (h Signature) Marshal() ([]byte, error)

func (Signature) MarshalText

func (h Signature) MarshalText() ([]byte, error)

MarshalText returns the hex representation of h.

func (*Signature) SetBytes

func (h *Signature) SetBytes(data []byte) error

func (Signature) Size

func (h Signature) Size() int

func (Signature) String

func (h Signature) String() string

func (*Signature) Unmarshal

func (h *Signature) Unmarshal(data []byte) error

func (*Signature) UnmarshalJSON

func (h *Signature) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a hash in hex syntax.

func (*Signature) UnmarshalText

func (h *Signature) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

type StorageSize

type StorageSize float64

StorageSize is a wrapper around a float value that supports user friendly formatting.

func (StorageSize) String

func (s StorageSize) String() string

String implements the stringer interface.

func (StorageSize) TerminalString

func (s StorageSize) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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