chain

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain interface {
	SubscribeFinalizedHeads() (*FinalizedHeadsSubscription, error)
	SubscribeNewHeads() (*NewHeadsSubscription, error)
	GetBlockHash(blockNumber uint64) (types.Hash, error)
	GetBlockHashLatest() (types.Hash, error)
	GetFinalizedHead() (types.Hash, error)
	GetBlock(blockHash types.Hash) (*types.SignedBlock, error)
	GetBlockLatest() (*types.SignedBlock, error)
	GetHeader(blockHash types.Hash) (*types.Header, error)
	GetHeaderLatest() (*types.Header, error)
}

func NewChain

func NewChain(cl client.Client) Chain

NewChain creates a new chain struct

type FinalizedHeadsSubscription

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

FinalizedHeadsSubscription is a subscription established through one of the Client's subscribe methods.

func (*FinalizedHeadsSubscription) Chan

func (s *FinalizedHeadsSubscription) Chan() <-chan types.Header

Chan returns the subscription channel.

The channel is closed when Unsubscribe is called on the subscription.

func (*FinalizedHeadsSubscription) Err

func (s *FinalizedHeadsSubscription) Err() <-chan error

Err returns the subscription error channel. The intended use of Err is to schedule resubscription when the client connection is closed unexpectedly.

The error channel receives a value when the subscription has ended due to an error. The received error is nil if Close has been called on the underlying client and no other error has occurred.

The error channel is closed when Unsubscribe is called on the subscription.

func (*FinalizedHeadsSubscription) Unsubscribe

func (s *FinalizedHeadsSubscription) Unsubscribe()

Unsubscribe unsubscribes the notification and closes the error channel. It can safely be called more than once.

type NewHeadsSubscription

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

NewHeadsSubscription is a subscription established through one of the Client's subscribe methods.

func (*NewHeadsSubscription) Chan

func (s *NewHeadsSubscription) Chan() <-chan types.Header

Chan returns the subscription channel.

The channel is closed when Unsubscribe is called on the subscription.

func (*NewHeadsSubscription) Err

func (s *NewHeadsSubscription) Err() <-chan error

Err returns the subscription error channel. The intended use of Err is to schedule resubscription when the client connection is closed unexpectedly.

The error channel receives a value when the subscription has ended due to an error. The received error is nil if Close has been called on the underlying client and no other error has occurred.

The error channel is closed when Unsubscribe is called on the subscription.

func (*NewHeadsSubscription) Unsubscribe

func (s *NewHeadsSubscription) Unsubscribe()

Unsubscribe unsubscribes the notification and closes the error channel. It can safely be called more than once.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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