eth

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AddressLength = 20

AddressLength is the expected length of the address.

View Source
const HashLength = 32

HashLength is the expected length of the hash.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a requested resource (block, receipt, ...) does not exist on the remote endpoint. Replaces ethereum.NotFound.

Functions

This section is empty.

Types

type Address

type Address [AddressLength]byte

Address represents the 20 byte address of an Ethereum account.

func AddressFromBytes

func AddressFromBytes(b []byte) Address

AddressFromBytes returns Address with value b. If b is larger than AddressLength, b will be cropped from the left.

func AddressFromString

func AddressFromString(s string) Address

AddressFromString returns Address with byte values parsed from s. The 0x prefix is optional; if s is larger than 2*AddressLength hex chars, it will be cropped from the left.

func (Address) Bytes

func (a Address) Bytes() []byte

Bytes returns a copy of the underlying byte representation of the address.

func (Address) MarshalText

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

MarshalText returns the hex representation of a (0x-prefixed lowercase). Mirrors go-ethereum's common.Address.MarshalText.

func (*Address) SetBytes

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

SetBytes sets the address to the value of b. If b is larger than AddressLength, b will be cropped from the left; if shorter, left-padded with zeros. TODO: Once migrated, panic/error if b is larger than address

func (*Address) UnmarshalJSON

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

UnmarshalJSON parses an address from a JSON string. Matches go-ethereum's common.Address.UnmarshalJSON: requires a quoted "0x"-prefixed hex string of exactly AddressLength bytes; case-insensitive.

func (*Address) UnmarshalText

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

UnmarshalText parses an address from its hex representation. Matches go-ethereum's common.Address.UnmarshalText: requires "0x"-prefixed hex of exactly AddressLength bytes; case-insensitive.

type DataBytes

type DataBytes []byte

DataBytes is a []byte that JSON-decodes from a 0x-prefixed hex string, matching the Ethereum JSON-RPC "data" wire format. An empty payload ("0x") is allowed. Unbounded — log/call data is capped by the L1 block gas limit (~3.75Mb at 30M max block gas)

func (*DataBytes) UnmarshalJSON

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

type Hash

type Hash [HashLength]byte

Hash represents the 32 byte Keccak256 hash of arbitrary data.

func HashFromBytes

func HashFromBytes(b []byte) Hash

HashFromBytes returns Hash with value b. If b is larger than HashLength, b will be cropped from the left.

func HashFromString

func HashFromString(s string) Hash

HashFromString returns Hash with byte values parsed from s. The 0x prefix is optional; if s is larger than 2*HashLength hex chars, it will be cropped from the left.

func (Hash) Bytes

func (h Hash) Bytes() []byte

Bytes returns a copy of the underlying byte representation of the hash.

func (Hash) Cmp

func (h Hash) Cmp(other Hash) int

Cmp compares two hashes.

func (Hash) Hex

func (h Hash) Hex() string

Hex converts a hash to a 0x-prefixed lowercase hex string.

func (Hash) MarshalText

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

MarshalText returns the hex representation of h (0x-prefixed lowercase). Mirrors go-ethereum's common.Hash.MarshalText.

func (*Hash) SetBytes

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

SetBytes sets the hash to the value of b. If b is larger than HashLength, b will be cropped from the left; if shorter, left-padded with zeros. TODO: Once migrated, panic/error if b is larger than hash

func (*Hash) UnmarshalJSON

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

UnmarshalJSON parses a hash from a JSON string. Matches go-ethereum's common.Hash.UnmarshalJSON: requires a quoted "0x"-prefixed hex string of exactly HashLength bytes; case-insensitive.

func (*Hash) UnmarshalText

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

UnmarshalText parses a hash from its hex representation. Matches go-ethereum's common.Hash.UnmarshalText: requires "0x"-prefixed hex of exactly HashLength bytes; case-insensitive.

type Header struct {
	Number HexU64 `json:"number"`
}

Header is the trimmed-down view of an Ethereum block header that juno needs. Only Number is read in production (l1/eth_subscriber.go). The HexU64 field type lets eth_getBlockByNumber responses unmarshal directly without any per-struct codec boilerplate.

type HexU64

type HexU64 uint64

HexU64 is a uint64 that JSON-decodes from a 0x-prefixed hex string, matching the Ethereum JSON-RPC "quantity" wire format. Used as a field type on structs that consume RPC responses (Header, Log).

func (*HexU64) UnmarshalJSON

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

type Log

type Log struct {
	Topics      []Hash    `json:"topics"`
	Data        DataBytes `json:"data"`
	BlockNumber HexU64    `json:"blockNumber"`
	Removed     bool      `json:"removed"`
}

Log represents a contract log event as juno consumes it. Only the fields actually read today are declared; other fields in an eth_getLogs response are silently dropped during unmarshal.

type Receipt

type Receipt struct {
	Logs []Log `json:"logs"`
}

Receipt is the trimmed-down view of an Ethereum transaction receipt. Only Logs is read in juno. All other fields in the eth_getTransactionReceipt JSON response are ignored.

type Subscription

type Subscription interface {
	Err() <-chan error
	Unsubscribe()
}

Subscription mirrors go-ethereum's event.Subscription surface as consumed by juno's l1 package: a channel signalling failure, and an Unsubscribe method to release resources.

Directories

Path Synopsis
Package abi decodes the non-indexed data section of specific Ethereum event logs the juno node consumes.
Package abi decodes the non-indexed data section of specific Ethereum event logs the juno node consumes.

Jump to

Keyboard shortcuts

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