blockscout

package
v0.0.0-...-13efa11 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(url string, validator ValidatorData) *http.Response

func GetBalance

func GetBalance(blockNumber string, validator ValidatorData) (balance *uint256.Int, err error)

func GetBalanceChange

func GetBalanceChange(blocks []BlockData, validator ValidatorData) (balance, change *uint256.Int, err error)

func GetBlockCount

func GetBlockCount(blocks []BlockData, validator ValidatorData) (blockCount int, err error)

func ReadBody

func ReadBody(rawResponse *http.Response, out IResponse) error

Types

type BlockData

type BlockData struct {
	BlockNumber string `json:"blockNumber"`
	TimeStamp   string `json:"timeStamp"`
}

type Config

type Config struct {
	Validators []ValidatorData `json:"validators"`
}

func Init

func Init() (config Config, err error)

type IResponse

type IResponse interface {
	GetMessage() string
	GetResult() interface{}
}

type ResponseBalance

type ResponseBalance struct {
	Message string `json:"error,omitempty"`
	Result  string `json:"result"`
}

func (*ResponseBalance) GetMessage

func (r *ResponseBalance) GetMessage() string

func (*ResponseBalance) GetResult

func (r *ResponseBalance) GetResult() interface{}

type ResponseBlocks

type ResponseBlocks struct {
	Message string      `json:"message"`
	Result  []BlockData `json:"result"`
}

func (*ResponseBlocks) GetMessage

func (r *ResponseBlocks) GetMessage() string

func (*ResponseBlocks) GetResult

func (r *ResponseBlocks) GetResult() interface{}

type Validator

type Validator struct {
	Name          string
	MinedBlocks   int
	Balance       *uint256.Int
	BalanceChange *uint256.Int
}

func GetData

func GetData(validator ValidatorData) (v Validator, err error)

type ValidatorData

type ValidatorData struct {
	Name            string `json:"name"`
	Address         string `json:"address"`
	URL             string `json:"url"`
	Blockscout      string `json:"blockscout"`
	HealthInterval  int    `json:"health_interval"`
	BalanceInterval int    `json:"balance_interval"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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