chain

package
v0.0.0-...-a457e19 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrGetBlockData cannot get block data from server
	ErrGetBlockData = fmt.Errorf("cannot get block data")
	//ErrGetCurrentBlockNum cannot get current block number from server
	ErrGetCurrentBlockNum = fmt.Errorf("cannnot get current block number from RPC response")
)

Functions

This section is empty.

Types

type Blockchain

type Blockchain struct {
	RPCAgent client.Agent
}

Blockchain contains pointer to a RPC client object

func Init

func Init(url string) (*Blockchain, error)

Init initializes blockchain object

func (*Blockchain) GenerateBlockEvent

func (bc *Blockchain) GenerateBlockEvent(blockNum int) beat.Event

GenerateBlockEvent returns beat event

func (*Blockchain) GetBlock

func (bc *Blockchain) GetBlock(blockNum int) (common.MapStr, error)

GetBlock gets the block information

func (*Blockchain) GetCurrentBlock

func (bc *Blockchain) GetCurrentBlock() (int, error)

GetCurrentBlock gets the current block number

Jump to

Keyboard shortcuts

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