client

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 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

Overview

Package client speaks JSON-RPC 2.0 to an Ethereum execution-layer node over WebSocket. It implements the small surface juno needs to follow the L1 head and serve starknet_getMessageStatus.

Index

Constants

View Source
const BlockFinalized = "finalized"

Variables

View Source
var ErrClosed = errors.New("client closed")

ErrClosed is terminal: the client was explicitly closed and will not redial.

View Source
var ErrSubscriptionQueueOverflow = errors.New("subscription queue overflow (slow subscriber)")

ErrSubscriptionQueueOverflow fails a subscription whose sink is not drained fast enough, matching go-ethereum's behaviour.

View Source
var ErrTransportClosed = errors.New("transport closed")

Functions

This section is empty.

Types

type Client

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

func New

func New(ctx context.Context, rawURL string, opts ...Option) (*Client, error)

func (*Client) BlockNumber

func (c *Client) BlockNumber(ctx context.Context) (uint64, error)

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params ...any) (json.RawMessage, error)

Call returns the raw JSON result of a JSON-RPC call.

func (*Client) ChainID

func (c *Client) ChainID(ctx context.Context) (*big.Int, error)

func (*Client) Close

func (c *Client) Close()

Close is terminal: no further redials.

func (*Client) FilterLogs

func (c *Client) FilterLogs(ctx context.Context, q FilterQuery) ([]eth.Log, error)

func (*Client) HeaderByNumber

func (c *Client) HeaderByNumber(ctx context.Context, tag string) (eth.Header, error)

HeaderByNumber maps a null result — the server's signal for "the named block does not exist yet" — to eth.ErrNotFound.

func (*Client) SubscribeLogs

func (c *Client) SubscribeLogs(
	ctx context.Context,
	q FilterQuery,
	sink chan<- *eth.Log,
) (Subscription, error)

SubscribeLogs uses ctx only for the subscribe call itself; the sub lives until Unsubscribe or a transport failure.

func (*Client) TransactionReceipt

func (c *Client) TransactionReceipt(ctx context.Context, txHash eth.Hash) (eth.Receipt, error)

TransactionReceipt maps a null result (receipt unknown to the node) to eth.ErrNotFound.

type FilterQuery

type FilterQuery struct {
	FromBlock *uint64
	ToBlock   *uint64
	Addresses []eth.Address
	// Topics is position-major: Topics[i] is the allowed-set at topic
	// position i (OR'd together); empty means "any value at that position".
	Topics [][]eth.Hash
}

FilterQuery selects logs by inclusive block range, contract address, and topics. A nil FromBlock/ToBlock is omitted from the wire: geth treats an explicit toBlock as a bounded historical filter, which would break live eth_subscribe subscriptions.

func (FilterQuery) MarshalJSON

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

type Option

type Option func(*options)

func WithDialTimeout

func WithDialTimeout(d time.Duration) Option

func WithLogger

func WithLogger(l log.StructuredLogger) Option

func WithPingConfig

func WithPingConfig(interval, timeout time.Duration) Option

WithPingConfig falls back to the defaults (30s/10s) for non-positive values.

type Subscription

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

Subscription mirrors go-ethereum's event.Subscription, as a drop-in for callers migrating off that package.

Jump to

Keyboard shortcuts

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