chain

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

Chain exposes methods for retrieval of chain data

func NewChain

func NewChain(cl client.Client) *Chain

NewChain creates a new Chain struct

func (*Chain) GetBlock added in v0.0.3

func (c *Chain) GetBlock(blockHash types.Hash) (*types.SignedBlock, error)

GetBlock returns the header and body of the relay chain block with the given hash

func (*Chain) GetBlockHash

func (c *Chain) GetBlockHash(blockNumber uint64) (types.Hash, error)

GetBlockHash returns the block hash for a specific block height

func (*Chain) GetBlockHashLatest

func (c *Chain) GetBlockHashLatest() (types.Hash, error)

GetBlockHashLatest returns the latest block hash

func (*Chain) GetBlockLatest added in v0.0.3

func (c *Chain) GetBlockLatest() (*types.SignedBlock, error)

GetBlockLatest returns the header and body of the latest relay chain block

func (*Chain) GetFinalizedHead added in v0.0.3

func (c *Chain) GetFinalizedHead() (types.Hash, error)

GetFinalizedHead returns the hash of the last finalized block in the canon chain

func (*Chain) GetHeader added in v0.0.3

func (c *Chain) GetHeader(blockHash types.Hash) (*types.Header, error)

GetHeader retrieves the header for the specific block

func (*Chain) GetHeaderLatest added in v0.0.3

func (c *Chain) GetHeaderLatest() (*types.Header, error)

GetHeaderLatest retrieves the header of the latest block

func (*Chain) SubscribeFinalizedHeads added in v1.0.0

func (c *Chain) SubscribeFinalizedHeads() (*FinalizedHeadsSubscription, error)

SubscribeFinalizedHeads subscribes the best finalized headers, returning a subscription that will receive server notifications containing the Header.

func (*Chain) SubscribeNewHeads added in v1.0.0

func (c *Chain) SubscribeNewHeads() (*NewHeadsSubscription, error)

SubscribeNewHeads subscribes the best headers, returning a subscription that will receive server notifications containing the Header.

type FinalizedHeadsSubscription added in v1.0.0

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

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

func (*FinalizedHeadsSubscription) Chan added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

func (s *FinalizedHeadsSubscription) Unsubscribe()

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

type NewHeadsSubscription added in v1.0.0

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

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

func (*NewHeadsSubscription) Chan added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

func (s *NewHeadsSubscription) Unsubscribe()

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

Jump to

Keyboard shortcuts

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