blocks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AverageBlockSize

type AverageBlockSize struct {
	Timestamp      time.Time `etherscan:"unixTimeStamp"`
	BlockSizeBytes uint32    `etherscan:"blockSize_bytes,num"`
}

AverageBlockSize contains information on the average size of a block on a given day.

type BlockCount

type BlockCount struct {
	DailyBlockRewards
	BlockCount uint32 `etherscan:"blockCount,num"`
}

BlockCount contains information on the block count on a particular day.

type BlockCountdown

type BlockCountdown struct {
	CurrentBlock      uint64          `etherscan:"CurrentBlock"`
	CountdownBlock    uint64          `etherscan:"CountdownBlock"`
	RemainingBlock    uint64          `etherscan:"RemainingBlock"`
	EstimateTimeInSec decimal.Decimal `etherscan:"EstimateTimeInSec"`
}

BlockCountdown contains information on the estimated time until a block is mined.

type BlockNumberRequest

type BlockNumberRequest struct {
	Timestamp time.Time
	Closest   ClosestAvailableBlock
}

BlockNumberRequest contains the request parameters for GetBlockNumber.

type BlockRewards

type BlockRewards struct {
	BlockNumber          uint64         `etherscan:"blockNumber"`
	Timestamp            time.Time      `etherscan:"timeStamp"`
	BlockMiner           common.Address `etherscan:"blockMiner"`
	BlockReward          *big.Int       `etherscan:"blockReward"`
	Uncles               []UncleReward
	UncleInclusionReward *big.Int `etherscan:"uncleInclusionReward"`
}

BlockRewards contains information on a block's mining reward.

type BlocksClient

type BlocksClient struct {
	API *httpapi.APIClient
}

BlocksClient is the client for blocks related actions.

func (*BlocksClient) GetBlockCountdown

func (c *BlocksClient) GetBlockCountdown(
	ctx context.Context, blockNumber uint64,
) (*BlockCountdown, error)

GetBlockCountdown returns the estimated time remaining, in seconds, until a certain block is mined.

func (*BlocksClient) GetBlockNumber

func (c *BlocksClient) GetBlockNumber(
	ctx context.Context, req *BlockNumberRequest,
) (uint64, error)

GetBlockNumber returns the block number that was mined at a certain timestamp.

func (*BlocksClient) GetBlockRewards

func (c *BlocksClient) GetBlockRewards(
	ctx context.Context, blockNumber uint64,
) (*BlockRewards, error)

GetBlockRewards returns the block reward and 'Uncle' block rewards.

func (*BlocksClient) GetDailyAverageBlockSize

func (c *BlocksClient) GetDailyAverageBlockSize(
	ctx context.Context, dates *ecommon.DateRange,
) (result []AverageBlockSize, err error)

GetDailyAverageBlockSize returns the daily average block size within a date range.

func (*BlocksClient) GetDailyAverageBlockTime

func (c *BlocksClient) GetDailyAverageBlockTime(
	ctx context.Context, dates *ecommon.DateRange,
) (result []DailyBlockTime, err error)

GetDailyAverageBlockTime returns the daily average of time needed for a block to be successfully mined.

func (*BlocksClient) GetDailyBlockCount

func (c *BlocksClient) GetDailyBlockCount(
	ctx context.Context, dates *ecommon.DateRange,
) (result []BlockCount, err error)

GetDailyBlockCount returns the number of blocks mined daily and the amount of block rewards.

func (*BlocksClient) GetDailyBlockRewards

func (c *BlocksClient) GetDailyBlockRewards(
	ctx context.Context, dates *ecommon.DateRange,
) (result []DailyBlockRewards, err error)

GetDailyBlockRewards returns the amount of block rewards distributed to miners daily.

func (*BlocksClient) GetDailyUnclesCount

func (c *BlocksClient) GetDailyUnclesCount(
	ctx context.Context, dates *ecommon.DateRange,
) (result []DailyUnclesCount, err error)

GetDailyUnclesCount returns the number of 'Uncle' blocks mined daily and the amount of 'Uncle' block rewards.

type ClosestAvailableBlock

type ClosestAvailableBlock int32

ClosestAvailableBlock is an enumaration of the closest available block parameters. ENUM(before,after)

const (
	// ClosestAvailableBlockBefore is a ClosestAvailableBlock of type Before.
	ClosestAvailableBlockBefore ClosestAvailableBlock = iota
	// ClosestAvailableBlockAfter is a ClosestAvailableBlock of type After.
	ClosestAvailableBlockAfter
)

func ParseClosestAvailableBlock

func ParseClosestAvailableBlock(name string) (ClosestAvailableBlock, error)

ParseClosestAvailableBlock attempts to convert a string to a ClosestAvailableBlock

func (ClosestAvailableBlock) String

func (x ClosestAvailableBlock) String() string

String implements the Stringer interface.

type DailyBlockRewards

type DailyBlockRewards struct {
	Timestamp       time.Time       `etherscan:"unixTimeStamp"`
	BlockRewardsETH decimal.Decimal `etherscan:"blockRewards_Eth"`
}

DailyBlockRewards contains information on the total block rewards distributed to miners on a particular day.

type DailyBlockTime

type DailyBlockTime struct {
	Timestamp        time.Time       `etherscan:"unixTimeStamp"`
	BlockTimeSeconds decimal.Decimal `etherscan:"blockTime_sec"`
}

DailyBlockTime contains information on the average time to mine a block on a particular day.

type DailyUnclesCount

type DailyUnclesCount struct {
	Timestamp            time.Time       `etherscan:"unixTimeStamp"`
	UncleBlockCount      uint32          `etherscan:"uncleBlockCount,num"`
	UncleBlockRewardsETH decimal.Decimal `etherscan:"uncleBlockRewards_Eth"`
}

DailyUnclesCount contains information on uncle blocks mined in a particular day.

type UncleReward

type UncleReward struct {
	Miner         common.Address
	UnclePosition uint32   `etherscan:"unclePosition"`
	BlockReward   *big.Int `etherscan:"blockreward"`
}

UncleReward contains information on a block uncle's mining reward.

Jump to

Keyboard shortcuts

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