chain

package
v0.0.0-...-477d63b Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package chain provides a blockchain client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Height  int64                         `json:"height"`
	Time    time.Time                     `json:"time"`
	Hash    []byte                        `json:"hash"`
	Results *coretypes.ResultBlockResults `json:"results"`
}

Block is a chain record.

type Client

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

Client provides Tendermint access.

func NewClient

func NewClient(ctx context.Context) (*Client, error)

NewClient configures a new instance. Timeout applies to all requests on endpoint.

func (*Client) BatchSize

func (c *Client) BatchSize() int

func (*Client) FetchSingle

func (c *Client) FetchSingle(height int64) (*coretypes.ResultBlockResults, error)

func (*Client) FirstBlockHash

func (c *Client) FirstBlockHash() (hash string, err error)

func (*Client) GetBlock

func (c *Client) GetBlock(height *int64) (*coretypes.ResultBlock, error)

Fetch Single block details

func (*Client) Iterator

func (c *Client) Iterator(startHeight, finalBlockHeight int64) Iterator

func (*Client) RefreshStatus

func (c *Client) RefreshStatus() (rs *coretypes.ResultStatus, err error)

Fetch the summary of the chain: latest height, node address, ...

type Iterator

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

func (*Iterator) Next

func (i *Iterator) Next() (*Block, error)

Jump to

Keyboard shortcuts

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