package chain

import "github.com/centrifuge/go-substrate-rpc-client/v4/rpc/chain"

Index

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.

Source Files

chain.go get_block.go get_block_hash.go get_finalized_head.go get_header.go subscribe_finalized_heads.go subscribe_new_heads.go

Directories

PathSynopsis
rpc/chain/generic
rpc/chain/mocks
Version
v4.2.1 (latest)
Published
Dec 5, 2023
Platform
linux/amd64
Imports
6 packages
Last checked
1 week ago

Tools for package owners.